PageSourceSearch

https://classta.co/assets/index-Cz3Xco8i.js

js classta.co collected 2026-09-28 13:51:00 UTC 3,021,999 bytes, 965 lines download raw bytes

vendor: 4,760 bytes, lines 1-9
1var DZ=Object.defineProperty;var $4=e=>{throw TypeError(e)};var AZ=(e,t,n)=>t in e?DZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ge=(e,t,n)=>AZ(e,typeof t!="symbol"?t+"":t,n),NC=(e,t,n)=>t.has(e)||$4("Cannot "+n);var X=(e,t,n)=>(NC(e,t,"read from private field"),n?n.call(e):t.get(e)),Qe=(e,t,n)=>t.has(e)?$4("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),et=(e,t,n,r)=>(NC(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ct=(e,t,n)=>(NC(e,t,"access private method"),n);var qv=(e,t,n,r)=>({set _(a){et(e,t,a,n)},get _(){return X(e,t,r)}});function TZ(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var xx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var UL={exports:{}},uN={},zL={exports:{}},sn={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var tv=Symbol.for("react.element"),OZ=Symbol.for("react.portal"),FZ=Symbol.for("react.fragment"),_Z=Symbol.for("react.strict_mode"),MZ=Symbol.for("react.profiler"),$Z=Symbol.for("react.provider"),IZ=Symbol.for("react.context"),RZ=Symbol.for("react.forward_ref"),BZ=Symbol.for("react.suspense"),LZ=Symbol.for("react.memo"),UZ=Symbol.for("react.lazy"),I4=Symbol.iterator;function zZ(e){return e===null||typeof e!="object"?null:(e=I4&&e[I4]||e["@@iterator"],typeof e=="function"?e:null)}var qL={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},WL=Object.assign,HL={};function hp(e,t,n){this.props=e,this.context=t,this.refs=HL,this.updater=n||qL}hp.prototype.isReactComponent={};hp.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")};hp.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function VL(){}VL.prototype=hp.prototype;function eA(e,t,n){this.props=e,this.context=t,this.refs=HL,this.updater=n||qL}var tA=eA.prototype=new VL;tA.constructor=eA;WL(tA,hp.prototype);tA.isPureReactComponent=!0;var R4=Array.isArray,KL=Object.prototype.hasOwnProperty,sA={current:null},GL={key:!0,ref:!0,__self:!0,__source:!0};function YL(e,t,n){var r,a={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)KL.call(t,r)&&!GL.hasOwnProperty(r)&&(a[r]=t[r]);var l=arguments.length-2;if(l===1)a.children=n;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];a.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)a[r]===void 0&&(a[r]=l[r]);return{$$typeof:tv,type:e,key:i,ref:o,props:a,_owner:sA.current}}function qZ(e,t){return{$$typeof:tv,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function nA(e){return typeof e=="object"&&e!==null&&e.$$typeof===tv}function WZ(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var B4=/\/+/g;function CC(e,t){return typeof e=="object"&&e!==null&&e.key!=null?WZ(""+e.key):t.toString(36)}function lb(e,t,n,r,a){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case tv:case OZ:o=!0}}if(o)return o=e,a=a(o),e=r===""?"."+CC(o,0):r,R4(a)?(n="",e!=null&&(n=e.replace(B4,"$&/")+"/"),lb(a,t,n,"",function(d){return d}
vendor: 4,447 bytes, lines 9-17
9)):a!=null&&(nA(a)&&(a=qZ(a,n+(!a.key||o&&o.key===a.key?"":(""+a.key).replace(B4,"$&/")+"/")+e)),t.push(a)),1;if(o=0,r=r===""?".":r+":",R4(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+CC(i,l);o+=lb(i,t,n,c,a)}else if(c=zZ(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+CC(i,l++),o+=lb(i,t,n,c,a);else if(i==="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 Wv(e,t,n){if(e==null)return e;var r=[],a=0;return lb(e,r,"","",function(i){return t.call(n,i,a++)}),r}function HZ(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ba={current:null},cb={transition:null},VZ={ReactCurrentDispatcher:Ba,ReactCurrentBatchConfig:cb,ReactCurrentOwner:sA};function QL(){throw Error("act(...) is not supported in production builds of React.")}sn.Children={map:Wv,forEach:function(e,t,n){Wv(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Wv(e,function(){t++}),t},toArray:function(e){return Wv(e,function(t){return t})||[]},only:function(e){if(!nA(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};sn.Component=hp;sn.Fragment=FZ;sn.Profiler=MZ;sn.PureComponent=eA;sn.StrictMode=_Z;sn.Suspense=BZ;sn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=VZ;sn.act=QL;sn.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=WL({},e.props),a=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=sA.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)KL.call(t,c)&&!GL.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:tv,type:e.type,key:a,ref:i,props:r,_owner:o}};sn.createContext=function(e){return e={$$typeof:IZ,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:$Z,_context:e},e.Consumer=e};sn.createElement=YL;sn.createFactory=function(e){var t=YL.bind(null,e);return t.type=e,t};sn.createRef=function(){return{current:null}};sn.forwardRef=function(e){return{$$typeof:RZ,render:e}};sn.isValidElement=nA;sn.lazy=function(e){return{$$typeof:UZ,_payload:{_status:-1,_result:e},_init:HZ}};sn.memo=function(e,t){return{$$typeof:LZ,type:e,compare:t===void 0?null:t}};sn.startTransition=function(e){var t=cb.transition;cb.transition={};try{e()}finally{cb.transition=t}};sn.unstable_act=QL;sn.useCallback=function(e,t){return Ba.current.useCallback(e,t)};sn.useContext=function(e){return Ba.current.useContext(e)};sn.useDebugValue=function(){};sn.useDeferredValue=function(e){return Ba.current.useDeferredValue(e)};sn.useEffect=function(e,t){return Ba.current.useEffect(e,t)};sn.useId=function(){return Ba.current.useId()};sn.useImperativeHandle=function(e,t,n){return Ba.current.useImperativeHandle(e,t,n)};sn.useInsertionEffect=function(e,t){return Ba.current.useInsertionEffect(e,t)};sn.useLayoutEffect=function(e,t){return Ba.current.useLayoutEffect(e,t)};sn.useMemo=function(e,t){return Ba.current.useMemo(e,t)};sn.useReducer=function(e,t,n){return Ba.current.useReducer(e,t,n)};sn.useRef=function(e){return Ba.current.useRef(e)};sn.useState=function(e){return Ba.current.useState(e)};sn.useSyncExternalStore=function(e,t,n){return Ba.current.useSyncExternalStore(e,t,n)};sn.useTransition=function(){return Ba.current.useTransition()};sn.version="18.3.1";zL.exports=sn;var f=zL.exports;const he=Qs(f),mN=TZ({__proto__:null,default:he},[f]);/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var KZ=f,GZ=Symbol.for("react.element"),YZ=Symbol.for("react.fragment"),QZ=Object.prototype.hasOwnProperty,JZ=KZ.__SECRET_INT
vendor: 11,407 bytes, lines 17-34
17ERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,XZ={key:!0,ref:!0,__self:!0,__source:!0};function JL(e,t,n){var r,a={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)QZ.call(t,r)&&!XZ.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)a[r]===void 0&&(a[r]=t[r]);return{$$typeof:GZ,type:e,key:i,ref:o,props:a,_owner:JZ.current}}uN.Fragment=YZ;uN.jsx=JL;uN.jsxs=JL;UL.exports=uN;var s=UL.exports,XL={exports:{}},Pi={},ZL={exports:{}},e8={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(e){function t(H,_){var L=H.length;H.push(_);e:for(;0<L;){var U=L-1>>>1,J=H[U];if(0<a(J,_))H[U]=_,H[L]=J,L=U;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var _=H[0],L=H.pop();if(L!==_){H[0]=L;e:for(var U=0,J=H.length,I=J>>>1;U<I;){var re=2*(U+1)-1,R=H[re],Y=re+1,M=H[Y];if(0>a(R,L))Y<J&&0>a(M,R)?(H[U]=M,H[Y]=L,U=Y):(H[U]=R,H[re]=L,U=re);else if(Y<J&&0>a(M,L))H[U]=M,H[Y]=L,U=Y;else break e}}return _}function a(H,_){var L=H.sortIndex-_.sortIndex;return L!==0?L:H.id-_.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],d=[],m=1,u=null,h=3,p=!1,v=!1,y=!1,g=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(H){for(var _=n(d);_!==null;){if(_.callback===null)r(d);else if(_.startTime<=H)r(d),_.sortIndex=_.expirationTime,t(c,_);else break;_=n(d)}}function j(H){if(y=!1,w(H),!v)if(n(c)!==null)v=!0,W(N);else{var _=n(d);_!==null&&q(j,_.startTime-H)}}function N(H,_){v=!1,y&&(y=!1,x(S),S=-1),p=!0;var L=h;try{for(w(_),u=n(c);u!==null&&(!(u.expirationTime>_)||H&&!z());){var U=u.callback;if(typeof U=="function"){u.callback=null,h=u.priorityLevel;var J=U(u.expirationTime<=_);_=e.unstable_now(),typeof J=="function"?u.callback=J:u===n(c)&&r(c),w(_)}else r(c);u=n(c)}if(u!==null)var I=!0;else{var re=n(d);re!==null&&q(j,re.startTime-_),I=!1}return I}finally{u=null,h=L,p=!1}}var C=!1,P=null,S=-1,E=5,T=-1;function z(){return!(e.unstable_now()-T<E)}function O(){if(P!==null){var H=e.unstable_now();T=H;var _=!0;try{_=P(!0,H)}finally{_?D():(C=!1,P=null)}}else C=!1}var D;if(typeof b=="function")D=function(){b(O)};else if(typeof MessageChannel<"u"){var k=new MessageChannel,F=k.port2;k.port1.onmessage=O,D=function(){F.postMessage(null)}}else D=function(){g(O,0)};function W(H){P=H,C||(C=!0,D())}function q(H,_){S=g(function(){H(e.unstable_now())},_)}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(H){H.callback=null},e.unstable_continueExecution=function(){v||p||(v=!0,W(N))},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(H){switch(h){case 1:case 2:case 3:var _=3;break;default:_=h}var L=h;h=_;try{return H()}finally{h=L}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(H,_){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var L=h;h=H;try{return _()}finally{h=L}},e.unstable_scheduleCallback=function(H,_,L){var U=e.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?U+L:U):L=U,H){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=L+J,H={id:m++,callback:_,priorityLevel:H,startTime:L,expirationTime:J,sortIndex:-1},L>U?(H.sortIndex=L,t(d,H),n(c)===null&&H===n(d)&&(y?(x(S),S=-1):y=!0,q(j,L-U))):(H.sortIndex=J,t(c,H),v||p||(v=!0,W(N))),H},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(H){var _=h;return function(){var L=h;h=_;try{return H.apply(this,arguments)}finally{h=L}}}})(e8);ZL.exports=e8;var ZZ=ZL.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var eee=f,gi=ZZ;function jt(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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 t8=new Set,rg={};function Sm(e,t){jf(e,t),jf(e+"Capture",t)}function jf(e,t){for(rg[e]=t,e=0;e<t.length;e++)t8.add(t[e])}var oc=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rk=Object.prototype.hasOwnProperty,tee=/^[: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]*$/,L4={},U4={};function see(e){return Rk.call(U4,e)?!0:Rk.call(L4,e)?!1:tee.test(e)?U4[e]=!0:(L4[e]=!0,!1)}function nee(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function ree(e,t,n,r){if(t===null||typeof t>"u"||nee(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.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 La(e,t,n,r,a,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var da={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){da[e]=new La(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];da[t]=new La(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){da[e]=new La(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){da[e]=new La(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){da[e]=new La(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){da[e]=new La(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){da[e]=new La(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){da[e]=new La(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){da[e]=new La(e,5,!1,e.toLowerCase(),null,!1,!1)});var rA=/[\-:]([a-z])/g;function aA(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(rA,aA);da[t]=new La(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(rA,aA);da[t]=new La(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(rA,aA);da[t]=new La(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){da[e]=new La(e,1,!1,e.toLowerCase(),null,!1,!1)});da.xlinkHref=new La("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){da[e]=new La(e,1,!1,e.toLowerCase(),null,!0,!0)});function iA(e,t,n,r){var a=da.hasOwnProperty(t)?da[t]:null;(a!==null?a.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(ree(t,n,a,r)&&(n=null),r||a===null?see(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=n===null?a.type===3?!1:"":n:(t=a.attributeName,r=a.attributeNamespace,n===null?e.removeAttribute(t):(a=a.type,n=a===3||a===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var bc=eee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Hv=Symbol.for("react.element"),sh=Symbol.for("react.portal"),nh=Symbol.for("react.fragment"),oA=Symbol.for("react.strict_mode"),Bk=Symbol.for("react.profiler"),s8=Symbol.for("react.provider"),n8=Symbol.for("react.context"),lA=Symbol.for("react.forward_ref"),Lk=Symbol.for("react.suspense"),Uk=Symbol.for("react.suspense_list"),cA=Symbol.for("react.memo"),$c=Symbol.for("react.lazy"),r8=Symbol.for("react.offscreen"),z4=Symbol.iterator;function Bp(e){return e===null||typeof e!="object"?null:(e=z4&&e[z4]||e["@@iterator"],typeof e=="function"?e:null)}var dr=Object.assign,SC;function gx(e){if(SC===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);SC=t&&t[1]||""}return`
34`+SC+e}var kC=!1;function PC(e,t){if(!e||kC)return"";kC=!0;var n=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(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}
vendor: 5,293 bytes, lines 34-37
34catch(d){if(d&&r&&typeof d.stack=="string"){for(var a=d.stack.split(`
35`),i=r.stack.split(`
36`),o=a.length-1,l=i.length-1;1<=o&&0<=l&&a[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(a[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||a[o]!==i[l]){var c=`
37`+a[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{kC=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?gx(e):""}function aee(e){switch(e.tag){case 5:return gx(e.type);case 16:return gx("Lazy");case 13:return gx("Suspense");case 19:return gx("SuspenseList");case 0:case 2:case 15:return e=PC(e.type,!1),e;case 11:return e=PC(e.type.render,!1),e;case 1:return e=PC(e.type,!0),e;default:return""}}function zk(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 nh:return"Fragment";case sh:return"Portal";case Bk:return"Profiler";case oA:return"StrictMode";case Lk:return"Suspense";case Uk:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case n8:return(e.displayName||"Context")+".Consumer";case s8:return(e._context.displayName||"Context")+".Provider";case lA:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case cA:return t=e.displayName||null,t!==null?t:zk(e.type)||"Memo";case $c:t=e._payload,e=e._init;try{return zk(e(t))}catch{}}return null}function iee(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 zk(t);case 8:return t===oA?"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 Pd(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function a8(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function oee(e){var t=a8(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Vv(e){e._valueTracker||(e._valueTracker=oee(e))}function i8(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=a8(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Bb(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 qk(e,t){var n=t.checked;return dr({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function q4(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Pd(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function o8(e,t){t=t.checked,t!=null&&iA(e,"checked",t,!1)}function Wk(e,t){o8(e,t);var n=Pd(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Hk(e,t.type,n):t.hasOwnProperty("defaultValue")&&Hk(e,t.type,Pd(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function W4(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Hk(e,t,n){(t!=="number"||Bb(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var yx=Array.isArray;function wh(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Pd(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function Vk(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(jt(91)
vendor: 10,477 bytes, line 37
37);return dr({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function H4(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(jt(92));if(yx(n)){if(1<n.length)throw Error(jt(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Pd(n)}}function l8(e,t){var n=Pd(t.value),r=Pd(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function V4(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function c8(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 Kk(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?c8(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Kv,d8=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,a){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,a)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Kv=Kv||document.createElement("div"),Kv.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Kv.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ag(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Tx={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},lee=["Webkit","ms","Moz","O"];Object.keys(Tx).forEach(function(e){lee.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Tx[t]=Tx[e]})});function u8(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Tx.hasOwnProperty(e)&&Tx[e]?(""+t).trim():t+"px"}function m8(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=u8(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var cee=dr({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 Gk(e,t){if(t){if(cee[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(jt(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(jt(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(jt(61))}if(t.style!=null&&typeof t.style!="object")throw Error(jt(62))}}function Yk(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 Qk=null;function dA(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Jk=null,jh=null,Nh=null;function K4(e){if(e=rv(e)){if(typeof Jk!="function")throw Error(jt(280));var t=e.stateNode;t&&(t=gN(t),Jk(e.stateNode,e.type,t))}}function h8(e){jh?Nh?Nh.push(e):Nh=[e]:jh=e}function f8(){if(jh){var e=jh,t=Nh;if(Nh=jh=null,K4(e),t)for(e=0;e<t.length;e++)K4(t[e])}}function p8(e,t){return e(t)}function x8(){}var EC=!1;function g8(e,t,n){if(EC)return e(t,n);EC=!0;try{return p8(e,t,n)}finally{EC=!1,(jh!==null||Nh!==null)&&(x8(),f8())}}function ig(e,t){var n=e.stateNode;if(n===null)return null;var r=gN(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(jt(231,t,typeof n));return n}var Xk=!1;if(oc)try{var Lp={};Object.defineProperty(Lp,"passive",{get:function(){Xk=!0}}),window.addEventListener("test",Lp,Lp),window.removeEventListener("test",Lp,Lp)}catch{Xk=!1}function dee(e,t,n,r,a,i,o,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(m){this.onError(m)}}var Ox=!1,Lb=null,Ub=!1,Zk=null,uee={onError:function(e){Ox=!0,Lb=e}};function mee(e,t,n,r,a,i,o,l,c){Ox=!1,Lb=null,dee.apply(uee,arguments)}function hee(e,t,n,r,a,i,o,l,c){if(mee.apply(this,arguments),Ox){if(Ox){var d=Lb;Ox=!1,Lb=null}else throw Error(jt(198));Ub||(Ub=!0,Zk=d)}}function km(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function y8(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 G4(e){if(km(e)!==e)throw Error(jt(188))}function fee(e){var t=e.alternate;if(!t){if(t=km(e),t===null)throw Error(jt(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var i=a.alternate;if(i===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===i.child){for(i=a.child;i;){if(i===n)return G4(a),e;if(i===r)return G4(a),t;i=i.sibling}throw Error(jt(188))}if(n.return!==r.return)n=a,r=i;else{for(var o=!1,l=a.child;l;){if(l===n){o=!0,n=a,r=i;break}if(l===r){o=!0,r=a,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=a;break}if(l===r){o=!0,r=i,n=a;break}l=l.sibling}if(!o)throw Error(jt(189))}}if(n.alternate!==r)throw Error(jt(190))}if(n.tag!==3)throw Error(jt(188));return n.stateNode.current===n?e:t}function v8(e){return e=fee(e),e!==null?b8(e):null}function b8(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=b8(e);if(t!==null)return t;e=e.sibling}return null}var w8=gi.unstable_scheduleCallback,Y4=gi.unstable_cancelCallback,pee=gi.unstable_shouldYield,xee=gi.unstable_requestPaint,br=gi.unstable_now,gee=gi.unstable_getCurrentPriorityLevel,uA=gi.unstable_ImmediatePriority,j8=gi.unstable_UserBlockingPriority,zb=gi.unstable_NormalPriority,yee=gi.unstable_LowPriority,N8=gi.unstable_IdlePriority,hN=null,gl=null;function vee(e){if(gl&&typeof gl.onCommitFiberRoot=="function")try{gl.onCommitFiberRoot(hN,e,void 0,(e.current.flags&128)===128)}catch{}}var _o=Math.clz32?Math.clz32:jee,bee=Math.log,wee=Math.LN2;function jee(e){return e>>>=0,e===0?32:31-(bee(e)/wee|0)|0}var Gv=64,Yv=4194304;function vx(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 qb(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~a;l!==0?r=vx(l):(i&=o,i!==0&&(r=vx(i)))}else o=n&~a,o!==0?r=vx(o):i!==0&&(r=vx(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&a)&&(a=r&-r,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-_o(t),a=1<<n,r|=e[n],t&=~a;return r}function Nee(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 Cee(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-_o(i),l=1<<o,c=a[o];c===-1?(!(l&n)||l&r)&&(a[o]=Nee(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function e2(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function C8(){var e=Gv;return Gv<<=1,!(Gv&4194240)&&(Gv=64),e}function DC(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function sv(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-_o(t),e[t]=n}function See(e,t){var n=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 r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-_o(n),i=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~i}}function mA(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-_o(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var An=0;function S8(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var k8,hA,P8,E8,D8,t2=!1,Qv=[],hd=null,fd=null,pd=null,og=new Map,lg=new Map,zc=[],kee="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 Q4(e,t){switch(e){case"focusin":case"focusout":hd=null;break;case"dragenter":case"dragleave":fd=null;break;case"mouseover":case"mouseout":pd=null;break;case"pointerover":case"pointerout":og.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":lg.delete(t.pointerId)}}function Up(e,t,n,r,a,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[a]},t!==null&&(t=rv(t),t!==null&&hA(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function Pee(e,t,n,r,a){switch(t){case"focusin":return hd=Up(hd,e,t,n,r,a),!0;case"dragenter":return fd=Up(fd,e,t,n,r,a),!0;
vendor: 11,645 bytes, line 37
37case"mouseover":return pd=Up(pd,e,t,n,r,a),!0;case"pointerover":var i=a.pointerId;return og.set(i,Up(og.get(i)||null,e,t,n,r,a)),!0;case"gotpointercapture":return i=a.pointerId,lg.set(i,Up(lg.get(i)||null,e,t,n,r,a)),!0}return!1}function A8(e){var t=fu(e.target);if(t!==null){var n=km(t);if(n!==null){if(t=n.tag,t===13){if(t=y8(n),t!==null){e.blockedOn=t,D8(e.priority,function(){P8(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function db(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=s2(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Qk=r,n.target.dispatchEvent(r),Qk=null}else return t=rv(n),t!==null&&hA(t),e.blockedOn=n,!1;t.shift()}return!0}function J4(e,t,n){db(e)&&n.delete(t)}function Eee(){t2=!1,hd!==null&&db(hd)&&(hd=null),fd!==null&&db(fd)&&(fd=null),pd!==null&&db(pd)&&(pd=null),og.forEach(J4),lg.forEach(J4)}function zp(e,t){e.blockedOn===t&&(e.blockedOn=null,t2||(t2=!0,gi.unstable_scheduleCallback(gi.unstable_NormalPriority,Eee)))}function cg(e){function t(a){return zp(a,e)}if(0<Qv.length){zp(Qv[0],e);for(var n=1;n<Qv.length;n++){var r=Qv[n];r.blockedOn===e&&(r.blockedOn=null)}}for(hd!==null&&zp(hd,e),fd!==null&&zp(fd,e),pd!==null&&zp(pd,e),og.forEach(t),lg.forEach(t),n=0;n<zc.length;n++)r=zc[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<zc.length&&(n=zc[0],n.blockedOn===null);)A8(n),n.blockedOn===null&&zc.shift()}var Ch=bc.ReactCurrentBatchConfig,Wb=!0;function Dee(e,t,n,r){var a=An,i=Ch.transition;Ch.transition=null;try{An=1,fA(e,t,n,r)}finally{An=a,Ch.transition=i}}function Aee(e,t,n,r){var a=An,i=Ch.transition;Ch.transition=null;try{An=4,fA(e,t,n,r)}finally{An=a,Ch.transition=i}}function fA(e,t,n,r){if(Wb){var a=s2(e,t,n,r);if(a===null)BC(e,t,r,Hb,n),Q4(e,r);else if(Pee(a,e,t,n,r))r.stopPropagation();else if(Q4(e,r),t&4&&-1<kee.indexOf(e)){for(;a!==null;){var i=rv(a);if(i!==null&&k8(i),i=s2(e,t,n,r),i===null&&BC(e,t,r,Hb,n),i===a)break;a=i}a!==null&&r.stopPropagation()}else BC(e,t,r,null,n)}}var Hb=null;function s2(e,t,n,r){if(Hb=null,e=dA(r),e=fu(e),e!==null)if(t=km(e),t===null)e=null;else if(n=t.tag,n===13){if(e=y8(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Hb=e,null}function T8(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(gee()){case uA:return 1;case j8:return 4;case zb:case yee:return 16;case N8:return 536870912;default:return 16}default:return 16}}var nd=null,pA=null,ub=null;function O8(){if(ub)return ub;var e,t=pA,n=t.length,r,a="value"in nd?nd.value:nd.textContent,i=a.length;for(e=0;e<n&&t[e]===a[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===a[i-r];r++);return ub=a.slice(e,1<r?1-r:void 0)}function mb(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 Jv(){return!0}function X4(){return!1}function Ei(e){function t(n,r,a,i,o){this._reactName=n,this._targetInst=a,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Jv:X4,this.isPropagationStopped=X4,this}return dr(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Jv)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Jv)},persist:function(){},isPersistent:Jv}),t}var fp={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xA=Ei(fp),nv=dr({},fp,{view:0,detail:0}),Tee=Ei(nv),AC,TC,qp,fN=dr({},nv,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gA,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!==qp&&(qp&&e.type==="mousemove"?(AC=e.screenX-qp.screenX,TC=e.screenY-qp.screenY):TC=AC=0,qp=e),AC)},movementY:function(e){return"movementY"in e?e.movementY:TC}}),Z4=Ei(fN),Oee=dr({},fN,{dataTransfer:0}),Fee=Ei(Oee),_ee=dr({},nv,{relatedTarget:0}),OC=Ei(_ee),Mee=dr({},fp,{animationName:0,elapsedTime:0,pseudoElement:0}),$ee=Ei(Mee),Iee=dr({},fp,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ree=Ei(Iee),Bee=dr({},fp,{data:0}),e_=Ei(Bee),Lee={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Uee={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"},zee={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qee(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=zee[e])?!!t[e]:!1}function gA(){return qee}var Wee=dr({},nv,{key:function(e){if(e.key){var t=Lee[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=mb(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Uee[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gA,charCode:function(e){return e.type==="keypress"?mb(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?mb(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Hee=Ei(Wee),Vee=dr({},fN,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),t_=Ei(Vee),Kee=dr({},nv,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gA}),Gee=Ei(Kee),Yee=dr({},fp,{propertyName:0,elapsedTime:0,pseudoElement:0}),Qee=Ei(Yee),Jee=dr({},fN,{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}),Xee=Ei(Jee),Zee=[9,13,27,32],yA=oc&&"CompositionEvent"in window,Fx=null;oc&&"documentMode"in document&&(Fx=document.documentMode);var ete=oc&&"TextEvent"in window&&!Fx,F8=oc&&(!yA||Fx&&8<Fx&&11>=Fx),s_=" ",n_=!1;function _8(e,t){switch(e){case"keyup":return Zee.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function M8(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var rh=!1;function tte(e,t){switch(e){case"compositionend":return M8(t);case"keypress":return t.which!==32?null:(n_=!0,s_);case"textInput":return e=t.data,e===s_&&n_?null:e;default:return null}}function ste(e,t){if(rh)return e==="compositionend"||!yA&&_8(e,t)?(e=O8(),ub=pA=nd=null,rh=!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 F8&&t.locale!=="ko"?null:t.data;default:return null}}var nte={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 r_(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!nte[e.type]:t==="textarea"}function $8(e,t,n,r){h8(r),t=Vb(t,"onChange"),0<t.length&&(n=new xA("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var _x=null,dg=null;function rte(e){K8(e,0)}function pN(e){var t=oh(e);if(i8(t))return e}function ate(e,t){if(e==="change")return t}var I8=!1;if(oc){var FC;if(oc){var _C="oninput"in document;if(!_C){var a_=document.createElement("div");a_.setAttribute("oninput","return;"),_C=typeof a_.oninput=="function"}FC=_C}else FC=!1;I8=FC&&(!document.documentMode||9<document.documentMode)}function i_(){_x&&(_x.detachEvent("onpropertychange",R8),dg=_x=null)}function R8(e){if(e.propertyName==="value"&&pN(dg)){var t=[];$8(t,dg,e,dA(e)),g8(rte,t)}}function ite(e,t,n){e==="focusin"?(i_(),_x=t,dg=n,_x.attachEvent("onpropertychange",R8)):e==="focusout"&&i_()}function ote(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return pN(dg)}function lte(e,t){if(e==="click")return pN(t)}function cte(e,t){if(e==="input"||e==="change")return pN(t)}function dte(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Io=typeof Object.is=="function"?Object.is:dte;function ug(e,t){if(Io(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!Rk.call(t,a)||!Io(e[a],t[a]))return!1}return!0}function o_(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function l_(e,t){var n=o_(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=o_(n)}}function B8(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?B8(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function L8(){for(var e=window,t=Bb();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Bb(e.document)}return t}function vA(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 ute(e){var t=L8(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&B8(n.ownerDocument.documentElement,n)){if(r!==null&&vA(n)){if
vendor: 5,785 bytes, line 37
37(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,i=Math.min(r.start,a);r=r.end===void 0?i:Math.min(r.end,a),!e.extend&&i>r&&(a=r,r=i,i=a),a=l_(n,i);var o=l_(n,r);a&&o&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var mte=oc&&"documentMode"in document&&11>=document.documentMode,ah=null,n2=null,Mx=null,r2=!1;function c_(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;r2||ah==null||ah!==Bb(r)||(r=ah,"selectionStart"in r&&vA(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Mx&&ug(Mx,r)||(Mx=r,r=Vb(n2,"onSelect"),0<r.length&&(t=new xA("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=ah)))}function Xv(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ih={animationend:Xv("Animation","AnimationEnd"),animationiteration:Xv("Animation","AnimationIteration"),animationstart:Xv("Animation","AnimationStart"),transitionend:Xv("Transition","TransitionEnd")},MC={},U8={};oc&&(U8=document.createElement("div").style,"AnimationEvent"in window||(delete ih.animationend.animation,delete ih.animationiteration.animation,delete ih.animationstart.animation),"TransitionEvent"in window||delete ih.transitionend.transition);function xN(e){if(MC[e])return MC[e];if(!ih[e])return e;var t=ih[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in U8)return MC[e]=t[n];return e}var z8=xN("animationend"),q8=xN("animationiteration"),W8=xN("animationstart"),H8=xN("transitionend"),V8=new Map,d_="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 _d(e,t){V8.set(e,t),Sm(t,[e])}for(var $C=0;$C<d_.length;$C++){var IC=d_[$C],hte=IC.toLowerCase(),fte=IC[0].toUpperCase()+IC.slice(1);_d(hte,"on"+fte)}_d(z8,"onAnimationEnd");_d(q8,"onAnimationIteration");_d(W8,"onAnimationStart");_d("dblclick","onDoubleClick");_d("focusin","onFocus");_d("focusout","onBlur");_d(H8,"onTransitionEnd");jf("onMouseEnter",["mouseout","mouseover"]);jf("onMouseLeave",["mouseout","mouseover"]);jf("onPointerEnter",["pointerout","pointerover"]);jf("onPointerLeave",["pointerout","pointerover"]);Sm("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Sm("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Sm("onBeforeInput",["compositionend","keypress","textInput","paste"]);Sm("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Sm("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Sm("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bx="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(" "),pte=new Set("cancel close invalid load scroll toggle".split(" ").concat(bx));function u_(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,hee(r,t,void 0,e),e.currentTarget=null}function K8(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==i&&a.isPropagationStopped())break e;u_(a,l,d),i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,d=l.currentTarget,l=l.listener,c!==i&&a.isPropagationStopped())break e;u_(a,l,d),i=c}}}if(Ub)throw e=Zk,Ub=!1,Zk=null,e}function Vn(e,t){var n=t[c2];n===void 0&&(n=t[c2]=new Set);var r=e+"__bubble";n.has(r)||(G8(t,e,2,!1),n.add(r))}function RC(e,t,n){var r=0;t&&(r|=4),G8(n,e,r,t)}var Zv="_reactListening"+Math.random().toString(36).slice(2);function mg(e){if(!e[Zv]){e[Zv]=!0,t8.forEach(function(n){n!=="selectionchange"&&(pte.has(n)||RC(n,!1,e),RC(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Zv]||(t[Zv]=!0,RC("selectionchange",!1,t))}}function G8(e,t,n,r){switch(T8(t)){case 1:var a=Dee;break;case 4:a=Aee;break;default:a=fA}n=a.bind(null,t,n,e),a=void 0,!Xk||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),r?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function BC(e,t,n,r,a){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;
vendor: 21,609 bytes, lines 37-38
37if(l===a||l.nodeType===8&&l.parentNode===a)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===a||c.nodeType===8&&c.parentNode===a))return;o=o.return}for(;l!==null;){if(o=fu(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}g8(function(){var d=i,m=dA(n),u=[];e:{var h=V8.get(e);if(h!==void 0){var p=xA,v=e;switch(e){case"keypress":if(mb(n)===0)break e;case"keydown":case"keyup":p=Hee;break;case"focusin":v="focus",p=OC;break;case"focusout":v="blur",p=OC;break;case"beforeblur":case"afterblur":p=OC;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Z4;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Fee;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Gee;break;case z8:case q8:case W8:p=$ee;break;case H8:p=Qee;break;case"scroll":p=Tee;break;case"wheel":p=Xee;break;case"copy":case"cut":case"paste":p=Ree;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=t_}var y=(t&4)!==0,g=!y&&e==="scroll",x=y?h!==null?h+"Capture":null:h;y=[];for(var b=d,w;b!==null;){w=b;var j=w.stateNode;if(w.tag===5&&j!==null&&(w=j,x!==null&&(j=ig(b,x),j!=null&&y.push(hg(b,j,w)))),g)break;b=b.return}0<y.length&&(h=new p(h,v,null,n,m),u.push({event:h,listeners:y}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==Qk&&(v=n.relatedTarget||n.fromElement)&&(fu(v)||v[lc]))break e;if((p||h)&&(h=m.window===m?m:(h=m.ownerDocument)?h.defaultView||h.parentWindow:window,p?(v=n.relatedTarget||n.toElement,p=d,v=v?fu(v):null,v!==null&&(g=km(v),v!==g||v.tag!==5&&v.tag!==6)&&(v=null)):(p=null,v=d),p!==v)){if(y=Z4,j="onMouseLeave",x="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(y=t_,j="onPointerLeave",x="onPointerEnter",b="pointer"),g=p==null?h:oh(p),w=v==null?h:oh(v),h=new y(j,b+"leave",p,n,m),h.target=g,h.relatedTarget=w,j=null,fu(m)===d&&(y=new y(x,b+"enter",v,n,m),y.target=w,y.relatedTarget=g,j=y),g=j,p&&v)t:{for(y=p,x=v,b=0,w=y;w;w=$m(w))b++;for(w=0,j=x;j;j=$m(j))w++;for(;0<b-w;)y=$m(y),b--;for(;0<w-b;)x=$m(x),w--;for(;b--;){if(y===x||x!==null&&y===x.alternate)break t;y=$m(y),x=$m(x)}y=null}else y=null;p!==null&&m_(u,h,p,y,!1),v!==null&&g!==null&&m_(u,g,v,y,!0)}}e:{if(h=d?oh(d):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var N=ate;else if(r_(h))if(I8)N=cte;else{N=ote;var C=ite}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(N=lte);if(N&&(N=N(e,d))){$8(u,N,n,m);break e}C&&C(e,h,d),e==="focusout"&&(C=h._wrapperState)&&C.controlled&&h.type==="number"&&Hk(h,"number",h.value)}switch(C=d?oh(d):window,e){case"focusin":(r_(C)||C.contentEditable==="true")&&(ah=C,n2=d,Mx=null);break;case"focusout":Mx=n2=ah=null;break;case"mousedown":r2=!0;break;case"contextmenu":case"mouseup":case"dragend":r2=!1,c_(u,n,m);break;case"selectionchange":if(mte)break;case"keydown":case"keyup":c_(u,n,m)}var P;if(yA)e:{switch(e){case"compositionstart":var S="onCompositionStart";break e;case"compositionend":S="onCompositionEnd";break e;case"compositionupdate":S="onCompositionUpdate";break e}S=void 0}else rh?_8(e,n)&&(S="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(S="onCompositionStart");S&&(F8&&n.locale!=="ko"&&(rh||S!=="onCompositionStart"?S==="onCompositionEnd"&&rh&&(P=O8()):(nd=m,pA="value"in nd?nd.value:nd.textContent,rh=!0)),C=Vb(d,S),0<C.length&&(S=new e_(S,e,null,n,m),u.push({event:S,listeners:C}),P?S.data=P:(P=M8(n),P!==null&&(S.data=P)))),(P=ete?tte(e,n):ste(e,n))&&(d=Vb(d,"onBeforeInput"),0<d.length&&(m=new e_("onBeforeInput","beforeinput",null,n,m),u.push({event:m,listeners:d}),m.data=P))}K8(u,t)})}function hg(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Vb(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,i=a.stateNode;a.tag===5&&i!==null&&(a=i,i=ig(e,n),i!=null&&r.unshift(hg(e,i,a)),i=ig(e,t),i!=null&&r.push(hg(e,i,a))),e=e.return}return r}function $m(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function m_(e,t,n,r,a){for(var i=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,a?(c=ig(n,i),c!=null&&o.unshift(hg(n,c,l))):a||(c=ig(n,i),c!=null&&o.push(hg(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var xte=/\r\n?/g,gte=/\u0000|\uFFFD/g;function h_(e){return(typeof e=="string"?e:""+e).replace(xte,`
38`).replace(gte,"")}function e0(e,t,n){if(t=h_(t),h_(e)!==t&&n)throw Error(jt(425))}function Kb(){}var a2=null,i2=null;function o2(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 l2=typeof setTimeout=="function"?setTimeout:void 0,yte=typeof clearTimeout=="function"?clearTimeout:void 0,f_=typeof Promise=="function"?Promise:void 0,vte=typeof queueMicrotask=="function"?queueMicrotask:typeof f_<"u"?function(e){return f_.resolve(null).then(e).catch(bte)}:l2;function bte(e){setTimeout(function(){throw e})}function LC(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(r===0){e.removeChild(a),cg(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=a}while(n);cg(t)}function xd(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 p_(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var pp=Math.random().toString(36).slice(2),ml="__reactFiber$"+pp,fg="__reactProps$"+pp,lc="__reactContainer$"+pp,c2="__reactEvents$"+pp,wte="__reactListeners$"+pp,jte="__reactHandles$"+pp;function fu(e){var t=e[ml];if(t)return t;for(var n=e.parentNode;n;){if(t=n[lc]||n[ml]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=p_(e);e!==null;){if(n=e[ml])return n;e=p_(e)}return t}e=n,n=e.parentNode}return null}function rv(e){return e=e[ml]||e[lc],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function oh(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(jt(33))}function gN(e){return e[fg]||null}var d2=[],lh=-1;function Md(e){return{current:e}}function Yn(e){0>lh||(e.current=d2[lh],d2[lh]=null,lh--)}function Wn(e,t){lh++,d2[lh]=e.current,e.current=t}var Ed={},ba=Md(Ed),Ya=Md(!1),tm=Ed;function Nf(e,t){var n=e.type.contextTypes;if(!n)return Ed;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in n)a[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function Qa(e){return e=e.childContextTypes,e!=null}function Gb(){Yn(Ya),Yn(ba)}function x_(e,t,n){if(ba.current!==Ed)throw Error(jt(168));Wn(ba,t),Wn(Ya,n)}function Y8(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var a in r)if(!(a in t))throw Error(jt(108,iee(e)||"Unknown",a));return dr({},n,r)}function Yb(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ed,tm=ba.current,Wn(ba,e),Wn(Ya,Ya.current),!0}function g_(e,t,n){var r=e.stateNode;if(!r)throw Error(jt(169));n?(e=Y8(e,t,tm),r.__reactInternalMemoizedMergedChildContext=e,Yn(Ya),Yn(ba),Wn(ba,e)):Yn(Ya),Wn(Ya,n)}var Il=null,yN=!1,UC=!1;function Q8(e){Il===null?Il=[e]:Il.push(e)}function Nte(e){yN=!0,Q8(e)}function $d(){if(!UC&&Il!==null){UC=!0;var e=0,t=An;try{var n=Il;for(An=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Il=null,yN=!1}catch(a){throw Il!==null&&(Il=Il.slice(e+1)),w8(uA,$d),a}finally{An=t,UC=!1}}return null}var ch=[],dh=0,Qb=null,Jb=0,Ri=[],Bi=0,sm=null,Yl=1,Ql="";function nu(e,t){ch[dh++]=Jb,ch[dh++]=Qb,Qb=e,Jb=t}function J8(e,t,n){Ri[Bi++]=Yl,Ri[Bi++]=Ql,Ri[Bi++]=sm,sm=e;var r=Yl;e=Ql;var a=32-_o(r)-1;r&=~(1<<a),n+=1;var i=32-_o(t)+a;if(30<i){var o=a-a%5;i=(r&(1<<o)-1).toString(32),r>>=o,a-=o,Yl=1<<32-_o(t)+a|n<<a|r,Ql=i+e}else Yl=1<<i|n<<a|r,Ql=e}function bA(e){e.return!==null&&(nu(e,1),J8(e,1,0))}function wA(e){for(;e===Qb;)Qb=ch[--dh],ch[dh]=null,Jb=ch[--dh],ch[dh]=null;for(;e===sm;)sm=Ri[--Bi],Ri[Bi]=null,Ql=Ri[--Bi],Ri[Bi]=null,Yl=Ri[--Bi],Ri[Bi]=null}var fi=null,hi=null,tr=!1,So=null;function X8(e,t){var n=zi(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function y_(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,fi=e,hi=xd(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,fi=e,hi=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=sm!==null?{id:Yl,overflow:Ql}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=zi(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,fi=e,hi=null,!0):!1;default:return!1}}function u2(e){return(e.mode&1)!==0&&(e.flags&128)===0}function m2(e){if(tr){var t=hi;if(t){var n=t;if(!y_(e,t)){if(u2(e))throw Error(jt(418));t=xd(n.nextSibling);var r=fi;t&&y_(e,t)?X8(r,n):(e.flags=e.flags&-4097|2,tr=!1,fi=e)}}else{if(u2(e))throw Error(jt(418));e.flags=e.flags&-4097|2,tr=!1,fi=e}}}function v_(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;fi=e}function t0(e){if(e!==fi)return!1;if(!tr)return v_(e),tr=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!o2(e.type,e.memoizedProps)),t&&(t=hi)){if(u2(e))throw Z8(),Error(jt(418));for(;t;)X8(e,t),t=xd(t.nextSibling)}if(v_(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(jt(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){hi=xd(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}hi=null}}else hi=fi?xd(e.stateNode.nextSibling):null;return!0}function Z8(){for(var e=hi;e;)e=xd(e.nextSibling)}function Cf(){hi=fi=null,tr=!1}function jA(e){So===null?So=[e]:So.push(e)}var Cte=bc.ReactCurrentBatchConfig;function Wp(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(jt(309));var r=n.stateNode}if(!r)throw Error(jt(147,e));var a=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=a.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(jt(284));if(!n._owner)throw Error(jt(290,e))}return e}function s0(e,t){throw e=Object.prototype.toString.call(t),Error(jt(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function b_(e){var t=e._init;return t(e._payload)}function eU(e){function t(x,b){if(e){var w=x.deletions;w===null?(x.deletions=[b],x.flags|=16):w.push(b)}}function n(x,b){if(!e)return null;for(;b!==null;)t(x,b),b=b.sibling;return null}function r(x,b){for(x=new Map;b!==null;)b.key!==null?x.set(b.key,b):x.set(b.index,b),b=b.sibling;return x}function a(x,b){return x=bd(x,b),x.index=0,x.sibling=null,x}function i(x,b,w){return x.index=w,e?(w=x.alternate,w!==null?(w=w.index,w<b?(x.flags|=2,b):w):(x.flags|=2,b)):(x.flags|=1048576,b)}function o(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,b,w,j){return b===null||b.tag!==6?(b=GC(w,x.mode,j),b.return=x,b):(b=a(b,w),b.return=x,b)}function c(x,b,w,j){var N=w.type;return N===nh?m(x,b,w.props.children,j,w.key):b!==null&&(b.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===$c&&b_(N)===b.type)?(j=a(b,w.props),j.ref=Wp(x,b,w),j.return=x,j):(j=vb(w.type,w.key,w.props,null,x.mode,j),j.ref=Wp(x,b,w),j.return=x,j)}function d(x,b,w,j){return b===null||b.tag!==4||b.stateNode.containerInfo!==w.containerInfo||b.stateNode.implementation!==w.implementation?(b=YC(w,x.mode,j),b.return=x,b):(b=a(b,w.children||[]),b.return=x,b)}function m(x,b,w,j,N){return b===null||b.tag!==7?(b=Ku(w,x.mode,j,N),b.return=x,b):(b=a(b,w),b.return=x,b)}function u(x,b,w){if(typeof b=="string"&&b!==""||typeof b=="number")return b=GC(""+b,x.mode,w),b.return=x,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Hv:return w=vb(b.type,b.key,b.props,null,x.mode,w),w.ref=Wp(x,null,b),w.return=x,w;case sh:return b=YC(b,x.mode,w),b.return=x,b;case $c:var j=b._init;return u(x,j(b._payload),w)}if(yx(b)||Bp(b))return b=Ku(b,x.mode,w,null),b.return=x,b;s0(x,b)}return null}function h(x,b,w,j){var N=b!==null?b.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return N!==null?null:l(x,b,""+w,j);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Hv:return w.key===N?c(x,b,w,j):null;case sh:return w.key===N?d(x,b,w,j):null;case $c:return N=w._init,h(x,b,N(w._payload),j)}if(yx(w)||Bp(w))return N!==null?null:m(x,b,w,j,null);s0(x,w)}return null}function p(x,b,w,j,N){if(typeof j=="string"&&j!==""||typeof j=="number")return x=x.get(w)||null,l(b,x,""+j,N);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Hv:return x=x.get(j.key===null?w:j.key)||null,c(b,x,j,N);case sh:return x=x.get(j.key===null?w:j.key)||null,d(b,x,j,N);case $c:var C=j._init;return p(x,b,w,C(j._payload),N)}if(yx(j)||Bp(j))return x=x.get(w)||null,m(b,x,j,N,null);s0(b,j)}return null}function v(x,b,w,j){for(var N=null,C=null,P=b,S=b=0,E=null;P!==null&&S<w.length;S++){P.index>S?(E=P,P=null):E=P.sibling;var T=h(x,P,w[S],j);if(T===null){P===null&&(P=E);break}e&&P&&T.alternate===null&&t(x,P),b=i(T,b,S),C===null?N=T:C.sibling=T,C=T,P=E}if(S===w.length)return n(x,P),tr&&nu(x,S),N;if(P===null){for(;S<w.length;S++)P=u(x,w[S],j),P!==null&&(b=i(P,b,S),C===null?N=P:C.sibling=P,C=P);return tr&&nu(x,S),N}for(P=r(x,P);S<w.length;S++)E=p(P,x,S,w[S],j),E!==null&&(e&&E.alternate!==null&&P.delete(E.key===null?S:E.key),b=i(E,b,S),C===null?N=E:C.sibling=E,C=E);return e&&P.forEach(function(z){return t(x,z)}),tr&&nu(x,S),N}function y(x,b,w,j){var N=Bp(w);if(typeof N!="function")throw Error(jt(150));if(w=N.call(w),w==null)throw Error(jt(151));for(var C=N=null,P=b,S=b=0,E=null,T=w.next();P!==null&&!T.done;S++,T=w.next()){P.index>S?(E=P,P=null):E=P.sibling;var z=h(x,P,T.value,j);if(z===null){P===null&&(P=E);break}e&&P&&z.alternate===null&&t(x,P),b=i(z,b,S),C===null?N=z:C.sibling=z,C=z,P=E}if(T.done)return n(x,P),tr&&nu(x,S),N;if(P===null){for(;!T.done;S++,T=w.next())T=u(x,T.value,j),T!==null&&(b=i(T,b,S),C===null?N=T:C.sibling=T,C=T);return tr&&nu(x,S),N}for(P=r(x,P);!T.done;S++,T=w.next())T=p(P,x,S,T.value,j),T!==null&&(e&&T.alternate!==null&&P.delete(T.key===null?S:T.key),b=i(T,b,S),C===null?N=T:C.sibling=T,C=T);return e&&P.forEach(function(O){return t(x,O)}),tr&&nu(x,S),N}function g(x,b,w,j){if(typeof w=="object"&&w!==null&&w.type===nh&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Hv:e:{for(var N=w.key,C=b;C!==null;){if(C.key===N){if(N=w.type,N===nh){if(C.tag===7){n(x,C.sibling),b=a(C,w.props.children),b.return=x,x=b;break e}}else if(C.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===$c&&b_(N)===C.type){n(x,C.sibling),b=a(C,w.props),b.ref=Wp(x,C,w),b.return=x,x=b;break e}n(x,C);break}else t(x,C);C=C.sibling}w.type===nh?(b=Ku(w.props.children,x.mode,j,w.key),b.return=x,x=b):(j=vb(w.type,w.key,w.props,null,x.mode,j),j.ref=Wp(x,b,w),j.return=x,x=j)}return o(x);case sh:e:{for(C=w.key;b!==null;){if(b.key===C)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(x,b.sibling),b=a(b,w.children||[]),b.return=x,x=b;break e}else{n(x,b);break}else t(x,b);b=b.sibling}b=YC(w,x.mode,j),b.return=x,x=b}return o(x);case $c:return C=w._init,g(x,b,C(w._payload),j)}if(yx(w))return v(x,b,w,j);if(Bp(w))return y(x,b,w,j);s0(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(x,b.sibling),b=a(b,w),b.return=x,x=b):(n(x,b),b=GC(w,x.mode,j),b.return=x,x=b),o(x)):n(x,b)}return g}var Sf=eU(!0),tU=eU(!1),Xb=Md(null),Zb=null,uh=null,NA=null;function CA(){NA=uh=Zb=null}function SA(e){var t=Xb.current;Yn(Xb),e._currentValue=t}function h2(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Sh(e,t){Zb=e,NA=uh=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ka=!0),e.firstContext=null)}function Yi(e){var t=e._currentValue;if(NA!==e)if(e={context:e,memoizedValue:t,next:null},uh===null){if(Zb===null)throw Error(jt(308));uh=e,Zb.dependencies={lanes:0,firstContext:e}}else uh=uh.next=e;return t}var pu=null;function kA(e){pu===null?pu=[e]:pu.push(e)}function sU(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,kA(t)):(n.next=a.next,a.next=n),t.interleaved=n,cc(e,r)}function cc(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ic=!1;function PA(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function nU(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 tc(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function gd(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,gn&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,cc(e,n)}return a=r.interleaved,a===null?(t.next=t,kA(r)):(t.next=a.next,a.next=t),r.interleaved=t,cc(e,n)}function hb(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,mA(e,n)}}function w_(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?a=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?a=i=t:i=i.next=t}else a=i=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ew(e,t,n,r){var a=e.updateQueue;Ic=!1;var i=a.firstBaseUpdate,o=a.lastBaseUpdate,l=a.shared.pending;if(l!==null){a.shared.pending=null;var c=l,d=c.next;c.next=null,o===null?i=d:o.next=d,o=c;var m=e.alternate;m!==null&&(m=m.updateQueue,l=m.lastBaseUpdate,l!==o&&(l===null?m.firstBaseUpdate=d:l.next=d,m.lastBaseUpdate=c))}if(i!==null){var u=a.baseState;o=0,m=d=c=null,l=i;do{var h=l.lane,p=l.eventTime;if((r&h)===h){m!==null&&(m=m.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var v=e,y=l;switch(h=t,p=n,y.tag){case 1:if(v=y.payload,typeof v=="function"){u=v.call(p,u,h);break e}u=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=y.payload,h=typeof v=="function"?v.call(p,u,h):v,h==null)break e;u=dr({},u,h);break e;case 2:Ic=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=a.effects,h===null?a.effects=[l]:h.push(l))}else p={eventTime:p,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},m===null?(d=m=p,c=u):m=m.next=p,o|=h;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;h=l,l=h.next,h.next=null,a.lastBaseUpdate=h,a.shared.pending=null}}while(!0);if(m===null&&(c=u),a.baseState=c,a.firstBaseUpdate=d,a.lastBaseUpdate=m,t=a.shared.interleaved,t!==null){a=t;do o|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);rm|=o,e.lanes=o,e.memoizedState=u}}function j_(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(a!==null){if(r.callback=null,r=n,typeof a!="function")throw Error(jt(191,a));a.call(r)}}}var av={},yl=Md(av),pg=Md(av),xg=Md(av);function xu(e){if(e===av)throw Error(jt(174));return e}function EA(e,t){switch(Wn(xg,t),Wn(pg,e),Wn(yl,av),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Kk(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Kk(t,e)}Yn(yl),Wn(yl,t)}function kf(){Yn(yl),Yn(pg),Yn(xg)}function rU(e){xu(xg.current);var t=xu(yl.current),n=Kk(t,e.type);t!==n&&(Wn(pg,e),Wn(yl,n))}function DA(e){pg.current===e&&(Yn(yl),Yn(pg))}var or=Md(0);function tw(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.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 zC=[];function AA(){for(var e=0;e<zC.length;e++)zC[e]._workInProgressVersionPrimary=null;zC.length=0}var fb=bc.ReactCurrentDispatcher,qC=bc.ReactCurrentBatchConfig,nm=0,cr=null,_r=null,Gr=null,sw=!1,$x=!1,gg=0,Ste=0;function ma(){throw Error(jt(321))}function TA(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Io(e[n],t[n]))return!1;return!0}
vendor: 4,556 bytes, line 38
38function OA(e,t,n,r,a,i){if(nm=i,cr=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,fb.current=e===null||e.memoizedState===null?Dte:Ate,e=n(r,a),$x){i=0;do{if($x=!1,gg=0,25<=i)throw Error(jt(301));i+=1,Gr=_r=null,t.updateQueue=null,fb.current=Tte,e=n(r,a)}while($x)}if(fb.current=nw,t=_r!==null&&_r.next!==null,nm=0,Gr=_r=cr=null,sw=!1,t)throw Error(jt(300));return e}function FA(){var e=gg!==0;return gg=0,e}function Xo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gr===null?cr.memoizedState=Gr=e:Gr=Gr.next=e,Gr}function Qi(){if(_r===null){var e=cr.alternate;e=e!==null?e.memoizedState:null}else e=_r.next;var t=Gr===null?cr.memoizedState:Gr.next;if(t!==null)Gr=t,_r=e;else{if(e===null)throw Error(jt(310));_r=e,e={memoizedState:_r.memoizedState,baseState:_r.baseState,baseQueue:_r.baseQueue,queue:_r.queue,next:null},Gr===null?cr.memoizedState=Gr=e:Gr=Gr.next=e}return Gr}function yg(e,t){return typeof t=="function"?t(e):t}function WC(e){var t=Qi(),n=t.queue;if(n===null)throw Error(jt(311));n.lastRenderedReducer=e;var r=_r,a=r.baseQueue,i=n.pending;if(i!==null){if(a!==null){var o=a.next;a.next=i.next,i.next=o}r.baseQueue=a=i,n.pending=null}if(a!==null){i=a.next,r=r.baseState;var l=o=null,c=null,d=i;do{var m=d.lane;if((nm&m)===m)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var u={lane:m,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=u,o=r):c=c.next=u,cr.lanes|=m,rm|=m}d=d.next}while(d!==null&&d!==i);c===null?o=r:c.next=l,Io(r,t.memoizedState)||(Ka=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){a=e;do i=a.lane,cr.lanes|=i,rm|=i,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function HC(e){var t=Qi(),n=t.queue;if(n===null)throw Error(jt(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,i=t.memoizedState;if(a!==null){n.pending=null;var o=a=a.next;do i=e(i,o.action),o=o.next;while(o!==a);Io(i,t.memoizedState)||(Ka=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function aU(){}function iU(e,t){var n=cr,r=Qi(),a=t(),i=!Io(r.memoizedState,a);if(i&&(r.memoizedState=a,Ka=!0),r=r.queue,_A(cU.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Gr!==null&&Gr.memoizedState.tag&1){if(n.flags|=2048,vg(9,lU.bind(null,n,r,a,t),void 0,null),Xr===null)throw Error(jt(349));nm&30||oU(n,t,a)}return a}function oU(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=cr.updateQueue,t===null?(t={lastEffect:null,stores:null},cr.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function lU(e,t,n,r){t.value=n,t.getSnapshot=r,dU(t)&&uU(e)}function cU(e,t,n){return n(function(){dU(t)&&uU(e)})}function dU(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Io(e,n)}catch{return!0}}function uU(e){var t=cc(e,1);t!==null&&Mo(t,e,1,-1)}function N_(e){var t=Xo();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:yg,lastRenderedState:e},t.queue=e,e=e.dispatch=Ete.bind(null,cr,e),[t.memoizedState,e]}function vg(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=cr.updateQueue,t===null?(t={lastEffect:null,stores:null},cr.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function mU(){return Qi().memoizedState}function pb(e,t,n,r){var a=Xo();cr.flags|=e,a.memoizedState=vg(1|t,n,void 0,r===void 0?null:r)}function vN(e,t,n,r){var a=Qi();r=r===void 0?null:r;var i=void 0;if(_r!==null){var o=_r.memoizedState;if(i=o.destroy,r!==null&&TA(r,o.deps)){a.memoizedState=vg(t,n,i,r);return}}cr.flags|=e,a.memoizedState=vg(1|t,n,i,r)}function C_(e,t){return pb(8390656,8,e,t)}function _A(e,t){return vN(2048,8,e,t)}function hU(e,t){return vN(4,2,e,t)}function fU(e,t){return vN(4,4,e,t)}function pU(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 xU(e,t,n){return n=n!=null?n.concat([e]):null,vN(4,4,pU.bind(null,t,e),n)}function MA(){}function gU(e,t){var n=Qi();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&TA(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function yU(e,t){var n=Qi();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&TA(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}
vendor: 9,648 bytes, lines 38-40
38function vU(e,t,n){return nm&21?(Io(n,t)||(n=C8(),cr.lanes|=n,rm|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ka=!0),e.memoizedState=n)}function kte(e,t){var n=An;An=n!==0&&4>n?n:4,e(!0);var r=qC.transition;qC.transition={};try{e(!1),t()}finally{An=n,qC.transition=r}}function bU(){return Qi().memoizedState}function Pte(e,t,n){var r=vd(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},wU(e))jU(t,n);else if(n=sU(e,t,n,r),n!==null){var a=$a();Mo(n,e,r,a),NU(n,t,r)}}function Ete(e,t,n){var r=vd(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(wU(e))jU(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(a.hasEagerState=!0,a.eagerState=l,Io(l,o)){var c=t.interleaved;c===null?(a.next=a,kA(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=sU(e,t,a,r),n!==null&&(a=$a(),Mo(n,e,r,a),NU(n,t,r))}}function wU(e){var t=e.alternate;return e===cr||t!==null&&t===cr}function jU(e,t){$x=sw=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function NU(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,mA(e,n)}}var nw={readContext:Yi,useCallback:ma,useContext:ma,useEffect:ma,useImperativeHandle:ma,useInsertionEffect:ma,useLayoutEffect:ma,useMemo:ma,useReducer:ma,useRef:ma,useState:ma,useDebugValue:ma,useDeferredValue:ma,useTransition:ma,useMutableSource:ma,useSyncExternalStore:ma,useId:ma,unstable_isNewReconciler:!1},Dte={readContext:Yi,useCallback:function(e,t){return Xo().memoizedState=[e,t===void 0?null:t],e},useContext:Yi,useEffect:C_,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,pb(4194308,4,pU.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pb(4194308,4,e,t)},useInsertionEffect:function(e,t){return pb(4,2,e,t)},useMemo:function(e,t){var n=Xo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Xo();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Pte.bind(null,cr,e),[r.memoizedState,e]},useRef:function(e){var t=Xo();return e={current:e},t.memoizedState=e},useState:N_,useDebugValue:MA,useDeferredValue:function(e){return Xo().memoizedState=e},useTransition:function(){var e=N_(!1),t=e[0];return e=kte.bind(null,e[1]),Xo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=cr,a=Xo();if(tr){if(n===void 0)throw Error(jt(407));n=n()}else{if(n=t(),Xr===null)throw Error(jt(349));nm&30||oU(r,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,C_(cU.bind(null,r,i,e),[e]),r.flags|=2048,vg(9,lU.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Xo(),t=Xr.identifierPrefix;if(tr){var n=Ql,r=Yl;n=(r&~(1<<32-_o(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=gg++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Ste++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Ate={readContext:Yi,useCallback:gU,useContext:Yi,useEffect:_A,useImperativeHandle:xU,useInsertionEffect:hU,useLayoutEffect:fU,useMemo:yU,useReducer:WC,useRef:mU,useState:function(){return WC(yg)},useDebugValue:MA,useDeferredValue:function(e){var t=Qi();return vU(t,_r.memoizedState,e)},useTransition:function(){var e=WC(yg)[0],t=Qi().memoizedState;return[e,t]},useMutableSource:aU,useSyncExternalStore:iU,useId:bU,unstable_isNewReconciler:!1},Tte={readContext:Yi,useCallback:gU,useContext:Yi,useEffect:_A,useImperativeHandle:xU,useInsertionEffect:hU,useLayoutEffect:fU,useMemo:yU,useReducer:HC,useRef:mU,useState:function(){return HC(yg)},useDebugValue:MA,useDeferredValue:function(e){var t=Qi();return _r===null?t.memoizedState=e:vU(t,_r.memoizedState,e)},useTransition:function(){var e=HC(yg)[0],t=Qi().memoizedState;return[e,t]},useMutableSource:aU,useSyncExternalStore:iU,useId:bU,unstable_isNewReconciler:!1};function uo(e,t){if(e&&e.defaultProps){t=dr({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function f2(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:dr({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var bN={isMounted:function(e){return(e=e._reactInternals)?km(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=$a(),a=vd(e),i=tc(r,a);i.payload=t,n!=null&&(i.callback=n),t=gd(e,i,a),t!==null&&(Mo(t,e,a,r),hb(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=$a(),a=vd(e),i=tc(r,a);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=gd(e,i,a),t!==null&&(Mo(t,e,a,r),hb(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=$a(),r=vd(e),a=tc(n,r);a.tag=2,t!=null&&(a.callback=t),t=gd(e,a,r),t!==null&&(Mo(t,e,r,n),hb(t,e,r))}};function S_(e,t,n,r,a,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!ug(n,r)||!ug(a,i):!0}function CU(e,t,n){var r=!1,a=Ed,i=t.contextType;return typeof i=="object"&&i!==null?i=Yi(i):(a=Qa(t)?tm:ba.current,r=t.contextTypes,i=(r=r!=null)?Nf(e,a):Ed),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=bN,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=i),t}function k_(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&bN.enqueueReplaceState(t,t.state,null)}function p2(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},PA(e);var i=t.contextType;typeof i=="object"&&i!==null?a.context=Yi(i):(i=Qa(t)?tm:ba.current,a.context=Nf(e,i)),a.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(f2(e,t,i,n),a.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(t=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),t!==a.state&&bN.enqueueReplaceState(a,a.state,null),ew(e,n,a,r),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function Pf(e,t){try{var n="",r=t;do n+=aee(r),r=r.return;while(r);var a=n}catch(i){a=`
39Error generating stack: `+i.message+`
40`+i.stack}return{value:e,source:t,stack:a,digest:null}}function VC(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function x2(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Ote=typeof WeakMap=="function"?WeakMap:Map;function SU(e,t,n){n=tc(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){aw||(aw=!0,k2=r),x2(e,t)},n}function kU(e,t,n){n=tc(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){x2(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){x2(e,t),typeof r!="function"&&(yd===null?yd=new Set([this]):yd.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function P_(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ote;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=Vte.bind(null,e,t,n),t.then(e,e))}function E_(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 D_(e,t,n,r,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=tc(-1,1),t.tag=2,gd(n,t,1))),n.lanes|=1),e)}var Fte=bc.ReactCurrentOwner,Ka=!1;function Ta(e,t,n,r){t.child=e===null?tU(t,null,n,r):Sf(t,e.child,n,r)}function A_(e,t,n,r,a){n=n.render;var i=t.ref;return Sh(t,a),r=OA(e,t,n,r,i,a),n=FA(),e!==null&&!Ka?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,dc(e,t,a)):(tr&&n&&bA(t),t.flags|=1,Ta(e,t,r,a),t.child)}function T_(e,t,n,r,a){if(e===null){var i=n.type;return typeof i=="function"&&!qA(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,PU(e,t,i,r,a)):(e=vb(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&a)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:ug,n(o,r)&&e.ref===t.ref)return dc(e,t,a)}return t.flags|=1,e=bd(i,r),e.ref=t.ref,e.return=t,t.child=e}function PU(e,t,n,r,a){if(e!==null){var i=e.memoizedProps;if(ug(i,r)&&e.ref===t.ref)if(Ka=!1,t.pendingProps=r=i,(e.lanes&a)!==0)e.flags&131072&&(Ka=!0);else return t.lanes=e.lanes,dc(e,t,a)}return g2(e,t,n,r,a)}function EU(e,t,n){var r=t.pendingProps,a=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Wn(hh,ci),ci|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Wn(hh,ci),ci|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Wn(hh,ci),ci|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Wn(hh,ci),ci|=r;return Ta(e,t,a,n),t.child}function DU(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}
vendor: 8,755 bytes, line 40
40function g2(e,t,n,r,a){var i=Qa(n)?tm:ba.current;return i=Nf(t,i),Sh(t,a),n=OA(e,t,n,r,i,a),r=FA(),e!==null&&!Ka?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,dc(e,t,a)):(tr&&r&&bA(t),t.flags|=1,Ta(e,t,n,a),t.child)}function O_(e,t,n,r,a){if(Qa(n)){var i=!0;Yb(t)}else i=!1;if(Sh(t,a),t.stateNode===null)xb(e,t),CU(t,n,r),p2(t,n,r,a),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,d=n.contextType;typeof d=="object"&&d!==null?d=Yi(d):(d=Qa(n)?tm:ba.current,d=Nf(t,d));var m=n.getDerivedStateFromProps,u=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==d)&&k_(t,o,r,d),Ic=!1;var h=t.memoizedState;o.state=h,ew(t,r,o,a),c=t.memoizedState,l!==r||h!==c||Ya.current||Ic?(typeof m=="function"&&(f2(t,n,m,r),c=t.memoizedState),(l=Ic||S_(t,n,l,r,h,c,d))?(u||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=r,t.memoizedState=c),o.props=r,o.state=c,o.context=d,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,nU(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:uo(t.type,l),o.props=d,u=t.pendingProps,h=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=Yi(c):(c=Qa(n)?tm:ba.current,c=Nf(t,c));var p=n.getDerivedStateFromProps;(m=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==u||h!==c)&&k_(t,o,r,c),Ic=!1,h=t.memoizedState,o.state=h,ew(t,r,o,a);var v=t.memoizedState;l!==u||h!==v||Ya.current||Ic?(typeof p=="function"&&(f2(t,n,p,r),v=t.memoizedState),(d=Ic||S_(t,n,d,r,h,v,c)||!1)?(m||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,v,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,v,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=v),o.props=r,o.state=v,o.context=c,r=d):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return y2(e,t,n,r,i,a)}function y2(e,t,n,r,a,i){DU(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return a&&g_(t,n,!1),dc(e,t,i);r=t.stateNode,Fte.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Sf(t,e.child,null,i),t.child=Sf(t,null,l,i)):Ta(e,t,l,i),t.memoizedState=r.state,a&&g_(t,n,!0),t.child}function AU(e){var t=e.stateNode;t.pendingContext?x_(e,t.pendingContext,t.pendingContext!==t.context):t.context&&x_(e,t.context,!1),EA(e,t.containerInfo)}function F_(e,t,n,r,a){return Cf(),jA(a),t.flags|=256,Ta(e,t,n,r),t.child}var v2={dehydrated:null,treeContext:null,retryLane:0};function b2(e){return{baseLanes:e,cachePool:null,transitions:null}}function TU(e,t,n){var r=t.pendingProps,a=or.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(a&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),Wn(or,a&1),e===null)return m2(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=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=NN(o,r,0,null),e=Ku(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=b2(n),t.memoizedState=v2,e):$A(t,o));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return _te(e,t,o,r,l,a,n);if(i){i=r.fallback,o=t.mode,a=e.child,l=a.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==a?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=bd(a,c),r.subtreeFlags=a.subtreeFlags&14680064),l!==null?i=bd(l,i):(i=Ku(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?b2(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=v2,r}return i=e.child,e=i.sibling,r=bd(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function $A(e,t){return t=NN({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function n0(e,t,n,r){return r!==null&&jA(r),Sf(t,e.child,null,n),e=$A(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _te(e,t,n,r,a,i,o){if(n)return t.flags&256?(t.flags&=-257,r=VC(Error(jt(422))),n0(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,a=t.mode,r=NN({mode:"visible",children:r.children},a,0,null),i=Ku(i,a,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Sf(t,e.child,null,o),t.child.memoizedState=b2(o),t.memoizedState=v2,i);if(!(t.mode&1))return n0(e,t,o,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(jt(419)),r=VC(i,r,void 0),n0(e,t,o,r)}if(l=(o&e.childLanes)!==0,Ka||l){if(r=Xr,r!==null){switch(o&-o){case 4:a=2;break;case 16:a=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:a=32;break;case 536870912:a=268435456;break;default:a=0}a=a&(r.suspendedLanes|o)?0:a,a!==0&&a!==i.retryLane&&(i.retryLane=a,cc(e,a),Mo(r,e,a,-1))}return zA(),r=VC(Error(jt(421))),n0(e,t,o,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=Kte.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,hi=xd(a.nextSibling),fi=t,tr=!0,So=null,e!==null&&(Ri[Bi++]=Yl,Ri[Bi++]=Ql,Ri[Bi++]=sm,Yl=e.id,Ql=e.overflow,sm=t),t=$A(t,r.children),t.flags|=4096,t)}function __(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),h2(e.return,t,n)}function KC(e,t,n,r,a){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a)}function OU(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;if(Ta(e,t,r.children,n),r=or.current,r&2)r=r&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&&__(e,n,t);else if(e.tag===19)__(e,n,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}r&=1}if(Wn(or,r),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&tw(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),KC(t,!1,a,n,i);break;case"backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&tw(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}KC(t,!0,n,null,i);break;case"together":KC(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function xb(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function dc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),rm|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(jt(153));if(t.child!==null){for(e=t.child,n=bd(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=bd(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Mte(e,t,n){switch(t.tag){case 3:AU(t),Cf();break;case 5:rU(t);break;case 1:Qa(t.type)&&Yb(t);break;case 4:EA(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;Wn(Xb,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Wn(or,or.current&1),t.flags|=128,null):n&t.child.childLanes?TU(e,t,n
vendor: 4,885 bytes, line 40
40):(Wn(or,or.current&1),e=dc(e,t,n),e!==null?e.sibling:null);Wn(or,or.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return OU(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Wn(or,or.current),r)break;return null;case 22:case 23:return t.lanes=0,EU(e,t,n)}return dc(e,t,n)}var FU,w2,_U,MU;FU=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};w2=function(){};_U=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,xu(yl.current);var i=null;switch(n){case"input":a=qk(e,a),r=qk(e,r),i=[];break;case"select":a=dr({},a,{value:void 0}),r=dr({},r,{value:void 0}),i=[];break;case"textarea":a=Vk(e,a),r=Vk(e,r),i=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Kb)}Gk(n,r);var o;n=null;for(d in a)if(!r.hasOwnProperty(d)&&a.hasOwnProperty(d)&&a[d]!=null)if(d==="style"){var l=a[d];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(rg.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var c=r[d];if(l=a!=null?a[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(rg.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&Vn("scroll",e),i||l===c||(i=[])):(i=i||[]).push(d,c))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};MU=function(e,t,n,r){n!==r&&(t.flags|=4)};function Hp(e,t){if(!tr)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ha(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&14680064,r|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function $te(e,t,n){var r=t.pendingProps;switch(wA(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ha(t),null;case 1:return Qa(t.type)&&Gb(),ha(t),null;case 3:return r=t.stateNode,kf(),Yn(Ya),Yn(ba),AA(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(t0(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,So!==null&&(D2(So),So=null))),w2(e,t),ha(t),null;case 5:DA(t);var a=xu(xg.current);if(n=t.type,e!==null&&t.stateNode!=null)_U(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(jt(166));return ha(t),null}if(e=xu(yl.current),t0(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[ml]=t,r[fg]=i,e=(t.mode&1)!==0,n){case"dialog":Vn("cancel",r),Vn("close",r);break;case"iframe":case"object":case"embed":Vn("load",r);break;case"video":case"audio":for(a=0;a<bx.length;a++)Vn(bx[a],r);break;case"source":Vn("error",r);break;case"img":case"image":case"link":Vn("error",r),Vn("load",r);break;case"details":Vn("toggle",r);break;case"input":q4(r,i),Vn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Vn("invalid",r);break;case"textarea":H4(r,i),Vn("invalid",r)}Gk(n,i),a=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&e0(r.textContent,l,e),a=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&e0(r.textContent,l,e),a=["children",""+l]):rg.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Vn("scroll",r)}switch(n){case"input":Vv(r),W4(r,i,!0);break;case"textarea":Vv(r),V4(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Kb)}r=a,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=c8(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>
40",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[ml]=t,e[fg]=r,FU(e,t,!1,!1),t.stateNode=e;e:{switch(o=Yk(n,r),n){case"dialog":Vn("cancel",e),Vn("close",e),a=r;break;case"iframe":case"object":case"embed":Vn("load",e),a=r;break;case"video":case"audio":for(a=0;a<bx.length;a++)Vn(bx[a],e);a=r;break;case"source":Vn("error",e),a=r;break;case"img":case"image":case"link":Vn("error",e),Vn("load",e),a=r;break;case"details":Vn("toggle",e),a=r;break;case"input":q4(e,r),a=qk(e,r),Vn("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=dr({},r,{value:void 0}),Vn("invalid",e);break;case"textarea":H4(e,r),a=Vk(e,r),Vn("invalid",e);break;default:a=r}Gk(n,a),l=a;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?m8(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&d8(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&ag(e,c):typeof c=="number"&&ag(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(rg.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Vn("scroll",e):c!=null&&iA(e,i,c,o))}switch(n){case"input":Vv(e),W4(e,r,!1);break;case"textarea":Vv(e),V4(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Pd(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?wh(e,!!r.multiple,i,!1):r.defaultValue!=null&&wh(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=Kb)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return ha(t),null;case 6:if(e&&t.stateNode!=null)MU(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(jt(166));if(n=xu(xg.current),xu(yl.current),t0(t)){if(r=t.stateNode,n=t.memoizedProps,r[ml]=t,(i=r.nodeValue!==n)&&(e=fi,e!==null))switch(e.tag){case 3:e0(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&e0(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[ml]=t,t.stateNode=r}return ha(t),null;case 13:if(Yn(or),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(tr&&hi!==null&&t.mode&1&&!(t.flags&128))Z8(),Cf(),t.flags|=98560,i=!1;else if(i=t0(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(jt(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(jt(317));i[ml]=t}else Cf(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ha(t),i=!1}else So!==null&&(D2(So),So=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||or.current&1?Br===0&&(Br=3):zA())),t.updateQueue!==null&&(t.flags|=4),ha(t),null);case 4:return kf(),w2(e,t),e===null&&mg(t.stateNode.containerInfo),ha(t),null;case 10:return SA(t.type._context),ha(t),null;case 17:return Qa(t.type)&&Gb(),ha(t),null;case 19:if(Yn(or),i=t.memoizedState,i===null)return ha(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)Hp(i,!1);else{if(Br!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=tw(e),o!==null){for(t.flags|=128,Hp(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Wn(or,or.current&1|2),t.child}e=e.sibling}i.tail!==null&&br()>Ef&&(t.flags|=128,r=!0,Hp(i,!1),t.lanes=4194304)}else{if(!r)if(e=tw(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Hp(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!tr)return ha(t),null}else 2*br()-i.renderingStartTime>Ef&&n!==1073741824&&(t.flags|=128,r=!0,Hp(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=br(),t.sibling=null,n=or.current,Wn(or,r?n&1|2:n&1),t):(ha(t),null);
vendor: 23,639 bytes, line 40
40case 22:case 23:return UA(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ci&1073741824&&(ha(t),t.subtreeFlags&6&&(t.flags|=8192)):ha(t),null;case 24:return null;case 25:return null}throw Error(jt(156,t.tag))}function Ite(e,t){switch(wA(t),t.tag){case 1:return Qa(t.type)&&Gb(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return kf(),Yn(Ya),Yn(ba),AA(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return DA(t),null;case 13:if(Yn(or),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(jt(340));Cf()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Yn(or),null;case 4:return kf(),null;case 10:return SA(t.type._context),null;case 22:case 23:return UA(),null;case 24:return null;default:return null}}var r0=!1,xa=!1,Rte=typeof WeakSet=="function"?WeakSet:Set,ns=null;function mh(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){hr(e,t,r)}else n.current=null}function j2(e,t,n){try{n()}catch(r){hr(e,t,r)}}var M_=!1;function Bte(e,t){if(a2=Wb,e=L8(),vA(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,d=0,m=0,u=e,h=null;t:for(;;){for(var p;u!==n||a!==0&&u.nodeType!==3||(l=o+a),u!==i||r!==0&&u.nodeType!==3||(c=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(p=u.firstChild)!==null;)h=u,u=p;for(;;){if(u===e)break t;if(h===n&&++d===a&&(l=o),h===i&&++m===r&&(c=o),(p=u.nextSibling)!==null)break;u=h,h=u.parentNode}u=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(i2={focusedElem:e,selectionRange:n},Wb=!1,ns=t;ns!==null;)if(t=ns,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ns=e;else for(;ns!==null;){t=ns;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var y=v.memoizedProps,g=v.memoizedState,x=t.stateNode,b=x.getSnapshotBeforeUpdate(t.elementType===t.type?y:uo(t.type,y),g);x.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(jt(163))}}catch(j){hr(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,ns=e;break}ns=t.return}return v=M_,M_=!1,v}function Ix(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&j2(t,n,i)}a=a.next}while(a!==r)}}function wN(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function N2(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function $U(e){var t=e.alternate;t!==null&&(e.alternate=null,$U(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ml],delete t[fg],delete t[c2],delete t[wte],delete t[jte])),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 IU(e){return e.tag===5||e.tag===3||e.tag===4}function $_(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||IU(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 C2(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Kb));else if(r!==4&&(e=e.child,e!==null))for(C2(e,t,n),e=e.sibling;e!==null;)C2(e,t,n),e=e.sibling}function S2(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(S2(e,t,n),e=e.sibling;e!==null;)S2(e,t,n),e=e.sibling}var ia=null,bo=!1;function Pc(e,t,n){for(n=n.child;n!==null;)RU(e,t,n),n=n.sibling}function RU(e,t,n){if(gl&&typeof gl.onCommitFiberUnmount=="function")try{gl.onCommitFiberUnmount(hN,n)}catch{}switch(n.tag){case 5:xa||mh(n,t);case 6:var r=ia,a=bo;ia=null,Pc(e,t,n),ia=r,bo=a,ia!==null&&(bo?(e=ia,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ia.removeChild(n.stateNode));break;case 18:ia!==null&&(bo?(e=ia,n=n.stateNode,e.nodeType===8?LC(e.parentNode,n):e.nodeType===1&&LC(e,n),cg(e)):LC(ia,n.stateNode));break;case 4:r=ia,a=bo,ia=n.stateNode.containerInfo,bo=!0,Pc(e,t,n),ia=r,bo=a;break;case 0:case 11:case 14:case 15:if(!xa&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var i=a,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&j2(n,t,o),a=a.next}while(a!==r)}Pc(e,t,n);break;case 1:if(!xa&&(mh(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){hr(n,t,l)}Pc(e,t,n);break;case 21:Pc(e,t,n);break;case 22:n.mode&1?(xa=(r=xa)||n.memoizedState!==null,Pc(e,t,n),xa=r):Pc(e,t,n);break;default:Pc(e,t,n)}}function I_(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Rte),t.forEach(function(r){var a=Gte.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function ao(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:ia=l.stateNode,bo=!1;break e;case 3:ia=l.stateNode.containerInfo,bo=!0;break e;case 4:ia=l.stateNode.containerInfo,bo=!0;break e}l=l.return}if(ia===null)throw Error(jt(160));RU(i,o,a),ia=null,bo=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(d){hr(a,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)BU(t,e),t=t.sibling}function BU(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ao(t,e),Ko(e),r&4){try{Ix(3,e,e.return),wN(3,e)}catch(y){hr(e,e.return,y)}try{Ix(5,e,e.return)}catch(y){hr(e,e.return,y)}}break;case 1:ao(t,e),Ko(e),r&512&&n!==null&&mh(n,n.return);break;case 5:if(ao(t,e),Ko(e),r&512&&n!==null&&mh(n,n.return),e.flags&32){var a=e.stateNode;try{ag(a,"")}catch(y){hr(e,e.return,y)}}if(r&4&&(a=e.stateNode,a!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&o8(a,i),Yk(l,o);var d=Yk(l,i);for(o=0;o<c.length;o+=2){var m=c[o],u=c[o+1];m==="style"?m8(a,u):m==="dangerouslySetInnerHTML"?d8(a,u):m==="children"?ag(a,u):iA(a,m,u,d)}switch(l){case"input":Wk(a,i);break;case"textarea":l8(a,i);break;case"select":var h=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?wh(a,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?wh(a,!!i.multiple,i.defaultValue,!0):wh(a,!!i.multiple,i.multiple?[]:"",!1))}a[fg]=i}catch(y){hr(e,e.return,y)}}break;case 6:if(ao(t,e),Ko(e),r&4){if(e.stateNode===null)throw Error(jt(162));a=e.stateNode,i=e.memoizedProps;try{a.nodeValue=i}catch(y){hr(e,e.return,y)}}break;case 3:if(ao(t,e),Ko(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{cg(t.containerInfo)}catch(y){hr(e,e.return,y)}break;case 4:ao(t,e),Ko(e);break;case 13:ao(t,e),Ko(e),a=e.child,a.flags&8192&&(i=a.memoizedState!==null,a.stateNode.isHidden=i,!i||a.alternate!==null&&a.alternate.memoizedState!==null||(BA=br())),r&4&&I_(e);break;case 22:if(m=n!==null&&n.memoizedState!==null,e.mode&1?(xa=(d=xa)||m,ao(t,e),xa=d):ao(t,e),Ko(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!m&&e.mode&1)for(ns=e,m=e.child;m!==null;){for(u=ns=m;ns!==null;){switch(h=ns,p=h.child,h.tag){case 0:case 11:case 14:case 15:Ix(4,h,h.return);break;case 1:mh(h,h.return);var v=h.stateNode;if(typeof v.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,v.props=t.memoizedProps,v.state=t.memoizedState,v.componentWillUnmount()}catch(y){hr(r,n,y)}}break;case 5:mh(h,h.return);break;case 22:if(h.memoizedState!==null){B_(u);continue}}p!==null?(p.return=h,ns=p):B_(u)}m=m.sibling}e:for(m=null,u=e;;){if(u.tag===5){if(m===null){m=u;try{a=u.stateNode,d?(i=a.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=u.stateNode,c=u.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=u8("display",o))}catch(y){hr(e,e.return,y)}}}else if(u.tag===6){if(m===null)try{u.stateNode.nodeValue=d?"":u.memoizedProps}catch(y){hr(e,e.return,y)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===e)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;u.sibling===null;){if(u.return===null||u.return===e)break e;m===u&&(m=null),u=u.return}m===u&&(m=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:ao(t,e),Ko(e),r&4&&I_(e);break;case 21:break;default:ao(t,e),Ko(e)}}function Ko(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(IU(n)){var r=n;break e}n=n.return}throw Error(jt(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(ag(a,""),r.flags&=-33);var i=$_(e);S2(e,i,a);break;case 3:case 4:var o=r.stateNode.containerInfo,l=$_(e);C2(e,l,o);break;default:throw Error(jt(161))}}catch(c){hr(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lte(e,t,n){ns=e,LU(e)}function LU(e,t,n){for(var r=(e.mode&1)!==0;ns!==null;){var a=ns,i=a.child;if(a.tag===22&&r){var o=a.memoizedState!==null||r0;if(!o){var l=a.alternate,c=l!==null&&l.memoizedState!==null||xa;l=r0;var d=xa;if(r0=o,(xa=c)&&!d)for(ns=a;ns!==null;)o=ns,c=o.child,o.tag===22&&o.memoizedState!==null?L_(a):c!==null?(c.return=o,ns=c):L_(a);for(;i!==null;)ns=i,LU(i),i=i.sibling;ns=a,r0=l,xa=d}R_(e)}else a.subtreeFlags&8772&&i!==null?(i.return=a,ns=i):R_(e)}}function R_(e){for(;ns!==null;){var t=ns;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:xa||wN(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!xa)if(n===null)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:uo(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&j_(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}j_(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var m=d.memoizedState;if(m!==null){var u=m.dehydrated;u!==null&&cg(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(jt(163))}xa||t.flags&512&&N2(t)}catch(h){hr(t,t.return,h)}}if(t===e){ns=null;break}if(n=t.sibling,n!==null){n.return=t.return,ns=n;break}ns=t.return}}function B_(e){for(;ns!==null;){var t=ns;if(t===e){ns=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ns=n;break}ns=t.return}}function L_(e){for(;ns!==null;){var t=ns;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{wN(4,t)}catch(c){hr(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(c){hr(t,a,c)}}var i=t.return;try{N2(t)}catch(c){hr(t,i,c)}break;case 5:var o=t.return;try{N2(t)}catch(c){hr(t,o,c)}}}catch(c){hr(t,t.return,c)}if(t===e){ns=null;break}var l=t.sibling;if(l!==null){l.return=t.return,ns=l;break}ns=t.return}}var Ute=Math.ceil,rw=bc.ReactCurrentDispatcher,IA=bc.ReactCurrentOwner,Wi=bc.ReactCurrentBatchConfig,gn=0,Xr=null,Pr=null,ca=0,ci=0,hh=Md(0),Br=0,bg=null,rm=0,jN=0,RA=0,Rx=null,Va=null,BA=0,Ef=1/0,$l=null,aw=!1,k2=null,yd=null,a0=!1,rd=null,iw=0,Bx=0,P2=null,gb=-1,yb=0;function $a(){return gn&6?br():gb!==-1?gb:gb=br()}function vd(e){return e.mode&1?gn&2&&ca!==0?ca&-ca:Cte.transition!==null?(yb===0&&(yb=C8()),yb):(e=An,e!==0||(e=window.event,e=e===void 0?16:T8(e.type)),e):1}function Mo(e,t,n,r){if(50<Bx)throw Bx=0,P2=null,Error(jt(185));sv(e,n,r),(!(gn&2)||e!==Xr)&&(e===Xr&&(!(gn&2)&&(jN|=n),Br===4&&qc(e,ca)),Ja(e,r),n===1&&gn===0&&!(t.mode&1)&&(Ef=br()+500,yN&&$d()))}function Ja(e,t){var n=e.callbackNode;Cee(e,t);var r=qb(e,e===Xr?ca:0);if(r===0)n!==null&&Y4(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Y4(n),t===1)e.tag===0?Nte(U_.bind(null,e)):Q8(U_.bind(null,e)),vte(function(){!(gn&6)&&$d()}),n=null;else{switch(S8(r)){case 1:n=uA;break;case 4:n=j8;break;case 16:n=zb;break;case 536870912:n=N8;break;default:n=zb}n=GU(n,UU.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function UU(e,t){if(gb=-1,yb=0,gn&6)throw Error(jt(327));var n=e.callbackNode;if(kh()&&e.callbackNode!==n)return null;var r=qb(e,e===Xr?ca:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ow(e,r);else{t=r;var a=gn;gn|=2;var i=qU();(Xr!==e||ca!==t)&&($l=null,Ef=br()+500,Vu(e,t));do try{Wte();break}catch(l){zU(e,l)}while(!0);CA(),rw.current=i,gn=a,Pr!==null?t=0:(Xr=null,ca=0,t=Br)}if(t!==0){if(t===2&&(a=e2(e),a!==0&&(r=a,t=E2(e,a))),t===1)throw n=bg,Vu(e,0),qc(e,r),Ja(e,br()),n;if(t===6)qc(e,r);else{if(a=e.current.alternate,!(r&30)&&!zte(a)&&(t=ow(e,r),t===2&&(i=e2(e),i!==0&&(r=i,t=E2(e,i))),t===1))throw n=bg,Vu(e,0),qc(e,r),Ja(e,br()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(jt(345));case 2:ru(e,Va,$l);break;case 3:if(qc(e,r),(r&130023424)===r&&(t=BA+500-br(),10<t)){if(qb(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){$a(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=l2(ru.bind(null,e,Va,$l),t);break}ru(e,Va,$l);break;case 4:if(qc(e,r),(r&4194240)===r)break;for(t=e.eventTimes,a=-1;0<r;){var o=31-_o(r);i=1<<o,o=t[o],o>a&&(a=o),r&=~i}if(r=a,r=br()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ute(r/1960))-r,10<r){e.timeoutHandle=l2(ru.bind(null,e,Va,$l),r);break}ru(e,Va,$l);break;case 5:ru(e,Va,$l);break;default:throw Error(jt(329))}}}return Ja(e,br()),e.callbackNode===n?UU.bind(null,e):null}function E2(e,t){var n=Rx;return e.current.memoizedState.isDehydrated&&(Vu(e,t).flags|=256),e=ow(e,t),e!==2&&(t=Va,Va=n,t!==null&&D2(t)),e}function D2(e){Va===null?Va=e:Va.push.apply(Va,e)}function zte(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var a=n[r],i=a.getSnapshot;a=a.value;try{if(!Io(i(),a))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 qc(e,t){for(t&=~RA,t&=~jN,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-_o(t),r=1<<n;e[n]=-1,t&=~r}}function U_(e){if(gn&6)throw Error(jt(327));kh();var t=qb(e,0);if(!(t&1))return Ja(e,br()),null;var n=ow(e,t);if(e.tag!==0&&n===2){var r=e2(e);r!==0&&(t=r,n=E2(e,r))}if(n===1)throw n=bg,Vu(e,0),qc(e,t),Ja(e,br()),n;if(n===6)throw Error(jt(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ru(e,Va,$l),Ja(e,br()),null}function LA(e,t){var n=gn;gn|=1;try{return e(t)}finally{gn=n,gn===0&&(Ef=br()+500,yN&&$d())}}function am(e){rd!==null&&rd.tag===0&&!(gn&6)&&kh();var t=gn;gn|=1;var n=Wi.transition,r=An;try{if(Wi.transition=null,An=1,e)return e()}finally{An=r,Wi.transition=n,gn=t,!(gn&6)&&$d()}}function UA(){ci=hh.current,Yn(hh)}function Vu(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,yte(n)),Pr!==null)for(n=Pr.return;n!==null;){var r=n;switch(wA(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Gb();break;case 3:kf(),Yn(Ya),Yn(ba),AA();break;case 5:DA(r);break;case 4:kf();break;case 13:Yn(or);break;case 19:Yn(or);break;case 10:SA(r.type._context);break;case 22:case 23:UA()}n=n.return}if(Xr=e,Pr=e=bd(e.current,null),ca=ci=t,Br=0,bg=null,RA=jN=rm=0,Va=Rx=null,pu!==null){for(t=0;t<pu.length;t++)if(n=pu[t],r=n.interleaved,r!==null){n.interleaved=null;var a=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=a,r.next=o}n.pending=r}pu=null}return e}function zU(e,t){do{var n=Pr;try{if(CA(),fb.current=nw,sw){for(var r=cr.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}sw=!1}if(nm=0,Gr=_r=cr=null,$x=!1,gg=0,IA.current=null,n===null||n.return===null){Br=1,bg=t,Pr=null;break}e:{var i=e,o=n.return,l=n,c=t;if(t=ca,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,m=l,u=m.tag;if(!(m.mode&1)&&(u===0||u===11||u===15)){var h=m.alternate;h?(m.updateQueue=h.updateQueue,m.memoizedState=h.memoizedState,m.lanes=h.lanes):(m.updateQueue=null,m.memoizedState=null)}var p=E_(o);if(p!==null){p.flags&=-257,D_(p,o,l,i,t),p.mode&1&&P_(i,d,t),t=p,c=d;var v=t.updateQueue;if(v===null){var y=new Set;y.add(c),t.updateQueue=y}else v.add(c);break e}else{if(!(t&1)){P_(i,d,t),zA();break e}c=Error(jt(426))}}else if(tr&&l.mode&1){var g=E_(o);if(g!==null){!(g.flags&65536)&&(g.flags|=256),D_(g,o,l,i,t),jA(Pf(c,l));break e}}i=c=Pf(c,l),Br!==4&&(Br=2),Rx===null?Rx=[i]:Rx.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=SU(i,c,t);w_(i,x);break e;case 1:l=c;var b=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(yd===null||!yd.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var j=kU(i,l,t);w_(i,j);break e}}i=i.return}while(i!==null)}HU(n)}catch(N){t=N,Pr===n&&n!==null&&(Pr=n=n.return);continue}break}while(!0)}function qU(){var e=rw.current;return rw.current=nw,e===null?nw:e}function zA(){(Br===0||Br===3||Br===2)&&(Br=4),Xr===null||!(rm&268435455)&&!(jN&268435455)||qc(Xr,ca)}function ow(e,t){var n=gn;gn|=2;var r=qU();(Xr!==e||ca!==t)&&($l=null,Vu(e,t));do try{qte();break}catch(a){zU(e,a)}while(!0);if(CA(),gn=n,rw.current=r,Pr!==null)throw Error(jt(261));return Xr=null,ca=0,Br}function qte(){for(;Pr!==null;)WU(Pr)}function Wte(){for(;Pr!==null&&!pee();)WU(Pr)}function WU(e){var t=KU(e.alternate,e,ci);e.memoizedProps=e.pendingProps,t===null?HU(e):Pr=t,IA.current=null}function HU(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Ite(n,t),n!==null){n.flags&=32767,Pr=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Br=6,Pr=null;return}}else if(n=$te(n,t,ci),n!==null){Pr=n;return}if(t=t.sibling,t!==null){Pr=t;return}Pr=t=e}while(t!==null);Br===0&&(Br=5)}function ru(e,t,n){var r=An,a=Wi.transition;try{Wi.transition=null,An=1,Hte(e,t,n,r)}finally{Wi.transition=a,An=r}return null}function Hte(e,t,n,r){do kh();while(rd!==null);if(gn&6)throw Error(jt(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(jt(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(See(e,i),e===Xr&&(Pr=Xr=null,ca=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||a0||(a0=!0,GU(zb,function(){return kh(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Wi.transition,Wi.transition=null;var o=An;An=1;var l=gn;gn|=4,IA.current=null,Bte(e,n),BU(n,e),ute(i2),Wb=!!a2,i2=a2=null,e.current=n,Lte(n),xee(),gn=l,An=o,Wi.transition=i}else e.current=n;if(a0&&(a0=!1,rd=e,iw=a),i=e.pendingLanes,i===0&&(yd=null),vee(n.stateNode),Ja(e,br()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(aw)throw aw=!1,e=k2,k2=null,e;return iw&1&&e.tag!==0&&kh(),i=e.pendingLanes,i&1?e===P2?Bx++:(Bx=0,P2=e):Bx=0,$d(),null}function kh(){if(rd!==null){var e=S8(iw),t=Wi.transition,n=An;try{if(Wi.transition=null,An=16>e?16:e,rd===null)var r=!1;else{if(e=rd,rd=null,iw=0,gn&6)throw Error(jt(331));var a=gn;for(gn|=4,ns=e.current;ns!==null;){var i=ns,o=i.child;if(ns.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(ns=d;ns!==null;){var m=ns;switch(m.tag){case 0:case 11:case 15:Ix(8,m,i)}var u=m.child;if(u!==null)u.return=m,ns=u;else for(;ns!==null;){m=ns;var h=m.sibling,p=m.return;if($U(m),m===d){ns=null;break}if(h!==null){h.return=p,ns=h;break}ns=p}}}var v=i.alternate;if(v!==null){var y=v.child;if(y!==null){v.child=null;do{var g=y.sibling;y.sibling=null,y=g}while(y!==null)}}ns=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,ns=o;else e:for(;ns!==null;){if(i=ns,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Ix(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,ns=x;break e}ns=i.return}}var b=e.current;for(ns=b;ns!==null;){o=ns;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,ns=w;else e:for(o=b;ns!==null;){if(l=ns,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:wN(9,l)}}catch(N){hr(l,l.return,N)}if(l===o){ns=null;break e}var j=l.sibling;if(j!==null){j.return=l.return,ns=j;break e}ns=l.return}}if(gn=a,$d(),gl&&typeof gl.onPostCommitFiberRoot=="function")try{gl.onPostCommitFiberRoot(hN,e)}catch{}r=!0}return r}finally{An=n,Wi.transition=t}}return!1}function z_(e,t,n){t=Pf(n,t),t=SU(e,t,1),e=gd(e,t,1),t=$a(),e!==null&&(sv(e,1,t),Ja(e,t))}function hr(e,t,n){if(e.tag===3)z_(e,e,n);else for(;t!==null;){if(t.tag===3){z_(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(yd===null||!yd.has(r))){e=Pf(n,e),e=kU(t,e,1),t=gd(t,e,1),e=$a(),t!==null&&(sv(t,1,e),Ja(t,e));break}}t=t.return}}function Vte(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=$a(),e.pingedLanes|=e.suspendedLanes&n,Xr===e&&(ca&n)===n&&(Br===4||Br===3&&(ca&130023424)===ca&&500>br()-BA?Vu(e,0):RA|=n),Ja(e,t)}function VU(e,t){t===0&&(e.mode&1?(t=Yv,Yv<<=1,!(Yv&130023424)&&(Yv=4194304)):t=1);var n=$a();e=cc(e,t),e!==null&&(sv(e,t,n),Ja(e,n))}function Kte(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),VU(e,n)}function Gte(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(jt(314))}r!==null&&r.delete(t),VU(e,n)}var KU;KU=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ya.current)Ka=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ka=!1,Mte(e,t,n);Ka=!!(e.flags&131072)}else Ka=!1,tr&&t.flags&1048576&&J8(t,Jb,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;xb(e,t),e=t.pendingProps;var a=Nf(t,ba.current);Sh(t,n),a=OA(null,t,r,e,a,n);var i=FA();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Qa(r)?(i=!0,Yb(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,PA(t),a.updater=bN,t.stateNode=a,a._reactInternals=t,p2(t,r,e,n),t=y2(null,t,r,!0,i,n)):(t.tag=0,tr&&i&&bA(t),Ta(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(xb(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=Qte(r),e=uo(r,e),a){case 0:t=g2(null,t,r,e,n);break e;case 1:t=O_(null,t,r,e,n);break e;case 11:t=A_(null,t,r,e,n);break e;case 14:t=T_(null,t,r,uo(r.type,e),n);break e}throw Error(jt(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:uo(r,a),g2(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:uo(r,a),O_(e,t,r,a,n);case 3:e:{if(AU(t),e===null)throw Error(jt(387));
vendor: 4,682 bytes, line 40
40r=t.pendingProps,i=t.memoizedState,a=i.element,nU(e,t),ew(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=Pf(Error(jt(423)),t),t=F_(e,t,r,n,a);break e}else if(r!==a){a=Pf(Error(jt(424)),t),t=F_(e,t,r,n,a);break e}else for(hi=xd(t.stateNode.containerInfo.firstChild),fi=t,tr=!0,So=null,n=tU(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Cf(),r===a){t=dc(e,t,n);break e}Ta(e,t,r,n)}t=t.child}return t;case 5:return rU(t),e===null&&m2(t),r=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,o=a.children,o2(r,a)?o=null:i!==null&&o2(r,i)&&(t.flags|=32),DU(e,t),Ta(e,t,o,n),t.child;case 6:return e===null&&m2(t),null;case 13:return TU(e,t,n);case 4:return EA(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Sf(t,null,r,n):Ta(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:uo(r,a),A_(e,t,r,a,n);case 7:return Ta(e,t,t.pendingProps,n),t.child;case 8:return Ta(e,t,t.pendingProps.children,n),t.child;case 12:return Ta(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,i=t.memoizedProps,o=a.value,Wn(Xb,r._currentValue),r._currentValue=o,i!==null)if(Io(i.value,o)){if(i.children===a.children&&!Ya.current){t=dc(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=tc(-1,n&-n),c.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var m=d.pending;m===null?c.next=c:(c.next=m.next,m.next=c),d.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),h2(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(jt(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),h2(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Ta(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,Sh(t,n),a=Yi(a),r=r(a),t.flags|=1,Ta(e,t,r,n),t.child;case 14:return r=t.type,a=uo(r,t.pendingProps),a=uo(r.type,a),T_(e,t,r,a,n);case 15:return PU(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:uo(r,a),xb(e,t),t.tag=1,Qa(r)?(e=!0,Yb(t)):e=!1,Sh(t,n),CU(t,r,a),p2(t,r,a,n),y2(null,t,r,!0,e,n);case 19:return OU(e,t,n);case 22:return EU(e,t,n)}throw Error(jt(156,t.tag))};function GU(e,t){return w8(e,t)}function Yte(e,t,n,r){this.tag=e,this.key=n,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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zi(e,t,n,r){return new Yte(e,t,n,r)}function qA(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qte(e){if(typeof e=="function")return qA(e)?1:0;if(e!=null){if(e=e.$$typeof,e===lA)return 11;if(e===cA)return 14}return 2}function bd(e,t){var n=e.alternate;return n===null?(n=zi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function vb(e,t,n,r,a,i){var o=2;if(r=e,typeof e=="function")qA(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case nh:return Ku(n.children,a,i,t);case oA:o=8,a|=8;break;case Bk:return e=zi(12,n,t,a|2),e.elementType=Bk,e.lanes=i,e;case Lk:return e=zi(13,n,t,a),e.elementType=Lk,e.lanes=i,e;case Uk:return e=zi(19,n,t,a),e.elementType=Uk,e.lanes=i,e;case r8:return NN(n,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case s8:o=10;break e;case n8:o=9;break e;case lA:o=11;break e;case cA:o=14;break e;case $c:o=16,r=null;break e}throw Error(jt(130,e==null?e:typeof e,""))}return t=zi(o,n,t,a),t.elementType=e,t.type=r,t.lanes=i,t}function Ku(e,t,n,r){return e=zi(7,e,r,t),e.lanes=n,e}function NN(e,t,n,r){return e=zi(22,e,r,t),e.elementType=r8,e.lanes=n,e.stateNode={isHidden:!1},e}
vendor: 5,704 bytes, line 40
40function GC(e,t,n){return e=zi(6,e,null,t),e.lanes=n,e}function YC(e,t,n){return t=zi(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Jte(e,t,n,r,a){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=DC(0),this.expirationTimes=DC(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=DC(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function WA(e,t,n,r,a,i,o,l,c){return e=new Jte(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=zi(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},PA(i),e}function Xte(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:sh,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function YU(e){if(!e)return Ed;e=e._reactInternals;e:{if(km(e)!==e||e.tag!==1)throw Error(jt(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Qa(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(jt(171))}if(e.tag===1){var n=e.type;if(Qa(n))return Y8(e,n,t)}return t}function QU(e,t,n,r,a,i,o,l,c){return e=WA(n,r,!0,e,a,i,o,l,c),e.context=YU(null),n=e.current,r=$a(),a=vd(n),i=tc(r,a),i.callback=t??null,gd(n,i,a),e.current.lanes=a,sv(e,a,r),Ja(e,r),e}function CN(e,t,n,r){var a=t.current,i=$a(),o=vd(a);return n=YU(n),t.context===null?t.context=n:t.pendingContext=n,t=tc(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=gd(a,t,o),e!==null&&(Mo(e,a,o,i),hb(e,a,o)),o}function lw(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 q_(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function HA(e,t){q_(e,t),(e=e.alternate)&&q_(e,t)}function Zte(){return null}var JU=typeof reportError=="function"?reportError:function(e){console.error(e)};function VA(e){this._internalRoot=e}SN.prototype.render=VA.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(jt(409));CN(e,t,null,null)};SN.prototype.unmount=VA.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;am(function(){CN(null,e,null,null)}),t[lc]=null}};function SN(e){this._internalRoot=e}SN.prototype.unstable_scheduleHydration=function(e){if(e){var t=E8();e={blockedOn:null,target:e,priority:t};for(var n=0;n<zc.length&&t!==0&&t<zc[n].priority;n++);zc.splice(n,0,e),n===0&&A8(e)}};function KA(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function kN(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function W_(){}function ese(e,t,n,r,a){if(a){if(typeof r=="function"){var i=r;r=function(){var d=lw(o);i.call(d)}}var o=QU(t,r,e,0,null,!1,!1,"",W_);return e._reactRootContainer=o,e[lc]=o.current,mg(e.nodeType===8?e.parentNode:e),am(),o}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var l=r;r=function(){var d=lw(c);l.call(d)}}var c=WA(e,0,!1,null,null,!1,!1,"",W_);return e._reactRootContainer=c,e[lc]=c.current,mg(e.nodeType===8?e.parentNode:e),am(function(){CN(t,c,n,r)}),c}function PN(e,t,n,r,a){var i=n._reactRootContainer;if(i){var o=i;if(typeof a=="function"){var l=a;a=function(){var c=lw(o);l.call(c)}}CN(t,o,e,a)}else o=ese(n,t,e,a,r);return lw(o)}k8=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=vx(t.pendingLanes);n!==0&&(mA(t,n|1),Ja(t,br()),!(gn&6)&&(Ef=br()+500,$d()))}break;case 13:am(function(){var r=cc(e,1);if(r!==null){var a=$a();Mo(r,e,1,a)}}),HA(e,1)}};hA=function(e){if(e.tag===13){var t=cc(e,134217728);if(t!==null){var n=$a();Mo(t,e,134217728,n)}HA(e,134217728)}};P8=function(e){if(e.tag===13){var t=vd(e),n=cc(e,t);if(n!==null){var r=$a();Mo(n,e,t,r)}HA(e,t)}};E8=function(){return An};D8=function(e,t){var n=An;try{return An=e,t()}finally{An=n}};Jk=function(e,t,n){switch(t){case"input":if(Wk(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=gN(r);if(!a)throw Error(jt(90));i8(r),Wk(r,a)}}}break;case"textarea":l8(e,n);break;case"select":t=n.value,t!=null&&wh(e,!!n.multiple,t,!1)}};p8=LA;x8=am;var tse={usingClientEntryPoint:!1,Events:[rv,oh,gN,h8,f8,LA]},Vp={findFiberByHostInstance:fu,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},sse={bundleType:Vp.bundleType,version:Vp.version,rendererPackageName:Vp.rendererPackageName,rendererConfig:Vp.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:bc.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=v8(e),e===null?null:e.stateNode},findFiberByHostInstance:Vp.findFiberByHostInstance||Zte,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};
40if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var i0=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!i0.isDisabled&&i0.supportsFiber)try{hN=i0.inject(sse),gl=i0}catch{}}Pi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=tse;Pi.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!KA(t))throw Error(jt(200));return Xte(e,t,null,n)};Pi.createRoot=function(e,t){if(!KA(e))throw Error(jt(299));var n=!1,r="",a=JU;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=WA(e,1,!1,null,null,n,!1,r,a),e[lc]=t.current,mg(e.nodeType===8?e.parentNode:e),new VA(t)};Pi.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(jt(188)):(e=Object.keys(e).join(","),Error(jt(268,e)));return e=v8(t),e=e===null?null:e.stateNode,e};Pi.flushSync=function(e){return am(e)};Pi.hydrate=function(e,t,n){if(!kN(t))throw Error(jt(200));return PN(null,e,t,!0,n)};Pi.hydrateRoot=function(e,t,n){if(!KA(e))throw Error(jt(405));var r=n!=null&&n.hydratedSources||null,a=!1,i="",o=JU;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=QU(t,null,e,1,n??null,a,!1,i,o),e[lc]=t.current,mg(e),r)for(e=0;e<r.length;e++)n=r[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new SN(t)};Pi.render=function(e,t,n){if(!kN(t))throw Error(jt(200));return PN(null,e,t,!1,n)};Pi.unmountComponentAtNode=function(e){if(!kN(e))throw Error(jt(40));return e._reactRootContainer?(am(function(){PN(null,null,e,!1,function(){e._reactRootContainer=null,e[lc]=null})}),!0):!1};Pi.unstable_batchedUpdates=LA;Pi.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!kN(n))throw Error(jt(200));if(e==null||e._reactInternals===void 0)throw Error(jt(38));return PN(e,t,n,!1,r)};Pi.version="18.3.1-next-f1338f8080-20240426";function XU(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(XU)}catch(e){console.error(e)}}XU(),XL.exports=Pi;var Id=XL.exports;const ZU=Qs(Id);var e9,H_=Id;e9=H_.createRoot,H_.hydrateRoot;function nse(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,a,i,o=[],l="",c=e.split("/");for(c[0]||c.shift();a=c.shift();)n=a[0],n==="*"?(o.push(n),l+=a[1]==="?"?"(?:/(.*))?":"/(.*)"):n===":"?(r=a.indexOf("?",1),i=a.indexOf(".",1),o.push(a.substring(1,~r?r:~i?i:a.length)),l+=~r&&!~i?"(?:/([^/]+?))?":"/([^/]+?)",~i&&(l+=(~r?"?":"")+"\\"+a.substring(i))):l+="/"+a;return{keys:o,pattern:new RegExp("^"+l+(t?"(?=$|/)":"/?$"),"i")}}var t9={exports:{}},s9={};/**
41 * @license React
42 * use-sync-external-store-shim.production.js
43 *
44 * Copyright (c) Meta Platforms, Inc. and affiliates.
45 *
46 * This source code is licensed under the MIT license found in the
47 * LICENSE file in the root directory of this source tree.
48 */var Df=f;function rse(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ase=typeof Object.is=="function"?Object.is:rse,ise=Df.useState,ose=Df.useEffect,lse=Df.useLayoutEffect,cse=Df.useDebugValue;function dse(e,t){var n=t(),r=ise({inst:{value:n,getSnapshot:t}}),a=r[0].inst,i=r[1];return lse(function(){a.value=n,a.getSnapshot=t,QC(a)&&i({inst:a})},[e,n,t]),ose(function(){return QC(a)&&i({inst:a}),e(function(){QC(a)&&i({inst:a})})},[e]),cse(n),n}function QC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ase(e,n)}catch{return!0}}function use(e,t){return t()}var mse=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?use:dse;s9.useSyncExternalStore=Df.useSyncExternalStore!==void 0?Df.useSyncExternalStore:mse;t9.exports=s9;var hse=t9.exports;const fse=mN.useInsertionEffect,pse=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",xse=pse?f.useLayoutEffect:f.useEffect,gse=fse||xse,n9=e=>{const t=f.useRef([e,(...n)=>t[0](...n)]).current;return gse(()=>{t[0]=e}),t[1]},yse="popstate",GA="pushState",YA="replaceState",vse="hashchange",V_=[yse,GA,YA,vse],bse=e=>{for(const t of V_)addEventListener(t,e);return()=>{for(const t of V_)removeEventListener(t,e)}},r9=(e,t)=>
48hse.useSyncExternalStore(bse,e,t),K_=()=>location.search,wse=({ssrSearch:e}={})=>r9(K_,e!=null?()=>e:K_),G_=()=>location.pathname,jse=({ssrPath:e}={})=>r9(G_,e!=null?()=>e:G_),Nse=(e,{replace:t=!1,state:n=null}={})=>history[t?YA:GA](n,"",e),Cse=(e={})=>[jse(e),Nse],Y_=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Y_]>"u"){for(const e of[GA,YA]){const t=history[e];history[e]=function(){const n=t.apply(this,arguments),r=new Event(e);return r.arguments=arguments,dispatchEvent(r),n}}Object.defineProperty(window,Y_,{value:!0})}const Sse=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",a9=(e="")=>e==="/"?"":e,kse=(e,t)=>e[0]==="~"?e.slice(1):a9(t)+e,Pse=(e="",t)=>Sse(Q_(a9(e)),Q_(t)),Q_=e=>{try{return decodeURI(e)}catch{return e}},i9={hook:Cse,searchHook:wse,parser:nse,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,t,n)=>e(t,n)},o9=f.createContext(i9),xp=()=>f.useContext(o9),l9={},c9=f.createContext(l9),sa=()=>f.useContext(c9),EN=e=>{const[t,n]=e.hook(e);return[Pse(e.base,t),n9((r,a)=>e.aroundNav(n,kse(r,e.base),a))]},cn=()=>EN(xp()),QA=(e,t,n,r)=>{const{pattern:a,keys:i}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",r),o=a.exec(n)||[],[l,...c]=o;return l!==void 0?[!0,(()=>{const d=i!==!1?Object.fromEntries(i.map((u,h)=>[u,c[h]])):o.groups;let m={...c};return d&&Object.assign(m,d),m})(),...r?[l]:[]]:[!1,null]},Ese=e=>QA(xp().parser,e,cn()[0]),Dse=({children:e,...t})=>{var m,u,h;const n=xp(),r=t.hook?i9:n;let a=r;const[i,o=t.ssrSearch??""]=((m=t.ssrPath)==null?void 0:m.split("?"))??[];i&&(t.ssrSearch=o,t.ssrPath=i),t.hrefs=t.hrefs??((u=t.hook)==null?void 0:u.hrefs),t.searchHook=t.searchHook??((h=t.hook)==null?void 0:h.searchHook);let l=f.useRef({}),c=l.current,d=c;for(let p in r){const v=p==="base"?r[p]+(t[p]??""):t[p]??r[p];c===d&&v!==d[p]&&(l.current=d={...d}),d[p]=v,(v!==r[p]||v!==a[p])&&(a=d)}return f.createElement(o9.Provider,{value:a,children:e})},J_=({children:e,component:t},n)=>t?f.createElement(t,{params:n}):typeof e=="function"?e(n):e,Ase=e=>{let t=f.useRef(l9);const n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([r,a])=>a!==n[r])?e:n},us=({path:e,nest:t,match:n,...r})=>{const a=xp(),[i]=EN(a),[o,l,c]=n??QA(a.parser,e,i,t),d=Ase({...sa(),...l});if(!o)return null;const m=c?f.createElement(Dse,{base:c},J_(r,d)):J_(r,d);return f.createElement(c9.Provider,{value:d,children:m})},dt=f.forwardRef((e,t)=>{const n=xp(),[r,a]=EN(n),{to:i="",href:o=i,onClick:l,asChild:c,children:d,className:m,replace:u,state:h,transition:p,...v}=e,y=n9(x=>{x.ctrlKey||x.metaKey||x.altKey||x.shiftKey||x.button!==0||(l==null||l(x),x.defaultPrevented||(x.preventDefault(),a(o,e)))}),g=n.hrefs(o[0]==="~"?o.slice(1):n.base+o,n);return c&&f.isValidElement(d)?f.cloneElement(d,{onClick:y,href:g}):f.createElement("a",{...v,onClick:y,href:g,className:m!=null&&m.call?m(r===o):m,children:d,ref:t})}),d9=e=>Array.isArray(e)?e.flatMap(t=>d9(t&&t.type===f.Fragment?t.props.children:t)):[e],Tse=({children:e,location:t})=>{const n=xp(),[r]=EN(n);for(const a of d9(e)){let i=0;if(f.isValidElement(a)&&(i=QA(n.parser,a.props.path,t||r,a.props.nest))[0])return f.cloneElement(a,{match:i})}return null};var gp=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(){}},Ose={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Hc,ZD,AL,Fse=(AL=class{constructor(){Qe(this,Hc,Ose);Qe(this,ZD,!1)}setTimeoutProvider(e){et(this,Hc,e)}setTimeout(e,t){return X(this,Hc).setTimeout(e,t)}clearTimeout(e){X(this,Hc).clearTimeout(e)}setInterval(e,t){return X(this,Hc).setInterval(e,t)}clearInterval(e){X(this,Hc).clearInterval(e)}},Hc=new WeakMap,ZD=new WeakMap,AL),gu=new Fse;function _se(e){setTimeout(e,0)}var im=typeof window>"u"||"Deno"in globalThis;function Oa(){}function Mse(e,t){return typeof e=="function"?e(t):e}function A2(e){return typeof e=="number"&&e>=0&&e!==1/0}function u9(e,t){return Math.max(e+(t||0)-Date.now(),0)}function wd(e,t){return typeof e=="function"?e(t):e}function Ii(e,t){return typeof e=="function"?e(t):e}function X_(e,t){const{type:n="all",exact:r,fetchStatus:a,predicate:i,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==JA(o,t.options))return!1}else if(!wg(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||a&&a!==t.state.fetchStatus||i&&!i(t))}function Z_(e,t){const{exact:n,status:r,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(om(t.options.mutationKey)!==om(i))return!1}else if(!wg(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function JA(e,t){return((t==null?void 0:t.queryKeyHashFn)||om)(e)}function om(e){return JSON.stringify(e,(t,n)=>T2(n)?Object.keys(n).sort().reduce((r,a)=>(r[a]=n[a],r),{}):n)}function wg(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>
48wg(e[n],t[n])):!1}var $se=Object.prototype.hasOwnProperty;function m9(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=eM(e)&&eM(t);if(!r&&!(T2(e)&&T2(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,c=r?new Array(l):{};let d=0;for(let m=0;m<l;m++){const u=r?m:o[m],h=e[u],p=t[u];if(h===p){c[u]=h,(r?m<i:$se.call(e,u))&&d++;continue}if(h===null||p===null||typeof h!="object"||typeof p!="object"){c[u]=p;continue}const v=m9(h,p,n+1);c[u]=v,v===h&&d++}return i===l&&d===i?e:c}function cw(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function eM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T2(e){if(!tM(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!tM(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function tM(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ise(e){return new Promise(t=>{gu.setTimeout(t,e)})}function O2(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?m9(e,t):t}function Rse(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Bse(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var XA=Symbol();function h9(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===XA?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ZA(e,t){return typeof e=="function"?e(...t):!!e}function Lse(e,t,n){let r=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),r||(r=!0,a.aborted?n():a.addEventListener("abort",n,{once:!0})),a)}),e}var Su,Vc,qh,TL,Use=(TL=class extends gp{constructor(){super();Qe(this,Su);Qe(this,Vc);Qe(this,qh);et(this,qh,t=>{if(!im&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){X(this,Vc)||this.setEventListener(X(this,qh))}onUnsubscribe(){var t;this.hasListeners()||((t=X(this,Vc))==null||t.call(this),et(this,Vc,void 0))}setEventListener(t){var n;et(this,qh,t),(n=X(this,Vc))==null||n.call(this),et(this,Vc,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){X(this,Su)!==t&&(et(this,Su,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof X(this,Su)=="boolean"?X(this,Su):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Su=new WeakMap,Vc=new WeakMap,qh=new WeakMap,TL),eT=new Use;function F2(){let e,t;const n=new Promise((a,i)=>{e=a,t=i});n.status="pending",n.catch(()=>{});function r(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},n.reject=a=>{r({status:"rejected",reason:a}),t(a)},n}var zse=_se;function qse(){let e=[],t=0,n=l=>{l()},r=l=>{l()},a=zse;const i=l=>{t?e.push(l):a(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&a(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{a=l}}}var Rr=qse(),Wh,Kc,Hh,OL,Wse=(OL=class extends gp{constructor(){super();Qe(this,Wh,!0);Qe(this,Kc);Qe(this,Hh);et(this,Hh,t=>{if(!im&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){X(this,Kc)||this.setEventListener(X(this,Hh))}onUnsubscribe(){var t;this.hasListeners()||((t=X(this,Kc))==null||t.call(this),et(this,Kc,void 0))}setEventListener(t){var n;et(this,Hh,t),(n=X(this,Kc))==null||n.call(this),et(this,Kc,t(this.setOnline.bind(this)))}setOnline(t){X(this,Wh)!==t&&(et(this,Wh,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return X(this,Wh)}},Wh=new WeakMap,Kc=new WeakMap,Hh=new WeakMap,OL),dw=new Wse;function Hse(e){return Math.min(1e3*2**e,3e4)}function f9(e){return(e??"online")==="online"?dw.isOnline():!0}
vendor: 5,027 bytes, line 48
48var _2=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function p9(e){let t=!1,n=0,r;const a=F2(),i=()=>a.status!=="pending",o=y=>{var g;if(!i()){const x=new _2(y);h(x),(g=e.onCancel)==null||g.call(e,x)}},l=()=>{t=!0},c=()=>{t=!1},d=()=>eT.isFocused()&&(e.networkMode==="always"||dw.isOnline())&&e.canRun(),m=()=>f9(e.networkMode)&&e.canRun(),u=y=>{i()||(r==null||r(),a.resolve(y))},h=y=>{i()||(r==null||r(),a.reject(y))},p=()=>new Promise(y=>{var g;r=x=>{(i()||d())&&y(x)},(g=e.onPause)==null||g.call(e)}).then(()=>{var y;r=void 0,i()||(y=e.onContinue)==null||y.call(e)}),v=()=>{if(i())return;let y;const g=n===0?e.initialPromise:void 0;try{y=g??e.fn()}catch(x){y=Promise.reject(x)}Promise.resolve(y).then(u).catch(x=>{var C;if(i())return;const b=e.retry??(im?0:3),w=e.retryDelay??Hse,j=typeof w=="function"?w(n,x):w,N=b===!0||typeof b=="number"&&n<b||typeof b=="function"&&b(n,x);if(t||!N){h(x);return}n++,(C=e.onFail)==null||C.call(e,n,x),Ise(j).then(()=>d()?void 0:p()).then(()=>{t?h(x):v()})})};return{promise:a,status:()=>a.status,cancel:o,continue:()=>(r==null||r(),a),cancelRetry:l,continueRetry:c,canStart:m,start:()=>(m()?v():p().then(v),a)}}var ku,FL,x9=(FL=class{constructor(){Qe(this,ku)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),A2(this.gcTime)&&et(this,ku,gu.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(im?1/0:5*60*1e3))}clearGcTimeout(){X(this,ku)&&(gu.clearTimeout(X(this,ku)),et(this,ku,void 0))}},ku=new WeakMap,FL),Pu,Vh,Mi,Eu,Vr,Dy,Du,mo,Ml,_L,Vse=(_L=class extends x9{constructor(t){super();Qe(this,mo);Qe(this,Pu);Qe(this,Vh);Qe(this,Mi);Qe(this,Eu);Qe(this,Vr);Qe(this,Dy);Qe(this,Du);et(this,Du,!1),et(this,Dy,t.defaultOptions),this.setOptions(t.options),this.observers=[],et(this,Eu,t.client),et(this,Mi,X(this,Eu).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,et(this,Pu,nM(this.options)),this.state=t.state??X(this,Pu),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=X(this,Vr))==null?void 0:t.promise}setOptions(t){if(this.options={...X(this,Dy),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=nM(this.options);n.data!==void 0&&(this.setState(sM(n.data,n.dataUpdatedAt)),et(this,Pu,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&X(this,Mi).remove(this)}setData(t,n){const r=O2(this.state.data,t,this.options);return ct(this,mo,Ml).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ct(this,mo,Ml).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,a;const n=(r=X(this,Vr))==null?void 0:r.promise;return(a=X(this,Vr))==null||a.cancel(t),n?n.then(Oa).catch(Oa):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(X(this,Pu))}isActive(){return this.observers.some(t=>Ii(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===XA||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>wd(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:!u9(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=X(this,Vr))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=X(this,Vr))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),X(this,Mi).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(X(this,Vr)&&(X(this,Du)?X(this,Vr).cancel({revert:!0}):X(this,Vr).cancelRetry()),this.scheduleGc()),X(this,Mi).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ct(this,mo,Ml).call(this,{type:"invalidate"})}async fetch(t,n){var c,d,m,u,h,p,v,y,g,x,b,w;if(this.state.fetchStatus!=="idle"&&((c=X(this,Vr))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(X(this,Vr))return X(this,Vr).continueRetry(),X(this,Vr).promise}if(t&&this.setOptions(t),!this.options.queryFn){const j=this.observers.find(N=>N.options.queryFn);j&&this.setOptions(j.options)}const r=new AbortController,a=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(et(this,Du,!0),r.signal)}
48)},i=()=>{const j=h9(this.options,n),C=(()=>{const P={client:X(this,Eu),queryKey:this.queryKey,meta:this.meta};return a(P),P})();return et(this,Du,!1),this.options.persister?this.options.persister(j,C,this):j(C)},l=(()=>{const j={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:X(this,Eu),state:this.state,fetchFn:i};return a(j),j})();(d=this.options.behavior)==null||d.onFetch(l,this),et(this,Vh,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((m=l.fetchOptions)==null?void 0:m.meta))&&ct(this,mo,Ml).call(this,{type:"fetch",meta:(u=l.fetchOptions)==null?void 0:u.meta}),et(this,Vr,p9({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:j=>{j instanceof _2&&j.revert&&this.setState({...X(this,Vh),fetchStatus:"idle"}),r.abort()},onFail:(j,N)=>{ct(this,mo,Ml).call(this,{type:"failed",failureCount:j,error:N})},onPause:()=>{ct(this,mo,Ml).call(this,{type:"pause"})},onContinue:()=>{ct(this,mo,Ml).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const j=await X(this,Vr).start();if(j===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(j),(p=(h=X(this,Mi).config).onSuccess)==null||p.call(h,j,this),(y=(v=X(this,Mi).config).onSettled)==null||y.call(v,j,this.state.error,this),j}catch(j){if(j instanceof _2){if(j.silent)return X(this,Vr).promise;if(j.revert){if(this.state.data===void 0)throw j;return this.state.data}}throw ct(this,mo,Ml).call(this,{type:"error",error:j}),(x=(g=X(this,Mi).config).onError)==null||x.call(g,j,this),(w=(b=X(this,Mi).config).onSettled)==null||w.call(b,this.state.data,j,this),j}finally{this.scheduleGc()}}},Pu=new WeakMap,Vh=new WeakMap,Mi=new WeakMap,Eu=new WeakMap,Vr=new WeakMap,Dy=new WeakMap,Du=new WeakMap,mo=new WeakSet,Ml=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...g9(r.data,this.options),fetchMeta:t.meta??null};case"success":const a={...r,...sM(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return et(this,Vh,t.manual?a:void 0),a;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Rr.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),X(this,Mi).notify({query:this,type:"updated",action:t})})},_L);function g9(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:f9(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function sM(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function nM(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var qa,hn,Ay,Ea,Au,Kh,Ll,Gc,Ty,Gh,Yh,Tu,Ou,Yc,Qh,En,wx,M2,$2,I2,R2,B2,L2,U2,y9,ML,Kse=(ML=class extends gp{constructor(t,n){super();Qe(this,En);Qe(this,qa);Qe(this,hn);Qe(this,Ay);Qe(this,Ea);Qe(this,Au);Qe(this,Kh);Qe(this,Ll);Qe(this,Gc);Qe(this,Ty);Qe(this,Gh);Qe(this,Yh);Qe(this,Tu);Qe(this,Ou);Qe(this,Yc);Qe(this,Qh,new Set);this.options=n,et(this,qa,t),et(this,Gc,null),et(this,Ll,F2()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(X(this,hn).addObserver(this),rM(X(this,hn),this.options)?ct(this,En,wx).call(this):this.updateResult(),ct(this,En,R2).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return z2(X(this,hn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return z2(X(this,hn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ct(this,En,B2).call(this),ct(this,En,L2).call(this),X(this,hn).removeObserver(this)}setOptions(t){const n=this.options,r=X(this,hn);if(this.options=X(this,qa).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ii(this.options.enabled,X(this,hn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ct(this,En,U2).call(this),X(this,hn).setOptions(this.options),n._defaulted&&!cw(this.options,n)&&X(this,qa).getQueryCache().notify({type:"observerOptionsUpdated",query:X(this,hn),observer:this});const a=this.hasListeners();a&&aM(X(this,hn),r,this.options,n)&&ct(this,En,wx).call(this),this.updateResult(),a&&(X(this,hn)!==r||Ii(this.options.enabled,X(this,hn))!==Ii(n.enabled,X(this,hn))||wd(this.options.staleTime,X(this,hn))!==wd(n.staleTime,X(this,hn)))&&ct(this,En,M2).call(this);const i=ct(this,En,$2).call(this);a&&(X(this,hn)!==r||Ii(this.options.enabled,X(this,hn))!==Ii(n.enabled,X(this,hn))||i!==X(this,Yc))&&ct(this,En,I2).call(this,i)}getOptimisticResult(t){const n=X(this,qa).getQueryCache().build(X(this,qa),t),r=this.createResult(n,t);return Yse(this,r)&&(et(this,Ea,r),et(this,Kh,this.options),et(this,Au,X(this,hn).state)),r}getCurrentResult(){return X(this,Ea)}trackResult(t,n){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),n==null||n(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&X(this,Ll).status==="pending"&&X(this,Ll).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,a))})}trackProp(t){X(this,Qh).add(t)}getCurrentQuery(){return X(this,hn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=X(this,qa).defaultQueryOptions(t),r=X(this,qa).getQueryCache().build(X(this,qa),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ct(this,En,wx).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),X(this,Ea)))}createResult(t,n){var E;const r=X(this,hn),a=this.options,i=X(this,Ea),o=X(this,Au),l=X(this,Kh),d=t!==r?t.state:X(this,Ay),{state:m}=t;let u={...m},h=!1,p;
vendor: 4,212 bytes, line 48
48if(n._optimisticResults){const T=this.hasListeners(),z=!T&&rM(t,n),O=T&&aM(t,r,n,a);(z||O)&&(u={...u,...g9(m.data,t.options)}),n._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:v,errorUpdatedAt:y,status:g}=u;p=u.data;let x=!1;if(n.placeholderData!==void 0&&p===void 0&&g==="pending"){let T;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(T=i.data,x=!0):T=typeof n.placeholderData=="function"?n.placeholderData((E=X(this,Yh))==null?void 0:E.state.data,X(this,Yh)):n.placeholderData,T!==void 0&&(g="success",p=O2(i==null?void 0:i.data,T,n),h=!0)}if(n.select&&p!==void 0&&!x)if(i&&p===(o==null?void 0:o.data)&&n.select===X(this,Ty))p=X(this,Gh);else try{et(this,Ty,n.select),p=n.select(p),p=O2(i==null?void 0:i.data,p,n),et(this,Gh,p),et(this,Gc,null)}catch(T){et(this,Gc,T)}X(this,Gc)&&(v=X(this,Gc),p=X(this,Gh),y=Date.now(),g="error");const b=u.fetchStatus==="fetching",w=g==="pending",j=g==="error",N=w&&b,C=p!==void 0,S={status:g,fetchStatus:u.fetchStatus,isPending:w,isSuccess:g==="success",isError:j,isInitialLoading:N,isLoading:N,data:p,dataUpdatedAt:u.dataUpdatedAt,error:v,errorUpdatedAt:y,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>d.dataUpdateCount||u.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!w,isLoadingError:j&&!C,isPaused:u.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:j&&C,isStale:tT(t,n),refetch:this.refetch,promise:X(this,Ll),isEnabled:Ii(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const T=D=>{S.status==="error"?D.reject(S.error):S.data!==void 0&&D.resolve(S.data)},z=()=>{const D=et(this,Ll,S.promise=F2());T(D)},O=X(this,Ll);switch(O.status){case"pending":t.queryHash===r.queryHash&&T(O);break;case"fulfilled":(S.status==="error"||S.data!==O.value)&&z();break;case"rejected":(S.status!=="error"||S.error!==O.reason)&&z();break}}return S}updateResult(){const t=X(this,Ea),n=this.createResult(X(this,hn),this.options);if(et(this,Au,X(this,hn).state),et(this,Kh,this.options),X(this,Au).data!==void 0&&et(this,Yh,X(this,hn)),cw(n,t))return;et(this,Ea,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!X(this,Qh).size)return!0;const o=new Set(i??X(this,Qh));return this.options.throwOnError&&o.add("error"),Object.keys(X(this,Ea)).some(l=>{const c=l;return X(this,Ea)[c]!==t[c]&&o.has(c)})};ct(this,En,y9).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ct(this,En,R2).call(this)}},qa=new WeakMap,hn=new WeakMap,Ay=new WeakMap,Ea=new WeakMap,Au=new WeakMap,Kh=new WeakMap,Ll=new WeakMap,Gc=new WeakMap,Ty=new WeakMap,Gh=new WeakMap,Yh=new WeakMap,Tu=new WeakMap,Ou=new WeakMap,Yc=new WeakMap,Qh=new WeakMap,En=new WeakSet,wx=function(t){ct(this,En,U2).call(this);let n=X(this,hn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Oa)),n},M2=function(){ct(this,En,B2).call(this);const t=wd(this.options.staleTime,X(this,hn));if(im||X(this,Ea).isStale||!A2(t))return;const r=u9(X(this,Ea).dataUpdatedAt,t)+1;et(this,Tu,gu.setTimeout(()=>{X(this,Ea).isStale||this.updateResult()},r))},$2=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(X(this,hn)):this.options.refetchInterval)??!1},I2=function(t){ct(this,En,L2).call(this),et(this,Yc,t),!(im||Ii(this.options.enabled,X(this,hn))===!1||!A2(X(this,Yc))||X(this,Yc)===0)&&et(this,Ou,gu.setInterval(()=>{(this.options.refetchIntervalInBackground||eT.isFocused())&&ct(this,En,wx).call(this)},X(this,Yc)))},R2=function(){ct(this,En,M2).call(this),ct(this,En,I2).call(this,ct(this,En,$2).call(this))},B2=function(){X(this,Tu)&&(gu.clearTimeout(X(this,Tu)),et(this,Tu,void 0))},L2=function(){X(this,Ou)&&(gu.clearInterval(X(this,Ou)),et(this,Ou,void 0))},U2=function(){const t=X(this,qa).getQueryCache().build(X(this,qa),this.options);if(t===X(this,hn))return;const n=X(this,hn);et(this,hn,t),et(this,Ay,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},y9=function(t){Rr.batch(()=>
vendor: 4,976 bytes, line 48
48{t.listeners&&this.listeners.forEach(n=>{n(X(this,Ea))}),X(this,qa).getQueryCache().notify({query:X(this,hn),type:"observerResultsUpdated"})})},ML);function Gse(e,t){return Ii(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function rM(e,t){return Gse(e,t)||e.state.data!==void 0&&z2(e,t,t.refetchOnMount)}function z2(e,t,n){if(Ii(t.enabled,e)!==!1&&wd(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&tT(e,t)}return!1}function aM(e,t,n,r){return(e!==t||Ii(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&tT(e,n)}function tT(e,t){return Ii(t.enabled,e)!==!1&&e.isStaleByTime(wd(t.staleTime,e))}function Yse(e,t){return!cw(e.getCurrentResult(),t)}function iM(e){return{onFetch:(t,n)=>{var m,u,h,p,v;const r=t.options,a=(h=(u=(m=t.fetchOptions)==null?void 0:m.meta)==null?void 0:u.fetchMore)==null?void 0:h.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],o=((v=t.state.data)==null?void 0:v.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let y=!1;const g=w=>{Lse(w,()=>t.signal,()=>y=!0)},x=h9(t.options,t.fetchOptions),b=async(w,j,N)=>{if(y)return Promise.reject();if(j==null&&w.pages.length)return Promise.resolve(w);const P=(()=>{const z={client:t.client,queryKey:t.queryKey,pageParam:j,direction:N?"backward":"forward",meta:t.options.meta};return g(z),z})(),S=await x(P),{maxPages:E}=t.options,T=N?Bse:Rse;return{pages:T(w.pages,S,E),pageParams:T(w.pageParams,j,E)}};if(a&&i.length){const w=a==="backward",j=w?Qse:oM,N={pages:i,pageParams:o},C=j(r,N);l=await b(N,C,w)}else{const w=e??i.length;do{const j=c===0?o[0]??r.initialPageParam:oM(r,l);if(c>0&&j==null)break;l=await b(l,j),c++}while(c<w)}return l};t.options.persister?t.fetchFn=()=>{var y,g;return(g=(y=t.options).persister)==null?void 0:g.call(y,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function oM(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Qse(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Oy,nl,Da,Fu,rl,Oc,$L,Jse=($L=class extends x9{constructor(t){super();Qe(this,rl);Qe(this,Oy);Qe(this,nl);Qe(this,Da);Qe(this,Fu);et(this,Oy,t.client),this.mutationId=t.mutationId,et(this,Da,t.mutationCache),et(this,nl,[]),this.state=t.state||v9(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){X(this,nl).includes(t)||(X(this,nl).push(t),this.clearGcTimeout(),X(this,Da).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){et(this,nl,X(this,nl).filter(n=>n!==t)),this.scheduleGc(),X(this,Da).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){X(this,nl).length||(this.state.status==="pending"?this.scheduleGc():X(this,Da).remove(this))}continue(){var t;return((t=X(this,Fu))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,c,d,m,u,h,p,v,y,g,x,b,w,j,N,C,P,S,E;const n=()=>{ct(this,rl,Oc).call(this,{type:"continue"})},r={client:X(this,Oy),meta:this.options.meta,mutationKey:this.options.mutationKey};et(this,Fu,p9({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(T,z)=>{ct(this,rl,Oc).call(this,{type:"failed",failureCount:T,error:z})},onPause:()=>{ct(this,rl,Oc).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>X(this,Da).canRun(this)}));const a=this.state.status==="pending",i=!X(this,Fu).canStart();try{if(a)n();else{ct(this,rl,Oc).call(this,{type:"pending",variables:t,isPaused:i}),await((l=(o=X(this,Da).config).onMutate)==null?void 0:l.call(o,t,this,r));const z=await((d=(c=this.options).onMutate)==null?void 0:d.call(c,t,r));z!==this.state.context&&ct(this,rl,Oc).call(this,{type:"pending",context:z,variables:t,isPaused:i})}const T=await X(this,Fu).start();return await((u=(m=X(this,Da).config).onSuccess)==null?void 0:u.call(m,T,t,this.state.context,this,r)),await((p=(h=this.options).onSuccess)==null?void 0:p.call(h,T,t,this.state.context,r)),await((y=(v=X(this,Da).config).onSettled)==null?void 0:y.call(v,T,null,this.state.variables,this.state.context,this,r)),await((x=(g=this.options).onSettled)==null?void 0:x.call(g,T,null,t,this.state.context,r)),ct(this,rl,Oc).call(this,{type:"success",data:T}),T}catch(T){try{await((w=(b=X(this,Da).config).onError)==null?void 0:w.call(b,T,t,this.state.context,this,r))}catch(z){Promise.reject(z)}try{await((N=(j=this.options).onError)==null?void 0:N.call(j,T,t,this.state.context,r))}catch(z){Promise.reject(z)}try{await((P=(C=X(this,Da).config).onSettled)==null?void 0:P.call(C,void 0,T,this.state.variables,this.state.context,this,r))}catch(z){Promise.reject(z)}
48try{await((E=(S=this.options).onSettled)==null?void 0:E.call(S,void 0,T,t,this.state.context,r))}catch(z){Promise.reject(z)}throw ct(this,rl,Oc).call(this,{type:"error",error:T}),T}finally{X(this,Da).runNext(this)}}},Oy=new WeakMap,nl=new WeakMap,Da=new WeakMap,Fu=new WeakMap,rl=new WeakSet,Oc=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Rr.batch(()=>{X(this,nl).forEach(r=>{r.onMutationUpdate(t)}),X(this,Da).notify({mutation:this,type:"updated",action:t})})},$L);function v9(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ul,ho,Fy,IL,Xse=(IL=class extends gp{constructor(t={}){super();Qe(this,Ul);Qe(this,ho);Qe(this,Fy);this.config=t,et(this,Ul,new Set),et(this,ho,new Map),et(this,Fy,0)}build(t,n,r){const a=new Jse({client:t,mutationCache:this,mutationId:++qv(this,Fy)._,options:t.defaultMutationOptions(n),state:r});return this.add(a),a}add(t){X(this,Ul).add(t);const n=o0(t);if(typeof n=="string"){const r=X(this,ho).get(n);r?r.push(t):X(this,ho).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(X(this,Ul).delete(t)){const n=o0(t);if(typeof n=="string"){const r=X(this,ho).get(n);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&X(this,ho).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=o0(t);if(typeof n=="string"){const r=X(this,ho).get(n),a=r==null?void 0:r.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const n=o0(t);if(typeof n=="string"){const a=(r=X(this,ho).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Rr.batch(()=>{X(this,Ul).forEach(t=>{this.notify({type:"removed",mutation:t})}),X(this,Ul).clear(),X(this,ho).clear()})}getAll(){return Array.from(X(this,Ul))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Z_(n,r))}findAll(t={}){return this.getAll().filter(n=>Z_(t,n))}notify(t){Rr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Rr.batch(()=>Promise.all(t.map(n=>n.continue().catch(Oa))))}},Ul=new WeakMap,ho=new WeakMap,Fy=new WeakMap,IL);function o0(e){var t;return(t=e.options.scope)==null?void 0:t.id}var zl,Qc,Wa,ql,ic,bb,q2,RL,Zse=(RL=class extends gp{constructor(n,r){super();Qe(this,ic);Qe(this,zl);Qe(this,Qc);Qe(this,Wa);Qe(this,ql);et(this,zl,n),this.setOptions(r),this.bindMethods(),ct(this,ic,bb).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var a;const r=this.options;this.options=X(this,zl).defaultMutationOptions(n),cw(this.options,r)||X(this,zl).getMutationCache().notify({type:"observerOptionsUpdated",mutation:X(this,Wa),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&om(r.mutationKey)!==om(this.options.mutationKey)?this.reset():((a=X(this,Wa))==null?void 0:a.state.status)==="pending"&&X(this,Wa).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=X(this,Wa))==null||n.removeObserver(this)}onMutationUpdate(n){ct(this,ic,bb).call(this),ct(this,ic,q2).call(this,n)}getCurrentResult(){return X(this,Qc)}reset(){var n;(n=X(this,Wa))==null||n.removeObserver(this),et(this,Wa,void 0),ct(this,ic,bb).call(this),ct(this,ic,q2).call(this)}mutate(n,r){var a;return et(this,ql,r),(a=X(this,Wa))==null||a.removeObserver(this),et(this,Wa,X(this,zl).getMutationCache().build(X(this,zl),this.options)),X(this,Wa).addObserver(this),X(this,Wa).execute(n)}},zl=new WeakMap,Qc=new WeakMap,Wa=new WeakMap,ql=new WeakMap,ic=new WeakSet,bb=function(){var r;const n=((r=X(this,Wa))==null?void 0:r.state)??v9();et(this,Qc,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},q2=function(n){Rr.batch(()=>{var r,a,i,o,l,c,d,m;if(X(this,ql)&&this.hasListeners()){const u=X(this,Qc).variables,h=X(this,Qc).context,p={client:X(this,zl),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(a=(r=X(this,ql)).onSuccess)==null||a.call(r,n.data,u,h,p)}catch(v){Promise.reject(v)}try{(o=(i=X(this,ql)).onSettled)==null||o.call(i,n.data,null,u,h,p)}catch(v){Promise.reject(v)}}else if((n==null?void 0:n.type)==="error"){try{(c=(l=X(this,ql)).onError)==null||c.call(l,n.error,u,h,p)}catch(v){Promise.reject(v)}try{(m=(d=X(this,ql)).onSettled)==null||m.call(d,void 0,n.error,u,h,p)}catch(v){Promise.reject(v)}}}
vendor: 6,206 bytes, line 48
48this.listeners.forEach(u=>{u(X(this,Qc))})})},RL),al,BL,ene=(BL=class extends gp{constructor(t={}){super();Qe(this,al);this.config=t,et(this,al,new Map)}build(t,n,r){const a=n.queryKey,i=n.queryHash??JA(a,n);let o=this.get(i);return o||(o=new Vse({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(o)),o}add(t){X(this,al).has(t.queryHash)||(X(this,al).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=X(this,al).get(t.queryHash);n&&(t.destroy(),n===t&&X(this,al).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Rr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return X(this,al).get(t)}getAll(){return[...X(this,al).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>X_(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>X_(t,r)):n}notify(t){Rr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Rr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Rr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},al=new WeakMap,BL),mr,Jc,Xc,Jh,Xh,Zc,Zh,ef,LL,tne=(LL=class{constructor(e={}){Qe(this,mr);Qe(this,Jc);Qe(this,Xc);Qe(this,Jh);Qe(this,Xh);Qe(this,Zc);Qe(this,Zh);Qe(this,ef);et(this,mr,e.queryCache||new ene),et(this,Jc,e.mutationCache||new Xse),et(this,Xc,e.defaultOptions||{}),et(this,Jh,new Map),et(this,Xh,new Map),et(this,Zc,0)}mount(){qv(this,Zc)._++,X(this,Zc)===1&&(et(this,Zh,eT.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,mr).onFocus())})),et(this,ef,dw.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,mr).onOnline())})))}unmount(){var e,t;qv(this,Zc)._--,X(this,Zc)===0&&((e=X(this,Zh))==null||e.call(this),et(this,Zh,void 0),(t=X(this,ef))==null||t.call(this),et(this,ef,void 0))}isFetching(e){return X(this,mr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return X(this,Jc).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=X(this,mr).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=X(this,mr).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(wd(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return X(this,mr).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=X(this,mr).get(r.queryHash),i=a==null?void 0:a.state.data,o=Mse(t,i);if(o!==void 0)return X(this,mr).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Rr.batch(()=>X(this,mr).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=X(this,mr).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=X(this,mr);Rr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=X(this,mr);return Rr.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Rr.batch(()=>X(this,mr).findAll(e).map(a=>a.cancel(n)));return Promise.all(r).then(Oa).catch(Oa)}invalidateQueries(e,t={}){return Rr.batch(()=>(X(this,mr).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Rr.batch(()=>X(this,mr).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,n);return n.throwOnError||(i=i.catch(Oa)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Oa)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=X(this,mr).build(this,t);return n.isStaleByTime(wd(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Oa).catch(Oa)}fetchInfiniteQuery(e){return e.behavior=iM(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Oa).catch(Oa)}ensureInfiniteQueryData(e){return e.behavior=iM(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return dw.isOnline()?X(this,Jc).resumePausedMutations():Promise.resolve()}getQueryCache(){return X(this,mr)}getMutationCache(){return X(this,Jc)}getDefaultOptions(){return X(this,Xc)}setDefaultOptions(e){et(this,Xc,e)}setQueryDefaults(e,t){X(this,Jh).set(om(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...X(this,Jh).values()],n={};return t.forEach(r=>{wg(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){X(this,Xh).set(om(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...X(this,Xh).values()],n={};return t.forEach(r=>{wg(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...X(this,Xc).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=JA(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===XA&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...X(this,Xc).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){X(this,mr).clear(),X(this,Jc).clear()}},mr=new WeakMap,Jc=new WeakMap,Xc=new WeakMap,Jh=new WeakMap,Xh=new WeakMap,Zc=new WeakMap,Zh=new WeakMap,ef=new WeakMap,LL),b9=f.createContext(void 0),jn=e=>{const t=f.useContext(b9);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},sne=({client:e,children:t})=>(f.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(b9.Provider,{value:e,children:t})),w9=f.createContext(!1),nne=()=>f.useContext(w9);w9.Provider;function rne(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}
48var ane=f.createContext(rne()),ine=()=>f.useContext(ane),one=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?ZA(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},lne=e=>{f.useEffect(()=>{e.clearReset()},[e])},cne=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||ZA(n,[e.error,r])),dne=e=>{if(e.suspense){const n=a=>a==="static"?a:Math.max(a??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...a)=>n(r(...a)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},une=(e,t)=>e.isLoading&&e.isFetching&&!t,mne=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,lM=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function hne(e,t,n){var h,p,v,y;const r=nne(),a=ine(),i=jn(),o=i.defaultQueryOptions(e);(p=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||p.call(h,o);const l=i.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",dne(o),one(o,a,l),lne(a);const c=!i.getQueryCache().get(o.queryHash),[d]=f.useState(()=>new t(i,o)),m=d.getOptimisticResult(o),u=!r&&e.subscribed!==!1;if(f.useSyncExternalStore(f.useCallback(g=>{const x=u?d.subscribe(Rr.batchCalls(g)):Oa;return d.updateResult(),x},[d,u]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),f.useEffect(()=>{d.setOptions(o)},[o,d]),mne(o,m))throw lM(o,d,a);if(cne({result:m,errorResetBoundary:a,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw m.error;if((y=(v=i.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||y.call(v,o,m),o.experimental_prefetchInRender&&!im&&une(m,r)){const g=c?lM(o,d,a):l==null?void 0:l.promise;g==null||g.catch(Oa).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?m:d.trackResult(m)}function Ue(e,t){return hne(e,Kse)}function xt(e,t){const n=jn(),[r]=f.useState(()=>new Zse(n,e));f.useEffect(()=>{r.setOptions(e)},[r,e]);const a=f.useSyncExternalStore(f.useCallback(o=>r.subscribe(Rr.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=f.useCallback((o,l)=>{r.mutate(o,l).catch(Oa)},[r]);if(a.error&&ZA(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:i,mutateAsync:a.mutate}}async function j9(e){if(!e.ok){const t=e.clone();try{const n=await e.json(),r=new Error(n.message||e.statusText);throw r.status=e.status,r.error=n.error,r}catch(n){if((n==null?void 0:n.status)!=null)throw n;const r=await t.text()||e.statusText;throw new Error(`${e.status}: ${r}`)}}}function fne(e){if((e==null?void 0:e.name)==="TypeError"&&(e!=null&&e.message)){const t=e.message.toLowerCase();return t.includes("fetch")||t.includes("network")||t.includes("failed to fetch")||t.includes("networkerror")||t.includes("timeout")}return(e==null?void 0:e.status)>=500&&(e==null?void 0:e.status)<600||(e==null?void 0:e.status)===408||(e==null?void 0:e.status)===429}async function Pe(e,t,n,r){var h,p,v,y;const a=t.includes("/api/confirm-booking")?2:0,i=1e3,o={};n&&(o["Content-Type"]="application/json");const l=JSON.parse(localStorage.getItem("instructorSession")||"{}"),c=JSON.parse(localStorage.getItem("admin_session")||"{}"),d=l.token||((h=c.instructor)==null?void 0:h.token)||localStorage.getItem("auth_token");(t.includes("/api/admin/")||t.includes("/api/stripe-connect/")||t.includes("/api/objects/")||t.includes("/api/instructor/logo")||t.includes("/api/zoom/"))&&(console.log(`🔑 Request to ${t} - Token found:`,d?"YES":"NO"),console.log("🔑 instructorSession:",l),console.log("🔑 adminSession:",c),console.log("🔑 localStorage auth_token:",localStorage.getItem("auth_token")),console.log("🔑 Final token being used:",d));const m=t.includes("/api/client/")&&!t.includes("/api/client/validate-token")&&!t.includes("/api/client/magic-link")&&!t.includes("/api/client/login")&&!t.includes("/api/client/verify-magic");if(m){let g=null;if(n&&typeof n=="object"&&"instructorId"in n&&(g=String(n.instructorId)),!g){const b=localStorage.getItem("currentInstructor");if(b)try{g=(p=JSON.parse(b).id)==null?void 0:p.toString()}catch{}}if(!g){const b=window.location.pathname.match(/\/my-account\/([^/]+)/);b&&(g=b[1])}let x=null;if(g&&(x=localStorage.getItem(`client_token_${g}`),!x))try{const b=localStorage.getItem(`member_token_${g}`),w=b?JSON.parse(b):null;x=(w==null?void 0:w.token)??null}catch{}if(x)o.Authorization=`Bearer ${x}`;else for(let b=0;b<localStorage.length;b++){const w=localStorage.key(b);if(w&&w.startsWith("client_token_")){const j=localStorage.getItem(w);if(j){o.Authorization=`Bearer ${j}`;break}}}}if(!m&&t.includes("/api/bookings/")&&t.includes("/cancel")){let g=null;const x=localStorage.getItem("currentInstructor");if(x)try{g=(v=JSON.parse(x).id)==null?void 0:v.toString()}catch{console.log("🔑 Failed to parse instructor data")}if(!g){const w=window.location.pathname.match(/\/my-account\/(\d+)/);w&&(g=w[1])}if(g){const b=localStorage.getItem(`client_token_${g}`);b&&(o.Authorization=`Bearer ${b}`,console.log("🔑 Client authorization header added for booking cancellation"))}else for(let b=0;b<localStorage.length;b++){const w=localStorage.key(b);if(w&&w.startsWith("client_token_")){const j=localStorage.getItem(w);if(j){o.Authorization=`Bearer ${j}`,console.log("🔑 Client authorization header added for booking cancellation (found token)");break}}}}else d&&(t.includes("/api/admin/")||t.includes("/api/classes")||t.includes("/api/bookings")||t.includes("/api/clients")||t.includes("/api/achievements")||t.includes("/api/coupons")||t.includes("/api/stats")||t.includes("/api/onboarding-forms")||t.includes("/api/instructors")||t.includes("/api/instructor/")||t.includes("/api/packages")||t.includes("/api/private-links")||t.includes("/api/memberships")||t.includes("/api/member-subscriptions")||t.includes("/api/stripe-connect/")||t.includes("/api/gocardless")||t.includes("/api/polish-text")||t.includes("/api/ai-generate-form")||t.includes("/api/ai-generate-class")||t.includes("/api/objects/")||t.includes("/api/instructor/logo")||t.includes("/api/calendar/")||t.includes("/api/test-push-notification")||t.includes("/api/test-email")||t.includes("/api/zoom/")||t.includes("/api/events")||t.includes("/api/services/admin/")||t.includes("/api/services")&&(t.endsWith("/api/services")||t.includes("/api/services/")))&&(o.Authorization=`Bearer ${d}`,t.includes("/api/admin/classes")&&console.log("🔑 Authorization header added for admin classes"),t.includes("/api/admin/manual-bookings")&&console.log("🔑 Authorization header added for manual booking"),t.includes("/api/services")&&console.log("🔑 Authorization header added for services API"));if(t.includes("/api/member/")){let g;const x=t.match(/\/api\/member\/(\d+)\//);if(x)g=x[1];
48else if(window.location.pathname.match(/^\/([^\/]+)\/member-area/)){const j=localStorage.getItem("currentInstructor");if(j)try{g=(y=JSON.parse(j).id)==null?void 0:y.toString()}catch{console.log("🔑 Failed to parse instructor data")}}if(g){const b=localStorage.getItem(`member_token_${g}`);if(b)try{const w=JSON.parse(b),j=new Date().getTime();w.expires&&j<w.expires&&w.token&&(o.Authorization=`Bearer ${w.token}`,console.log("🔑 Member authorization header added for:",t))}catch{console.log("🔑 Failed to parse member token data")}}}let u;for(let g=0;g<=a;g++)try{const x=await fetch(t,{method:e,headers:o,body:n?JSON.stringify(n):void 0,credentials:"include"});return await j9(x),x}catch(x){if(u=x,!fne(x)||g>=a)throw x;const b=i*Math.pow(2,g);console.log(`🔄 Network error on attempt ${g+1}/${a+1}, retrying in ${b}ms...`,x.message),await new Promise(w=>setTimeout(w,b))}throw u}const pne=({on401:e})=>async({queryKey:t})=>{const n=t[0],r={},a=JSON.parse(localStorage.getItem("instructorSession")||"{}"),i=a.token||localStorage.getItem("auth_token");n.includes("/api/memberships")&&(console.log("🔑 Memberships query - Token found:",i?"YES":"NO"),console.log("🔑 instructorSession:",a),console.log("🔑 localStorage auth_token:",localStorage.getItem("auth_token"))),i&&(n.includes("/api/admin/")||n.includes("/api/classes")||n.includes("/api/bookings")||n.includes("/api/clients")||n.includes("/api/achievements")||n.includes("/api/coupons")||n.includes("/api/stats")||n.includes("/api/onboarding-forms")||n.includes("/api/instructors")||n.includes("/api/instructor/")||n.includes("/api/memberships")||n.includes("/api/gocardless")||n.includes("/api/zoom/")||n.includes("/api/services/admin/")||n.includes("/api/services")&&(n.endsWith("/api/services")||n.includes("/api/services/")))&&(r.Authorization=`Bearer ${i}`);const o=await fetch(n,{headers:r,credentials:"include"});return await j9(o),await o.json()},Ms=new tne({defaultOptions:{queries:{queryFn:pne({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!1,staleTime:0,retry:!1},mutations:{retry:!1}}}),xne=1,gne=1e6;let JC=0;function yne(){return JC=(JC+1)%Number.MAX_SAFE_INTEGER,JC.toString()}const XC=new Map,cM=e=>{if(XC.has(e))return;const t=setTimeout(()=>{XC.delete(e),Lx({type:"REMOVE_TOAST",toastId:e})},gne);XC.set(e,t)},vne=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,xne)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?cM(n):e.toasts.forEach(r=>{cM(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},wb=[];let jb={toasts:[]};function Lx(e){jb=vne(jb,e),wb.forEach(t=>{t(jb)})}function bne({...e}){const t=yne(),n=a=>Lx({type:"UPDATE_TOAST",toast:{...a,id:t}}),r=()=>Lx({type:"DISMISS_TOAST",toastId:t});return Lx({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||r()}}}),{id:t,dismiss:r,update:n}}function Yt(){const[e,t]=f.useState(jb);return f.useEffect(()=>(wb.push(t),()=>{const n=wb.indexOf(t);n>-1&&wb.splice(n,1)}),[e]),{...e,toast:bne,dismiss:n=>Lx({type:"DISMISS_TOAST",toastId:n})}}function At(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function dM(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Pl(...e){return t=>{let n=!1;const r=e.map(a=>{const i=dM(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<r.length;a++){const i=r[a];typeof i=="function"?i():dM(e[a],null)}}}}function Us(...e){return f.useCallback(Pl(...e),e)}function wne(e,t){const n=f.createContext(t),r=i=>{const{children:o,...l}=i,c=f.useMemo(()=>l,Object.values(l));return s.jsx(n.Provider,{value:c,children:o})};r.displayName=e+"Provider";function a(i){const o=f.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,a]}function ua(e,t=[]){let n=[];function r(i,o){const l=f.createContext(o),c=n.length;n=[...n,o];const d=u=>{var x;const{scope:h,children:p,...v}=u,y=((x=h==null?void 0:h[e])==null?void 0:x[c])||l,g=f.useMemo(()=>v,Object.values(v));return s.jsx(y.Provider,{value:g,children:p})};d.displayName=i+"Provider";function m(u,h){var y;const p=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=f.useContext(p);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${i}\``)}return[d,m]}const a=()=>{const i=n.map(o=>f.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return f.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[r,jne(a,...t)]}function jne(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));
vendor: 12,953 bytes, line 48
48return function(i){const o=r.reduce((l,{useScope:c,scopeName:d})=>{const u=c(i)[`__scope${d}`];return{...l,...u}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function uM(e){const t=Nne(e),n=f.forwardRef((r,a)=>{const{children:i,...o}=r,l=f.Children.toArray(i),c=l.find(Sne);if(c){const d=c.props.children,m=l.map(u=>u===c?f.Children.count(d)>1?f.Children.only(null):f.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...o,ref:a,children:f.isValidElement(d)?f.cloneElement(d,void 0,m):null})}return s.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function Nne(e){const t=f.forwardRef((n,r)=>{const{children:a,...i}=n;if(f.isValidElement(a)){const o=Pne(a),l=kne(i,a.props);return a.type!==f.Fragment&&(l.ref=r?Pl(r,o):o),f.cloneElement(a,l)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Cne=Symbol("radix.slottable");function Sne(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Cne}function kne(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function Pne(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function DN(e){const t=e+"CollectionProvider",[n,r]=ua(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:g,children:x}=y,b=he.useRef(null),w=he.useRef(new Map).current;return s.jsx(a,{scope:g,itemMap:w,collectionRef:b,children:x})};o.displayName=t;const l=e+"CollectionSlot",c=uM(l),d=he.forwardRef((y,g)=>{const{scope:x,children:b}=y,w=i(l,x),j=Us(g,w.collectionRef);return s.jsx(c,{ref:j,children:b})});d.displayName=l;const m=e+"CollectionItemSlot",u="data-radix-collection-item",h=uM(m),p=he.forwardRef((y,g)=>{const{scope:x,children:b,...w}=y,j=he.useRef(null),N=Us(g,j),C=i(m,x);return he.useEffect(()=>(C.itemMap.set(j,{ref:j,...w}),()=>void C.itemMap.delete(j))),s.jsx(h,{[u]:"",ref:N,children:b})});p.displayName=m;function v(y){const g=i(e+"CollectionConsumer",y);return he.useCallback(()=>{const b=g.collectionRef.current;if(!b)return[];const w=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(g.itemMap.values()).sort((C,P)=>w.indexOf(C.ref.current)-w.indexOf(P.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:d,ItemSlot:p},v,r]}function Ene(e){const t=Dne(e),n=f.forwardRef((r,a)=>{const{children:i,...o}=r,l=f.Children.toArray(i),c=l.find(Tne);if(c){const d=c.props.children,m=l.map(u=>u===c?f.Children.count(d)>1?f.Children.only(null):f.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...o,ref:a,children:f.isValidElement(d)?f.cloneElement(d,void 0,m):null})}return s.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function Dne(e){const t=f.forwardRef((n,r)=>{const{children:a,...i}=n;if(f.isValidElement(a)){const o=Fne(a),l=One(i,a.props);return a.type!==f.Fragment&&(l.ref=r?Pl(r,o):o),f.cloneElement(a,l)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ane=Symbol("radix.slottable");function Tne(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ane}function One(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function Fne(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _ne=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ms=_ne.reduce((e,t)=>{const n=Ene(`Primitive.${t}`),r=f.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function sT(e,t){e&&Id.flushSync(()=>e.dispatchEvent(t))}function Za(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Mne(e,t=globalThis==null?void 0:globalThis.document){const n=Za(e);f.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var $ne="DismissableLayer",W2="dismissableLayer.update",Ine="dismissableLayer.pointerDownOutside",Rne="dismissableLayer.focusOutside",mM,N9=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Pm=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,d=f.useContext(N9),[m,u]=f.useState(null),h=(m==null?void 0:m.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=f.useState({}),v=Us(t,P=>u(P)),y=Array.from(d.layers),[g]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),x=y.indexOf(g),b=m?y.indexOf(m):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,j=b>=x,N=Lne(P=>{const S=P.target,E=[...d.branches].some(T=>T.contains(S));!j||E||(a==null||a(P),o==null||o(P),P.defaultPrevented||l==null||l())},h),C=Une(P=>{const S=P.target;[...d.branches].some(T=>T.contains(S))||(i==null||i(P),o==null||o(P),P.defaultPrevented||l==null||l())},h);return Mne(P=>{b===d.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&l&&(P.preventDefault(),l()))},h),f.useEffect(()=>{if(m)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(mM=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),hM(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=mM)}},[m,h,n,d]),f.useEffect(()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),hM())},[m,d]),f.useEffect(()=>{const P=()=>p({});return document.addEventListener(W2,P),()=>document.removeEventListener(W2,P)},[]),s.jsx(ms.div,{...c,ref:v,style:{pointerEvents:w?j?"auto":"none":void 0,...e.style},onFocusCapture:At(e.onFocusCapture,C.onFocusCapture),onBlurCapture:At(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:At(e.onPointerDownCapture,N.onPointerDownCapture)})});Pm.displayName=$ne;var Bne="DismissableLayerBranch",C9=f.forwardRef((e,t)=>{const n=f.useContext(N9),r=f.useRef(null),a=Us(t,r);return f.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(ms.div,{...e,ref:a})});C9.displayName=Bne;function Lne(e,t=globalThis==null?void 0:globalThis.document){const n=Za(e),r=f.useRef(!1),a=f.useRef(()=>{});return f.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){S9(Ine,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Une(e,t=globalThis==null?void 0:globalThis.document){const n=Za(e),r=f.useRef(!1);return f.useEffect(()=>{const a=i=>{i.target&&!r.current&&S9(Rne,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function hM(){const e=new CustomEvent(W2);document.dispatchEvent(e)}function S9(e,t,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?sT(a,i):a.dispatchEvent(i)}var zne=Pm,qne=C9,ea=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},Wne="Portal",yp=f.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[a,i]=f.useState(!1);ea(()=>i(!0),[]);const o=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?ZU.createPortal(s.jsx(ms.div,{...r,ref:t}),o):null});yp.displayName=Wne;function Hne(e,t){return f.useReducer((n,r)=>t[n][r]??n,e)}var Na=e=>{const{present:t,children:n}=e,r=Vne(t),a=typeof n=="function"?n({present:r.isPresent}):f.Children.only(n),i=Us(r.ref,Kne(a));return typeof n=="function"||r.isPresent?f.cloneElement(a,{ref:i}):null};Na.displayName="Presence";function Vne(e){const[t,n]=f.useState(),r=f.useRef(null),a=f.useRef(e),i=f.useRef("none"),o=e?"mounted":"unmounted",[l,c]=Hne(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const d=l0(r.current);i.current=l==="mounted"?d:"none"},[l]),ea(()=>{const d=r.current,m=a.current;if(m!==e){const h=i.current,p=l0(d);e?c("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(m&&h!==p?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),ea(()=>{if(t){let d;const m=t.ownerDocument.defaultView??window,u=p=>{const y=l0(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&y&&(c("ANIMATION_END"),!a.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",d=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=p=>{p.target===t&&(i.current=l0(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{m.clearTimeout(d),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:f.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function l0(e){return(e==null?void 0:e.animationName)||"none"}function Kne(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Gne=mN[" useInsertionEffect ".trim().toString()]||ea;function yi({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,i,o]=Yne({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:a;{const m=f.useRef(e!==void 0);f.useEffect(()=>{const u=m.current;u!==l&&console.warn(`${r} is changing from ${u?"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.`),m.current=l},[l,r])}const d=f.useCallback(m=>{var u;if(l){const h=Qne(m)?m(e):m;h!==e&&((u=o.current)==null||u.call(o,h))}else i(m)},[l,e,i,o]);return[c,d]}function Yne({defaultProp:e,onChange:t}){const[n,r]=f.useState(e),a=f.useRef(n),i=f.useRef(t);return Gne(()=>{i.current=t},[t]),f.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,r,i]}function Qne(e){return typeof e=="function"}var k9=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"}),Jne="VisuallyHidden",AN=f.forwardRef((e,t)=>s.jsx(ms.span,{...e,ref:t,style:{...k9,...e.style}}));AN.displayName=Jne;var Xne=AN,nT="ToastProvider",[rT,Zne,ere]=DN("Toast"),[P9]=ua("Toast",[ere]),[tre,TN]=P9(nT),E9=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:o}=e,[l,c]=f.useState(null),[d,m]=f.useState(0),u=f.useRef(!1),h=f.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${nT}\`. Expected non-empty \`string\`.`),s.jsx(rT.Provider,{scope:t,children:s.jsx(tre,{scope:t,label:n,duration:r,swipeDirection:a,swipeThreshold:i,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:f.useCallback(()=>m(p=>p+1),[]),onToastRemove:f.useCallback(()=>m(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:u,isClosePausedRef:h,children:o})})};E9.displayName=nT;var D9="ToastViewport",sre=["F8"],H2="toast.viewportPause",V2="toast.viewportResume",A9=f.forwardRef((e,t)=>
48{const{__scopeToast:n,hotkey:r=sre,label:a="Notifications ({hotkey})",...i}=e,o=TN(D9,n),l=Zne(n),c=f.useRef(null),d=f.useRef(null),m=f.useRef(null),u=f.useRef(null),h=Us(t,u,o.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=o.toastCount>0;f.useEffect(()=>{const g=x=>{var w;r.length!==0&&r.every(j=>x[j]||x.code===j)&&((w=u.current)==null||w.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]),f.useEffect(()=>{const g=c.current,x=u.current;if(v&&g&&x){const b=()=>{if(!o.isClosePausedRef.current){const C=new CustomEvent(H2);x.dispatchEvent(C),o.isClosePausedRef.current=!0}},w=()=>{if(o.isClosePausedRef.current){const C=new CustomEvent(V2);x.dispatchEvent(C),o.isClosePausedRef.current=!1}},j=C=>{!g.contains(C.relatedTarget)&&w()},N=()=>{g.contains(document.activeElement)||w()};return g.addEventListener("focusin",b),g.addEventListener("focusout",j),g.addEventListener("pointermove",b),g.addEventListener("pointerleave",N),window.addEventListener("blur",b),window.addEventListener("focus",w),()=>{g.removeEventListener("focusin",b),g.removeEventListener("focusout",j),g.removeEventListener("pointermove",b),g.removeEventListener("pointerleave",N),window.removeEventListener("blur",b),window.removeEventListener("focus",w)}}},[v,o.isClosePausedRef]);const y=f.useCallback(({tabbingDirection:g})=>{const b=l().map(w=>{const j=w.ref.current,N=[j,...pre(j)];return g==="forwards"?N:N.reverse()});return(g==="forwards"?b.reverse():b).flat()},[l]);return f.useEffect(()=>{const g=u.current;if(g){const x=b=>{var N,C,P;const w=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!w){const S=document.activeElement,E=b.shiftKey;if(b.target===g&&E){(N=d.current)==null||N.focus();return}const O=y({tabbingDirection:E?"backwards":"forwards"}),D=O.findIndex(k=>k===S);ZC(O.slice(D+1))?b.preventDefault():E?(C=d.current)==null||C.focus():(P=m.current)==null||P.focus()}};return g.addEventListener("keydown",x),()=>g.removeEventListener("keydown",x)}},[l,y]),s.jsxs(qne,{ref:c,role:"region","aria-label":a.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&s.jsx(K2,{ref:d,onFocusFromOutsideViewport:()=>{const g=y({tabbingDirection:"forwards"});ZC(g)}}),s.jsx(rT.Slot,{scope:n,children:s.jsx(ms.ol,{tabIndex:-1,...i,ref:h})}),v&&s.jsx(K2,{ref:m,onFocusFromOutsideViewport:()=>{const g=y({tabbingDirection:"backwards"});ZC(g)}})]})});A9.displayName=D9;var T9="ToastFocusProxy",K2=f.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...a}=e,i=TN(T9,n);return s.jsx(AN,{tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const l=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(l))&&r()}})});K2.displayName=T9;var iv="Toast",nre="toast.swipeStart",rre="toast.swipeMove",are="toast.swipeCancel",ire="toast.swipeEnd",O9=f.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:a,onOpenChange:i,...o}=e,[l,c]=yi({prop:r,defaultProp:a??!0,onChange:i,caller:iv});return s.jsx(Na,{present:n||l,children:s.jsx(cre,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:Za(e.onPause),onResume:Za(e.onResume),onSwipeStart:At(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:At(e.onSwipeMove,d=>{const{x:m,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${u}px`)}),onSwipeCancel:At(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:At(e.onSwipeEnd,d=>{const{x:m,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${u}px`),c(!1)})})})});O9.displayName=iv;var[ore,lre]=P9(iv,{onClose(){}}),cre=f.forwardRef((e,t)=>
48{const{__scopeToast:n,type:r="foreground",duration:a,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:m,onSwipeMove:u,onSwipeCancel:h,onSwipeEnd:p,...v}=e,y=TN(iv,n),[g,x]=f.useState(null),b=Us(t,k=>x(k)),w=f.useRef(null),j=f.useRef(null),N=a||y.duration,C=f.useRef(0),P=f.useRef(N),S=f.useRef(0),{onToastAdd:E,onToastRemove:T}=y,z=Za(()=>{var F;(g==null?void 0:g.contains(document.activeElement))&&((F=y.viewport)==null||F.focus()),o()}),O=f.useCallback(k=>{!k||k===1/0||(window.clearTimeout(S.current),C.current=new Date().getTime(),S.current=window.setTimeout(z,k))},[z]);f.useEffect(()=>{const k=y.viewport;if(k){const F=()=>{O(P.current),d==null||d()},W=()=>{const q=new Date().getTime()-C.current;P.current=P.current-q,window.clearTimeout(S.current),c==null||c()};return k.addEventListener(H2,W),k.addEventListener(V2,F),()=>{k.removeEventListener(H2,W),k.removeEventListener(V2,F)}}},[y.viewport,N,c,d,O]),f.useEffect(()=>{i&&!y.isClosePausedRef.current&&O(N)},[i,N,y.isClosePausedRef,O]),f.useEffect(()=>(E(),()=>T()),[E,T]);const D=f.useMemo(()=>g?B9(g):null,[g]);return y.viewport?s.jsxs(s.Fragment,{children:[D&&s.jsx(dre,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:D}),s.jsx(ore,{scope:n,onClose:z,children:Id.createPortal(s.jsx(rT.ItemSlot,{scope:n,children:s.jsx(zne,{asChild:!0,onEscapeKeyDown:At(l,()=>{y.isFocusedToastEscapeKeyDownRef.current||z(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:s.jsx(ms.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":y.swipeDirection,...v,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:At(e.onKeyDown,k=>{k.key==="Escape"&&(l==null||l(k.nativeEvent),k.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,z()))}),onPointerDown:At(e.onPointerDown,k=>{k.button===0&&(w.current={x:k.clientX,y:k.clientY})}),onPointerMove:At(e.onPointerMove,k=>{if(!w.current)return;const F=k.clientX-w.current.x,W=k.clientY-w.current.y,q=!!j.current,H=["left","right"].includes(y.swipeDirection),_=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,L=H?_(0,F):0,U=H?0:_(0,W),J=k.pointerType==="touch"?10:2,I={x:L,y:U},re={originalEvent:k,delta:I};q?(j.current=I,c0(rre,u,re,{discrete:!1})):fM(I,y.swipeDirection,J)?(j.current=I,c0(nre,m,re,{discrete:!1}),k.target.setPointerCapture(k.pointerId)):(Math.abs(F)>J||Math.abs(W)>J)&&(w.current=null)}),onPointerUp:At(e.onPointerUp,k=>{const F=j.current,W=k.target;if(W.hasPointerCapture(k.pointerId)&&W.releasePointerCapture(k.pointerId),j.current=null,w.current=null,F){const q=k.currentTarget,H={originalEvent:k,delta:F};fM(F,y.swipeDirection,y.swipeThreshold)?c0(ire,p,H,{discrete:!0}):c0(are,h,H,{discrete:!0}),q.addEventListener("click",_=>_.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),dre=e=>{const{__scopeToast:t,children:n,...r}=e,a=TN(iv,t),[i,o]=f.useState(!1),[l,c]=f.useState(!1);return hre(()=>o(!0)),f.useEffect(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:s.jsx(yp,{asChild:!0,children:s.jsx(AN,{...r,children:i&&s.jsxs(s.Fragment,{children:[a.label," ",n]})})})},ure="ToastTitle",F9=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return s.jsx(ms.div,{...r,ref:t})});F9.displayName=ure;var mre="ToastDescription",_9=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return s.jsx(ms.div,{...r,ref:t})});_9.displayName=mre;var M9="ToastAction",$9=f.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?s.jsx(R9,{altText:n,asChild:!0,children:s.jsx(aT,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${M9}\`. Expected non-empty \`string\`.`),null)});$9.displayName=M9;var I9="ToastClose",aT=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,a=lre(I9,n);return s.jsx(R9,{asChild:!0,children:s.jsx(ms.button,{type:"button",...r,ref:t,onClick:At(e.onClick,a.onClose)})})});aT.displayName=I9;var R9=f.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...a}=e;return s.jsx(ms.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...a,ref:t})});function B9(e){const t=[];
vendor: 10,511 bytes, lines 48-172
48return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),fre(r)){const a=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const o=r.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...B9(r))}}),t}function c0(e,t,n,{discrete:r}){const a=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?sT(a,i):a.dispatchEvent(i)}var fM=(e,t,n=0)=>{const r=Math.abs(e.x),a=Math.abs(e.y),i=r>a;return t==="left"||t==="right"?i&&r>n:!i&&a>n};function hre(e=()=>{}){const t=Za(e);ea(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function fre(e){return e.nodeType===e.ELEMENT_NODE}function pre(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ZC(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var xre=E9,L9=A9,U9=O9,z9=F9,q9=_9,W9=$9,H9=aT;function V9(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=V9(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function pn(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=V9(e))&&(r&&(r+=" "),r+=t);return r}const pM=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,xM=pn,ov=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return xM(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(d=>{const m=n==null?void 0:n[d],u=i==null?void 0:i[d];if(m===null)return null;const h=pM(m)||pM(u);return a[d][h]}),l=n&&Object.entries(n).reduce((d,m)=>{let[u,h]=m;return h===void 0||(d[u]=h),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,m)=>{let{class:u,className:h,...p}=m;return Object.entries(p).every(v=>{let[y,g]=v;return Array.isArray(g)?g.includes({...i,...l}[y]):{...i,...l}[y]===g})?[...d,u,h]:d},[]);return xM(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};/**
49 * @license lucide-react v0.453.0 - ISC
50 *
51 * This source code is licensed under the ISC license.
52 * See the LICENSE file in the root directory of this source tree.
53 */const gre=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K9=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/**
54 * @license lucide-react v0.453.0 - ISC
55 *
56 * This source code is licensed under the ISC license.
57 * See the LICENSE file in the root directory of this source tree.
58 */var yre={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"};/**
59 * @license lucide-react v0.453.0 - ISC
60 *
61 * This source code is licensed under the ISC license.
62 * See the LICENSE file in the root directory of this source tree.
63 */const vre=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:o,...l},c)=>f.createElement("svg",{ref:c,...yre,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:K9("lucide",a),...l},[...o.map(([d,m])=>f.createElement(d,m)),...Array.isArray(i)?i:[i]]));/**
64 * @license lucide-react v0.453.0 - ISC
65 *
66 * This source code is licensed under the ISC license.
67 * See the LICENSE file in the root directory of this source tree.
68 */const yt=(e,t)=>{const n=f.forwardRef(({className:r,...a},i)=>f.createElement(vre,{ref:i,iconNode:t,className:K9(`lucide-${gre(e)}`,r),...a}));return n.displayName=`${e}`,n};/**
69 * @license lucide-react v0.453.0 - ISC
70 *
71 * This source code is licensed under the ISC license.
72 * See the LICENSE file in the root directory of this source tree.
73 */const gM=yt("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
74 * @license lucide-react v0.453.0 - ISC
75 *
76 * This source code is licensed under the ISC license.
77 * See the LICENSE file in the root directory of this source tree.
78 */const xr=yt("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
79 * @license lucide-react v0.453.0 - ISC
80 *
81 * This source code is licensed under the ISC license.
82 * See the LICENSE file in the root directory of this source tree.
83 */const qn=yt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
84 * @license lucide-react v0.453.0 - ISC
85 *
86 * This source code is licensed under the ISC license.
87 * See the LICENSE file in the root directory of this source tree.
88 */const Af=yt("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
89 * @license lucide-react v0.453.0 - ISC
90 *
91 * This source code is licensed under the ISC license.
92 * See the LICENSE file in the root directory of this source tree.
93 */const bre=yt("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
94 * @license lucide-react v0.453.0 - ISC
95 *
96 * This source code is licensed under the ISC license.
97 * See the LICENSE file in the root directory of this source tree.
98 */const uw=yt("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
99 * @license lucide-react v0.453.0 - ISC
100 *
101 * This source code is licensed under the ISC license.
102 * See the LICENSE file in the root directory of this source tree.
103 */const iT=yt("CalendarCheck",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]]);/**
104 * @license lucide-react v0.453.0 - ISC
105 *
106 * This source code is licensed under the ISC license.
107 * See the LICENSE file in the root directory of this source tree.
108 */const wre=yt("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
109 * @license lucide-react v0.453.0 - ISC
110 *
111 * This source code is licensed under the ISC license.
112 * See the LICENSE file in the root directory of this source tree.
113 */const Ls=yt("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
114 * @license lucide-react v0.453.0 - ISC
115 *
116 * This source code is licensed under the ISC license.
117 * See the LICENSE file in the root directory of this source tree.
118 */const bn=yt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
119 * @license lucide-react v0.453.0 - ISC
120 *
121 * This source code is licensed under the ISC license.
122 * See the LICENSE file in the root directory of this source tree.
123 */const vi=yt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
124 * @license lucide-react v0.453.0 - ISC
125 *
126 * This source code is licensed under the ISC license.
127 * See the LICENSE file in the root directory of this source tree.
128 */const lm=yt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
129 * @license lucide-react v0.453.0 - ISC
130 *
131 * This source code is licensed under the ISC license.
132 * See the LICENSE file in the root directory of this source tree.
133 */const Ji=yt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
134 * @license lucide-react v0.453.0 - ISC
135 *
136 * This source code is licensed under the ISC license.
137 * See the LICENSE file in the root directory of this source tree.
138 */const ON=yt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
139 * @license lucide-react v0.453.0 - ISC
140 *
141 * This source code is licensed under the ISC license.
142 * See the LICENSE file in the root directory of this source tree.
143 */const cm=yt("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
144 * @license lucide-react v0.453.0 - ISC
145 *
146 * This source code is licensed under the ISC license.
147 * See the LICENSE file in the root directory of this source tree.
148 */const qt=yt("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
149 * @license lucide-react v0.453.0 - ISC
150 *
151 * This source code is licensed under the ISC license.
152 * See the LICENSE file in the root directory of this source tree.
153 */const jre=yt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
154 * @license lucide-react v0.453.0 - ISC
155 *
156 * This source code is licensed under the ISC license.
157 * See the LICENSE file in the root directory of this source tree.
158 */const Ux=yt("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"}]]);/**
159 * @license lucide-react v0.453.0 - ISC
160 *
161 * This source code is licensed under the ISC license.
162 * See the LICENSE file in the root directory of this source tree.
163 */const G9=yt("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
164 * @license lucide-react v0.453.0 - ISC
165 *
166 * This source code is licensed under the ISC license.
167 * See the LICENSE file in the root directory of this source tree.
168 */const ei=yt("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
169 * @license lucide-react v0.453.0 - ISC
170 *
171 * This source code is licensed under the ISC license.
172 * See the LICENSE file in the root directory of this source tree.
173 */const pr=yt("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"}]]);/**
174 * @license lucide-react v0.453.0 - ISC
175 *
176 * This source code is licensed under the ISC license.
177 * See the LICENSE file in the root directory of this source tree.
178 */const ti=yt("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
179 * @license lucide-react v0.453.0 - ISC
180 *
181 * This source code is licensed under the ISC license.
182 * See the LICENSE file in the root directory of this source tree.
183 */const mw=yt("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
184 * @license lucide-react v0.453.0 - ISC
185 *
186 * This source code is licensed under the ISC license.
187 * See the LICENSE file in the root directory of this source tree.
188 */const Ph=yt("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
189 * @license lucide-react v0.453.0 - ISC
190 *
191 * This source code is licensed under the ISC license.
192 * See the LICENSE file in the root directory of this source tree.
193 */const Li=yt("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"}]]);/**
194 * @license lucide-react v0.453.0 - ISC
195 *
196 * This source code is licensed under the ISC license.
197 * See the LICENSE file in the root directory of this source tree.
198 */const zx=yt("Dumbbell",[["path",{d:"M14.4 14.4 9.6 9.6",key:"ic80wn"}],["path",{d:"M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z",key:"nnl7wr"}],["path",{d:"m21.5 21.5-1.4-1.4",key:"1f1ice"}],["path",{d:"M3.9 3.9 2.5 2.5",key:"1evmna"}],["path",{d:"M6.404 12.768a2 2 0 1 1-2.829-2.829l1.768-1.767a2 2 0 1 1-2.828-2.829l2.828-2.828a2 2 0 1 1 2.829 2.828l1.767-1.768a2 2 0 1 1 2.829 2.829z",key:"yhosts"}]]);/**
199 * @license lucide-react v0.453.0 - ISC
200 *
201 * This source code is licensed under the ISC license.
202 * See the LICENSE file in the root directory of this source tree.
203 */const yM=yt("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
204 * @license lucide-react v0.453.0 - ISC
205 *
206 * This source code is licensed under the ISC license.
207 * See the LICENSE file in the root directory of this source tree.
208 */const Lr=yt("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
209 * @license lucide-react v0.453.0 - ISC
210 *
211 * This source code is licensed under the ISC license.
212 * See the LICENSE file in the root directory of this source tree.
213 */const uc=yt("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
214 * @license lucide-react v0.453.0 - ISC
215 *
216 * This source code is licensed under the ISC license.
217 * See the LICENSE file in the root directory of this source tree.
218 */const wa=yt("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"}]]);/**
219 * @license lucide-react v0.453.0 - ISC
220 *
221 * This source code is licensed under the ISC license.
222 * See the LICENSE file in the root directory of this source tree.
223 */const ad=yt("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"}]]);/**
224 * @license lucide-react v0.453.0 - ISC
225 *
226 * This source code is licensed under the ISC license.
227 * See the LICENSE file in the root directory of this source tree.
228 */const Nre=yt("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/**
229 * @license lucide-react v0.453.0 - ISC
230 *
231 * This source code is licensed under the ISC license.
232 * See the LICENSE file in the root directory of this source tree.
233 */const Cre=yt("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"}]]);/**
234 * @license lucide-react v0.453.0 - ISC
235 *
236 * This source code is licensed under the ISC license.
237 * See the LICENSE file in the root directory of this source tree.
238 */const G2=yt("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/**
239 * @license lucide-react v0.453.0 - ISC
240 *
241 * This source code is licensed under the ISC license.
242 * See the LICENSE file in the root directory of this source tree.
243 */const Sre=yt("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
244 * @license lucide-react v0.453.0 - ISC
245 *
246 * This source code is licensed under the ISC license.
247 * See the LICENSE file in the root directory of this source tree.
248 */const Y9=yt("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
249 * @license lucide-react v0.453.0 - ISC
250 *
251 * This source code is licensed under the ISC license.
252 * See the LICENSE file in the root directory of this source tree.
253 */const FN=yt("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
254 * @license lucide-react v0.453.0 - ISC
255 *
256 * This source code is licensed under the ISC license.
257 * See the LICENSE file in the root directory of this source tree.
258 */const kre=yt("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"}]]);/**
259 * @license lucide-react v0.453.0 - ISC
260 *
261 * This source code is licensed under the ISC license.
262 * See the LICENSE file in the root directory of this source tree.
263 */const Pre=yt("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
264 * @license lucide-react v0.453.0 - ISC
265 *
266 * This source code is licensed under the ISC license.
267 * See the LICENSE file in the root directory of this source tree.
268 */const eS=yt("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
269 * @license lucide-react v0.453.0 - ISC
270 *
271 * This source code is licensed under the ISC license.
272 * See the LICENSE file in the root directory of this source tree.
273 */const Ere=yt("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
274 * @license lucide-react v0.453.0 - ISC
275 *
276 * This source code is licensed under the ISC license.
277 * See the LICENSE file in the root directory of this source tree.
278 */const vM=yt("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
279 * @license lucide-react v0.453.0 - ISC
280 *
281 * This source code is licensed under the ISC license.
282 * See the LICENSE file in the root directory of this source tree.
283 */const Tf=yt("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
284 * @license lucide-react v0.453.0 - ISC
285 *
286 * This source code is licensed under the ISC license.
287 * See the LICENSE file in the root directory of this source tree.
288 */const Dre=yt("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);/**
289 * @license lucide-react v0.453.0 - ISC
290 *
291 * This source code is licensed under the ISC license.
292 * See the LICENSE file in the root directory of this source tree.
293 */const Are=yt("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
294 * @license lucide-react v0.453.0 - ISC
295 *
296 * This source code is licensed under the ISC license.
297 * See the LICENSE file in the root directory of this source tree.
298 */const _N=yt("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
299 * @license lucide-react v0.453.0 - ISC
300 *
301 * This source code is licensed under the ISC license.
302 * See the LICENSE file in the root directory of this source tree.
303 */const Qr=yt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
304 * @license lucide-react v0.453.0 - ISC
305 *
306 * This source code is licensed under the ISC license.
307 * See the LICENSE file in the root directory of this source tree.
308 */const jd=yt("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"}]]);/**
309 * @license lucide-react v0.453.0 - ISC
310 *
311 * This source code is licensed under the ISC license.
312 * See the LICENSE file in the root directory of this source tree.
313 */const Nd=yt("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
314 * @license lucide-react v0.453.0 - ISC
315 *
316 * This source code is licensed under the ISC license.
317 * See the LICENSE file in the root directory of this source tree.
318 */const Tre=yt("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"}]]);/**
319 * @license lucide-react v0.453.0 - ISC
320 *
321 * This source code is licensed under the ISC license.
322 * See the LICENSE file in the root directory of this source tree.
323 */const _n=yt("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"}]]);/**
324 * @license lucide-react v0.453.0 - ISC
325 *
326 * This source code is licensed under the ISC license.
327 * See the LICENSE file in the root directory of this source tree.
328 */const si=yt("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"}]]);/**
329 * @license lucide-react v0.453.0 - ISC
330 *
331 * This source code is licensed under the ISC license.
332 * See the LICENSE file in the root directory of this source tree.
333 */const MN=yt("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"}]]);/**
334 * @license lucide-react v0.453.0 - ISC
335 *
336 * This source code is licensed under the ISC license.
337 * See the LICENSE file in the root directory of this source tree.
338 */const hw=yt("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
339 * @license lucide-react v0.453.0 - ISC
340 *
341 * This source code is licensed under the ISC license.
342 * See the LICENSE file in the root directory of this source tree.
343 */const fw=yt("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
344 * @license lucide-react v0.453.0 - ISC
345 *
346 * This source code is licensed under the ISC license.
347 * See the LICENSE file in the root directory of this source tree.
348 */const tS=yt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
349 * @license lucide-react v0.453.0 - ISC
350 *
351 * This source code is licensed under the ISC license.
352 * See the LICENSE file in the root directory of this source tree.
353 */const jg=yt("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"}]]);/**
354 * @license lucide-react v0.453.0 - ISC
355 *
356 * This source code is licensed under the ISC license.
357 * See the LICENSE file in the root directory of this source tree.
358 */const Q9=yt("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
359 * @license lucide-react v0.453.0 - ISC
360 *
361 * This source code is licensed under the ISC license.
362 * See the LICENSE file in the root directory of this source tree.
363 */const Y2=yt("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
364 * @license lucide-react v0.453.0 - ISC
365 *
366 * This source code is licensed under the ISC license.
367 * See the LICENSE file in the root directory of this source tree.
368 */const Ore=yt("Pen",[["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"}]]);/**
369 * @license lucide-react v0.453.0 - ISC
370 *
371 * This source code is licensed under the ISC license.
372 * See the LICENSE file in the root directory of this source tree.
373 */const bM=yt("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/**
374 * @license lucide-react v0.453.0 - ISC
375 *
376 * This source code is licensed under the ISC license.
377 * See the LICENSE file in the root directory of this source tree.
378 */const Fre=yt("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"}]]);/**
379 * @license lucide-react v0.453.0 - ISC
380 *
381 * This source code is licensed under the ISC license.
382 * See the LICENSE file in the root directory of this source tree.
383 */const Gs=yt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
384 * @license lucide-react v0.453.0 - ISC
385 *
386 * This source code is licensed under the ISC license.
387 * See the LICENSE file in the root directory of this source tree.
388 */const wM=yt("PoundSterling",[["path",{d:"M18 7c0-5.333-8-5.333-8 0",key:"1prm2n"}],["path",{d:"M10 7v14",key:"18tmcs"}],["path",{d:"M6 21h12",key:"4dkmi1"}],["path",{d:"M6 13h10",key:"ybwr4a"}]]);/**
389 * @license lucide-react v0.453.0 - ISC
390 *
391 * This source code is licensed under the ISC license.
392 * See the LICENSE file in the root directory of this source tree.
393 */const Q2=yt("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/**
394 * @license lucide-react v0.453.0 - ISC
395 *
396 * This source code is licensed under the ISC license.
397 * See the LICENSE file in the root directory of this source tree.
398 */const pw=yt("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
399 * @license lucide-react v0.453.0 - ISC
400 *
401 * This source code is licensed under the ISC license.
402 * See the LICENSE file in the root directory of this source tree.
403 */const Ng=yt("RectangleEllipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/**
404 * @license lucide-react v0.453.0 - ISC
405 *
406 * This source code is licensed under the ISC license.
407 * See the LICENSE file in the root directory of this source tree.
408 */const Of=yt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
409 * @license lucide-react v0.453.0 - ISC
410 *
411 * This source code is licensed under the ISC license.
412 * See the LICENSE file in the root directory of this source tree.
413 */const _re=yt("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
414 * @license lucide-react v0.453.0 - ISC
415 *
416 * This source code is licensed under the ISC license.
417 * See the LICENSE file in the root directory of this source tree.
418 */const dm=yt("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"}]]);/**
419 * @license lucide-react v0.453.0 - ISC
420 *
421 * This source code is licensed under the ISC license.
422 * See the LICENSE file in the root directory of this source tree.
423 */const J9=yt("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
424 * @license lucide-react v0.453.0 - ISC
425 *
426 * This source code is licensed under the ISC license.
427 * See the LICENSE file in the root directory of this source tree.
428 */const Eh=yt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
429 * @license lucide-react v0.453.0 - ISC
430 *
431 * This source code is licensed under the ISC license.
432 * See the LICENSE file in the root directory of this source tree.
433 */const Nb=yt("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"}]]);/**
434 * @license lucide-react v0.453.0 - ISC
435 *
436 * This source code is licensed under the ISC license.
437 * See the LICENSE file in the root directory of this source tree.
438 */const Dd=yt("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
439 * @license lucide-react v0.453.0 - ISC
440 *
441 * This source code is licensed under the ISC license.
442 * See the LICENSE file in the root directory of this source tree.
443 */const Ff=yt("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
444 * @license lucide-react v0.453.0 - ISC
445 *
446 * This source code is licensed under the ISC license.
447 * See the LICENSE file in the root directory of this source tree.
448 */const X9=yt("Share",[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["polyline",{points:"16 6 12 2 8 6",key:"m901s6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15",key:"1p0rca"}]]);/**
449 * @license lucide-react v0.453.0 - ISC
450 *
451 * This source code is licensed under the ISC license.
452 * See the LICENSE file in the root directory of this source tree.
453 */const Mre=yt("ShieldCheck",[["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",ke
453y:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
454 * @license lucide-react v0.453.0 - ISC
455 *
456 * This source code is licensed under the ISC license.
457 * See the LICENSE file in the root directory of this source tree.
458 */const oT=yt("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"}]]);/**
459 * @license lucide-react v0.453.0 - ISC
460 *
461 * This source code is licensed under the ISC license.
462 * See the LICENSE file in the root directory of this source tree.
463 */const $re=yt("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
464 * @license lucide-react v0.453.0 - ISC
465 *
466 * This source code is licensed under the ISC license.
467 * See the LICENSE file in the root directory of this source tree.
468 */const jl=yt("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
469 * @license lucide-react v0.453.0 - ISC
470 *
471 * This source code is licensed under the ISC license.
472 * See the LICENSE file in the root directory of this source tree.
473 */const Ur=yt("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"}]]);/**
474 * @license lucide-react v0.453.0 - ISC
475 *
476 * This source code is licensed under the ISC license.
477 * See the LICENSE file in the root directory of this source tree.
478 */const Ire=yt("StarOff",[["path",{d:"M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43",ke
478y:"16m0ql"}],["path",{d:"M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91",key:"1vt8nq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
479 * @license lucide-react v0.453.0 - ISC
480 *
481 * This source code is licensed under the ISC license.
482 * See the LICENSE file in the root directory of this source tree.
483 */const dl=yt("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/**
484 * @license lucide-react v0.453.0 - ISC
485 *
486 * This source code is licensed under the ISC license.
487 * See the LICENSE file in the root directory of this source tree.
488 */const um=yt("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"}]]);/**
489 * @license lucide-react v0.453.0 - ISC
490 *
491 * This source code is licensed under the ISC license.
492 * See the LICENSE file in the root directory of this source tree.
493 */const Rre=yt("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
494 * @license lucide-react v0.453.0 - ISC
495 *
496 * This source code is licensed under the ISC license.
497 * See the LICENSE file in the root directory of this source tree.
498 */const ln=yt("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"}]]);/**
499 * @license lucide-react v0.453.0 - ISC
500 *
501 * This source code is licensed under the ISC license.
502 * See the LICENSE file in the root directory of this source tree.
503 */const sS=yt("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
504 * @license lucide-react v0.453.0 - ISC
505 *
506 * This source code is licensed under the ISC license.
507 * See the LICENSE file in the root directory of this source tree.
508 */const fh=yt("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"}]]);/**
509 * @license lucide-react v0.453.0 - ISC
510 *
511 * This source code is licensed under the ISC license.
512 * See the LICENSE file in the root directory of this source tree.
513 */const Mr=yt("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"}]]);/**
514 * @license lucide-react v0.453.0 - ISC
515 *
516 * This source code is licensed under the ISC license.
517 * See the LICENSE file in the root directory of this source tree.
518 */const Bre=yt("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/**
519 * @license lucide-react v0.453.0 - ISC
520 *
521 * This source code is licensed under the ISC license.
522 * See the LICENSE file in the root directory of this source tree.
523 */const jM=yt("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
524 * @license lucide-react v0.453.0 - ISC
525 *
526 * This source code is licensed under the ISC license.
527 * See the LICENSE file in the root directory of this source tree.
528 */const Lre=yt("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);/**
529 * @license lucide-react v0.453.0 - ISC
530 *
531 * This source code is licensed under the ISC license.
532 * See the LICENSE file in the root directory of this source tree.
533 */const id=yt("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"}]]);/**
534 * @license lucide-react v0.453.0 - ISC
535 *
536 * This source code is licensed under the ISC license.
537 * See the LICENSE file in the root directory of this source tree.
538 */const Dr=yt("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"}]]);/**
539 * @license lucide-react v0.453.0 - ISC
540 *
541 * This source code is licensed under the ISC license.
542 * See the LICENSE file in the root directory of this source tree.
543 */const sr=yt("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"}]]);/**
544 * @license lucide-react v0.453.0 - ISC
545 *
546 * This source code is licensed under the ISC license.
547 * See the LICENSE file in the root directory of this source tree.
548 */const lT=yt("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
549 * @license lucide-react v0.453.0 - ISC
550 *
551 * This source code is licensed under the ISC license.
552 * See the LICENSE file in the root directory of this source tree.
553 */const lr=yt("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
554 * @license lucide-react v0.453.0 - ISC
555 *
556 * This source code is licensed under the ISC license.
557 * See the LICENSE file in the root directory of this source tree.
558 */const ja=yt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}
vendor: 8,449 bytes, lines 558-563
558],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
559 * @license lucide-react v0.453.0 - ISC
560 *
561 * This source code is licensed under the ISC license.
562 * See the LICENSE file in the root directory of this source tree.
563 */const Z9=yt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),cT="-",Ure=e=>{const t=qre(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(cT);return l[0]===""&&l.length!==1&&l.shift(),e7(l,t)||zre(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},e7=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?e7(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(cT);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},NM=/^\[(.+)\]$/,zre=e=>{if(NM.test(e)){const t=NM.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},qre=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Hre(Object.entries(e.classGroups),n).forEach(([i,o])=>{J2(o,r,i,t)}),r},J2=(e,t,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:CM(t,a);i.classGroupId=n;return}if(typeof a=="function"){if(Wre(a)){J2(a(r),t,n,r);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([i,o])=>{J2(o,CM(t,i),n,r)})})},CM=(e,t)=>{let n=e;return t.split(cT).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Wre=e=>e.isThemeGetter,Hre=(e,t)=>t?e.map(([n,r])=>{const a=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[n,a]}):e,Vre=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const a=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return a(i,o),o},set(i,o){n.has(i)?n.set(i,o):a(i,o)}}},t7="!",Kre=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,a=t[0],i=t.length,o=l=>{const c=[];let d=0,m=0,u;for(let g=0;g<l.length;g++){let x=l[g];if(d===0){if(x===a&&(r||l.slice(g,g+i)===t)){c.push(l.slice(m,g)),m=g+i;continue}if(x==="/"){u=g;continue}}x==="["?d++:x==="]"&&d--}const h=c.length===0?l:l.substring(m),p=h.startsWith(t7),v=p?h.substring(1):h,y=u&&u>m?u-m:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:y}};return n?l=>n({className:l,parseClassName:o}):o},Gre=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Yre=e=>({cache:Vre(e.cacheSize),parseClassName:Kre(e),...Ure(e)}),Qre=/\s+/,Jre=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=t,i=[],o=e.trim().split(Qre);let l="";for(let c=o.length-1;c>=0;c-=1){const d=o[c],{modifiers:m,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:p}=n(d);let v=!!p,y=r(v?h.substring(0,p):h);if(!y){if(!v){l=d+(l.length>0?" "+l:l);continue}if(y=r(h),!y){l=d+(l.length>0?" "+l:l);continue}v=!1}const g=Gre(m).join(":"),x=u?g+t7:g,b=x+y;if(i.includes(b))continue;i.push(b);const w=a(y,v);for(let j=0;j<w.length;++j){const N=w[j];i.push(x+N)}l=d+(l.length>0?" "+l:l)}return l};function Xre(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=s7(t))&&(r&&(r+=" "),r+=n);return r}const s7=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=s7(e[r]))&&(n&&(n+=" "),n+=t);return n};function Zre(e,...t){let n,r,a,i=o;function o(c){const d=t.reduce((m,u)=>u(m),e());return n=Yre(d),r=n.cache.get,a=n.cache.set,i=l,l(c)}function l(c){const d=r(c);if(d)return d;const m=Jre(c,n);return a(c,m),m}return function(){return i(Xre.apply(null,arguments))}}const Hn=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},n7=/^\[(?:([a-z-]+):)?(.+)\]$/i,eae=/^\d+\/\d+$/,tae=new Set(["px","full","screen"]),sae=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,nae=/\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$/,rae=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,aae=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,iae=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ol=e=>Dh(e)||tae.has(e)||eae.test(e),Ec=e=>vp(e,"length",fae),Dh=e=>!!e&&!Number.isNaN(Number(e)),nS=e=>vp(e,"number",Dh),Kp=e=>!!e&&Number.isInteger(Number(e)),oae=e=>e.endsWith("%")&&Dh(e.slice(0,-1)),Ws=e=>n7.test(e),Dc=e=>sae.test(e),lae=new Set(["length","size","percentage"]),cae=e=>vp(e,lae,r7),dae=e=>vp(e,"position",r7),uae=new Set(["image","url"]),mae=e=>vp(e,uae,xae),hae=e=>vp(e,"",pae),Gp=()=>!0,vp=(e,t,n)=>{const r=n7.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},fae=e=>nae.test(e)&&!rae.test(e),r7=()=>!1,pae=e=>aae.test(e),xae=e=>iae.test(e),gae=()=>{const e=Hn("colors"),t=Hn("spacing"),n=Hn("blur"),r=Hn("brightness"),a=Hn("borderColor"),i=Hn("borderRadius"),o=Hn("borderSpacing"),l=Hn("borderWidth"),c=Hn("contrast"),d=Hn("grayscale"),m=Hn("hueRotate"),u=Hn("invert"),h=Hn("gap"),p=Hn("gradientColorStops"),v=Hn("gradientColorStopPositions"),y=Hn("inset"),g=Hn("margin"),x=Hn("opacity"),b=Hn("padding"),w=Hn("saturate"),j=Hn("scale"),N=Hn("sepia"),C=Hn("skew"),P=Hn("space"),S=Hn("translate"),E=()=>["auto","contain","none"],T=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto",Ws,t],O=()=>[Ws,t],D=()=>["",Ol,Ec],k=()=>["auto",Dh,Ws],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],W=()=>["solid","dashed","dotted","double","none"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],_=()=>["","0",Ws],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[Dh,Ws];return{cacheSize:500,separator:":",theme:{colors:[Gp],spacing:[Ol,Ec],blur:["none","",Dc,Ws],brightness:U(),borderColor:[e],borderRadius:["none","","full",Dc,Ws],borderSpacing:O(),borderWidth:D(),contrast:U(),grayscale:_(),hueRotate:U(),invert:_(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[oae,Ec],inset:z(),margin:z(),opacity:U(),padding:O(),saturate:U(),scale:U(),sepia:_(),skew:U(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",Ws]}],container:["container"],columns:[{columns:[Dc]}],"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:[...F(),Ws]}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Kp,Ws]}],basis:[{basis:z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ws]}],grow:[{grow:_()}],shrink:[{shrink:_()}],order:[{order:["first","last","none",Kp,Ws]}],"grid-cols":[{"grid-cols":[Gp]}],"col-start-end":[{col:["auto",{span:["full",Kp,Ws]},Ws]}],"col-start":[{"col-start":k()}
vendor: 9,129 bytes, line 563
563],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":[Gp]}],"row-start-end":[{row:["auto",{span:[Kp,Ws]},Ws]}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ws]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ws]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ws,t]}],"min-w":[{"min-w":[Ws,t,"min","max","fit"]}],"max-w":[{"max-w":[Ws,t,"none","full","min","max","fit","prose",{screen:[Dc]},Dc]}],h:[{h:[Ws,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ws,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ws,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ws,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Dc,Ec]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",nS]}],"font-family":[{font:[Gp]}],"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",Ws]}],"line-clamp":[{"line-clamp":["none",Dh,nS]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ol,Ws]}],"list-image":[{"list-image":["none",Ws]}],"list-style-type":[{list:["none","disc","decimal",Ws]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...W(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ol,Ec]}],"underline-offset":[{"underline-offset":["auto",Ol,Ws]}],"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:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ws]}],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",Ws]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),dae]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",cae]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},mae]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...W(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:W()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...W()]}],"outline-offset":[{"outline-offset":[Ol,Ws]}],"outline-w":[{outline:[Ol,Ec]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[Ol,Ec]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Dc,hae]}],"shadow-color":[{shadow:[Gp]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Dc,Ws]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[u]}],saturate:[{saturate:[w]}],sepia:[{sepia:[N]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"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",Ws]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",Ws]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ws]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Kp,Ws]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ws]}],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",Ws]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}
563],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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",Ws]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ol,Ec,nS]}],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"]}}},yae=Zre(gae);function bt(...e){return yae(pn(e))}function rS(e,t){if(!e||typeof e!="string")return e;const n=/(https?:\/\/[^\s<>"']+)/gi;return e.split(n).map((a,i)=>/^https?:\/\//i.test(a)?he.createElement("a",{key:i,href:a,target:"_blank",rel:"noopener noreferrer",className:t??"text-blue-600 hover:underline break-all"},a):he.createElement("span",{key:i},a))}const vae=xre,a7=f.forwardRef(({className:e,...t},n)=>s.jsx(L9,{ref:n,className:bt("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}));a7.displayName=L9.displayName;const bae=ov("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"}}),i7=f.forwardRef(({className:e,variant:t,...n},r)=>s.jsx(U9,{ref:r,className:bt(bae({variant:t}),e),...n}));i7.displayName=U9.displayName;const wae=f.forwardRef(({className:e,...t},n)=>s.jsx(W9,{ref:n,className:bt("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));wae.displayName=W9.displayName;const o7=f.forwardRef(({className:e,...t},n)=>s.jsx(H9,{ref:n,className:bt("absolute right-2 top-2 rounded-md p-1 text-foreground
vendor: 20,513 bytes, line 563
563/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:s.jsx(ja,{className:"h-4 w-4"})}));o7.displayName=H9.displayName;const l7=f.forwardRef(({className:e,...t},n)=>s.jsx(z9,{ref:n,className:bt("text-sm font-semibold",e),...t}));l7.displayName=z9.displayName;const c7=f.forwardRef(({className:e,...t},n)=>s.jsx(q9,{ref:n,className:bt("text-sm opacity-90",e),...t}));c7.displayName=q9.displayName;function jae(){const{toasts:e}=Yt();return s.jsxs(vae,{children:[e.map(function({id:t,title:n,description:r,action:a,...i}){return s.jsxs(i7,{...i,children:[s.jsxs("div",{className:"grid gap-1",children:[n&&s.jsx(l7,{children:n}),r&&s.jsx(c7,{children:r})]}),a,s.jsx(o7,{})]},t)}),s.jsx(a7,{})]})}var Nae=mN[" useId ".trim().toString()]||(()=>{}),Cae=0;function pi(e){const[t,n]=f.useState(Nae());return ea(()=>{n(r=>r??String(Cae++))},[e]),t?`radix-${t}`:""}const Sae=["top","right","bottom","left"],Ad=Math.min,ui=Math.max,xw=Math.round,d0=Math.floor,vl=e=>({x:e,y:e}),kae={left:"right",right:"left",bottom:"top",top:"bottom"},Pae={start:"end",end:"start"};function X2(e,t,n){return ui(e,Ad(t,n))}function mc(e,t){return typeof e=="function"?e(t):e}function hc(e){return e.split("-")[0]}function bp(e){return e.split("-")[1]}function dT(e){return e==="x"?"y":"x"}function uT(e){return e==="y"?"height":"width"}const Eae=new Set(["top","bottom"]);function fl(e){return Eae.has(hc(e))?"y":"x"}function mT(e){return dT(fl(e))}function Dae(e,t,n){n===void 0&&(n=!1);const r=bp(e),a=mT(e),i=uT(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=gw(o)),[o,gw(o)]}function Aae(e){const t=gw(e);return[Z2(e),t,Z2(t)]}function Z2(e){return e.replace(/start|end/g,t=>Pae[t])}const SM=["left","right"],kM=["right","left"],Tae=["top","bottom"],Oae=["bottom","top"];function Fae(e,t,n){switch(e){case"top":case"bottom":return n?t?kM:SM:t?SM:kM;case"left":case"right":return t?Tae:Oae;default:return[]}}function _ae(e,t,n,r){const a=bp(e);let i=Fae(hc(e),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),t&&(i=i.concat(i.map(Z2)))),i}function gw(e){return e.replace(/left|right|bottom|top/g,t=>kae[t])}function Mae(e){return{top:0,right:0,bottom:0,left:0,...e}}function d7(e){return typeof e!="number"?Mae(e):{top:e,right:e,bottom:e,left:e}}function yw(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function PM(e,t,n){let{reference:r,floating:a}=e;const i=fl(t),o=mT(t),l=uT(o),c=hc(t),d=i==="y",m=r.x+r.width/2-a.width/2,u=r.y+r.height/2-a.height/2,h=r[l]/2-a[l]/2;let p;switch(c){case"top":p={x:m,y:r.y-a.height};break;case"bottom":p={x:m,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-a.width,y:u};break;default:p={x:r.x,y:r.y}}switch(bp(t)){case"start":p[o]-=h*(n&&d?-1:1);break;case"end":p[o]+=h*(n&&d?-1:1);break}return p}const $ae=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:o}=n,l=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:m,y:u}=PM(d,r,c),h=r,p={},v=0;for(let y=0;y<l.length;y++){const{name:g,fn:x}=l[y],{x:b,y:w,data:j,reset:N}=await x({x:m,y:u,initialPlacement:r,placement:h,strategy:a,middlewareData:p,rects:d,platform:o,elements:{reference:e,floating:t}});m=b??m,u=w??u,p={...p,[g]:{...p[g],...j}},N&&v<=50&&(v++,typeof N=="object"&&(N.placement&&(h=N.placement),N.rects&&(d=N.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:a}):N.rects),{x:m,y:u}=PM(d,h,c)),y=-1)}return{x:m,y:u,placement:h,strategy:a,middlewareData:p}};async function Cg(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:i,rects:o,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:m="viewport",elementContext:u="floating",altBoundary:h=!1,padding:p=0}=mc(t,e),v=d7(p),g=l[h?u==="floating"?"reference":"floating":u],x=yw(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(g)))==null||n?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:m,strategy:c})),b=u==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),j=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},N=yw(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:w,strategy:c}):b);return{top:(x.top-N.top+v.top)/j.y,bottom:(N.bottom-x.bottom+v.bottom)/j.y,left:(x.left-N.left+v.left)/j.x,right:(N.right-x.right+v.right)/j.x}}const Iae=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:d,padding:m=0}=mc(e,t)||{};if(d==null)return{};const u=d7(m),h={x:n,y:r},p=mT(a),v=uT(p),y=await o.getDimensions(d),g=p==="y",x=g?"top":"left",b=g?"bottom":"right",w=g?"clientHeight":"clientWidth",j=i.reference[v]+i.reference[p]-h[p]-i.floating[v],N=h[p]-i.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let P=C?C[w]:0;(!P||!await(o.isElement==null?void 0:o.isElement(C)))&&(P=l.floating[w]||i.floating[v]);const S=j/2-N/2,E=P/2-y[v]/2-1,T=Ad(u[x],E),z=Ad(u[b],E),O=T,D=P-y[v]-z,k=P/2-y[v]/2+S,F=X2(O,k,D),W=!c.arrow&&bp(a)!=null&&k!==F&&i.reference[v]/2-(k<O?T:z)-y[v]/2<0,q=W?k<O?k-O:k-D:0;return{[p]:h[p]+q,data:{[p]:F,centerOffset:k-F-q,...W&&{alignmentOffset:q}},reset:W}}}),Rae=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:m=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:y=!0,...g}=mc(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=hc(a),b=fl(l),w=hc(l)===l,j=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=h||(w||!y?[gw(l)]:Aae(l)),C=v!=="none";!h&&C&&N.push(..._ae(l,y,v,j));const P=[l,...N],S=await Cg(t,g),E=[];let T=((r=i.flip)==null?void 0:r.overflows)||[];if(m&&E.push(S[x]),u){const k=Dae(a,o,j);E.push(S[k[0]],S[k[1]])}if(T=[...T,{placement:a,overflows:E}],!E.every(k=>k<=0)){var z,O;const k=(((z=i.flip)==null?void 0:z.index)||0)+1,F=P[k];if(F&&(!(u==="alignment"?b!==fl(F):!1)||T.every(H=>fl(H.placement)===b?H.overflows[0]>0:!0)))return{data:{index:k,overflows:T},reset:{placement:F}};let W=(O=T.filter(q=>q.overflows[0]<=0).sort((q,H)=>q.overflows[1]-H.overflows[1])[0])==null?void 0:O.placement;if(!W)switch(p){case"bestFit":{var D;const q=(D=T.filter(H=>{if(C){const _=fl(H.placement);return _===b||_==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(_=>_>0).reduce((_,L)=>_+L,0)]).sort((H,_)=>H[1]-_[1])[0])==null?void 0:D[0];q&&(W=q);break}case"initialPlacement":W=l;break}if(a!==W)return{reset:{placement:W}}}return{}}}};function EM(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function DM(e){return Sae.some(t=>e[t]>=0)}const Bae=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=mc(e,t);switch(r){case"referenceHidden":{const i=await Cg(t,{...a,elementContext:"reference"}),o=EM(i,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:DM(o)}}}case"escaped":{const i=await Cg(t,{...a,altBoundary:!0}),o=EM(i,n.floating);return{data:{escapedOffsets:o,escaped:DM(o)}}}default:return{}}}}},u7=new Set(["left","top"]);async function Lae(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=hc(n),l=bp(n),c=fl(n)==="y",d=u7.has(o)?-1:1,m=i&&c?-1:1,u=mc(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:v}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof v=="number"&&(p=l==="end"?v*-1:v),c?{x:p*m,y:h*d}:{x:h*d,y:p*m}}const Uae=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:o,middlewareData:l}=t,c=await Lae(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:a+c.x,y:i+c.y,data:{...c,placement:o}}}}},zae=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:i=!0,crossAxis:o=!1,limiter:l={fn:g=>{let{x,y:b}=g;return{x,y:b}}},...c}=mc(e,t),d={x:n,y:r},m=await Cg(t,c),u=fl(hc(a)),h=dT(u);let p=d[h],v=d[u];if(i){const g=h==="y"?"top":"left",x=h==="y"?"bottom":"right",b=p+m[g],w=p-m[x];p=X2(b,p,w)}if(o){const g=u==="y"?"top":"left",x=u==="y"?"bottom":"right",b=v+m[g],w=v-m[x];v=X2(b,v,w)}const y=l.fn({...t,[h]:p,[u]:v});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:i,[u]:o}}}}}},qae=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:i,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=mc(e,t),m={x:n,y:r},u=fl(a),h=dT(u);let p=m[h],v=m[u];const y=mc(l,t),g=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){const w=h==="y"?"height":"width",j=i.reference[h]-i.floating[w]+g.mainAxis,N=i.reference[h]+i.reference[w]-g.mainAxis;p<j?p=j:p>N&&(p=N)}if(d){var x,b;const w=h==="y"?"width":"height",j=u7.has(hc(a)),N=i.reference[u]-i.floating[w]+(j&&((x=o.offset)==null?void 0:x[u])||0)+(j?0:g.crossAxis),C=i.reference[u]+i.reference[w]+(j?0:((b=o.offset)==null?void 0:b[u])||0)-(j?g.crossAxis:0);v<N?v=N:v>C&&(v=C)}return{[h]:p,[u]:v}}}},Wae=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:i,platform:o,elements:l}=t,{apply:c=()=>{},...d}=mc(e,t),m=await Cg(t,d),u=hc(a),h=bp(a),p=fl(a)==="y",{width:v,height:y}=i.floating;let g,x;u==="top"||u==="bottom"?(g=u,x=h===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(x=u,g=h==="end"?"top":"bottom");const b=y-m.top-m.bottom,w=v-m.left-m.right,j=Ad(y-m[g],b),N=Ad(v-m[x],w),C=!t.middlewareData.shift;let P=j,S=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(S=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=b),C&&!h){const T=ui(m.left,0),z=ui(m.right,0),O=ui(m.top,0),D=ui(m.bottom,0);p?S=v-2*(T!==0||z!==0?T+z:ui(m.left,m.right)):P=y-2*(O!==0||D!==0?O+D:ui(m.top,m.bottom))}await c({...t,availableWidth:S,availableHeight:P});const E=await o.getDimensions(l.floating);return v!==E.width||y!==E.height?{reset:{rects:!0}}:{}}}};function $N(){return typeof window<"u"}function wp(e){return m7(e)?(e.nodeName||"").toLowerCase():"#document"}function xi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function El(e){var t;return(t=(m7(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function m7(e){return $N()?e instanceof Node||e instanceof xi(e).Node:!1}function Ro(e){return $N()?e instanceof Element||e instanceof xi(e).Element:!1}function Nl(e){return $N()?e instanceof HTMLElement||e instanceof xi(e).HTMLElement:!1}function AM(e){return!$N()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof xi(e).ShadowRoot}const Hae=new Set(["inline","contents"]);function lv(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Bo(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Hae.has(a)}const Vae=new Set(["table","td","th"]);function Kae(e){return Vae.has(wp(e))}const Gae=[":popover-open",":modal"];function IN(e){return Gae.some(t=>{try{return e.matches(t)}catch{return!1}})}const Yae=["transform","translate","scale","rotate","perspective"],Qae=["transform","translate","scale","rotate","perspective","filter"],Jae=["paint","layout","strict","content"];function hT(e){const t=fT(),n=Ro(e)?Bo(e):e;return Yae.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Qae.some(r=>(n.willChange||"").includes(r))||Jae.some(r=>(n.contain||"").includes(r))}function Xae(e){let t=Td(e);for(;Nl(t)&&!_f(t);){if(hT(t))return t;if(IN(t))return null;t=Td(t)}return null}function fT(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Zae=new Set(["html","body","#document"]);function _f(e){return Zae.has(wp(e))}function Bo(e){return xi(e).getComputedStyle(e)}function RN(e){return Ro(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Td(e){if(wp(e)==="html")return e;const t=e.assignedSlot||e.parentNode||AM(e)&&e.host||El(e);return AM(t)?t.host:t}function h7(e){const t=Td(e);return _f(t)?e.ownerDocument?e.ownerDocument.body:e.body:Nl(t)&&lv(t)?t:h7(t)}function Sg(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=h7(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),o=xi(a);if(i){const l=eP(o);return t.concat(o,o.visualViewport||[],lv(a)?a:[],l&&n?Sg(l):[])}return t.concat(a,Sg(a,[],n))}function eP(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function f7(e){const t=Bo(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Nl(e),i=a?e.offsetWidth:n,o=a?e.offsetHeight:r,l=xw(n)!==i||xw(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function pT(e){return Ro(e)?e:e.contextElement}function Ah(e){const t=pT(e);if(!Nl(t))return vl(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=f7(t);let o=(i?xw(n.width):n.width)/r,l=(i?xw(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const eie=vl(0);function p7(e){const t=xi(e);return!fT()||!t.visualViewport?eie:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tie(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==xi(e)?!1:t}function mm(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=pT(e);let o=vl(1);t&&(r?Ro(r)&&(o=Ah(r)):o=Ah(e));const l=tie(i,n,r)?p7(i):vl(0);let c=(a.left+l.x)/o.x,d=(a.top+l.y)/o.y,m=a.width/o.x,u=a.height/o.y;if(i){const h=xi(i),p=r&&Ro(r)?xi(r):r;let v=h,y=eP(v);for(;y&&r&&p!==v;){const g=Ah(y),x=y.getBoundingClientRect(),b=Bo(y),w=x.left+(y.clientLeft+parseFloat(b.paddingLeft))*g.x,j=x.top+(y.clientTop+parseFloat(b.paddingTop))*g.y;c*=g.x,d*=g.y,m*=g.x,u*=g.y,c+=w,d+=j,v=xi(y),y=eP(v)}}return yw({width:m,height:u,x:c,y:d})}function BN(e,t){const n=RN(e).scrollLeft;return t?t.left+n:mm(El(e)).left+n}function x7(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-BN(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function sie(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",o=El(r),l=t?IN(t.floating):!1;if(r===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=vl(1);const m=vl(0),u=Nl(r);if((u||!u&&!i)&&((wp(r)!=="body"||lv(o))&&(c=RN(r)),Nl(r))){const p=mm(r);d=Ah(r),m.x=p.x+r.clientLeft,m.y=p.y+r.clientTop}const h=o&&!u&&!i?x7(o,c):vl(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+m.x+h.x,y:n.y*d.y-c.scrollTop*d.y+m.y+h.y}}function nie(e){return Array.from(e.getClientRects())}function rie(e){const t=El(e),n=RN(e),r=e.ownerDocument.body,a=ui(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ui(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+BN(e);const l=-n.scrollTop;return Bo(r).direction==="rtl"&&(o+=ui(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:l}}const TM=25;function aie(e,t){const n=xi(e),r=El(e),a=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,c=0;if(a){i=a.width,o=a.height;const m=fT();(!m||m&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}const d=BN(r);if(d<=0){const m=r.ownerDocument,u=m.body,h=getComputedStyle(u),p=m.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(r.clientWidth-u.clientWidth-p);v<=TM&&(i-=v)}else d<=TM&&(i+=d);return{width:i,height:o,x:l,y:c}}const iie=new Set(["absolute","fixed"]);function oie(e,t){const n=mm(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=Nl(e)?Ah(e):vl(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=a*i.x,d=r*i.y;return{width:o,height:l,x:c,y:d}}function OM(e,t,n){let r;if(t==="viewport")r=aie(e,n);else if(t==="document")r=rie(El(e));else if(Ro(t))r=oie(t,n);else{const a=p7(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return yw(r)}function g7(e,t){const n=Td(e);return n===t||!Ro(n)||_f(n)?!1:Bo(n).position==="fixed"||g7(n,t)}function lie(e,t){const n=t.get(e);if(n)return n;let r=Sg(e,[],!1).filter(l=>Ro(l)&&wp(l)!=="body"),a=null;const i=Bo(e).position==="fixed";let o=i?Td(e):e;for(;Ro(o)&&!_f(o);){const l=Bo(o),c=hT(o);!c&&l.position==="fixed"&&(a=null),(i?!c&&!a:!c&&l.position==="static"&&!!a&&iie.has(a.position)||lv(o)&&!c&&g7(e,o))?r=r.filter(m=>m!==o):a=l,o=Td(o)}return t.set(e,r),r}function cie(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const o=[...n==="clippingAncestors"?IN(t)?[]:lie(t,this._c):[].concat(n),r],l=o[0],c=o.reduce((d,m)=>{const u=OM(t,m,a);return d.top=ui(u.top,d.top),d.right=Ad(u.right,d.right),d.bottom=Ad(u.bottom,d.bottom),d.left=ui(u.left,d.left),d},OM(t,l,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function die(e){const{width:t,height:n}=f7(e);return{width:t,height:n}}function uie(e,t,n){const r=Nl(t),a=El(t),i=n==="fixed",o=mm(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=vl(0);function d(){c.x=BN(a)}if(r||!r&&!i)if((wp(t)!=="body"||lv(a))&&(l=RN(t)),r){const p=mm(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else a&&d();i&&!r&&a&&d();const m=a&&!r&&!i?x7(a,l):vl(0),u=o.left+l.scrollLeft-c.x-m.x,h=o.top+l.scrollTop-c.y-m.y;return{x:u,y:h,width:o.width,height:o.height}}function aS(e){return Bo(e).position==="static"}function FM(e,t){if(!Nl(e)||Bo(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return El(e)===n&&(n=n.ownerDocument.body),n}function y7(e,t){const n=xi(e);if(IN(e))return n;if(!Nl(e)){let a=Td(e);for(;a&&!_f(a);){if(Ro(a)&&!aS(a))return a;a=Td(a)}return n}let r=FM(e,t);for(;r&&Kae(r)&&aS(r);)r=FM(r,t);return r&&_f(r)&&aS(r)&&!hT(r)?n:r||Xae(e)||n}const mie=async function(e){const t=this.getOffsetParent||y7,n=this.getDimensions,r=await n(e.floating);return{reference:uie(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hie(e){return Bo(e).direction==="rtl"}const fie={convertOffsetParentRelativeRectToViewportRelativeRect:sie,getDocumentElement:El,getClippingRect:cie,getOffsetParent:y7,getElementRects:mie,getClientRects:nie,getDimensions:die,getScale:Ah,isElement:Ro,isRTL:hie};function v7(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pie(e,t){let n=null,r;const a=El(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:m,top:u,width:h,height:p}=d;if(l||t(),!h||!p)return;const v=d0(u),y=d0(a.clientWidth-(m+h)),g=d0(a.clientHeight-(u+p)),x=d0(m),w={rootMargin:-v+"px "+-y+"px "+-g+"px "+-x+"px",threshold:ui(0,Ad(1,c))||1};let j=!0;function N(C){const P=C[0].intersectionRatio;if(P!==c){if(!j)return o();P?o(!1,P):r=setTimeout(()=>{o(!1,1e-7)},1e3)}P===1&&!v7(d,e.getBoundingClientRect())&&o(),j=!1}try{n=new IntersectionObserver(N,{...w,root:a.ownerDocument})}catch{n=new IntersectionObserver(N,w)}n.observe(e)}return o(!0),i}function xie(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=pT(e),m=a||i?[...d?Sg(d):[],...Sg(t)]:[];m.forEach(x=>{a&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const u=d&&l?pie(d,n):null;let h=-1,p=null;o&&(p=new ResizeObserver(x=>{let[b]=x;b&&b.target===d&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),d&&!c&&p.observe(d),p.observe(t));let v,y=c?mm(e):null;c&&g();function g(){const x=mm(e);y&&!v7(y,x)&&n(),y=x,v=requestAnimationFrame(g)}return n(),()=>{var x;m.forEach(b=>{a&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}
vendor: 4,244 bytes, line 563
563),u==null||u(),(x=p)==null||x.disconnect(),p=null,c&&cancelAnimationFrame(v)}}const gie=Uae,yie=zae,vie=Rae,bie=Wae,wie=Bae,_M=Iae,jie=qae,Nie=(e,t,n)=>{const r=new Map,a={platform:fie,...n},i={...a.platform,_c:r};return $ae(e,t,{...a,platform:i})};var Cie=typeof document<"u",Sie=function(){},Cb=Cie?f.useLayoutEffect:Sie;function vw(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!vw(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&e.$$typeof)&&!vw(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function b7(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function MM(e,t){const n=b7(e);return Math.round(t*n)/n}function iS(e){const t=f.useRef(e);return Cb(()=>{t.current=e}),t}function kie(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[m,u]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=f.useState(r);vw(h,r)||p(r);const[v,y]=f.useState(null),[g,x]=f.useState(null),b=f.useCallback(H=>{H!==C.current&&(C.current=H,y(H))},[]),w=f.useCallback(H=>{H!==P.current&&(P.current=H,x(H))},[]),j=i||v,N=o||g,C=f.useRef(null),P=f.useRef(null),S=f.useRef(m),E=c!=null,T=iS(c),z=iS(a),O=iS(d),D=f.useCallback(()=>{if(!C.current||!P.current)return;const H={placement:t,strategy:n,middleware:h};z.current&&(H.platform=z.current),Nie(C.current,P.current,H).then(_=>{const L={..._,isPositioned:O.current!==!1};k.current&&!vw(S.current,L)&&(S.current=L,Id.flushSync(()=>{u(L)}))})},[h,t,n,z,O]);Cb(()=>{d===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,u(H=>({...H,isPositioned:!1})))},[d]);const k=f.useRef(!1);Cb(()=>(k.current=!0,()=>{k.current=!1}),[]),Cb(()=>{if(j&&(C.current=j),N&&(P.current=N),j&&N){if(T.current)return T.current(j,N,D);D()}},[j,N,D,T,E]);const F=f.useMemo(()=>({reference:C,floating:P,setReference:b,setFloating:w}),[b,w]),W=f.useMemo(()=>({reference:j,floating:N}),[j,N]),q=f.useMemo(()=>{const H={position:n,left:0,top:0};if(!W.floating)return H;const _=MM(W.floating,m.x),L=MM(W.floating,m.y);return l?{...H,transform:"translate("+_+"px, "+L+"px)",...b7(W.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:L}},[n,l,W.floating,m.x,m.y]);return f.useMemo(()=>({...m,update:D,refs:F,elements:W,floatingStyles:q}),[m,D,F,W,q])}const Pie=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?_M({element:r.current,padding:a}).fn(n):{}:r?_M({element:r,padding:a}).fn(n):{}}}},Eie=(e,t)=>({...gie(e),options:[e,t]}),Die=(e,t)=>({...yie(e),options:[e,t]}),Aie=(e,t)=>({...jie(e),options:[e,t]}),Tie=(e,t)=>({...vie(e),options:[e,t]}),Oie=(e,t)=>({...bie(e),options:[e,t]}),Fie=(e,t)=>({...wie(e),options:[e,t]}),_ie=(e,t)=>({...Pie(e),options:[e,t]});var Mie="Arrow",w7=f.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...i}=e;return s.jsx(ms.svg,{...i,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});w7.displayName=Mie;var $ie=w7;function LN(e){const[t,n]=f.useState(void 0);return ea(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var xT="Popper",[j7,Rd]=ua(xT),[Iie,N7]=j7(xT),C7=e=>{const{__scopePopper:t,children:n}=e,[r,a]=f.useState(null);return s.jsx(Iie,{scope:t,anchor:r,onAnchorChange:a,children:n})};C7.displayName=xT;var S7="PopperAnchor",k7=f.forwardRef((e,t)=>
vendor: 4,726 bytes, line 563
563{const{__scopePopper:n,virtualRef:r,...a}=e,i=N7(S7,n),o=f.useRef(null),l=Us(t,o),c=f.useRef(null);return f.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||o.current,d!==c.current&&i.onAnchorChange(c.current)}),r?null:s.jsx(ms.div,{...a,ref:l})});k7.displayName=S7;var gT="PopperContent",[Rie,Bie]=j7(gT),P7=f.forwardRef((e,t)=>{var M,se,Q,te,G,Z;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:m=0,sticky:u="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:v,...y}=e,g=N7(gT,n),[x,b]=f.useState(null),w=Us(t,ie=>b(ie)),[j,N]=f.useState(null),C=LN(j),P=(C==null?void 0:C.width)??0,S=(C==null?void 0:C.height)??0,E=r+(i!=="center"?"-"+i:""),T=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},z=Array.isArray(d)?d:[d],O=z.length>0,D={padding:T,boundary:z.filter(Uie),altBoundary:O},{refs:k,floatingStyles:F,placement:W,isPositioned:q,middlewareData:H}=kie({strategy:"fixed",placement:E,whileElementsMounted:(...ie)=>xie(...ie,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[Eie({mainAxis:a+S,alignmentAxis:o}),c&&Die({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Aie():void 0,...D}),c&&Tie({...D}),Oie({...D,apply:({elements:ie,rects:A,availableWidth:ge,availableHeight:je})=>{const{width:ke,height:Ie}=A.reference,$e=ie.floating.style;$e.setProperty("--radix-popper-available-width",`${ge}px`),$e.setProperty("--radix-popper-available-height",`${je}px`),$e.setProperty("--radix-popper-anchor-width",`${ke}px`),$e.setProperty("--radix-popper-anchor-height",`${Ie}px`)}}),j&&_ie({element:j,padding:l}),zie({arrowWidth:P,arrowHeight:S}),h&&Fie({strategy:"referenceHidden",...D})]}),[_,L]=A7(W),U=Za(v);ea(()=>{q&&(U==null||U())},[q,U]);const J=(M=H.arrow)==null?void 0:M.x,I=(se=H.arrow)==null?void 0:se.y,re=((Q=H.arrow)==null?void 0:Q.centerOffset)!==0,[R,Y]=f.useState();return ea(()=>{x&&Y(window.getComputedStyle(x).zIndex)},[x]),s.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:q?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(te=H.transformOrigin)==null?void 0:te.x,(G=H.transformOrigin)==null?void 0:G.y].join(" "),...((Z=H.hide)==null?void 0:Z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(Rie,{scope:n,placedSide:_,onArrowChange:N,arrowX:J,arrowY:I,shouldHideArrow:re,children:s.jsx(ms.div,{"data-side":_,"data-align":L,...y,ref:w,style:{...y.style,animation:q?void 0:"none"}})})})});P7.displayName=gT;var E7="PopperArrow",Lie={top:"bottom",right:"left",bottom:"top",left:"right"},D7=f.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,i=Bie(E7,r),o=Lie[i.placedSide];return s.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:s.jsx($ie,{...a,ref:n,style:{...a.style,display:"block"}})})});D7.displayName=E7;function Uie(e){return e!==null}var zie=e=>({name:"transformOrigin",options:e,fn(t){var g,x,b;const{placement:n,rects:r,middlewareData:a}=t,o=((g=a.arrow)==null?void 0:g.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,m]=A7(n),u={start:"0%",center:"50%",end:"100%"}[m],h=(((x=a.arrow)==null?void 0:x.x)??0)+l/2,p=(((b=a.arrow)==null?void 0:b.y)??0)+c/2;let v="",y="";return d==="bottom"?(v=o?u:`${h}px`,y=`${-c}px`):d==="top"?(v=o?u:`${h}px`,y=`${r.floating.height+c}px`):d==="right"?(v=`${-c}px`,y=o?u:`${p}px`):d==="left"&&(v=`${r.floating.width+c}px`,y=o?u:`${p}px`),{data:{x:v,y}}}});function A7(e){const[t,n="center"]=e.split("-");return[t,n]}var UN=C7,cv=k7,zN=P7,qN=D7,qie=Symbol("radix.slottable");function Wie(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=qie,t}var[WN]=ua("Tooltip",[Rd]),HN=Rd(),T7="TooltipProvider",Hie=700,tP="tooltip.open",[Vie,yT]=WN(T7),O7=e=>{const{__scopeTooltip:t,delayDuration:n=Hie,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:i}=e,o=f.useRef(!0),l=f.useRef(!1),c=f.useRef(0);return f.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),s.jsx(Vie,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:f.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:f.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>
vendor: 5,071 bytes, line 563
563o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:f.useCallback(d=>{l.current=d},[]),disableHoverableContent:a,children:i})};O7.displayName=T7;var kg="Tooltip",[Kie,VN]=WN(kg),F7=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=e,c=yT(kg,e.__scopeTooltip),d=HN(t),[m,u]=f.useState(null),h=pi(),p=f.useRef(0),v=o??c.disableHoverableContent,y=l??c.delayDuration,g=f.useRef(!1),[x,b]=yi({prop:r,defaultProp:a??!1,onChange:P=>{P?(c.onOpen(),document.dispatchEvent(new CustomEvent(tP))):c.onClose(),i==null||i(P)},caller:kg}),w=f.useMemo(()=>x?g.current?"delayed-open":"instant-open":"closed",[x]),j=f.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,b(!0)},[b]),N=f.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),C=f.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,b(!0),p.current=0},y)},[y,b]);return f.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),s.jsx(UN,{...d,children:s.jsx(Kie,{scope:t,contentId:h,open:x,stateAttribute:w,trigger:m,onTriggerChange:u,onTriggerEnter:f.useCallback(()=>{c.isOpenDelayedRef.current?C():j()},[c.isOpenDelayedRef,C,j]),onTriggerLeave:f.useCallback(()=>{v?N():(window.clearTimeout(p.current),p.current=0)},[N,v]),onOpen:j,onClose:N,disableHoverableContent:v,children:n})})};F7.displayName=kg;var sP="TooltipTrigger",_7=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=VN(sP,n),i=yT(sP,n),o=HN(n),l=f.useRef(null),c=Us(t,l,a.onTriggerChange),d=f.useRef(!1),m=f.useRef(!1),u=f.useCallback(()=>d.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",u),[u]),s.jsx(cv,{asChild:!0,...o,children:s.jsx(ms.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:c,onPointerMove:At(e.onPointerMove,h=>{h.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),m.current=!0)}),onPointerLeave:At(e.onPointerLeave,()=>{a.onTriggerLeave(),m.current=!1}),onPointerDown:At(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",u,{once:!0})}),onFocus:At(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:At(e.onBlur,a.onClose),onClick:At(e.onClick,a.onClose)})})});_7.displayName=sP;var Gie="TooltipPortal",[RVe,Yie]=WN(Gie,{forceMount:void 0}),Mf="TooltipContent",M7=f.forwardRef((e,t)=>{const n=Yie(Mf,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...i}=e,o=VN(Mf,e.__scopeTooltip);return s.jsx(Na,{present:r||o.open,children:o.disableHoverableContent?s.jsx($7,{side:a,...i,ref:t}):s.jsx(Qie,{side:a,...i,ref:t})})}),Qie=f.forwardRef((e,t)=>{const n=VN(Mf,e.__scopeTooltip),r=yT(Mf,e.__scopeTooltip),a=f.useRef(null),i=Us(t,a),[o,l]=f.useState(null),{trigger:c,onClose:d}=n,m=a.current,{onPointerInTransitChange:u}=r,h=f.useCallback(()=>{l(null),u(!1)},[u]),p=f.useCallback((v,y)=>{const g=v.currentTarget,x={x:v.clientX,y:v.clientY},b=toe(x,g.getBoundingClientRect()),w=soe(x,b),j=noe(y.getBoundingClientRect()),N=aoe([...w,...j]);l(N),u(!0)},[u]);return f.useEffect(()=>()=>h(),[h]),f.useEffect(()=>{if(c&&m){const v=g=>p(g,m),y=g=>p(g,c);return c.addEventListener("pointerleave",v),m.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",v),m.removeEventListener("pointerleave",y)}}},[c,m,p,h]),f.useEffect(()=>{if(o){const v=y=>{const g=y.target,x={x:y.clientX,y:y.clientY},b=(c==null?void 0:c.contains(g))||(m==null?void 0:m.contains(g)),w=!roe(x,o);b?h():w&&(h(),d())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,m,o,d,h]),s.jsx($7,{...e,ref:i})}),[Jie,Xie]=WN(kg,{isInside:!1}),Zie=Wie("TooltipContent"),$7=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=VN(Mf,n),d=HN(n),{onClose:m}=c;return f.useEffect(()=>(document.addEventListener(tP,m),()=>document.removeEventListener(tP,m)),[m]),f.useEffect(()=>{if(c.trigger){const u=h=>{const p=h.target;p!=null&&p.contains(c.trigger)&&m()};return window.addEventListener("scroll",u,{capture:!0}),()=>window.removeEventListener("scroll",u,{capture:!0})}},[c.trigger,m]),s.jsx(Pm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:u=>u.preventDefault(),onDismiss:m,children:s.jsxs(zN,{"data-state":c.stateAttribute,...d,...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:[s.jsx(Zie,{children:r}),s.jsx(Jie,{scope:n,isInside:!0,children:s.jsx(Xne,{id:c.contentId,role:"tooltip",children:a||r})})]})})});M7.displayName=Mf;var I7="TooltipArrow",eoe=f.forwardRef((e,t)=>
563{const{__scopeTooltip:n,...r}=e,a=HN(n);return Xie(I7,n).isInside?null:s.jsx(qN,{...a,...r,ref:t})});eoe.displayName=I7;function toe(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,a,i)){case i:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function soe(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function noe(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function roe(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],d=l.x,m=l.y,u=c.x,h=c.y;m>r!=h>r&&n<(u-d)*(r-m)/(h-m)+d&&(a=!a)}return a}function aoe(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),ioe(t)}function ioe(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const a=e[r];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(a.y-o.y)>=(i.y-o.y)*(a.x-o.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(a.y-o.y)>=(i.y-o.y)*(a.x-o.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var ooe=O7,loe=F7,coe=_7,R7=M7;const doe=ooe,vT=loe,bT=coe,KN=f.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(R7,{ref:r,sideOffset:t,className:bt("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 origin-[--radix-tooltip-content-transform-origin]",e),...n}));KN.displayName=R7.displayName;var uoe=typeof Element<"u",moe=typeof Map=="function",hoe=typeof Set=="function",foe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Sb(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,a;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Sb(e[r],t[r]))return!1;return!0}var i;if(moe&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i=e.entries();!(r=i.next()).done;)if(!t.has(r.value[0]))return!1;for(i=e.entries();!(r=i.next()).done;)if(!Sb(r.value[1],t.get(r.value[0])))return!1;return!0}if(hoe&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i=e.entries();!(r=i.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(foe&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])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(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,a[r]))return!1;if(uoe&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((a[r]==="_owner"||a[r]==="__v"||a[r]==="__o")&&e.$$typeof)&&!Sb(e[a[r]],t[a[r]]))return!1;return!0}return e!==e&&t!==t}var poe=function(t,n){try{return Sb(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const xoe=Qs(poe);var goe=function(e,t,n,r,a,i,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 d=[n,r,a,i,o,l],m=0;c=new Error(t.replace(/%s/g,function(){return d[m++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}},yoe=goe;const $M=Qs(yoe);var voe=function(t,n,r,a){var i=r?r.call(a,t,n):void 0;if(i!==void 0)return!!i;if(t===n)return!0;
563if(typeof t!="object"||!t||typeof n!="object"||!n)return!1;var o=Object.keys(t),l=Object.keys(n);if(o.length!==l.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(n),d=0;d<o.length;d++){var m=o[d];if(!c(m))return!1;var u=t[m],h=n[m];if(i=r?r.call(a,u,h,m):void 0,i===!1||i===void 0&&u!==h)return!1}return!0};const boe=Qs(voe);var B7=(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))(B7||{}),oS={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"]}},IM=Object.values(B7),wT={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},woe=Object.entries(wT).reduce((e,[t,n])=>(e[n]=t,e),{}),Ao="data-rh",Th={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},Oh=(e,t)=>{for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(Object.prototype.hasOwnProperty.call(r,t))return r[t]}return null},joe=e=>{let t=Oh(e,"title");const n=Oh(e,Th.TITLE_TEMPLATE);if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,()=>t);const r=Oh(e,Th.DEFAULT_TITLE);return t||r||void 0},Noe=e=>Oh(e,Th.ON_CHANGE_CLIENT_STATE)||(()=>{}),lS=(e,t)=>t.filter(n=>typeof n[e]<"u").map(n=>n[e]).reduce((n,r)=>({...n,...r}),{}),Coe=(e,t)=>t.filter(n=>typeof n.base<"u").map(n=>n.base).reverse().reduce((n,r)=>{if(!n.length){const a=Object.keys(r);for(let i=0;i<a.length;i+=1){const l=a[i].toLowerCase();if(e.indexOf(l)!==-1&&r[l])return n.concat(r)}}return n},[]),Soe=e=>console&&typeof console.warn=="function"&&console.warn(e),Yp=(e,t,n)=>{const r={};return n.filter(a=>Array.isArray(a[e])?!0:(typeof a[e]<"u"&&Soe(`Helmet: ${e} should be of type "Array". Instead found type "${typeof a[e]}"`),!1)).map(a=>a[e]).reverse().reduce((a,i)=>{const o={};i.filter(c=>{let d;const m=Object.keys(c);for(let h=0;h<m.length;h+=1){const p=m[h],v=p.toLowerCase();t.indexOf(v)!==-1&&!(d==="rel"&&c[d].toLowerCase()==="canonical")&&!(v==="rel"&&c[v].toLowerCase()==="stylesheet")&&(d=v),t.indexOf(p)!==-1&&(p==="innerHTML"||p==="cssText"||p==="itemprop")&&(d=p)}if(!d||!c[d])return!1;const u=c[d].toLowerCase();return r[d]||(r[d]={}),o[d]||(o[d]={}),r[d][u]?!1:(o[d][u]=!0,!0)}).reverse().forEach(c=>a.push(c));const l=Object.keys(o);for(let c=0;c<l.length;c+=1){const d=l[c],m={...r[d],...o[d]};r[d]=m}return a},[]).reverse()},koe=(e,t)=>{if(Array.isArray(e)&&e.length){for(let n=0;n<e.length;n+=1)if(e[n][t])return!0}return!1},Poe=e=>({baseTag:Coe(["href"],e),bodyAttributes:lS("bodyAttributes",e),defer:Oh(e,Th.DEFER),encode:Oh(e,Th.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:lS("htmlAttributes",e),linkTags:Yp("link",["rel","href"],e),metaTags:Yp("meta",["name","charset","http-equiv","property","itemprop"],e),noscriptTags:Yp("noscript",["innerHTML"],e),onChangeClientState:Noe(e),scriptTags:Yp("script",["src","innerHTML"],e),styleTags:Yp("style",["cssText"],e),title:joe(e),titleAttributes:lS("titleAttributes",e),prioritizeSeoTags:koe(e,Th.PRIORITIZE_SEO_TAGS)}),L7=e=>Array.isArray(e)?e.join(""):e,Eoe=(e,t)=>{const n=Object.keys(e);for(let r=0;r<n.length;r+=1)if(t[n[r]]&&t[n[r]].includes(e[n[r]]))return!0;return!1},cS=(e,t)=>Array.isArray(e)?e.reduce((n,r)=>(Eoe(r,t)?n.priority.push(r):n.default.push(r),n),{priority:[],default:[]}):{default:e,priority:[]},RM=(e,t)=>({...e,[t]:void 0}),Doe=["noscript","script","style"],nP=(e,t=!0)=>t===!1?String(e):String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;"),U7=e=>Object.keys(e).reduce((t,n)=>{const r=typeof e[n]<"u"?`${n}="${e[n]}"`:`${n}`;return t?`${t} ${r}`:r},""),Aoe=(e,t,n,r)=>{const a=U7(n),i=L7(t);return a?`<${e} ${Ao}="true" ${a}>${nP(i,r)}</${e}>`:`<${e} ${Ao}="true">${nP(i,r)}</${e}>`},Toe=(e,t,n=!0)=>t.reduce((r,a)=>{const i=a,o=Object.keys(i).filter(d=>!(d==="innerHTML"||d==="cssText")).reduce((d,m)=>{const u=typeof i[m]>"u"?m:`${m}="${nP(i[m],n)}"`;return d?`${d} ${u}`:u},""),l=i.innerHTML||i.cssText||"",c=Doe.indexOf(e)===-1;return`${r}<${e} ${Ao}="true" ${o}${c?"/>":`>${l}</${e}>`}`},""),z7=(e,t={})=>Object.keys(e).reduce((n,r)=>{const a=wT[r];return n[a||r]=e[r],n},t),Ooe=(e,t,n)=>{const r={key:t,[Ao]:!0},a=z7(n,r);return[he.createElement("title",a,t)]},kb=(e,t)=>
563t.map((n,r)=>{const a={key:r,[Ao]:!0};return Object.keys(n).forEach(i=>{const l=wT[i]||i;if(l==="innerHTML"||l==="cssText"){const c=n.innerHTML||n.cssText;a.dangerouslySetInnerHTML={__html:c}}else a[l]=n[i]}),he.createElement(e,a)}),_i=(e,t,n=!0)=>{switch(e){case"title":return{toComponent:()=>Ooe(e,t.title,t.titleAttributes),toString:()=>Aoe(e,t.title,t.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>z7(t),toString:()=>U7(t)};default:return{toComponent:()=>kb(e,t),toString:()=>Toe(e,t,n)}}},Foe=({metaTags:e,linkTags:t,scriptTags:n,encode:r})=>{const a=cS(e,oS.meta),i=cS(t,oS.link),o=cS(n,oS.script);return{priorityMethods:{toComponent:()=>[...kb("meta",a.priority),...kb("link",i.priority),...kb("script",o.priority)],toString:()=>`${_i("meta",a.priority,r)} ${_i("link",i.priority,r)} ${_i("script",o.priority,r)}`},metaTags:a.default,linkTags:i.default,scriptTags:o.default}},_oe=e=>{const{baseTag:t,bodyAttributes:n,encode:r=!0,htmlAttributes:a,noscriptTags:i,styleTags:o,title:l="",titleAttributes:c,prioritizeSeoTags:d}=e;let{linkTags:m,metaTags:u,scriptTags:h}=e,p={toComponent:()=>{},toString:()=>""};return d&&({priorityMethods:p,linkTags:m,metaTags:u,scriptTags:h}=Foe(e)),{priority:p,base:_i("base",t,r),bodyAttributes:_i("bodyAttributes",n,r),htmlAttributes:_i("htmlAttributes",a,r),link:_i("link",m,r),meta:_i("meta",u,r),noscript:_i("noscript",i,r),script:_i("script",h,r),style:_i("style",o,r),title:_i("title",{title:l,titleAttributes:c},r)}},rP=_oe,u0=[],q7=!!(typeof window<"u"&&window.document&&window.document.createElement),aP=class{constructor(e,t){Ge(this,"instances",[]);Ge(this,"canUseDOM",q7);Ge(this,"context");Ge(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?u0:this.instances,add:e=>{(this.canUseDOM?u0:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?u0:this.instances).indexOf(e);(this.canUseDOM?u0:this.instances).splice(t,1)}}});this.context=e,this.canUseDOM=t||!1,t||(e.helmet=rP({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},Moe={},W7=he.createContext(Moe),_u,H7=(_u=class extends f.Component{constructor(n){super(n);Ge(this,"helmetData");this.helmetData=new aP(this.props.context||{},_u.canUseDOM)}render(){return he.createElement(W7.Provider,{value:this.helmetData.value},this.props.children)}},Ge(_u,"canUseDOM",q7),_u),Im=(e,t)=>{const n=document.head||document.querySelector("head"),r=n.querySelectorAll(`${e}[${Ao}]`),a=[].slice.call(r),i=[];let o;return t&&t.length&&t.forEach(l=>{const c=document.createElement(e);for(const d in l)if(Object.prototype.hasOwnProperty.call(l,d))if(d==="innerHTML")c.innerHTML=l.innerHTML;else if(d==="cssText")c.styleSheet?c.styleSheet.cssText=l.cssText:c.appendChild(document.createTextNode(l.cssText));else{const m=d,u=typeof l[m]>"u"?"":l[m];c.setAttribute(d,u)}c.setAttribute(Ao,"true"),a.some((d,m)=>(o=m,c.isEqualNode(d)))?a.splice(o,1):i.push(c)}),a.forEach(l=>{var c;return(c=l.parentNode)==null?void 0:c.removeChild(l)}),i.forEach(l=>n.appendChild(l)),{oldTags:a,newTags:i}},iP=(e,t)=>{const n=document.getElementsByTagName(e)[0];if(!n)return;const r=n.getAttribute(Ao),a=r?r.split(","):[],i=[...a],o=Object.keys(t);for(const l of o){const c=t[l]||"";n.getAttribute(l)!==c&&n.setAttribute(l,c),a.indexOf(l)===-1&&a.push(l);const d=i.indexOf(l);d!==-1&&i.splice(d,1)}for(let l=i.length-1;l>=0;l-=1)n.removeAttribute(i[l]);a.length===i.length?n.removeAttribute(Ao):n.getAttribute(Ao)!==o.join(",")&&n.setAttribute(Ao,o.join(","))},$oe=(e,t)=>{typeof e<"u"&&document.title!==e&&(document.title=L7(e)),iP("title",t)},BM=(e,t)=>{const{baseTag:n,bodyAttributes:r,htmlAttributes:a,linkTags:i,metaTags:o,noscriptTags:l,onChangeClientState:c,scriptTags:d,styleTags:m,title:u,titleAttributes:h}=e;iP("body",r),iP("html",a),$oe(u,h);const p={baseTag:Im("base",n),linkTags:Im("link",i),metaTags:Im("meta",o),noscriptTags:Im("noscript",l),scriptTags:Im("script",d),styleTags:Im("style",m)},v={},y={};Object.keys(p).forEach(g=>{const{newTags:x,oldTags:b}=p[g];x.length&&(v[g]=x),b.length&&(y[g]=p[g].oldTags)}),t&&t(),c(e,v,y)},Qp=null,Ioe=e=>
563{Qp&&cancelAnimationFrame(Qp),e.defer?Qp=requestAnimationFrame(()=>{BM(e,()=>{Qp=null})}):(BM(e),Qp=null)},Roe=Ioe,LM=class extends f.Component{constructor(){super(...arguments);Ge(this,"rendered",!1)}shouldComponentUpdate(t){return!boe(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let r=null;const a=Poe(t.get().map(i=>{const o={...i.props};return delete o.context,o}));H7.canUseDOM?Roe(a):rP&&(r=rP(a)),n(r)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},Mk,zo=(Mk=class extends f.Component{shouldComponentUpdate(e){return!xoe(RM(this.props,"helmetData"),RM(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,n,r){return{...t,[e.type]:[...t[e.type]||[],{...n,...this.mapNestedChildrenToProps(e,r)}]}}mapObjectTypeChildren(e,t,n,r){switch(e.type){case"title":return{...t,[e.type]:r,titleAttributes:{...n}};case"body":return{...t,bodyAttributes:{...n}};case"html":return{...t,htmlAttributes:{...n}};default:return{...t,[e.type]:{...n}}}}mapArrayTypeChildrenToProps(e,t){let n={...t};return Object.keys(e).forEach(r=>{n={...n,[r]:e[r]}}),n}warnOnInvalidChildren(e,t){return $M(IM.some(n=>e.type===n),typeof e.type=="function"?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${IM.join(", ")} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`),$M(!t||typeof t=="string"||Array.isArray(t)&&!t.some(n=>typeof n!="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 n={};return he.Children.forEach(e,r=>{if(!r||!r.props)return;const{children:a,...i}=r.props,o=Object.keys(i).reduce((c,d)=>(c[woe[d]||d]=i[d],c),{});let{type:l}=r;
563switch(typeof l=="symbol"?l=l.toString():this.warnOnInvalidChildren(r,a),l){case"Symbol(react.fragment)":t=this.mapChildrenToProps(a,t);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(r,n,o,a);break;default:t=this.mapObjectTypeChildren(r,t,o,a);break}}),this.mapArrayTypeChildrenToProps(n,t)}render(){const{children:e,...t}=this.props;let n={...t},{helmetData:r}=t;if(e&&(n=this.mapChildrenToProps(e,n)),r&&!(r instanceof aP)){const a=r;r=new aP(a.context,!0),delete n.helmetData}return r?he.createElement(LM,{...n,context:r.value}):he.createElement(W7.Consumer,null,a=>he.createElement(LM,{...n,context:a}))}},Ge(Mk,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),Mk),Boe=Symbol.for("react.lazy"),bw=mN[" use ".trim().toString()];function Loe(e){return typeof e=="object"&&e!==null&&"then"in e}function V7(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Boe&&"_payload"in e&&Loe(e._payload)}function K7(e){const t=zoe(e),n=f.forwardRef((r,a)=>{let{children:i,...o}=r;V7(i)&&typeof bw=="function"&&(i=bw(i._payload));const l=f.Children.toArray(i),c=l.find(Woe);if(c){const d=c.props.children,m=l.map(u=>u===c?f.Children.count(d)>1?f.Children.only(null):f.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...o,ref:a,children:f.isValidElement(d)?f.cloneElement(d,void 0,m):null})}return s.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}var Uoe=K7("Slot");function zoe(e){const t=f.forwardRef((n,r)=>{let{children:a,...i}=n;if(V7(a)&&typeof bw=="function"&&(a=bw(a._payload)),f.isValidElement(a)){const o=Voe(a),l=Hoe(i,a.props);return a.type!==f.Fragment&&(l.ref=r?Pl(r,o):o),f.cloneElement(a,l)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qoe=Symbol("radix.slottable");function Woe(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qoe}function Hoe(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function Voe(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const jT=ov("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"}}),B=f.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...a},i)=>{const o=r?Uoe:"button";return s.jsx(o,{className:bt(jT({variant:t,size:n,className:e})),ref:i,...a})});B.displayName="Button";const me=f.forwardRef(({className:e,type:t,...n},r)=>s.jsx("input",{type:t,className:bt("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:r,...n}));me.displayName="Input";var Koe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Goe=Koe.reduce((e,t)=>
vendor: 4,842 bytes, line 563
563{const n=K7(`Primitive.${t}`),r=f.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Yoe="Label",G7=f.forwardRef((e,t)=>s.jsx(Goe.label,{...e,ref:t,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));G7.displayName=Yoe;var Y7=G7;const Qoe=ov("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),V=f.forwardRef(({className:e,...t},n)=>s.jsx(Y7,{ref:n,className:bt(Qoe(),e),...t}));V.displayName=Y7.displayName;const Is=f.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:bt("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background 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,...t}));Is.displayName="Textarea";var dS="focusScope.autoFocusOnMount",uS="focusScope.autoFocusOnUnmount",UM={bubbles:!1,cancelable:!0},Joe="FocusScope",dv=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=e,[l,c]=f.useState(null),d=Za(a),m=Za(i),u=f.useRef(null),h=Us(t,y=>c(y)),p=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(r){let y=function(w){if(p.paused||!l)return;const j=w.target;l.contains(j)?u.current=j:Fc(u.current,{select:!0})},g=function(w){if(p.paused||!l)return;const j=w.relatedTarget;j!==null&&(l.contains(j)||Fc(u.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const N of w)N.removedNodes.length>0&&Fc(l)};document.addEventListener("focusin",y),document.addEventListener("focusout",g);const b=new MutationObserver(x);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",g),b.disconnect()}}},[r,l,p.paused]),f.useEffect(()=>{if(l){qM.add(p);const y=document.activeElement;if(!l.contains(y)){const x=new CustomEvent(dS,UM);l.addEventListener(dS,d),l.dispatchEvent(x),x.defaultPrevented||(Xoe(nle(Q7(l)),{select:!0}),document.activeElement===y&&Fc(l))}return()=>{l.removeEventListener(dS,d),setTimeout(()=>{const x=new CustomEvent(uS,UM);l.addEventListener(uS,m),l.dispatchEvent(x),x.defaultPrevented||Fc(y??document.body,{select:!0}),l.removeEventListener(uS,m),qM.remove(p)},0)}}},[l,d,m,p]);const v=f.useCallback(y=>{if(!n&&!r||p.paused)return;const g=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,x=document.activeElement;if(g&&x){const b=y.currentTarget,[w,j]=Zoe(b);w&&j?!y.shiftKey&&x===j?(y.preventDefault(),n&&Fc(w,{select:!0})):y.shiftKey&&x===w&&(y.preventDefault(),n&&Fc(j,{select:!0})):x===b&&y.preventDefault()}},[n,r,p.paused]);return s.jsx(ms.div,{tabIndex:-1,...o,ref:h,onKeyDown:v})});dv.displayName=Joe;function Xoe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Fc(r,{select:t}),document.activeElement!==n)return}function Zoe(e){const t=Q7(e),n=zM(t,e),r=zM(t.reverse(),e);return[n,r]}function Q7(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function zM(e,t){for(const n of e)if(!ele(n,{upTo:t}))return n}function ele(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 tle(e){return e instanceof HTMLInputElement&&"select"in e}function Fc(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&tle(e)&&t&&e.select()}}var qM=sle();function sle(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=WM(e,t),e.unshift(t)},remove(t){var n;e=WM(e,t),(n=e[0])==null||n.resume()}}}function WM(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function nle(e){return e.filter(t=>t.tagName!=="A")}var mS=0;function GN(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??HM()),document.body.insertAdjacentElement("beforeend",e[1]??HM()),mS++,()=>{mS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),mS--}},[])}function HM(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.
vendor: 5,687 bytes, lines 563-578
563style.position="fixed",e.style.pointerEvents="none",e}var hl=function(){return hl=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},hl.apply(this,arguments)};function J7(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function rle(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,i;r<a;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Pb="right-scroll-bar-position",Eb="width-before-scroll-bar",ale="with-scroll-bars-hidden",ile="--removed-body-scroll-bar-size";function hS(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ole(e,t){var n=f.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var lle=typeof window<"u"?f.useLayoutEffect:f.useEffect,VM=new WeakMap;function cle(e,t){var n=ole(null,function(r){return e.forEach(function(a){return hS(a,r)})});return lle(function(){var r=VM.get(n);if(r){var a=new Set(r),i=new Set(e),o=n.current;a.forEach(function(l){i.has(l)||hS(l,null)}),i.forEach(function(l){a.has(l)||hS(l,o)})}VM.set(n,e)},[e]),n}function dle(e){return e}function ule(e,t){t===void 0&&(t=dle);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var c=function(){var m=o;o=[],m.forEach(i)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(m){o.push(m),d()},filter:function(m){return o=o.filter(m),n}}}};return a}function mle(e){e===void 0&&(e={});var t=ule(null);return t.options=hl({async:!0,ssr:!1},e),t}var X7=function(e){var t=e.sideCar,n=J7(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return f.createElement(r,hl({},n))};X7.isSideCarExport=!0;function hle(e,t){return e.useMedium(t),X7}var Z7=mle(),fS=function(){},YN=f.forwardRef(function(e,t){var n=f.useRef(null),r=f.useState({onScrollCapture:fS,onWheelCapture:fS,onTouchMoveCapture:fS}),a=r[0],i=r[1],o=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,m=e.enabled,u=e.shards,h=e.sideCar,p=e.noRelative,v=e.noIsolation,y=e.inert,g=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,j=J7(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=h,C=cle([n,t]),P=hl(hl({},j),a);return f.createElement(f.Fragment,null,m&&f.createElement(N,{sideCar:Z7,removeScrollBar:d,shards:u,noRelative:p,noIsolation:v,inert:y,setCallbacks:i,allowPinchZoom:!!g,lockRef:n,gapMode:w}),o?f.cloneElement(f.Children.only(l),hl(hl({},P),{ref:C})):f.createElement(b,hl({},P,{className:c,ref:C}),l))});YN.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};YN.classNames={fullWidth:Eb,zeroRight:Pb};var fle=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function ple(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=fle();return t&&e.setAttribute("nonce",t),e}function xle(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function gle(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var yle=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ple())&&(xle(t,n),gle(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},vle=function(){var e=yle();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ez=function(){var e=vle(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},ble={left:0,top:0,right:0,gap:0},pS=function(e){return parseInt(e||"",10)||0},wle=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[pS(n),pS(r),pS(a)]},jle=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return ble;var t=wle(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Nle=ez(),Fh="data-scroll-locked",Cle=function(e,t,n,r){var a=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
564  .`.concat(ale,` {
565   overflow: hidden `).concat(r,`;
566   padding-right: `).concat(l,"px ").concat(r,`;
567  }
568  body[`).concat(Fh,`] {
569    overflow: hidden `).concat(r,`;
570    overscroll-behavior: contain;
571    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
572    padding-left: `.concat(a,`px;
573    padding-top: `).concat(i,`px;
574    padding-right: `).concat(o,`px;
575    margin-left:0;
576    margin-top:0;
577    margin-right: `).concat(l,"px ").concat(r,`;
578    `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";
578")].filter(Boolean).join(""),`
579  }
580  
581  .`).concat(Pb,` {
582    right: `).concat(l,"px ").concat(r,`;
583  }
584  
585  .`).concat(Eb,` {
586    margin-right: `).concat(l,"px ").concat(r,`;
587  }
588  
589  .`).concat(Pb," .").concat(Pb,` {
590    right: 0 `).concat(r,`;
591  }
592  
593  .`).concat(Eb," .").concat(Eb,` {
594    margin-right: 0 `).concat(r,`;
595  }
596  
597  body[`).concat(Fh,`] {
598    `).concat(ile,": ").concat(l,`px;
599  }
600`)},KM=function(){var e=parseInt(document.body.getAttribute(Fh)||"0",10);return isFinite(e)?e:0},Sle=function(){f.useEffect(function(){return document.body.setAttribute(Fh,(KM()+1).toString()),function(){var e=KM()-1;e<=0?document.body.removeAttribute(Fh):document.body.setAttribute(Fh,e.toString())}},[])},kle=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;Sle();var i=f.useMemo(function(){return jle(a)},[a]);return f.createElement(Nle,{styles:Cle(i,!t,a,n?"":"!important")})},oP=!1;if(typeof window<"u")try{var m0=Object.defineProperty({},"passive",{get:function(){return oP=!0,!0}});window.addEventListener("test",m0,m0),window.removeEventListener("test",m0,m0)}catch{oP=!1}var Rm=oP?{passive:!1}:!1,Ple=function(e){return e.tagName==="TEXTAREA"},tz=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Ple(e)&&n[t]==="visible")},Ele=function(e){return tz(e,"overflowY")},Dle=function(e){return tz(e,"overflowX")},GM=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=sz(e,r);if(a){var i=nz(e,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ale=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Tle=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},sz=function(e,t){return e==="v"?Ele(t):Dle(t)},nz=function(e,t){return e==="v"?Ale(t):Tle(t)},Ole=function(e,t){return e==="h"&&t==="rtl"?-1:1},Fle=function(e,t,n,r,a){var i=Ole(e,window.getComputedStyle(t).direction),o=i*r,l=n.target,c=t.contains(l),d=!1,m=o>0,u=0,h=0;do{if(!l)break;var p=nz(e,l),v=p[0],y=p[1],g=p[2],x=y-g-i*v;(v||x)&&sz(e,l)&&(u+=x,h+=v);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(m&&Math.abs(u)<1||!m&&Math.abs(h)<1)&&(d=!0),d},h0=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},YM=function(e){return[e.deltaX,e.deltaY]},QM=function(e){return e&&"current"in e?e.current:e},_le=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Mle=function(e){return`
601  .block-interactivity-`.concat(e,` {pointer-events: none;}
602  .allow-interactivity-`).concat(e,` {pointer-events: all;}
603`)},$le=0,Bm=[];function Ile(e){var t=f.useRef([]),n=f.useRef([0,0]),r=f.useRef(),a=f.useState($le++)[0],i=f.useState(ez)[0],o=f.useRef(e);f.useEffect(function(){o.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var y=rle([e.lockRef.current],(e.shards||[]).map(QM),!0).filter(Boolean);return y.forEach(function(g){return g.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),y.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=f.useCallback(function(y,g){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!o.current.allowPinchZoom;var x=h0(y),b=n.current,w="deltaX"in y?y.deltaX:b[0]-x[0],j="deltaY"in y?y.deltaY:b[1]-x[1],N,C=y.target,P=Math.abs(w)>Math.abs(j)?"h":"v";if("touches"in y&&P==="h"&&C.type==="range")return!1;var S=window.getSelection(),E=S&&S.anchorNode,T=E?E===C||E.contains(C):!1;if(T)return!1;var z=GM(P,C);if(!z)return!0;if(z?N=P:(N=P==="v"?"h":"v",z=GM(P,C)),!z)return!1;if(!r.current&&"changedTouches"in y&&(w||j)&&(r.current=N),!N)return!0;var O=r.current||N;return Fle(O,g,y,O==="h"?w:j)},[]),c=f.useCallback(function(y){var g=y;if(!(!Bm.length||Bm[Bm.length-1]!==i)){var x="deltaY"in g?YM(g):h0(g),b=t.current.filter(function(N){return N.name===g.type&&(N.target===g.target||g.target===N.shadowParent)&&_le(N.delta,x)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}
vendor: 9,640 bytes, lines 603-607
603if(!b){var w=(o.current.shards||[]).map(QM).filter(Boolean).filter(function(N){return N.contains(g.target)}),j=w.length>0?l(g,w[0]):!o.current.noIsolation;j&&g.cancelable&&g.preventDefault()}}},[]),d=f.useCallback(function(y,g,x,b){var w={name:y,delta:g,target:x,should:b,shadowParent:Rle(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(j){return j!==w})},1)},[]),m=f.useCallback(function(y){n.current=h0(y),r.current=void 0},[]),u=f.useCallback(function(y){d(y.type,YM(y),y.target,l(y,e.lockRef.current))},[]),h=f.useCallback(function(y){d(y.type,h0(y),y.target,l(y,e.lockRef.current))},[]);f.useEffect(function(){return Bm.push(i),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Rm),document.addEventListener("touchmove",c,Rm),document.addEventListener("touchstart",m,Rm),function(){Bm=Bm.filter(function(y){return y!==i}),document.removeEventListener("wheel",c,Rm),document.removeEventListener("touchmove",c,Rm),document.removeEventListener("touchstart",m,Rm)}},[]);var p=e.removeScrollBar,v=e.inert;return f.createElement(f.Fragment,null,v?f.createElement(i,{styles:Mle(a)}):null,p?f.createElement(kle,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Rle(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Ble=hle(Z7,Ile);var uv=f.forwardRef(function(e,t){return f.createElement(YN,hl({},e,{ref:t,sideCar:Ble}))});uv.classNames=YN.classNames;var Lle=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Lm=new WeakMap,f0=new WeakMap,p0={},xS=0,rz=function(e){return e&&(e.host||rz(e.parentNode))},Ule=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=rz(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},zle=function(e,t,n,r){var a=Ule(t,Array.isArray(e)?e:[e]);p0[n]||(p0[n]=new WeakMap);var i=p0[n],o=[],l=new Set,c=new Set(a),d=function(u){!u||l.has(u)||(l.add(u),d(u.parentNode))};a.forEach(d);var m=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(h){if(l.has(h))m(h);else try{var p=h.getAttribute(r),v=p!==null&&p!=="false",y=(Lm.get(h)||0)+1,g=(i.get(h)||0)+1;Lm.set(h,y),i.set(h,g),o.push(h),y===1&&v&&f0.set(h,!0),g===1&&h.setAttribute(n,"true"),v||h.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",h,x)}})};return m(t),l.clear(),xS++,function(){o.forEach(function(u){var h=Lm.get(u)-1,p=i.get(u)-1;Lm.set(u,h),i.set(u,p),h||(f0.has(u)||u.removeAttribute(r),f0.delete(u)),p||u.removeAttribute(n)}),xS--,xS||(Lm=new WeakMap,Lm=new WeakMap,f0=new WeakMap,p0={})}},QN=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=Lle(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),zle(r,a,n,"aria-hidden")):function(){return null}};function qle(e){const t=Wle(e),n=f.forwardRef((r,a)=>{const{children:i,...o}=r,l=f.Children.toArray(i),c=l.find(Vle);if(c){const d=c.props.children,m=l.map(u=>u===c?f.Children.count(d)>1?f.Children.only(null):f.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...o,ref:a,children:f.isValidElement(d)?f.cloneElement(d,void 0,m):null})}return s.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function Wle(e){const t=f.forwardRef((n,r)=>{const{children:a,...i}=n;if(f.isValidElement(a)){const o=Gle(a),l=Kle(i,a.props);return a.type!==f.Fragment&&(l.ref=r?Pl(r,o):o),f.cloneElement(a,l)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Hle=Symbol("radix.slottable");function Vle(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Hle}function Kle(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function Gle(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var JN="Dialog",[az,iz]=ua(JN),[Yle,qo]=az(JN),oz=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!0}=e,l=f.useRef(null),c=f.useRef(null),[d,m]=yi({prop:r,defaultProp:a??!1,onChange:i,caller:JN});return s.jsx(Yle,{scope:t,triggerRef:l,contentRef:c,contentId:pi(),titleId:pi(),descriptionId:pi(),open:d,onOpenChange:m,onOpenToggle:f.useCallback(()=>m(u=>!u),[m]),modal:o,children:n})};oz.displayName=JN;var lz="DialogTrigger",cz=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=qo(lz,n),i=Us(t,a.triggerRef);return s.jsx(ms.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":ST(a.open),...r,ref:i,onClick:At(e.onClick,a.onOpenToggle)})});cz.displayName=lz;var NT="DialogPortal",[Qle,dz]=az(NT,{forceMount:void 0}),uz=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,i=qo(NT,t);return s.jsx(Qle,{scope:t,forceMount:n,children:f.Children.map(r,o=>s.jsx(Na,{present:n||i.open,children:s.jsx(yp,{asChild:!0,container:a,children:o})}))})};uz.displayName=NT;var ww="DialogOverlay",mz=f.forwardRef((e,t)=>{const n=dz(ww,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=qo(ww,e.__scopeDialog);return i.modal?s.jsx(Na,{present:r||i.open,children:s.jsx(Xle,{...a,ref:t})}):null});mz.displayName=ww;var Jle=qle("DialogOverlay.RemoveScroll"),Xle=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=qo(ww,n);return s.jsx(uv,{as:Jle,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(ms.div,{"data-state":ST(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),hm="DialogContent",hz=f.forwardRef((e,t)=>{const n=dz(hm,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=qo(hm,e.__scopeDialog);return s.jsx(Na,{present:r||i.open,children:i.modal?s.jsx(Zle,{...a,ref:t}):s.jsx(ece,{...a,ref:t})})});hz.displayName=hm;var Zle=f.forwardRef((e,t)=>{const n=qo(hm,e.__scopeDialog),r=f.useRef(null),a=Us(t,n.contentRef,r);return f.useEffect(()=>{const i=r.current;if(i)return QN(i)},[]),s.jsx(fz,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:At(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:At(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:At(e.onFocusOutside,i=>i.preventDefault())})}),ece=f.forwardRef((e,t)=>{const n=qo(hm,e.__scopeDialog),r=f.useRef(!1),a=f.useRef(!1);return s.jsx(fz,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),fz=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=e,l=qo(hm,n),c=f.useRef(null),d=Us(t,c);return GN(),s.jsxs(s.Fragment,{children:[s.jsx(dv,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(Pm,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":ST(l.open),...o,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(sce,{titleId:l.titleId}),s.jsx(rce,{contentRef:c,descriptionId:l.descriptionId})]})]})}),CT="DialogTitle",pz=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=qo(CT,n);return s.jsx(ms.h2,{id:a.titleId,...r,ref:t})});pz.displayName=CT;var xz="DialogDescription",gz=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=qo(xz,n);return s.jsx(ms.p,{id:a.descriptionId,...r,ref:t})});gz.displayName=xz;var yz="DialogClose",vz=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=qo(yz,n);return s.jsx(ms.button,{type:"button",...r,ref:t,onClick:At(e.onClick,()=>a.onOpenChange(!1))})});vz.displayName=yz;function ST(e){return e?"open":"closed"}var bz="DialogTitleWarning",[tce,wz]=wne(bz,{contentName:hm,titleName:CT,docsSlug:"dialog"}),sce=({titleId:e})=>{const t=wz(bz),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
604
605If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
606
607For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return f.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},nce="DialogDescriptionWarning",rce=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wz(nce).contentName}}.`;return f.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},kT=oz,jz=cz,PT=uz,mv=mz,hv=hz,fv=pz,pv=gz,XN=vz;let qx=0,ace=new Set;function Nz(){return qx++,Cz(),qx}function jw(){return qx=Math.max(0,qx-1),Cz(),qx}
607function Cz(){ace.forEach(e=>e())}const Ct=({open:e,onOpenChange:t,...n})=>{const r=f.useRef(!1),a=f.useRef(e??!1);return f.useEffect(()=>{const i=e??!1,o=a.current;i!==o&&(i&&!o?Nz():!i&&o&&jw(),a.current=i,r.current=i)},[e]),f.useEffect(()=>()=>{r.current&&(jw(),r.current=!1)},[]),s.jsx(kT,{open:e,onOpenChange:t,...n})};Ct.displayName="Dialog";const Jr=jz,ice=PT,Sz=f.forwardRef(({className:e,...t},n)=>s.jsx(mv,{ref:n,className:bt("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}));Sz.displayName=mv.displayName;const St=f.forwardRef(({className:e,children:t,onInteractOutside:n,onPointerDownOutside:r,...a},i)=>{const o=()=>{var u;try{const h=window.Beacon;if(h&&typeof h=="function"){const p=h("info");return((u=p==null?void 0:p.status)==null?void 0:u.isOpened)||!1}}catch{}return!1},l=u=>{if(!u)return!1;let h=u,p=0;for(;h&&p<20;){const v=h.id||"",y=h.className||"",g=h.getAttribute("data-cy")||"";if(v.toLowerCase().includes("beacon")||y.toLowerCase().includes("beacon")||g.toLowerCase().includes("beacon"))return!0;h=h.parentElement,p++}return!1},c=u=>{var g,x;if(!u)return!1;const h=(g=u.closest)==null?void 0:g.call(u,"button");if(!h||((x=h.textContent)==null?void 0:x.trim())!=="Help")return!1;const v=h.getBoundingClientRect();return Math.abs(v.bottom-window.innerHeight)<5&&Math.abs(v.right-window.innerWidth)<5};f.useEffect(()=>{const u=h=>{var y;const p=h.target;if(o()){const g=h.clientX,x=h.clientY,b=document.querySelector('[id*="beacon"], [id*="Beacon"], [class*="beacon"], [class*="Beacon"]');let w=!1,j=null;if(b){const S=b.getBoundingClientRect();j={left:S.left,top:S.top,right:S.right,bottom:S.bottom,width:S.width,height:S.height},w=g>=S.left&&g<=S.right&&x>=S.top&&x<=S.bottom}const N=document.querySelector('[data-cy="beacon-close-button"], .c-BeaconCloseButton');let C=!1,P=null;if(N){const S=N.getBoundingClientRect();P={left:S.left,top:S.top,right:S.right,bottom:S.bottom,width:S.width,height:S.height},C=g>=S.left&&g<=S.right&&x>=S.top&&x<=S.bottom}if(console.log("[Dialog] Click detected while beacon is open:",{clickX:g,clickY:x,target:p.tagName,targetClasses:(y=p.className)==null?void 0:y.substring(0,100),beaconWidgetFound:!!b,beaconBounds:j,clickInBeacon:w,closeButtonFound:!!N,closeButtonBounds:P,clickInCloseButton:C}),C){console.log("[Dialog] ✅✅✅ Click is within beacon close button bounds!");const S=document.querySelectorAll('[data-state="open"]');let E=!1;for(const T of Array.from(S)){const z=T,O=window.getComputedStyle(z),D=z.className||"";if(O.position==="fixed"&&(D.includes("inset-0")||D.includes("bg-black"))){E=!0;break}}if(console.log("[Dialog] Dialog open?",E,'Overlays with data-state="open":',S.length),E){const T=window.Beacon;T&&typeof T=="function"&&(console.log("[Dialog] Dialog is open, manually closing beacon"),T("close"))}else console.log("[Dialog] No dialog open, letting HelpScout handle the close")}else w&&console.log("[Dialog] ⚠️ Click is within beacon widget but not on close button")}};return document.addEventListener("click",u,!0),document.addEventListener("mousedown",u,!0),()=>{document.removeEventListener("click",u,!0),document.removeEventListener("mousedown",u,!0)}},[]);const d=u=>{const h=u.target;if(c(h)){u.preventDefault();return}if(o()||l(h)){u.preventDefault();return}n&&n(u)},m=u=>{const h=u.target;if(c(h)){u.preventDefault();return}if(o()||l(h)){u.preventDefault();return}r&&r(u)};return s.jsxs(ice,{children:[s.jsx(Sz,{}),s.jsxs(hv,{ref:i,className:bt("fixed left-4 right-4 top-[50%] z-50 grid w-auto max-w-lg 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-top-[48%] data-[state=open]:slide-in-from-top-[48%] sm:left-[50%] sm:right-auto sm:w-full sm:translate-x-[-50%] sm:data-[state=closed]:slide-out-to-left-1/2 sm:data-[state=open]:slide-in-from-left-1/2 sm:rounded-lg",e),onInteractOutside:d,onPointerDownOutside:m,...a,children:[t,s.jsxs(XN,{className:"absolute right-4 top-4 roun
607ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[s.jsx(ja,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});St.displayName=hv.displayName;const kt=({className:e,...t})=>s.jsx("div",{className:bt("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});kt.displayName="DialogHeader";const Er=({className:e,...t})=>s.jsx("div",{className:bt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Er.displayName="DialogFooter";const Pt=f.forwardRef(({className:e,...t},n)=>s.jsx(fv,{ref:n,className:bt("text-lg font-semibold leading-none tracking-tight",e),...t}));Pt.displayName=fv.displayName;const yn=f.forwardRef(({className:e,...t},n)=>s.jsx(pv,{ref:n,className:bt("text-sm text-muted-foreground",e),...t}));yn.displayName=pv.displayName;function kz({isOpen:e,onClose:t}){const[n,r]=f.useState(!1),[a,i]=f.useState({name:"",email:"",subject:"",message:"",honeypot:""}),{toast:o}=Yt(),l=async d=>{if(d.preventDefault(),!a.honeypot){if(!a.name.trim()||!a.email.trim()||!a.message.trim()){o({title:"Please fill in all required fields",variant:"destructive"});return}r(!0);try{await Pe("POST","/api/contact",{name:a.name.trim(),email:a.email.trim(),subject:a.subject.trim()||"Contact Form Submission",message:a.message.trim()}),o({title:"Message sent successfully!",description:"Thank you for your feedback. We'll get back to you soon."}),i({name:"",email:"",subject:"",message:"",honeypot:""}),t()}catch{o({title:"Failed to send message",description:"Please try again later or contact us directly.",variant:"destructive"})}finally{r(!1)}}},c=(d,m)=>{i(u=>({...u,[d]:m}))};return s.jsx(Ct,{open:e,onOpenChange:t,children:s.jsxs(St,{className:"sm:max-w-md",children:[s.jsxs(kt,{children:[s.jsxs(Pt,{className:"flex items-center gap-2",children:[s.jsx(_n,{className:"h-5 w-5 text-primary"}),"Contact Us"]}),s.jsx(yn,{children:"Send us your feedback, questions, or suggestions. We'd love to hear from you!"})]}),s.jsxs("form",{onSubmit:l,className:"space-y-4",children:[s.jsx("input",{type:"text",name:"website",value:a.honeypot,onChange:d=>c("honeypot",d.target.value),style:{display:"none"},tabIndex:-1,autoComplete:"off"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"name",children:"Name *"}),s.jsx(me,{id:"name",type:"text",value:a.name,onChange:d=>c("name",d.target.value),placeholder:"Your name",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"email",children:"Email *"}),s.jsx(me,{id:"email",type:"email",value:a.email,onChange:d=>c("email",d.target.value),placeholder:"[email protected]",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"subject",children:"Subject"}),s.jsx(me,{id:"subject",type:"text",value:a.subject,onChange:d=>c("subject",d.target.value),placeholder:"What's this about?"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"message",children:"Message *"}),s.jsx(Is,{id:"message",value:a.message,onChange:d=>c("message",d.target.value),placeholder:"Tell us what's on your mind...",rows:4,required:!0})]}),s.jsxs("div",{className:"flex gap-3 pt-2",children:[s.jsx(B,{type:"button",variant:"outline",onClick:t,className:"flex-1",disabled:n,children:"Cancel"}),s.jsx(B,{type:"submit",className:"flex-1",disabled:n,children:n?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Sending..."]}):s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nb,{className:"h-4 w-4"}),"Send Message"]})})]})]})]})})}const lP="classta_ref",oce=1e3*60*60*24*30;function ET(e){return e.trim().slice(0,255)}function Pz(e,t){var a;const n=typeof window<"u"&&((a=window.location)!=null&&a.origin)?window.location.origin:"https://classta.co",r=new URL("/",n);return e&&e.trim()&&r.searchParams.set("ref",ET(e)),r.toString()}function Ez(){if(!(typeof window>"u"))try{const e=new URLSearchParams(window.location.search).get("ref");e&&e.trim()&&localStorage.setItem(lP,JSON.stringify({ref:ET(e),ts:Date.now()}))}catch{}}function Dz(){if(typeof window>"u")return"";try{const e=new URLSearchParams(window.location.search).get("ref");if(e&&e.trim())return ET(e);const t=localStorage.getItem(lP);if(!t)return"";const n=JSON.parse(t);
607return!(n!=null&&n.ref)||!(n!=null&&n.ts)?"":Date.now()-n.ts>oce?(localStorage.removeItem(lP),""):n.ref}catch{return""}}function lce(){const[e,t]=f.useState(!1),[n,r]=f.useState(!1),[a,i]=f.useState("");f.useEffect(()=>{const d=()=>{const h=window.location.pathname;r(h.startsWith("/cal/")||h.startsWith("/my-account/")||h.startsWith("/classes/")&&h.length>9);const p=h.match(/^\/(?:cal|my-account|classes)\/([^/]+)/);i(p?decodeURIComponent(p[1]):"")};d();const m=()=>d();window.addEventListener("popstate",m);const u=setInterval(d,250);return()=>{window.removeEventListener("popstate",m),clearInterval(u)}},[]),f.useEffect(()=>{const d=()=>{window.location.hash==="#contact"&&(t(!0),window.history.replaceState(null,"",window.location.pathname+window.location.search))};return d(),window.addEventListener("hashchange",d),()=>{window.removeEventListener("hashchange",d)}},[]);const[o,l]=f.useState(!0);return f.useEffect(()=>{const d=window.location.pathname;d.startsWith("/classes/")||d.startsWith("/checkout/")||d.startsWith("/my-account/")?l(!1):l(!0)},[]),typeof window<"u"&&window.flutter_inappwebview?s.jsx("div",{}):n?s.jsx("footer",{className:"bg-slate-50 border-t border-slate-200 mt-auto",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 text-sm text-slate-600",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[s.jsx(dt,{href:"/terms",className:"text-primary hover:text-primary/80 font-medium transition-colors underline",children:"Terms & Conditions"}),s.jsx("span",{children:"|"}),s.jsx(dt,{href:"/privacy",className:"text-primary hover:text-primary/80 font-medium transition-colors underline",children:"Privacy Policy"})]}),s.jsxs("div",{className:"flex items-center",children:[s.jsx("span",{children:"Powered by "}),s.jsx("a",{href:Pz(a),target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 font-medium transition-colors underline ml-1",children:"Classta"}),s.jsx("span",{className:"ml-1",children:"© 2026"})]})]})})}):s.jsxs(s.Fragment,{children:[s.jsx("footer",{className:"bg-slate-50 border-t border-slate-200 mt-auto",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:s.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3 text-sm text-slate-600",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-center space-x-2",children:[s.jsx(dt,{href:"/instructor-signup",className:"text-primary hover:text-primary/80 font-medium transition-colors underline",children:"Sign Up"}),s.jsx("span",{children:"•"}),s.jsx(dt,{href:"/pricing",className:"text-primary hover:text-primary/80 font-medium transition-colors underline",children:"Pricing"}),s.jsx("span",{children:"•"}),s.jsx("a",{href:"https://help.classta.co/",className:"text-primary hover:text-primary/80 font-medium transition-colors underline",children:"Help & FAQ"}),s.jsx("span",{children:"•"}),s.jsx(dt,{href:"/free-tools",className:"text-primary hover:text-primary/80 font-medium transition-colors underline relative",children:"Free Tools"}),s.jsx("span",{children:"•"}),s.jsx(dt,{href:"/blog",className:"text-primary hover:text-primary/80 font-medium transition-colors underline",children:"Blog"}),s.jsx("span",{children:"•"}),s.jsx("button",{onClick:()=>t(!0),className:"text-primary hover:text-primary/80 font-medium transition-colors underline",children:"Contact Us"}),s.jsx("span",{children:"•"}),s.jsx(dt,{href:"/terms",className:"text-primary hover:text-primary/80 font-medium transition-colors underline",children:"Terms & Conditions"}),s.jsx("span",{children:"•"}),s.jsx(dt,{href:"/privacy",className:"text-primary hover:text-primary/80 font-medium transition-colors underline",children:"Privacy Policy"}),o&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"•"}),s.jsx("a",{href:"https://classtaco-56fd.endorsely.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 font-medium transition-colors underline",children:"Affiliate Programme"})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center justify-center space-x-2",children:[s.jsx("span",{children:"© 2026 MJT Net Ltd. All rights reserved."}),s.jsx("span",{children:"•"}),s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx("span",{children:"Made with"}),s.jsx(Cre,{className:"h-4 w-4 text-red-500 fill-current"}),s.jsx("span",{children:"by"}),s.jsx("a",{href:"https://www.mjtnet.com",target:"_blank",rel:"noopener noreferrer nofollow",className:"text-primary hover:text-primary/80 font-medium transition-colors",children:"MJT Net Ltd"})]})]})]})})}),s.jsx(kz,{isOpen:e,onClose:()=>t(!1)})]})}
607const cce={AT:"EUR",BE:"EUR",CY:"EUR",EE:"EUR",FI:"EUR",FR:"EUR",DE:"EUR",GR:"EUR",IE:"EUR",IT:"EUR",LV:"EUR",LT:"EUR",LU:"EUR",MT:"EUR",NL:"EUR",PT:"EUR",SK:"EUR",SI:"EUR",ES:"EUR",US:"USD",GB:"GBP"};async function dce(){try{console.log("🌍 Starting location detection...");const t=await(await fetch("/api/geolocation")).json();if(console.log("🌍 Server geolocation response:",t),t&&!t.error&&(t.country_code||t.countryCode||t.country)){const n=t.country_code||t.countryCode||t.country,r=typeof n=="string"?n.toUpperCase():"GB",a=t.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone;return console.log(`🌍 Location detected: ${r}, ${a}`),{country:r,timezone:a,currency:hce(r)}}throw new Error("Server geolocation failed")}catch(e){return console.error("Could not detect location, using defaults:",e),console.log("🌍 Falling back to default location GB/EUR/London"),{country:"GB",timezone:"Europe/London",currency:"GBP"}}}function uce(e,t){return`${{GBP:"£",EUR:"€",USD:"$"}[t]||t}${e}`}function mce(e){return{GBP:"£",EUR:"€",USD:"$"}[e]||e}function hce(e){return cce[e]||"GBP"}const Az=f.createContext(void 0);function fce({children:e}){const[t,n]=f.useState(null),[r,a]=f.useState([]),[i,o]=f.useState(!0);f.useEffect(()=>{(async()=>{try{const y=await dce();n(y);const g=localStorage.getItem("instructor-pricing"),x=localStorage.getItem("instructor-pricing-timestamp"),b=Date.now(),w=24*60*60*1e3;if(g&&x&&b-parseInt(x)<w){a(JSON.parse(g)),o(!1);return}const j=await fetch("/api/instructor-pricing");if(j.ok){const N=await j.json();a(N),localStorage.setItem("instructor-pricing",JSON.stringify(N)),localStorage.setItem("instructor-pricing-timestamp",b.toString())}}catch(y){console.error("Failed to initialize currency data:",y)}finally{o(!1)}})()},[]);const l=(t==null?void 0:t.currency)||"GBP",c={GBP:15,EUR:10,USD:15},d=r.find(v=>v.currency===l),m=(d==null?void 0:d.price)!==void 0?parseFloat(d.price):c[l]??10,u=mce(l),h=v=>uce(v,l);f.useEffect(()=>{i||console.log("💱 CurrencyContext",{userLocation:t,currentCurrency:l,currentPrice:m,pricingCount:r.length,pricingFromCache:!!localStorage.getItem("instructor-pricing")})},[i,t,l,m,r]);const p={userLocation:t,pricing:r,currentPrice:m,currentCurrency:l,currentSymbol:u,formatPrice:h,isLoading:i};return s.jsx(Az.Provider,{value:p,children:e})}function ZN(){const e=f.useContext(Az);if(e===void 0)throw new Error("useCurrency must be used within a CurrencyProvider");return e}const Ce=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:bt("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Ce.displayName="Card";const gt=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:bt("flex flex-col space-y-1.5 p-6",e),...t}));gt.displayName="CardHeader";const Nt=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:bt("text-2xl font-semibold leading-none tracking-tight",e),...t}));Nt.displayName="CardTitle";const Ys=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:bt("text-sm text-muted-foreground",e),...t}));Ys.displayName="CardDescription";const Ee=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:bt("p-6 pt-0",e),...t}));Ee.displayName="CardContent";const pce=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:bt("flex items-center p-6 pt-0",e),...t}));pce.displayName="CardFooter";const xce=ov("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Je({className:e,variant:t,...n}){return s.jsx("div",{className:bt(xce({variant:t}),e),...n})}function JM(e,[t,n]){return Math.min(n,Math.max(t,e))}var gce=f.createContext(void 0);function xv(e){const t=f.useContext(gce);return e||t||"ltr"}function yce(e){const t=vce(e),n=f.forwardRef((r,a)=>{const{children:i,...o}=r,l=f.Children.toArray(i),c=l.find(wce);if(c){const d=c.props.children,m=l.map(u=>u===c?f.Children.count(d)>1?f.Children.only(null):f.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...o,ref:a,children:f.isValidElement(d)?f.cloneElement(d,void 0,m):null})}return s.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function vce(e){const t=f.forwardRef((n,r)=>{const{children:a,...i}=n;
vendor: 19,350 bytes, line 607
607if(f.isValidElement(a)){const o=Nce(a),l=jce(i,a.props);return a.type!==f.Fragment&&(l.ref=r?Pl(r,o):o),f.cloneElement(a,l)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var bce=Symbol("radix.slottable");function wce(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===bce}function jce(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function Nce(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function e1(e){const t=f.useRef({value:e,previous:e});return f.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Cce=[" ","Enter","ArrowUp","ArrowDown"],Sce=[" ","Enter"],fm="Select",[t1,s1,kce]=DN(fm),[jp]=ua(fm,[kce,Rd]),n1=Rd(),[Pce,Bd]=jp(fm),[Ece,Dce]=jp(fm),Tz=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:d,name:m,autoComplete:u,disabled:h,required:p,form:v}=e,y=n1(t),[g,x]=f.useState(null),[b,w]=f.useState(null),[j,N]=f.useState(!1),C=xv(d),[P,S]=yi({prop:r,defaultProp:a??!1,onChange:i,caller:fm}),[E,T]=yi({prop:o,defaultProp:l,onChange:c,caller:fm}),z=f.useRef(null),O=g?v||!!g.closest("form"):!0,[D,k]=f.useState(new Set),F=Array.from(D).map(W=>W.props.value).join(";");return s.jsx(UN,{...y,children:s.jsxs(Pce,{required:p,scope:t,trigger:g,onTriggerChange:x,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:j,onValueNodeHasChildrenChange:N,contentId:pi(),value:E,onValueChange:T,open:P,onOpenChange:S,dir:C,triggerPointerDownPosRef:z,disabled:h,children:[s.jsx(t1.Provider,{scope:t,children:s.jsx(Ece,{scope:e.__scopeSelect,onNativeOptionAdd:f.useCallback(W=>{k(q=>new Set(q).add(W))},[]),onNativeOptionRemove:f.useCallback(W=>{k(q=>{const H=new Set(q);return H.delete(W),H})},[]),children:n})}),O?s.jsxs(tq,{"aria-hidden":!0,required:p,tabIndex:-1,name:m,autoComplete:u,value:E,onChange:W=>T(W.target.value),disabled:h,form:v,children:[E===void 0?s.jsx("option",{value:""}):null,Array.from(D)]},F):null]})})};Tz.displayName=fm;var Oz="SelectTrigger",Fz=f.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,i=n1(n),o=Bd(Oz,n),l=o.disabled||r,c=Us(t,o.onTriggerChange),d=s1(n),m=f.useRef("touch"),[u,h,p]=nq(y=>{const g=d().filter(w=>!w.disabled),x=g.find(w=>w.value===o.value),b=rq(g,y,x);b!==void 0&&o.onValueChange(b.value)}),v=y=>{l||(o.onOpenChange(!0),p()),y&&(o.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})};return s.jsx(cv,{asChild:!0,...i,children:s.jsx(ms.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":sq(o.value)?"":void 0,...a,ref:c,onClick:At(a.onClick,y=>{y.currentTarget.focus(),m.current!=="mouse"&&v(y)}),onPointerDown:At(a.onPointerDown,y=>{m.current=y.pointerType;const g=y.target;g.hasPointerCapture(y.pointerId)&&g.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(v(y),y.preventDefault())}),onKeyDown:At(a.onKeyDown,y=>{const g=u.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&h(y.key),!(g&&y.key===" ")&&Cce.includes(y.key)&&(v(),y.preventDefault())})})})});Fz.displayName=Oz;var _z="SelectValue",Mz=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...l}=e,c=Bd(_z,n),{onValueNodeHasChildrenChange:d}=c,m=i!==void 0,u=Us(t,c.onValueNodeChange);return ea(()=>{d(m)},[d,m]),s.jsx(ms.span,{...l,ref:u,style:{pointerEvents:"none"},children:sq(c.value)?s.jsx(s.Fragment,{children:o}):i})});Mz.displayName=_z;var Ace="SelectIcon",$z=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return s.jsx(ms.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});$z.displayName=Ace;var Tce="SelectPortal",Iz=e=>s.jsx(yp,{asChild:!0,...e});Iz.displayName=Tce;var pm="SelectContent",Rz=f.forwardRef((e,t)=>{const n=Bd(pm,e.__scopeSelect),[r,a]=f.useState();if(ea(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?Id.createPortal(s.jsx(Bz,{scope:e.__scopeSelect,children:s.jsx(t1.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),i):null}return s.jsx(Lz,{...e,ref:t})});Rz.displayName=pm;var co=10,[Bz,Ld]=jp(pm),Oce="SelectContentImpl",Fce=yce("SelectContent.RemoveScroll"),Lz=f.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:d,alignOffset:m,arrowPadding:u,collisionBoundary:h,collisionPadding:p,sticky:v,hideWhenDetached:y,avoidCollisions:g,...x}=e,b=Bd(pm,n),[w,j]=f.useState(null),[N,C]=f.useState(null),P=Us(t,M=>j(M)),[S,E]=f.useState(null),[T,z]=f.useState(null),O=s1(n),[D,k]=f.useState(!1),F=f.useRef(!1);f.useEffect(()=>{if(w)return QN(w)},[w]),GN();const W=f.useCallback(M=>{const[se,...Q]=O().map(Z=>Z.ref.current),[te]=Q.slice(-1),G=document.activeElement;for(const Z of M)if(Z===G||(Z==null||Z.scrollIntoView({block:"nearest"}),Z===se&&N&&(N.scrollTop=0),Z===te&&N&&(N.scrollTop=N.scrollHeight),Z==null||Z.focus(),document.activeElement!==G))return},[O,N]),q=f.useCallback(()=>W([S,w]),[W,S,w]);f.useEffect(()=>{D&&q()},[D,q]);const{onOpenChange:H,triggerPointerDownPosRef:_}=b;f.useEffect(()=>{if(w){let M={x:0,y:0};const se=te=>{var G,Z;M={x:Math.abs(Math.round(te.pageX)-(((G=_.current)==null?void 0:G.x)??0)),y:Math.abs(Math.round(te.pageY)-(((Z=_.current)==null?void 0:Z.y)??0))}},Q=te=>{M.x<=10&&M.y<=10?te.preventDefault():w.contains(te.target)||H(!1),document.removeEventListener("pointermove",se),_.current=null};return _.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",Q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",Q,{capture:!0})}}},[w,H,_]),f.useEffect(()=>{const M=()=>H(!1);return window.addEventListener("blur",M),window.addEventListener("resize",M),()=>{window.removeEventListener("blur",M),window.removeEventListener("resize",M)}},[H]);const[L,U]=nq(M=>{const se=O().filter(G=>!G.disabled),Q=se.find(G=>G.ref.current===document.activeElement),te=rq(se,M,Q);te&&setTimeout(()=>te.ref.current.focus())}),J=f.useCallback((M,se,Q)=>{const te=!F.current&&!Q;(b.value!==void 0&&b.value===se||te)&&(E(M),te&&(F.current=!0))},[b.value]),I=f.useCallback(()=>w==null?void 0:w.focus(),[w]),re=f.useCallback((M,se,Q)=>{const te=!F.current&&!Q;(b.value!==void 0&&b.value===se||te)&&z(M)},[b.value]),R=r==="popper"?cP:Uz,Y=R===cP?{side:l,sideOffset:c,align:d,alignOffset:m,arrowPadding:u,collisionBoundary:h,collisionPadding:p,sticky:v,hideWhenDetached:y,avoidCollisions:g}:{};return s.jsx(Bz,{scope:n,content:w,viewport:N,onViewportChange:C,itemRefCallback:J,selectedItem:S,onItemLeave:I,itemTextRefCallback:re,focusSelectedItem:q,selectedItemText:T,position:r,isPositioned:D,searchRef:L,children:s.jsx(uv,{as:Fce,allowPinchZoom:!0,children:s.jsx(dv,{asChild:!0,trapped:b.open,onMountAutoFocus:M=>{M.preventDefault()},onUnmountAutoFocus:At(a,M=>{var se;(se=b.trigger)==null||se.focus({preventScroll:!0}),M.preventDefault()}),children:s.jsx(Pm,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:M=>M.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:s.jsx(R,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:M=>M.preventDefault(),...x,...Y,onPlaced:()=>k(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:At(x.onKeyDown,M=>{const se=M.ctrlKey||M.altKey||M.metaKey;if(M.key==="Tab"&&M.preventDefault(),!se&&M.key.length===1&&U(M.key),["ArrowUp","ArrowDown","Home","End"].includes(M.key)){let te=O().filter(G=>!G.disabled).map(G=>G.ref.current);if(["ArrowUp","End"].includes(M.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(M.key)){const G=M.target,Z=te.indexOf(G);te=te.slice(Z+1)}setTimeout(()=>W(te)),M.preventDefault()}})})})})})})});Lz.displayName=Oce;var _ce="SelectItemAlignedPosition",Uz=f.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,i=Bd(pm,n),o=Ld(pm,n),[l,c]=f.useState(null),[d,m]=f.useState(null),u=Us(t,P=>m(P)),h=s1(n),p=f.useRef(!1),v=f.useRef(!0),{viewport:y,selectedItem:g,selectedItemText:x,focusSelectedItem:b}=o,w=f.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&d&&y&&g&&x){const P=i.trigger.getBoundingClientRect(),S=d.getBoundingClientRect(),E=i.valueNode.getBoundingClientRect(),T=x.getBoundingClientRect();if(i.dir!=="rtl"){const G=T.left-S.left,Z=E.left-G,ie=P.left-Z,A=P.width+ie,ge=Math.max(A,S.width),je=window.innerWidth-co,ke=JM(Z,[co,Math.max(co,je-ge)]);l.style.minWidth=A+"px",l.style.left=ke+"px"}else{const G=S.right-T.right,Z=window.innerWidth-E.right-G,ie=window.innerWidth-P.right-Z,A=P.width+ie,ge=Math.max(A,S.width),je=window.innerWidth-co,ke=JM(Z,[co,Math.max(co,je-ge)]);l.style.minWidth=A+"px",l.style.right=ke+"px"}const z=h(),O=window.innerHeight-co*2,D=y.scrollHeight,k=window.getComputedStyle(d),F=parseInt(k.borderTopWidth,10),W=parseInt(k.paddingTop,10),q=parseInt(k.borderBottomWidth,10),H=parseInt(k.paddingBottom,10),_=F+W+D+H+q,L=Math.min(g.offsetHeight*5,_),U=window.getComputedStyle(y),J=parseInt(U.paddingTop,10),I=parseInt(U.paddingBottom,10),re=P.top+P.height/2-co,R=O-re,Y=g.offsetHeight/2,M=g.offsetTop+Y,se=F+W+M,Q=_-se;if(se<=re){const G=z.length>0&&g===z[z.length-1].ref.current;l.style.bottom="0px";const Z=d.clientHeight-y.offsetTop-y.offsetHeight,ie=Math.max(R,Y+(G?I:0)+Z+q),A=se+ie;l.style.height=A+"px"}else{const G=z.length>0&&g===z[0].ref.current;l.style.top="0px";const ie=Math.max(re,F+y.offsetTop+(G?J:0)+Y)+Q;l.style.height=ie+"px",y.scrollTop=se-re+y.offsetTop}l.style.margin=`${co}px 0`,l.style.minHeight=L+"px",l.style.maxHeight=O+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,l,d,y,g,x,i.dir,r]);ea(()=>w(),[w]);const[j,N]=f.useState();ea(()=>{d&&N(window.getComputedStyle(d).zIndex)},[d]);const C=f.useCallback(P=>{P&&v.current===!0&&(w(),b==null||b(),v.current=!1)},[w,b]);return s.jsx($ce,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:C,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:s.jsx(ms.div,{...a,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});Uz.displayName=_ce;var Mce="SelectPopperPosition",cP=f.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=co,...i}=e,o=n1(n);return s.jsx(zN,{...o,...i,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});cP.displayName=Mce;var[$ce,DT]=jp(pm,{}),dP="SelectViewport",zz=f.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...a}=e,i=Ld(dP,n),o=DT(dP,n),l=Us(t,i.onViewportChange),c=f.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(t1.Slot,{scope:n,children:s.jsx(ms.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:At(a.onScroll,d=>{const m=d.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&u){const p=Math.abs(c.current-m.scrollTop);if(p>0){const v=window.innerHeight-co*2,y=parseFloat(u.style.minHeight),g=parseFloat(u.style.height),x=Math.max(y,g);if(x<v){const b=x+p,w=Math.min(v,b),j=b-w;u.style.height=w+"px",u.style.bottom==="0px"&&(m.scrollTop=j>0?j:0,u.style.justifyContent="flex-end")}}}c.current=m.scrollTop})})})]})});zz.displayName=dP;var qz="SelectGroup",[Ice,Rce]=jp(qz),Bce=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=pi();return s.jsx(Ice,{scope:n,id:a,children:s.jsx(ms.div,{role:"group","aria-labelledby":a,...r,ref:t})})});Bce.displayName=qz;var Wz="SelectLabel",Hz=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Rce(Wz,n);return s.jsx(ms.div,{id:a.id,...r,ref:t})});Hz.displayName=Wz;var Nw="SelectItem",[Lce,Vz]=jp(Nw),Kz=f.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=e,l=Bd(Nw,n),c=Ld(Nw,n),d=l.value===r,[m,u]=f.useState(i??""),[h,p]=f.useState(!1),v=Us(t,b=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,b,r,a)}),y=pi(),g=f.useRef("touch"),x=()=>{a||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(Lce,{scope:n,value:r,disabled:a,textId:y,isSelected:d,onItemTextChange:f.useCallback(b=>{u(w=>w||((b==null?void 0:b.textContent)??"").trim())},[]),children:s.jsx(t1.ItemSlot,{scope:n,value:r,disabled:a,textValue:m,children:s.jsx(ms.div,{role:"option","aria-labelledby":y,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:v,onFocus:At(o.onFocus,()=>p(!0)),onBlur:At(o.onBlur,()=>p(!1)),onClick:At(o.onClick,()=>{g.current!=="mouse"&&x()}),onPointerUp:At(o.onPointerUp,()=>{g.current==="mouse"&&x()}),onPointerDown:At(o.onPointerDown,b=>{g.current=b.pointerType}),onPointerMove:At(o.onPointerMove,b=>{var w;g.current=b.pointerType,a?(w=c.onItemLeave)==null||w.call(c):g.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:At(o.onPointerLeave,b=>{var w;b.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:At(o.onKeyDown,b=>{var j;((j=c.searchRef)==null?void 0:j.current)!==""&&b.key===" "||(Sce.includes(b.key)&&x(),b.key===" "&&b.preventDefault())})})})})});Kz.displayName=Nw;var jx="SelectItemText",Gz=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...i}=e,o=Bd(jx,n),l=Ld(jx,n),c=Vz(jx,n),d=Dce(jx,n),[m,u]=f.useState(null),h=Us(t,x=>u(x),c.onItemTextChange,x=>{var b;return(b=l.itemTextRefCallback)==null?void 0:b.call(l,x,c.value,c.disabled)}),p=m==null?void 0:m.textContent,v=f.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:y,onNativeOptionRemove:g}=d;return ea(()=>(y(v),()=>g(v)),[y,g,v]),s.jsxs(s.Fragment,{children:[s.jsx(ms.span,{id:c.textId,...i,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Id.createPortal(i.children,o.valueNode):null]})});Gz.displayName=jx;var Yz="SelectItemIndicator",Qz=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Vz(Yz,n).isSelected?s.jsx(ms.span,{"aria-hidden":!0,...r,ref:t}):null});Qz.displayName=Yz;var uP="SelectScrollUpButton",Jz=f.forwardRef((e,t)=>{const n=Ld(uP,e.__scopeSelect),r=DT(uP,e.__scopeSelect),[a,i]=f.useState(!1),o=Us(t,r.onScrollButtonChange);return ea(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),a?s.jsx(Zz,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Jz.displayName=uP;var mP="SelectScrollDownButton",Xz=f.forwardRef((e,t)=>{const n=Ld(mP,e.__scopeSelect),r=DT(mP,e.__scopeSelect),[a,i]=f.useState(!1),o=Us(t,r.onScrollButtonChange);return ea(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,m=Math.ceil(c.scrollTop)<d;i(m)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),a?s.jsx(Zz,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Xz.displayName=mP;var Zz=f.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=e,i=Ld("SelectScrollButton",n),o=f.useRef(null),l=s1(n),c=f.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return f.useEffect(()=>()=>c(),[c]),ea(()=>{var m;const d=l().find(u=>u.ref.current===document.activeElement);(m=d==null?void 0:d.ref.current)==null||m.scrollIntoView({block:"nearest"})},[l]),s.jsx(ms.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:At(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:At(a.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:At(a.onPointerLeave,()=>{c()})})}),Uce="SelectSeparator",eq=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return s.jsx(ms.div,{"aria-hidden":!0,...r,ref:t})});eq.displayName=Uce;var hP="SelectArrow",zce=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=n1(n),i=Bd(hP,n),o=Ld(hP,n);return i.open&&o.position==="popper"?s.jsx(qN,{...a,...r,ref:t}):null});zce.displayName=hP;var qce="SelectBubbleInput",tq=f.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const a=f.useRef(null),i=Us(r,a),o=e1(t);return f.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&m){const u=new Event("change",{bubbles:!0});m.call(l,t),l.dispatchEvent(u)}},[o,t]),s.jsx(ms.select,{...n,style:{...k9,...n.style},ref:i,defaultValue:t})});tq.displayName=qce;function sq(e){return e===""||e===void 0}function nq(e){const t=Za(e),n=f.useRef(""),r=f.useRef(0),a=f.useCallback(o=>{const l=n.current+o;t(l),function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),i=f.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function rq(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=Wce(e,Math.max(i,0));a.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.textValue.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}function Wce(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Hce=Tz,aq=Fz,Vce=Mz,Kce=$z,Gce=Iz,iq=Rz,Yce=zz,oq=Hz,lq=Kz,Qce=Gz,Jce=Qz,cq=Jz,dq=Xz,uq=eq;const Bt=Hce,Lt=Vce,$t=f.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(aq,{ref:r,className:bt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
607ing-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,s.jsx(Kce,{asChild:!0,children:s.jsx(vi,{className:"h-4 w-4 opacity-50"})})]}));$t.displayName=aq.displayName;const mq=f.forwardRef(({className:e,...t},n)=>s.jsx(cq,{ref:n,className:bt("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(ON,{className:"h-4 w-4"})}));mq.displayName=cq.displayName;const hq=f.forwardRef(({className:e,...t},n)=>s.jsx(dq,{ref:n,className:bt("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(vi,{className:"h-4 w-4"})}));hq.displayName=dq.displayName;const It=f.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>s.jsx(Gce,{children:s.jsxs(iq,{ref:a,className:bt("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[s.jsx(mq,{}),s.jsx(Yce,{className:bt("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(hq,{})]})}));It.displayName=iq.displayName;const Xce=f.forwardRef(({className:e,...t},n)=>s.jsx(oq,{ref:n,className:bt("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Xce.displayName=oq.displayName;const ce=f.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(lq,{ref:r,className:bt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(Jce,{children:s.jsx(bn,{className:"h-4 w-4"})})}),s.jsx(Qce,{children:t})]}));ce.displayName=lq.displayName;const Zce=f.forwardRef(({className:e,...t},n)=>s.jsx(uq,{ref:n,className:bt("-mx-1 my-1 h-px bg-muted",e),...t}));Zce.displayName=uq.displayName;function Ia({className:e="",size:t="md"}){const n={sm:"w-6 h-6",md:"w-8 h-8",lg:"w-10 h-10"};return s.jsxs("svg",{className:`${n[t]} ${e}`,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("circle",{cx:"16",cy:"16",r:"16",fill:"currentColor"}),s.jsx("path",{d:"M22 11c0-3.5-2.5-6-6-6s-6 2.5-6 6v10c0 3.5 2.5 6 6 6s6-2.5 6-6",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",fill:"none"}),s.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"white",opacity:"0.8"}),s.jsx("circle",{cx:"20",cy:"16",r:"1.5",fill:"white",opacity:"0.6"}),s.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"white",opacity:"0.8"})]})}function Cw({className:e,...t}){return s.jsx("div",{className:bt("animate-pulse rounded-md bg-muted",e),...t})}const mt=(e="GBP")=>{switch((e||"GBP").toUpperCase()){case"GBP":return"£";case"USD":return"$";case"EUR":return"€";case"AUD":return"A$";case"CAD":return"C$";default:return"£"}},_h=(e,t="GBP")=>{const n=mt(t),r=typeof e=="string"?parseFloat(e):e;return`${n}${r.toFixed(2)}`};function Cl(e){const t=typeof window<"u"&&window.self!==window.top,n=f.useRef(!1);f.useRef(!1),f.useEffect(()=>{if(t){if(e&&!n.current){const r=Nz();n.current=!0,r===1&&window.parent.postMessage({type:"CLASSTA_MODAL_OPEN"},"*")}else if(!e&&n.current){const r=jw();n.current=!1,r===0&&window.parent.postMessage({type:"CLASSTA_MODAL_CLOSE"},"*")}return()=>{n.current&&(jw()===0&&window.parent.postMessage({type:"CLASSTA_MODAL_CLOSE"},"*"),n.current=!1)}}},[e,t])}function In(e){const t=e==null||e===""?new Date:typeof e=="string"?new Date(e):e;if(Number.isNaN(t.getTime()))return In(new Date);const n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return`${n}-${r}-${a}`}function fq({classId:e,classDate:t,classTime:n,onSuccess:r,onCancel:a}
607){const[i,o]=f.useState({name:"",email:"",phone:""}),[l,c]=f.useState(!1),{toast:d}=Yt(),m=async u=>{u.preventDefault(),c(!0);try{const h=In(t),p=await Pe("POST",`/api/waitlist/${e}`,{name:i.name,email:i.email.trim().toLowerCase(),phone:i.phone||void 0,classDate:h,classTime:n});if(!p.ok){const v=await p.json();throw new Error(v.message||"Failed to add to waitlist")}d({title:"Added to Waitlist",description:"You'll be notified when a spot becomes available."}),r()}catch(h){d({title:"Error",description:h.message||"Failed to add to waitlist",variant:"destructive"})}finally{c(!1)}};return s.jsxs("form",{onSubmit:m,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"waitlist-name",children:"Name *"}),s.jsx(me,{id:"waitlist-name",type:"text",value:i.name,onChange:u=>o({...i,name:u.target.value}),required:!0,placeholder:"Your name"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"waitlist-email",children:"Email *"}),s.jsx(me,{id:"waitlist-email",type:"email",value:i.email,onChange:u=>o({...i,email:u.target.value}),required:!0,placeholder:"[email protected]"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"waitlist-phone",children:"Phone (Optional)"}),s.jsx(me,{id:"waitlist-phone",type:"tel",value:i.phone,onChange:u=>o({...i,phone:u.target.value}),placeholder:"Your phone number"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"We'll send you SMS notifications if you provide your phone number"})]}),s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsx(B,{type:"button",variant:"outline",onClick:a,disabled:l,children:"Cancel"}),s.jsx(B,{type:"submit",disabled:l,children:l?"Adding...":"Add to Waitlist"})]})]})}function XM(e){try{const t=localStorage.getItem("classta-user-data");if(t){const n=JSON.parse(t);if(n.email)return n.email}}catch{}if(e)try{const t=localStorage.getItem(`client_token_${e}`)}catch{}return null}function ede({classId:e,offerFreeTrial:t,userEmail:n}){const{data:r,refetch:a,isLoading:i}=Ue({queryKey:[`/api/classes/${e}/has-booked`,e,n],queryFn:async()=>{if(!n)return{hasBooked:!1};const l=await Pe("GET",`/api/classes/${e}/has-booked?email=${encodeURIComponent(n)}`);return l.ok?l.json():{hasBooked:!1}},enabled:!!(n&&t),staleTime:0,refetchOnMount:!0,refetchOnWindowFocus:!0});f.useEffect(()=>{n&&t&&a()},[n,t,a]);const o=(r==null?void 0:r.freeTrialUnavailable)??(r==null?void 0:r.hasBooked)??!1;return!t||n&&o?null:s.jsx(Je,{variant:"outline",className:"text-xs w-full justify-center bg-green-50 text-green-700 border-green-300 font-semibold",children:"FREE TRIAL"})}function tde({classId:e,offerFirstUsePrice:t,firstUsePrice:n,userEmail:r,currencySymbol:a}){const{data:i,refetch:o}=Ue({queryKey:[`/api/classes/${e}/has-booked`,e,r],queryFn:async()=>{if(!r)return{hasBooked:!1};const m=await Pe("GET",`/api/classes/${e}/has-booked?email=${encodeURIComponent(r)}`);return m.ok?m.json():{hasBooked:!1}},enabled:!!(r&&t),staleTime:0,refetchOnMount:!0,refetchOnWindowFocus:!0});f.useEffect(()=>{r&&t&&o()},[r,t,o]);const l=(i==null?void 0:i.hasBooked)??!1,c=(i==null?void 0:i.firstUseUnavailable)??(l||((i==null?void 0:i.isExcludedFromFreeTrial)??!1)),d=parseFloat(String(n??""));return!t||Number.isNaN(d)||d<0||r&&c?null:s.jsxs(Je,{variant:"outline",className:"text-xs w-full justify-center bg-amber-50 text-amber-800 border-amber-300 font-semibold",children:["First session ",a,n]})}function sde(e){const t=/(https?:\/\/[^\s]+)/g;return e.split(t).map((r,a)=>r.match(t)?s.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-all",children:r},a):r)}function pq({classes:e,currentWeek:t,onClassSelect:n,onContactInstructor:r,isRootPage:a=!1,instructorCurrency:i="GBP",instructor:o}){const[l,c]=f.useState([]),[d,m]=f.useState(null),[u,h]=f.useState(!1),[p,v]=f.useState(!1),[y,g]=f.useState(null),[x,b]=f.useState(null);Cl(y!==null||x!==null);const[w,j]=f.useState(()=>XM(o==null?void 0:o.id));f.useEffect(()=>{const F=()=>{const q=XM(o==null?void 0:o.id);j(q)};F();const W=setInterval(F,1e3);return window.addEventListener("storage",F),()=>{clearInterval(W),window.removeEventListener("storage",F)}},[o==null?void 0:o.id]);const{data:N=[]}=Ue({queryKey:["/api/instructors"],enabled:a}),C=F=>a?N.find(W=>W.id===F.instructorId):null,S=(F=>{const W=new Date(F.getFullYear(),F.getMonth(),F.getDate()),q=W.getDay(),H=W.getDate()-q+(q===0?-6:1);W.setDate(H);const _=[];for(let L=0;L<7;L++){const U=new Date(W.getFullYear(),W.getMonth(),W.getDate()+L);_.push(U)}return _})(t),E=["MON","TUE","WED","THU","FRI","SAT","SUN"],T=(F,W)=>{if(F.frequency==="daily")try{const q=JSON.parse(F.startTime);if(typeof q=="object"&&q!==null){const H=W.getDay();return q[H.toString()]||Object.values(q)[0]||"09:00"}}catch{}return F.startTime||"09:00"},z=F=>{if(F.isBeforeOpenTime||F.isPastCutoff)return!0;const W=new Date,q=new Date(F.date),H=T(F,q),[_,L]=H.split(":").map(Number);if(q.setHours(_||9,L||0,0,0),F.bookingCutoffHours===null||F.bookingCutoffHours===void 0)return q<W;
607const U=Number(F.bookingCutoffHours),J=new Date(q);if(U>0)return J.setHours(J.getHours()-U),W>J;if(U<0){const I=Math.abs(U);return J.setHours(J.getHours()+I),W>J}else return W>q};f.useEffect(()=>{const F=async()=>{var H;v(!0);const q=[];if(o&&!a)try{const _=S[0],L=S[S.length-1],U=`${_.getFullYear()}-${String(_.getMonth()+1).padStart(2,"0")}-${String(_.getDate()).padStart(2,"0")}`,J=new Date(L);J.setDate(L.getDate()+1);const I=`${J.getFullYear()}-${String(J.getMonth()+1).padStart(2,"0")}-${String(J.getDate()).padStart(2,"0")}`,re=await fetch(`/api/instructor/${o.id}/class-availability?startDate=${U}&endDate=${I}`);if(!re.ok)throw new Error(`Batch availability request failed: ${re.status}`);const R=await re.json();for(const Y of e)for(const M of S){const se=M.getDay(),Q=M.getFullYear(),te=String(M.getMonth()+1).padStart(2,"0"),G=String(M.getDate()).padStart(2,"0"),Z=`${Q}-${te}-${G}`;let ie=!1;if(Y.exceptionalDates)try{JSON.parse(Y.exceptionalDates).find(je=>je.new_date===Z)&&(ie=!0)}catch(A){console.error("Error parsing exceptionalDates for class:",Y.id,A)}if(!ie)if(Y.frequency==="daily"){if(Y.enabledDays)try{ie=JSON.parse(Y.enabledDays).includes(se)}catch(A){console.error("Error parsing enabledDays for class:",Y.id,A),ie=!1}}else ie=se===Y.dayOfWeek;if(ie){if(Y.startDate&&Z<Y.startDate||Y.endDate&&Z>Y.endDate||Y.excludeDates&&Y.excludeDates.split(`
608`).map(je=>je.trim()).filter(je=>je).includes(Z))continue;if(Y.exceptionalDates)try{if(JSON.parse(Y.exceptionalDates).find(ke=>ke.original_date===Z))continue}catch(ge){console.error("Error parsing exceptionalDates for class:",Y.id,ge)}const A=(H=R[Y.id])==null?void 0:H[Z];if(A){const ge={...Y,date:new Date(M),spotsLeft:A.availableSpots||0,isAvailable:A.isAvailable!==!1,isPastCutoff:A.isPastCutoff||!1,isBeforeOpenTime:A.isBeforeOpenTime||!1,isLocked:A.isLocked===!0||Y.isLocked===!0||Y.bookingLocked===!0};if(o!=null&&o.hidePastClasses&&z(ge))continue;q.push(ge)}else continue}}}catch(_){return console.error("Batch availability failed, falling back to individual calls:",_),W()}else return W();c(q),v(!1)},W=async()=>{const q=[];for(const J of e)for(const I of S){const re=I.getDay(),R=I.getFullYear(),Y=String(I.getMonth()+1).padStart(2,"0"),M=String(I.getDate()).padStart(2,"0"),se=`${R}-${Y}-${M}`;let Q=!1;if(J.exceptionalDates)try{JSON.parse(J.exceptionalDates).find(Z=>Z.new_date===se)&&(Q=!0)}catch(te){console.error("Error parsing exceptionalDates for class:",J.id,te)}if(!Q)if(J.frequency==="daily"){if(J.enabledDays)try{Q=JSON.parse(J.enabledDays).includes(re)}catch(te){console.error("Error parsing enabledDays for class:",J.id,te),Q=!1}}else Q=re===J.dayOfWeek;if(Q){if(J.startDate&&se<J.startDate||J.endDate&&se>J.endDate||J.excludeDates&&J.excludeDates.split(`
609`).map(G=>G.trim()).filter(G=>G).includes(se))continue;if(J.exceptionalDates)try{if(JSON.parse(J.exceptionalDates).find(Z=>Z.original_date===se))continue}catch(te){console.error("Error parsing exceptionalDates for class:",J.id,te)}q.push({classData:J,date:I,dateString:se})}}const H=Array.from(new Set(q.map(J=>J.classData.id))),_=Array.from(new Set(q.map(J=>J.dateString)));if(H.length===0||_.length===0){c([]),v(!1);return}console.log(`🚀 Making ONE bulk API call for ${H.length} classes × ${_.length} dates`);const L=[];let U={};try{const J=await fetch("/api/classes/availability/bulk",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({classIds:H,dates:_})});if(J.ok)U=await J.json(),console.log(`✅ Bulk availability received for ${H.length} × ${_.length} = ${H.length*_.length} combinations`);else{console.error("Bulk availability request failed:",J.status);const I=await J.text();console.error("Error response:",I)}}catch(J){console.error("Bulk availability request error:",J)}for(const{classData:J,date:I,dateString:re}of q){const R=U[J.id],Y=R==null?void 0:R[re],M=(Y==null?void 0:Y.availableSpots)??J.maxCapacity,se=(Y==null?void 0:Y.isAvailable)!==!1,Q=(Y==null?void 0:Y.isPastCutoff)||!1,te=(Y==null?void 0:Y.isBeforeOpenTime)||!1,G=(Y==null?void 0:Y.isLocked)===!0||J.isLocked===!0||J.bookingLocked===!0,Z={...J,date:new Date(I),spotsLeft:M,isAvailable:se,isPastCutoff:Q,isBeforeOpenTime:te,isLocked:G};if(a){const ie=C(J);if(ie!=null&&ie.hidePastClasses&&z(Z))continue}else if(o!=null&&o.hidePastClasses&&z(Z))continue;L.push(Z)}c(L),v(!1)};F()},[e,t,o,a]);const O=F=>{switch(F.toLowerCase()){case"pilates":return"bg-primary/10 border-primary/20 hover:bg-primary/20 text-primary";case"hiit":case"bootcamp":return"bg-secondary/10 border-secondary/20 hover:bg-secondary/20 text-secondary";case"yoga":return"bg-accent/10 border-accent/20 hover:bg-accent/20 text-accent";default:return"bg-slate-100 border-slate-200 hover:bg-slate-200 text-slate-700"}},D=F=>{if(!F||F==="undefined")return"TBD";const[W,q]=F.split(":");if(!W||!q||isNaN(parseInt(W))||isNaN(parseInt(q)))return"TBD";const H=parseInt(W),_=H===0?12:H>12?H-12:H,L=H>=12?"PM":"AM";return`${_}:${q} ${L}`},k=F=>l.filter(q=>{if(q.date.toDateString()!==F.toDateString())return!1;const H=a?C(q):o;return!(H!=null&&H.hidePastClasses&&z(q))}).sort((q,H)=>{const _=T(q,q.date),L=T(H,H.date),[U,J]=_.split(":").map(Number),[I,re]=L.split(":").map(Number),R=(U||0)*60+(J||0),Y=(I||0)*60+(re||0);return R-Y});return p?s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3 sm:gap-4 lg:gap-6",children:S.map((F,W)=>s.jsx(Ce,{className:"min-h-[250px] sm:min-h-[300px]",children:s.jsxs(Ee,{className:"p-3 sm:p-4",children:[s.jsxs("div",{className:"text-center mb-3 sm:mb-4",children:[s.jsx("div",{className:"text-xs sm:text-sm font-medium text-slate-500",children:E[W]}),s.jsx("div",{className:"text-xl sm:text-2xl font-bold text-slate-900",children:F.getDate()})]}),s.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[s.jsx(Cw,{className:"h-20 w-full rounded-lg"}),s.jsx(Cw,{className:"h-16 w-full rounded-lg"})]})]})},F.toISOString()))}):s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3 sm:gap-4 lg:gap-6",children:[S.map((F,W)=>{const q=k(F),H=a?null:o;return H!=null&&H.hidePastClasses&&q.length===0?null:s.jsx(Ce,{className:"min-h-[250px] sm:min-h-[300px]",children:s.jsxs(Ee,{className:"p-3 sm:p-4",children:[s.jsxs("div",{className:"text-center mb-3 sm:mb-4",children:[s.jsx("div",{className:"text-xs sm:text-sm font-medium text-slate-500",children:E[W]}),s.jsx("div",{className:"text-xl sm:text-2xl font-bold text-slate-900",children:F.getDate()})]}),s.jsx("div",{className:"space-y-2 sm:space-y-3",children:q.length===0?s.jsx("div",{className:"text-center text-slate-400 text-xs sm:text-sm mt-6 sm:mt-8",children:F.getDay()===0?"Rest day":"No classes scheduled"}):q.map(_=>{var re,R;const L=C(_),U=(re=_.instructorName)==null?void 0:re.trim(),J=(R=a?L==null?void 0:L.instructorName:o==null?void 0:o.instructorName)==null?void 0:R.trim(),I=U&&U.length>0?U:J||"TBC";return s.jsxs("div",{className:`${O(_.classType)} border rounded-lg p-2 sm:p-3 ${_.isAvailable?"":"opacity-60"} cursor-pointer transition-colors relative`,onClick:()=>
609{if(_.isAvailable)n(_);else if(_.spotsLeft===0)m(_);else if(_.isPastCutoff)return},children:[s.jsxs("div",{className:"flex items-start justify-between mb-1",children:[s.jsx("div",{className:"text-xs sm:text-sm font-semibold leading-tight flex-1",children:_.name}),(_.description||_.photoUrl)&&s.jsxs(vT,{children:[s.jsx(bT,{asChild:!0,children:s.jsx(B,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 ml-1 text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-full transition-colors",onClick:Y=>{Y.stopPropagation(),g(_.id)},children:s.jsx(FN,{className:"h-4 w-4"})})}),s.jsx(KN,{children:s.jsx("p",{children:"View class details"})})]})]}),s.jsxs("div",{className:"text-xs text-slate-500 mb-1",children:["Instructor: ",I]}),a&&L&&s.jsx("div",{className:"mb-1",children:s.jsx(dt,{href:`/classes/${L.subdomain}`,children:s.jsxs(B,{variant:"link",className:"h-auto p-0 text-xs text-slate-600 hover:text-primary font-normal",onClick:Y=>Y.stopPropagation(),children:["by ",L.instructorName,s.jsx(Lr,{className:"h-3 w-3 ml-1"})]})})}),s.jsx("div",{className:"text-xs text-slate-600 mb-1 sm:mb-2",children:(()=>{const Y=T(_,_.date),M=D(Y),[se,Q]=Y.split(":");if(!se||!Q||isNaN(parseInt(se))||isNaN(parseInt(Q)))return"Time TBD";const te=parseInt(se)*60+parseInt(Q)+_.duration,G=Math.floor(te/60),Z=te%60,ie=`${String(G).padStart(2,"0")}:${String(Z).padStart(2,"0")}`,A=D(ie);return`${M} - ${A}`})()}),_.location&&s.jsxs("div",{className:"text-xs text-slate-500 mb-1 leading-tight",children:["📍 ",_.location]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ede,{classId:_.id,offerFreeTrial:_.offerFreeTrial||!1,userEmail:w}),_.allowSingleBooking&&s.jsx(tde,{classId:_.id,offerFirstUsePrice:_.offerFirstUsePrice||!1,firstUsePrice:_.firstUsePrice,userEmail:w,currencySymbol:mt(a?(L==null?void 0:L.currency)||"GBP":i)}),_.memberships&&_.memberships.length>0&&s.jsx(Je,{variant:"outline",className:"text-xs w-full justify-center bg-purple-50 text-purple-700 border-purple-200",children:_.memberships.map(Y=>Y.membershipName).join(", ")}),(()=>{const Y=a?L:o;return(Y==null?void 0:Y.hideSpotsRemaining)===!0?s.jsx("div",{className:"h-0.5 w-full rounded bg-secondary"}):s.jsx(Je,{variant:_.spotsLeft===0?"destructive":_.isLocked?"outline":"secondary",className:"text-xs w-full justify-center",children:_.isAvailable?_.isLocked?"Locked":`${Math.max(_.spotsLeft,0)} ${_.spotsLeft===1?"spot":"spots"} left`:_.spotsLeft===0?"Full":"Booking closed"})})(),(()=>{const Y=a?L:o;if((Y==null?void 0:Y.hidePriceOnCalendarCards)===!0)return null;const M=parseFloat(String(_.singlePrice||"0")),se=_.allowSingleBooking===!0||M>0,Q=mt(a?(L==null?void 0:L.currency)||"GBP":i),te=_.packages,G=Array.isArray(te)?te:[];if(!se&&G.length===0)return null;const Z=_.frequency==="daily"?"Day":"Week";_.frequency;const ie=G.length>0,ge=se&&(_.allowSingleBooking===!0||!ie)?s.jsxs("div",{className:"text-xs font-medium text-slate-700 text-center",children:[ie&&"Single Class: ",Q,_.singlePrice]}):null,je=G.length===1?`${G[0].numberOfWeeks} ${Z} Package: ${Q}${G[0].price}`:G.length>1?`Packages from: ${Q}${Math.min(...G.map(ke=>parseFloat(String(ke.price)))).toFixed(2)}`:null;return s.jsxs("div",{className:"space-y-0.5",children:[ge,je&&s.jsxs("div",{className:"text-xs font-medium text-slate-700 text-center",children:[je,G.length>1&&s.jsxs(s.Fragment,{children:[" ",s.jsx("button",{type:"button",className:"text-primary underline hover:no-underline font-normal",onClick:ke=>{ke.stopPropagation(),b(_.id)},children:"More"})]})]})]})})()]})]},`${_.id}-${_.date.toISOString()}`)})})]})},F.toISOString())}),(()=>{const F=l.find(W=>W.id===y);return!F||!F.description&&!F.photoUrl?null:s.jsx(Ct,{open:!0,onOpenChange:W=>{W||g(null)},children:s.jsxs(St,{className:"max-w-md max-h-[90vh] flex flex-col",onClick:W=>W.stopPropagation(),children:[s.jsx(kt,{children:s.jsx(Pt,{children:F.name})}),s.jsxs("div",{className:"mt-4 overflow-y-auto flex-1 pr-2 -mr-2",children:[F.description&&s.jsx("p",{className:"text-sm text-slate-600 leading-relaxed",children:sde(F.description)}),F.photoUrl&&s.jsx("div",{className:F.description?"mt-4":"",children:s.jsx("img",{src:F.photoUrl,alt:`${F.name} photo`,className:"w-full rounded-lg object-cover"})})]})]})})})(),(()=>{const F=l.find(L=>
609L.id===x);if(!F||!x)return null;const W=F.packages,q=Array.isArray(W)?[...W].sort((L,U)=>L.numberOfWeeks-U.numberOfWeeks):[],H=F.frequency==="daily"?"days":"weeks",_=mt(a?(rootInstructor==null?void 0:rootInstructor.currency)||"GBP":i);return s.jsx(Ct,{open:!0,onOpenChange:L=>{L||b(null)},children:s.jsxs(St,{className:"max-w-sm",onClick:L=>L.stopPropagation(),children:[s.jsx(kt,{children:s.jsxs(Pt,{children:["Packages for ",F.name]})}),s.jsxs("table",{className:"mt-3 w-full text-sm table-fixed",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-slate-200 text-left text-xs font-medium text-slate-500 uppercase tracking-wider",children:[s.jsx("th",{className:"pb-2 pr-4 font-medium",children:"Package"}),s.jsx("th",{className:"pb-2 pr-4 text-right w-20",children:"Duration"}),s.jsx("th",{className:"pb-2 text-right w-24",children:"Price"})]})}),s.jsx("tbody",{children:q.map((L,U)=>s.jsxs("tr",{className:"border-b border-slate-100 last:border-0",children:[s.jsx("td",{className:"py-2 pr-4 text-slate-700 align-baseline",children:L.name||`${L.numberOfWeeks} ${F.frequency==="daily"?"Day":"Week"} Package`}),s.jsxs("td",{className:"py-2 pr-4 text-slate-500 text-xs text-right align-baseline w-20",children:[L.numberOfWeeks," ",H]}),s.jsxs("td",{className:"py-2 text-right font-medium text-slate-900 align-baseline w-24 tabular-nums",children:[_,typeof L.price=="string"?L.price:String(L.price)]})]},U))})]})]})})})(),s.jsx(Ct,{open:!!d,onOpenChange:F=>{F||(m(null),h(!1))},children:s.jsxs(St,{className:"max-w-md",children:[s.jsx(kt,{children:s.jsx(Pt,{children:u?"Add to Waitlist":"Class is Full"})}),s.jsx("div",{className:"space-y-4",children:u?d&&s.jsx(fq,{classId:d.id,classDate:d.date,classTime:T(d,d.date),onSuccess:()=>{h(!1),m(null)},onCancel:()=>h(!1)}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-lg font-semibold mb-2",children:d==null?void 0:d.name}),s.jsxs("div",{className:"text-sm text-slate-600 mb-4",children:[d==null?void 0:d.date.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})," at ",d?D(T(d,d.date)):"TBD"]}),s.jsx("div",{className:"bg-orange-50 border border-orange-200 rounded-lg p-4 mb-4",children:s.jsx("p",{className:"text-sm text-orange-800",children:"This class is currently full with no spots available."})})]}),s.jsxs("div",{className:"text-center space-y-3",children:[s.jsx("p",{className:"text-sm text-slate-600",children:"You can choose a different class time, or contact the instructor to see if they can accommodate you."}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(B,{variant:"outline",onClick:()=>m(null),className:"w-full",children:"Choose Different Class"}),(d==null?void 0:d.waitlistEnabled)&&s.jsx(B,{onClick:()=>h(!0),className:"w-full",children:"Add to Waitlist"}),r&&s.jsx(B,{onClick:()=>{d&&(r(d),m(null))},className:"w-full",children:"Contact Instructor"})]})]})]})})]})})]})}function nde(e){const t=/(https?:\/\/[^\s]+)/g;return e.split(t).map((r,a)=>r.match(t)?s.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-all",children:r},a):r)}function ZM(e){try{const t=localStorage.getItem("classta-user-data");if(t){const n=JSON.parse(t);if(n.email)return n.email}}catch{}if(e)try{const t=localStorage.getItem(`client_token_${e}`)}catch{}return null}function rde({classId:e,offerFreeTrial:t,userEmail:n,index:r}){const{data:a,refetch:i,isLoading:o}=Ue({queryKey:[`/api/classes/${e}/has-booked`,e,n],queryFn:async()=>{if(!n)return{hasBooked:!1};const c=await Pe("GET",`/api/classes/${e}/has-booked?email=${encodeURIComponent(n)}`);return c.ok?c.json():{hasBooked:!1}},enabled:!!(n&&t),staleTime:0,refetchOnMount:!0,refetchOnWindowFocus:!0});f.useEffect(()=>{n&&t&&i()},[n,t,i]);const l=(a==null?void 0:a.freeTrialUnavailable)??(a==null?void 0:a.hasBooked)??!1;return f.useEffect(()=>{n&&t&&console.log(`[FreeTrialBadge] Class ${e}, Email: ${n}, freeTrialUnavailable: ${l}, isLoading: ${o}`)},[e,n,l,o,t]),!t||n&&l?null:s.jsx(Je,{variant:"outline",className:"text-xs w-full justify-center bg-green-50 text-green-700 border-green-300 font-semibold","data-testid":`free-trial-badge-${e}-${r}`,children:"FREE TRIAL"})}function ade({classId:e,offerFirstUsePrice:t,firstUsePrice:n,userEmail:r,currencySymbol:a,index:i}){const{data:o,refetch:l}=Ue({queryKey:[`/api/classes/${e}/has-booked`,e,r],queryFn:async()=>
609{if(!r)return{hasBooked:!1};const u=await Pe("GET",`/api/classes/${e}/has-booked?email=${encodeURIComponent(r)}`);return u.ok?u.json():{hasBooked:!1}},enabled:!!(r&&t),staleTime:0,refetchOnMount:!0,refetchOnWindowFocus:!0});f.useEffect(()=>{r&&t&&l()},[r,t,l]);const c=(o==null?void 0:o.hasBooked)??!1,d=(o==null?void 0:o.firstUseUnavailable)??(c||((o==null?void 0:o.isExcludedFromFreeTrial)??!1)),m=parseFloat(String(n??""));return!t||Number.isNaN(m)||m<0||r&&d?null:s.jsxs(Je,{variant:"outline",className:"text-xs w-full justify-center bg-amber-50 text-amber-800 border-amber-300 font-semibold","data-testid":`first-use-badge-${e}-${i}`,children:["First session ",a,n]})}function xq({classes:e,onClassSelect:t,onContactInstructor:n,isRootPage:r=!1,instructorCurrency:a="GBP",instructor:i}){const[o,l]=f.useState([]),[c,d]=f.useState([]),[m,u]=f.useState(null),[h,p]=f.useState(!1),[v,y]=f.useState(!1),[g,x]=f.useState(new Date),[b,w]=f.useState(null),[j,N]=f.useState(null);Cl(b!==null||j!==null);const[C,P]=f.useState(()=>ZM(i==null?void 0:i.id));f.useEffect(()=>{const H=()=>{const L=ZM(i==null?void 0:i.id);P(L)};H();const _=setInterval(H,1e3);return window.addEventListener("storage",H),()=>{clearInterval(_),window.removeEventListener("storage",H)}},[i==null?void 0:i.id]);const{data:S=[]}=Ue({queryKey:["/api/instructors"],enabled:r}),E=H=>r?S.find(_=>_.id===H.instructorId):null,T=H=>{const _=[],L=new Date(H.getFullYear(),H.getMonth(),1);for(let U=0;U<3;U++){const J=new Date(L.getFullYear(),L.getMonth()+U,1);_.push(J)}return _};f.useEffect(()=>{const H=async()=>{var J;y(!0);const L=T(g),U=[];if(i&&!r)try{const I=L[0],re=L[L.length-1],R=new Date(re.getFullYear(),re.getMonth()+1,0),Y=`${I.getFullYear()}-${String(I.getMonth()+1).padStart(2,"0")}-01`,M=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`,se=await fetch(`/api/instructor/${i.id}/class-availability?startDate=${Y}&endDate=${M}`);if(!se.ok)throw new Error(`Batch availability request failed: ${se.status}`);const Q=await se.json();console.log(`🚀 Batch availability received for ${Object.keys(Q).length} classes`);for(const te of L){const G=new Date(te.getFullYear(),te.getMonth()+1,0),Z=[];for(let ie=1;ie<=G.getDate();ie++){const A=new Date(te.getFullYear(),te.getMonth(),ie),ge=new Date;ge.setHours(0,0,0,0);const je=new Date(A);if(je.setHours(0,0,0,0),!(je<ge))for(const ke of e){const Ie=A.getDay(),$e=A.getFullYear(),qe=String(A.getMonth()+1).padStart(2,"0"),ft=String(A.getDate()).padStart(2,"0"),be=`${$e}-${qe}-${ft}`;let Fe=!1;if(ke.exceptionalDates)try{JSON.parse(ke.exceptionalDates).find(ue=>ue.new_date===be)&&(Fe=!0)}catch(_e){console.error("Error parsing exceptionalDates for class:",ke.id,_e)}if(!Fe)if(ke.frequency==="daily"){if(ke.enabledDays)try{Fe=JSON.parse(ke.enabledDays).includes(Ie)}catch(_e){console.error("Error parsing enabledDays for class:",ke.id,_e),Fe=!1}}else Fe=Ie===ke.dayOfWeek;if(Fe){if(ke.startDate&&be<ke.startDate||ke.endDate&&be>ke.endDate||ke.excludeDates&&ke.excludeDates.split(`
610`).map(ue=>ue.trim()).filter(ue=>ue).includes(be))continue;if(ke.exceptionalDates)try{if(JSON.parse(ke.exceptionalDates).find(Me=>Me.original_date===be))continue}catch(ze){console.error("Error parsing exceptionalDates for class:",ke.id,ze)}const _e=(J=Q[ke.id])==null?void 0:J[be];if(_e){const ze={...ke,date:new Date(A),spotsLeft:_e.availableSpots||0,isAvailable:_e.isAvailable!==!1,isPastCutoff:_e.isPastCutoff||!1,isBeforeOpenTime:_e.isBeforeOpenTime||!1,isLocked:_e.isLocked===!0||ke.isLocked===!0||ke.bookingLocked===!0};if(i!=null&&i.hidePastClasses&&W(ze))continue;Z.push(ze)}else continue}}}Z.sort((ie,A)=>{const ge=ie.date.getTime()-A.date.getTime();if(ge!==0)return ge;const je=F(ie,ie.date),ke=F(A,A.date),[Ie,$e]=je.split(":").map(Number),[qe,ft]=ke.split(":").map(Number),be=(Ie||0)*60+($e||0),Fe=(qe||0)*60+(ft||0);return be-Fe}),Z.length>0&&U.push({month:te.toLocaleDateString("en-US",{month:"long"}),year:te.getFullYear(),classes:Z})}}catch(I){return console.error("Batch availability failed, falling back to individual calls:",I),_()}else return _();l(U),y(!1)},_=async()=>{const L=T(g),U=[],J=[];for(const M of L){const se=new Date(M.getFullYear(),M.getMonth()+1,0);for(let Q=1;Q<=se.getDate();Q++){const te=new Date(M.getFullYear(),M.getMonth(),Q),G=new Date;G.setHours(0,0,0,0);const Z=new Date(te);if(Z.setHours(0,0,0,0),Z<G)continue;const ie=te.getFullYear(),A=String(te.getMonth()+1).padStart(2,"0"),ge=String(te.getDate()).padStart(2,"0"),je=`${ie}-${A}-${ge}`;for(const ke of e){const Ie=te.getDay();let $e=!1;if(ke.exceptionalDates)try{JSON.parse(ke.exceptionalDates).find(be=>be.new_date===je)&&($e=!0)}catch(qe){console.error("Error parsing exceptionalDates for class:",ke.id,qe)}if(!$e)if(ke.frequency==="daily"){if(ke.enabledDays)try{$e=JSON.parse(ke.enabledDays).includes(Ie)}catch(qe){console.error("Error parsing enabledDays for class:",ke.id,qe),$e=!1}}else $e=Ie===ke.dayOfWeek;if($e){if(ke.startDate&&je<ke.startDate||ke.endDate&&je>ke.endDate||ke.excludeDates&&ke.excludeDates.split(`
611`).map(ft=>ft.trim()).filter(ft=>ft).includes(je))continue;
611if(ke.exceptionalDates)try{if(JSON.parse(ke.exceptionalDates).find(be=>be.original_date===je))continue}catch(qe){console.error("Error parsing exceptionalDates for class:",ke.id,qe)}J.push({classData:ke,date:te,dateString:je,monthStart:M})}}}}const I=Array.from(new Set(J.map(M=>M.classData.id))),re=Array.from(new Set(J.map(M=>M.dateString)));if(I.length===0||re.length===0){l([]),y(!1);return}console.log(`🚀 Making ONE bulk API call for ${I.length} classes × ${re.length} dates`);let R={};try{const M=await fetch("/api/classes/availability/bulk",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({classIds:I,dates:re})});if(M.ok)R=await M.json(),console.log(`✅ Bulk availability received for ${I.length} × ${re.length} = ${I.length*re.length} combinations`);else{console.error("Bulk availability request failed:",M.status);const se=await M.text();console.error("Error response:",se)}}catch(M){console.error("Bulk availability request error:",M)}const Y=new Map;for(const{classData:M,date:se,dateString:Q,monthStart:te}of J){const G=`${te.getFullYear()}-${te.getMonth()}`;Y.has(G)||Y.set(G,[]);const Z=R[M.id],ie=Z==null?void 0:Z[Q],A=(ie==null?void 0:ie.availableSpots)??M.maxCapacity,ge=(ie==null?void 0:ie.isAvailable)!==!1,je=(ie==null?void 0:ie.isPastCutoff)||!1,ke=(ie==null?void 0:ie.isBeforeOpenTime)||!1,Ie=(ie==null?void 0:ie.isLocked)===!0||M.isLocked===!0||M.bookingLocked===!0,$e={...M,date:new Date(se),spotsLeft:A,isAvailable:ge,isPastCutoff:je,isBeforeOpenTime:ke,isLocked:Ie};if(r){const qe=E(M);if(qe!=null&&qe.hidePastClasses&&W($e))continue}else if(i!=null&&i.hidePastClasses&&W($e))continue;Y.get(G).push($e)}for(const M of L){const se=`${M.getFullYear()}-${M.getMonth()}`,Q=Y.get(se)||[];Q.sort((te,G)=>{const Z=te.date.getTime()-G.date.getTime();if(Z!==0)return Z;const ie=F(te,te.date),A=F(G,G.date),[ge,je]=ie.split(":").map(Number),[ke,Ie]=A.split(":").map(Number),$e=(ge||0)*60+(je||0),qe=(ke||0)*60+(Ie||0);return $e-qe}),Q.length>0&&U.push({month:M.toLocaleDateString("en-US",{month:"long"}),year:M.getFullYear(),classes:Q})}l(U),y(!1)};H()},[e,g,i]),f.useEffect(()=>{const H=[];let _=0;o.forEach((L,U)=>{L.classes.forEach((J,I)=>{H.push({type:"class",classData:J,index:_,...I===0&&{month:L.month,year:L.year}}),_++})}),d(H)},[o]),f.useEffect(()=>{const H=()=>{const L=document.querySelector(".grid.grid-cols-1.md\\:grid-cols-2.lg\\:grid-cols-3");if(!L)return;L.querySelectorAll(".noMonthHeader").forEach(R=>{R.style.display=""});const I=window.getComputedStyle(L).gridTemplateColumns.split(" ").length,re=Array.from(L.children);for(let R=0;R<re.length;R+=I){const Y=re.slice(R,R+I);Y.every(se=>se.querySelector(".noMonthHeader")!==null)&&Y.forEach(se=>{const Q=se.querySelector(".noMonthHeader");Q&&(Q.style.display="none")})}},_=setTimeout(H,0);return window.addEventListener("resize",H),()=>{clearTimeout(_),window.removeEventListener("resize",H)}},[c]);const z=H=>{const _=new Date(g);_.setMonth(_.getMonth()+(H==="next"?3:-3)),x(_)},O=f.useMemo(()=>{if(!(i!=null&&i.hidePastClasses)&&!r)return!0;if(r){const U=new Date,J=new Date(U.getFullYear(),U.getMonth(),1);return new Date(g.getFullYear(),g.getMonth(),1)>J}const H=new Date,_=new Date(H.getFullYear(),H.getMonth(),1);return new Date(g.getFullYear(),g.getMonth(),1)>_},[i==null?void 0:i.hidePastClasses,g,r]),D=H=>{switch(H.toLowerCase()){case"pilates":return"bg-primary/10 border-primary/20 hover:bg-primary/20 text-primary";case"hiit":case"bootcamp":return"bg-secondary/10 border-secondary/20 hover:bg-secondary/20 text-secondary";case"yoga":return"bg-accent/10 border-accent/20 hover:bg-accent/20 text-accent";default:return"bg-slate-100 border-slate-200 hover:bg-slate-200 text-slate-700"}},k=H=>{if(!H||H==="undefined")return"TBD";const[_,L]=H.split(":");if(!_||!L||isNaN(parseInt(_))||isNaN(parseInt(L)))return"TBD";const U=parseInt(_),J=U===0?12:U>12?U-12:U,I=U>=12?"PM":"AM";return`${J}:${L} ${I}`},F=(H,_)=>{if(H.frequency==="daily")try{const L=JSON.parse(H.startTime);if(typeof L=="object"&&L!==null){const U=_.getDay();return L[U.toString()]||Object.values(L)[0]||"09:00"}}catch{}return H.startTime||"09:00"},W=H=>
611{if(H.isBeforeOpenTime||H.isPastCutoff)return!0;const _=new Date,L=new Date(H.date),U=F(H,L),[J,I]=U.split(":").map(Number);if(L.setHours(J||9,I||0,0,0),H.bookingCutoffHours===null||H.bookingCutoffHours===void 0)return L<_;const re=Number(H.bookingCutoffHours),R=new Date(L);if(re>0)return R.setHours(R.getHours()-re),_>R;if(re<0){const Y=Math.abs(re);return R.setHours(R.getHours()+Y),_>R}else return _>L},q=H=>H.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"});return v?s.jsxs("div",{className:"space-y-8",children:[s.jsx(Cw,{className:"h-8 w-40 mb-4"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3,4,5,6,7,8,9].map(H=>s.jsx(Cw,{className:"h-40 w-full rounded-lg"},H))})]}):s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"flex items-center justify-between bg-slate-50 p-3 sm:p-4 rounded-lg",children:[s.jsxs(B,{variant:"ghost",onClick:()=>z("prev"),disabled:!O,className:"flex items-center space-x-1 sm:space-x-2 text-slate-600 hover:text-primary disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"previous-months-top",children:[s.jsx(lm,{className:"h-4 w-4"}),s.jsx("span",{className:"text-sm sm:text-base",children:"Prev"})]}),s.jsxs(B,{variant:"ghost",onClick:()=>z("next"),className:"flex items-center space-x-1 sm:space-x-2 text-slate-600 hover:text-primary","data-testid":"next-months-top",children:[s.jsx("span",{className:"text-sm sm:text-base",children:"Next"}),s.jsx(Ji,{className:"h-4 w-4"})]})]}),c.length===0?s.jsxs("div",{className:"text-center py-12 text-slate-500",children:[s.jsx("p",{className:"text-lg",children:"No classes scheduled for this period"}),s.jsx("p",{className:"text-sm mt-2",children:"Try navigating to different months or check back later"})]}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:c.map((H,_)=>{var G,Z;const L=H.classData,U=H.index,J=E(L),I=(G=L.instructorName)==null?void 0:G.trim(),re=(Z=r?J==null?void 0:J.instructorName:i==null?void 0:i.instructorName)==null?void 0:Z.trim(),R=I&&I.length>0?I:re||"TBC",Y=F(L,L.date),M=k(Y),[se,Q]=Y.split(":");let te="TBD";if(se&&Q&&!isNaN(parseInt(se))&&!isNaN(parseInt(Q))){const ie=parseInt(se)*60+parseInt(Q)+L.duration,A=Math.floor(ie/60),ge=ie%60,je=`${String(A).padStart(2,"0")}:${String(ge).padStart(2,"0")}`;te=k(je)}return s.jsxs("div",{className:"space-y-2",children:[H.month&&H.year?s.jsxs("h2",{className:"text-2xl font-bold text-slate-900 mb-2",children:[H.month," ",H.year]}):s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-2 noMonthHeader",children:" "}),s.jsx(Ce,{className:`${D(L.classType)} border cursor-pointer transition-all hover:shadow-md ${L.isAvailable?"":"opacity-60"}`,onClick:()=>{if(L.isAvailable)t(L);else if(L.spotsLeft===0)u(L);else if(L.isPastCutoff)return},"data-testid":`class-card-${L.id}-${U}`,children:s.jsxs(Ee,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("div",{className:"font-semibold text-slate-900",children:q(L.date)}),(L.description||L.photoUrl)&&s.jsxs(vT,{children:[s.jsx(bT,{asChild:!0,children:s.jsx(B,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-full transition-colors",onClick:ie=>{ie.stopPropagation(),w(L.id)},"data-testid":`info-button-${L.id}-${U}`,children:s.jsx(FN,{className:"h-4 w-4"})})}),s.jsx(KN,{children:s.jsx("p",{children:"View class details"})})]})]}),s.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-2","data-testid":`class-name-${L.id}-${U}`,children:L.name}),s.jsxs("div",{className:"text-sm text-slate-500 mb-2",children:["Instructor: ",R]}),r&&J&&s.jsx("div",{className:"mb-2",children:s.jsx(dt,{href:`/classes/${J.subdomain}`,children:s.jsxs(B,{variant:"link",className:"h-auto p-0 text-sm text-slate-600 hover:text-primary font-normal",onClick:ie=>ie.stopPropagation(),"data-testid":`instructor-link-${L.id}-${U}`,children:["by ",J.instructorName,s.jsx(Lr,{className:"h-3 w-3 ml-1"})]})})}),s.jsxs("div",{className:"text-sm text-slate-600 mb-2","data-testid":`class-time-${L.id}-${U}`,children:["🕐 ",M," - ",te]}),L.location&&s.jsxs("div",{className:"text-sm text-slate-500 mb-3","data-testid":`class-location-${L.id}-${U}`,children:["📍 ",L.location]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(rde,{classId:L.id,offerFreeTrial:L.offerFreeTrial||!1,userEmail:C,index:U}),L.allowSingleBooking&&s.jsx(ade,{classId:L.id,offerFirstUsePrice:L.offerFirstUsePrice||!1,firstUsePrice:L.firstUsePrice,userEmail:C,currencySymbol:mt(r?(J==null?void 0:J.currency)||"GBP":a),index:U}),L.memberships&&L.memberships.length>0&&s.jsx(Je,{variant:"outline",className:"text-xs w-full justify-center bg-purple-50 text-purple-700 border-purple-200","data-testid":`membership-badge-${L.id}-${U}`,children:L.memberships.map(ie=>ie.membershipName).join(", ")}),(()=>{const ie=r?J:i;
611return(ie==null?void 0:ie.hideSpotsRemaining)===!0?s.jsx("div",{className:"h-0.5 w-full rounded bg-secondary"}):s.jsx(Je,{variant:L.spotsLeft===0?"destructive":L.isLocked?"outline":"secondary",className:"text-xs w-full justify-center","data-testid":`spots-badge-${L.id}-${U}`,children:L.isAvailable?L.isLocked?"Locked":`${Math.max(L.spotsLeft,0)} ${L.spotsLeft===1?"spot":"spots"} left`:L.spotsLeft===0?"Full":"Booking closed"})})(),(()=>{const ie=r?J:i;if((ie==null?void 0:ie.hidePriceOnCalendarCards)===!0)return null;const A=parseFloat(String(L.singlePrice||"0")),ge=L.allowSingleBooking===!0||A>0,je=mt(r?(J==null?void 0:J.currency)||"GBP":a),ke=L.packages,Ie=Array.isArray(ke)?ke:[];if(!ge&&Ie.length===0)return null;const $e=L.frequency==="daily"?"Day":"Week",qe=Ie.length>0,be=ge&&(L.allowSingleBooking===!0||!qe)?s.jsx("div",{className:"text-center pt-1","data-testid":`class-price-${L.id}-${U}`,children:s.jsxs("span",{className:qe?"text-sm font-normal text-slate-700":"text-lg font-bold text-slate-900",children:[qe&&"Single Class: ",je,L.singlePrice]})}):null,Fe=Ie.length===1?`${Ie[0].numberOfWeeks} ${$e} Package: ${je}${Ie[0].price}`:Ie.length>1?`Packages from ${je}${Math.min(...Ie.map(_e=>parseFloat(String(_e.price)))).toFixed(2)}`:null;return s.jsxs("div",{className:"space-y-0.5",children:[be,Fe&&s.jsxs("div",{className:"text-sm font-bold text-slate-900 text-center",children:[Fe,Ie.length>1&&s.jsxs(s.Fragment,{children:[" ",s.jsx("button",{type:"button",className:"text-primary underline hover:no-underline font-normal font-bold",onClick:_e=>{_e.stopPropagation(),N(L.id)},children:"More"})]})]})]})})()]})]})})]},`${L.id}-${L.date.toISOString()}`)})}),(()=>{var _;const H=(_=c.find(L=>L.classData.id===b))==null?void 0:_.classData;return!H||!H.description&&!H.photoUrl?null:s.jsx(Ct,{open:!0,onOpenChange:L=>{L||w(null)},children:s.jsxs(St,{className:"max-w-md max-h-[90vh] flex flex-col",onClick:L=>L.stopPropagation(),children:[s.jsx(kt,{children:s.jsx(Pt,{children:H.name})}),s.jsxs("div",{className:"mt-4 overflow-y-auto flex-1 pr-2 -mr-2",children:[H.description&&s.jsx("p",{className:"text-sm text-slate-600 leading-relaxed",children:nde(H.description)}),H.photoUrl&&s.jsx("div",{className:H.description?"mt-4":"",children:s.jsx("img",{src:H.photoUrl,alt:`${H.name} photo`,className:"w-full rounded-lg object-cover"})})]})]})})})(),(()=>{const H=c.find(R=>R.classData.id===j),_=H==null?void 0:H.classData;if(!_||!j)return null;const L=_.packages,U=Array.isArray(L)?[...L].sort((R,Y)=>R.numberOfWeeks-Y.numberOfWeeks):[],J=_.frequency==="daily"?"days":"weeks",I=E(_),re=mt(r?(I==null?void 0:I.currency)||"GBP":a);return s.jsx(Ct,{open:!0,onOpenChange:R=>{R||N(null)},children:s.jsxs(St,{className:"max-w-sm",onClick:R=>R.stopPropagation(),children:[s.jsx(kt,{children:s.jsxs(Pt,{children:["Packages for ",_.name]})}),s.jsxs("table",{className:"mt-3 w-full text-sm table-fixed",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-slate-200 text-left text-xs font-medium text-slate-500 uppercase tracking-wider",children:[s.jsx("th",{className:"pb-2 pr-4 font-medium",children:"Package"}),s.jsx("th",{className:"pb-2 pr-4 text-right w-20",children:"Duration"}),s.jsx("th",{className:"pb-2 text-right w-24",children:"Price"})]})}),s.jsx("tbody",{children:U.map((R,Y)=>s.jsxs("tr",{className:"border-b border-slate-100 last:border-0",children:[s.jsx("td",{className:"py-2 pr-4 text-slate-700 align-baseline",children:R.name||`${R.numberOfWeeks} ${_.frequency==="daily"?"Day":"Week"} Package`}),s.jsxs("td",{className:"py-2 pr-4 text-slate-500 text-xs text-right align-baseline w-20",children:[R.numberOfWeeks," ",J]}),s.jsxs("td",{className:"py-2 text-right font-medium text-slate-900 align-baseline w-24 tabular-nums",children:[re,typeof R.price=="string"?R.price:String(R.price)]})]},Y))})]})]})})})(),c.length>0&&s.jsxs("div",{className:"flex items-center justify-between bg-slate-50 p-3 sm:p-4 rounded-lg",children:[s.jsxs(B,{variant:"ghost",onClick:()=>z("prev"),disabled:!O,className:"flex items-center space-x-1 sm:space-x-2 text-slate-600 hover:text-primary disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"previous-months-bottom",children:[s.jsx(lm,{className:"h-4 w-4"}),s.jsx("span",{className:"text-sm sm:text-base",children:"Prev"})]}),s.jsxs(B,{variant:"ghost",onClick:()=>z("next"),className:"flex items-center space-x-1 sm:space-x-2 text-slate-600 hover:text-primary","data-testid":"next-months-bottom",children:[s.jsx("span",{className:"text-sm sm:text-base",children:"Next"}),s.jsx(Ji,{className:"h-4 w-4"})]})]}),s.jsx(Ct,{open:!!m,onOpenChange:H=>{H||(u(null),p(!1))},children:s.jsxs(St,{className:"max-w-md",children:[s.jsx(kt,{children:s.jsx(Pt,{children:h?"Add to Waitlist":"Class is Full"})}),s.jsx("div",{className:"space-y-4",children:h?m&&s.jsx(fq,{classId:m.id,classDate:m.date,classTime:F(m,m.date),onSuccess:()=>{p(!1),u(null)},onCancel:()=>p(!1)}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-lg font-semibold mb-2",children:m==null?void 0:m.name}),s.jsxs("div",{className:"text-sm text-slate-600 mb-4",children:[m==null?void 0:m.date.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})," at ",m?k(F(m,m.date)):"TBD"]}),s.jsx("div",{className:"bg-orange-50 border border-orange-200 rounded-lg p-4 mb-4",children:s.jsx("p",{className:"text-sm text-orange-800",children:"This class is currently full with no spots available."})})]}),s.jsxs("div",{className:"text-center space-y-3",children:[s.jsx("p",{className:"text-sm text-slate-600",children:"You can choose a different class time, or contact the instructor to see if they can accommodate you."}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(B,{variant:"outline",onClick:()=>u(null),className:"w-full","data-testid":"choose-different-class-button",children:"Choose Different Class"}),(m==null?void 0:m.waitlistEnabled)&&s.jsx(B,{onClick:()=>p(!0),className:"w-full",children:"Add to Waitlist"}),n&&s.jsx(B,{onClick:()=>{m&&(n(m),u(null))},className:"w-full","data-testid":"contact-instructor-button",children:"Contact Instructor"})]})]})]})})]})})]})}var gS="rovingFocusGroup.onEntryFocus",ide={bubbles:!1,cancelable:!0},gv="RovingFocusGroup",[fP,gq,ode]=DN(gv),[lde,Np]=ua(gv,[ode]),[cde,dde]=lde(gv),yq=f.forwardRef((e,t)=>
vendor: 6,051 bytes, line 611
611s.jsx(fP.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(fP.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(ude,{...e,ref:t})})}));yq.displayName=gv;var ude=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:m=!1,...u}=e,h=f.useRef(null),p=Us(t,h),v=xv(i),[y,g]=yi({prop:o,defaultProp:l??null,onChange:c,caller:gv}),[x,b]=f.useState(!1),w=Za(d),j=gq(n),N=f.useRef(!1),[C,P]=f.useState(0);return f.useEffect(()=>{const S=h.current;if(S)return S.addEventListener(gS,w),()=>S.removeEventListener(gS,w)},[w]),s.jsx(cde,{scope:n,orientation:r,dir:v,loop:a,currentTabStopId:y,onItemFocus:f.useCallback(S=>g(S),[g]),onItemShiftTab:f.useCallback(()=>b(!0),[]),onFocusableItemAdd:f.useCallback(()=>P(S=>S+1),[]),onFocusableItemRemove:f.useCallback(()=>P(S=>S-1),[]),children:s.jsx(ms.div,{tabIndex:x||C===0?-1:0,"data-orientation":r,...u,ref:p,style:{outline:"none",...e.style},onMouseDown:At(e.onMouseDown,()=>{N.current=!0}),onFocus:At(e.onFocus,S=>{const E=!N.current;if(S.target===S.currentTarget&&E&&!x){const T=new CustomEvent(gS,ide);if(S.currentTarget.dispatchEvent(T),!T.defaultPrevented){const z=j().filter(W=>W.focusable),O=z.find(W=>W.active),D=z.find(W=>W.id===y),F=[O,D,...z].filter(Boolean).map(W=>W.ref.current);wq(F,m)}}N.current=!1}),onBlur:At(e.onBlur,()=>b(!1))})})}),vq="RovingFocusGroupItem",bq=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...l}=e,c=pi(),d=i||c,m=dde(vq,n),u=m.currentTabStopId===d,h=gq(n),{onFocusableItemAdd:p,onFocusableItemRemove:v,currentTabStopId:y}=m;return f.useEffect(()=>{if(r)return p(),()=>v()},[r,p,v]),s.jsx(fP.ItemSlot,{scope:n,id:d,focusable:r,active:a,children:s.jsx(ms.span,{tabIndex:u?0:-1,"data-orientation":m.orientation,...l,ref:t,onMouseDown:At(e.onMouseDown,g=>{r?m.onItemFocus(d):g.preventDefault()}),onFocus:At(e.onFocus,()=>m.onItemFocus(d)),onKeyDown:At(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){m.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const x=fde(g,m.orientation,m.dir);if(x!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let w=h().filter(j=>j.focusable).map(j=>j.ref.current);if(x==="last")w.reverse();else if(x==="prev"||x==="next"){x==="prev"&&w.reverse();const j=w.indexOf(g.currentTarget);w=m.loop?pde(w,j+1):w.slice(j+1)}setTimeout(()=>wq(w))}}),children:typeof o=="function"?o({isCurrentTabStop:u,hasTabStop:y!=null}):o})})});bq.displayName=vq;var mde={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hde(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function fde(e,t,n){const r=hde(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return mde[r]}function wq(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function pde(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var AT=yq,TT=bq,OT="Radio",[xde,jq]=ua(OT),[gde,yde]=xde(OT),Nq=f.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:a=!1,required:i,disabled:o,value:l="on",onCheck:c,form:d,...m}=e,[u,h]=f.useState(null),p=Us(t,g=>h(g)),v=f.useRef(!1),y=u?d||!!u.closest("form"):!0;return s.jsxs(gde,{scope:n,checked:a,disabled:o,children:[s.jsx(ms.button,{type:"button",role:"radio","aria-checked":a,"data-state":Pq(a),"data-disabled":o?"":void 0,disabled:o,value:l,...m,ref:p,onClick:At(e.onClick,g=>{a||c==null||c(),y&&(v.current=g.isPropagationStopped(),v.current||g.stopPropagation())})}),y&&s.jsx(kq,{control:u,bubbles:!v.current,name:r,value:l,checked:a,required:i,disabled:o,form:d,style:{transform:"translateX(-100%)"}})]})});Nq.displayName=OT;var Cq="RadioIndicator",Sq=f.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...a}=e,i=yde(Cq,n);return s.jsx(Na,{present:r||i.checked,children:s.jsx(ms.span,{"data-state":Pq(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t})})});Sq.displayName=Cq;var vde="RadioBubbleInput",kq=f.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...a},i)=>{const o=f.useRef(null),l=Us(o,i),c=e1(n),d=LN(t);return f.useEffect(()=>{const m=o.current;if(!m)return;const u=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(u,"checked").set;if(c!==n&&p){const v=new Event("click",{bubbles:r});p.call(m,n),m.dispatchEvent(v)}},[c,n,r]),s.jsx(ms.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});kq.displayName=vde;function Pq(e){return e?"checked":"unchecked"}var bde=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],r1="RadioGroup",[wde]=ua(r1,[Np,jq]),Eq=Np(),Dq=jq(),[jde,Nde]=wde(r1),Aq=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:a,value:i,required:o=!1,disabled:l=!1,orientation:c,dir:d,loop:m=!0,onValueChange:u,...h}=e,p=Eq(n),v=xv(d),[y,g]=yi({prop:i,defaultProp:a??null,onChange:u,caller:r1});return s.jsx(jde,{scope:n,name:r,required:o,disabled:l,value:y,onValueChange:g,children:s.jsx(AT,{asChild:!0,...p,orientation:c,dir:v,loop:m,children:s.jsx(ms.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:v,...h,ref:t})})})});Aq.displayName=r1;var Tq="RadioGroupItem",Oq=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...a}=e,i=Nde(Tq,n),o=i.disabled||r,l=Eq(n),c=Dq(n),d=f.useRef(null),m=Us(t,d),u=i.value===a.value,h=f.useRef(!1);return f.useEffect(()=>{const p=y=>{bde.includes(y.key)&&(h.current=!0)},v=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",v)}},[]),s.jsx(TT,{asChild:!0,...l,focusable:!o,active:u,children:s.jsx(Nq,{disabled:o,required:i.required,
611checked:u,...c,...a,name:i.name,ref:m,onCheck:()=>i.onValueChange(a.value),onKeyDown:At(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:At(a.onFocus,()=>{var p;h.current&&((p=d.current)==null||p.click())})})})});Oq.displayName=Tq;var Cde="RadioGroupIndicator",Fq=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,a=Dq(n);return s.jsx(Sq,{...a,...r,ref:t})});Fq.displayName=Cde;var _q=Aq,Mq=Oq,Sde=Fq;const Sl=f.forwardRef(({className:e,...t},n)=>s.jsx(_q,{className:bt("grid gap-2",e),...t,ref:n}));Sl.displayName=_q.displayName;const $r=f.forwardRef(({className:e,...t},n)=>s.jsx(Mq,{ref:n,className:bt("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:s.jsx(Sde,{className:"flex items-center justify-center",children:s.jsx(G9,{className:"h-2.5 w-2.5 fill-current text-current"})})}));$r.displayName=Mq.displayName;var a1="Checkbox",[kde]=ua(a1),[Pde,FT]=kde(a1);function Ede(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:a,disabled:i,form:o,name:l,onCheckedChange:c,required:d,value:m="on",internal_do_not_use_render:u}=e,[h,p]=yi({prop:n,defaultProp:a??!1,onChange:c,caller:a1}),[v,y]=f.useState(null),[g,x]=f.useState(null),b=f.useRef(!1),w=v?!!o||!!v.closest("form"):!0,j={checked:h,disabled:i,setChecked:p,control:v,setControl:y,name:l,form:o,value:m,hasConsumerStoppedPropagationRef:b,required:d,defaultChecked:Cd(a)?!1:a,isFormControl:w,bubbleInput:g,setBubbleInput:x};return s.jsx(Pde,{scope:t,...j,children:Dde(u)?u(j):r})}var $q="CheckboxTrigger",Iq=f.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},a)=>{const{control:i,value:o,disabled:l,checked:c,required:d,setControl:m,setChecked:u,hasConsumerStoppedPropagationRef:h,isFormControl:p,bubbleInput:v}=FT($q,e),y=Us(a,m),g=f.useRef(c);return f.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const b=()=>u(g.current);return x.addEventListener("reset",b),()=>x.removeEventListener("reset",b)}},[i,u]),s.jsx(ms.button,{type:"button",role:"checkbox","aria-checked":Cd(c)?"mixed":c,"aria-required":d,"data-state":zq(c),"data-disabled":l?"":void 0,disabled:l,value:o,...r,ref:y,onKeyDown:At(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:At(n,x=>{u(b=>Cd(b)?!0:!b),v&&p&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})})});Iq.displayName=$q;var _T=f.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:d,form:m,...u}=e;return s.jsx(Ede,{__scopeCheckbox:n,checked:a,defaultChecked:i,disabled:l,required:o,onCheckedChange:d,name:r,form:m,value:c,internal_do_not_use_render:({isFormControl:h})=>s.jsxs(s.Fragment,{children:[s.jsx(Iq,{...u,ref:t,__scopeCheckbox:n}),h&&s.jsx(Uq,{__scopeCheckbox:n})]})})});_T.displayName=a1;var Rq="CheckboxIndicator",Bq=f.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...a}=e,i=FT(Rq,n);return s.jsx(Na,{present:r||Cd(i.checked)||i.checked===!0,children:s.jsx(ms.span,{"data-state":zq(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});Bq.displayName=Rq;var Lq="CheckboxBubbleInput",Uq=f.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:o,required:l,disabled:c,name:d,value:m,form:u,bubbleInput:h,setBubbleInput:p}=FT(Lq,e),v=Us(n,p),y=e1(i),g=LN(r);f.useEffect(()=>{const b=h;if(!b)return;const w=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(w,"checked").set,C=!a.current;if(y!==i&&N){const P=new Event("click",{bubbles:C});b.indeterminate=Cd(i),N.call(b,Cd(i)?!1:i),b.dispatchEvent(P)}},[h,y,i,a]);const x=f.useRef(Cd(i)?!1:i);return s.jsx(ms.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:l,disabled:c,name:d,value:m,form:u,...t,tabIndex:-1,ref:v,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Uq.displayName=Lq;function Dde(e){return typeof e=="function"}function Cd(e){return e==="indeterminate"}function zq(e){return Cd(e)?"indeterminate":e?"checked":"unchecked"}const Xt=f.forwardRef(({className:e,...t},n)=>s.jsx(_T,{ref:n,className:bt("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:s.jsx(Bq,{className:bt("flex items-center justify-center text-current"),children:s.jsx(bn,{className:"h-4 w-4"})})}));Xt.displayName=_T.displayName;var qq="basil",Ade=function(t){return t===3?"v3":t},Wq="https://js.stripe.com",Tde="".concat(Wq,"/").concat(qq,"/stripe.js"),Ode=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Fde=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;var _de=function(t){return Ode.test(t)||Fde.test(t)},Mde=function(){for(var t=document.querySelectorAll('script[src^="'.concat(Wq,'"]')),n=0;n<t.length;n++){var r=t[n];if(_de(r.src))return r}return null},e5=function(t){var n="",r=document.createElement("script");r.src="".concat(Tde).concat(n);var a=document.head||document.body;if(!a)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return a.appendChild(r),r},$de=function(t,n){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"7.9.0",startTime:n})},Jp=null,x0=null,g0=null,Ide=function(t){return function(n){t(new Error("Failed to load Stripe.js",{cause:n}))}},Rde=function(t,n){return function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))}},Bde=function(t){return Jp!==null?Jp:(Jp=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe){n(window.Stripe);return}try{var a=Mde();if(!(a&&t)){if(!a)a=e5(t);else if(a&&g0!==null&&x0!==null){var i;a.removeEventListener("load",g0),a.removeEventListener("error",x0),(i=a.parentNode)===null||i===void 0||i.removeChild(a),a=e5(t)}}g0=Rde(n,r),x0=Ide(r),a.addEventListener("load",g0),a.addEventListener("error",x0)}catch(o){r(o);return}}),Jp.catch(function(n){return Jp=null,Promise.reject(n)}))},Lde=function(t,n,r){if(t===null)return null;var a=n[0],i=a.match(/^pk_test/),o=Ade(t.version),l=qq;i&&o!==l&&console.warn("Stripe.js@".concat(o," was loaded on the page, but @stripe/stripe-js@").concat("7.9.0"," expected Stripe.js@").concat(l,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var c=t.apply(void 0,n);return $de(c,r),c}
vendor: 5,381 bytes, lines 611-612
611,Xp,Hq=!1,Vq=function(){return Xp||(Xp=Bde(null).catch(function(t){return Xp=null,Promise.reject(t)}),Xp)};Promise.resolve().then(function(){return Vq()}).catch(function(e){Hq||console.warn(e)});var od=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Hq=!0;var a=Date.now();return Vq().then(function(i){return Lde(i,n,a)})},Kq={exports:{}},Ude="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",zde=Ude,qde=zde;function Gq(){}function Yq(){}Yq.resetWarningCache=Gq;var Wde=function(){function e(r,a,i,o,l,c){if(c!==qde){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Yq,resetWarningCache:Gq};return n.PropTypes=n,n};Kq.exports=Wde();var Hde=Kq.exports;const vs=Qs(Hde);function t5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function s5(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?t5(Object(n),!0).forEach(function(r){Qq(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Db(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Db=function(t){return typeof t}:Db=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Db(e)}function Qq(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vde(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Kde(e,t){if(e==null)return{};var n=Vde(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Jq(e,t){return Gde(e)||Yde(e,t)||Qde(e,t)||Jde()}function Gde(e){if(Array.isArray(e))return e}function Yde(e,t){var n=e&&(typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"]);if(n!=null){var r=[],a=!0,i=!1,o,l;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));a=!0);}catch(c){i=!0,l=c}finally{try{!a&&n.return!=null&&n.return()}finally{if(i)throw l}}return r}}function Qde(e,t){if(e){if(typeof e=="string")return n5(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return n5(e,t)}}function n5(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Jde(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
612In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Sa=function(t,n,r){var a=!!r,i=he.useRef(r);he.useEffect(function(){i.current=r},[r]),he.useEffect(function(){if(!a||!t)return function(){};var o=function(){i.current&&i.current.apply(i,arguments)};return t.on(n,o),function(){t.off(n,o)}},[a,n,t,i])},pP=function(t){var n=he.useRef(t);return he.useEffect(function(){n.current=t},[t]),n.current},$f=function(t){return t!==null&&Db(t)==="object"},Xde=function(t){return $f(t)&&typeof t.then=="function"},Zde=function(t){return $f(t)&&typeof t.elements=="function"&&typeof t.createToken=="function"&&typeof t.createPaymentMethod=="function"&&typeof t.confirmCardPayment=="function"},r5="[object Object]",eue=function e(t,n){if(!$f(t)||!$f(n))return t===n;var r=Array.isArray(t),a=Array.isArray(n);if(r!==a)return!1;var i=Object.prototype.toString.call(t)===r5,o=Object.prototype.toString.call(n)===r5;if(i!==o)return!1;if(!i&&!r)return t===n;var l=Object.keys(t),c=Object.keys(n);if(l.length!==c.length)return!1;for(var d={},m=0;m<l.length;m+=1)d[l[m]]=!0;for(var u=0;u<c.length;u+=1)d[c[u]]=!0;var h=Object.keys(d);if(h.length!==l.length)return!1;var p=t,v=n,y=function(x){return e(p[x],v[x])};return h.every(y)},Xq=function(t,n,r){return $f(t)?Object.keys(t).reduce(function(a,i){var o=!$f(n)||!eue(t[i],n[i]);return r.includes(i)?(o&&console.warn("Unsupported prop change: options.".concat(i," is not a mutable property.")),a):o?s5(s5({},a||{}),{},Qq({},i,t[i])):a},null):null},Zq="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",a5=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Zq;if(t===null||Zde(t))return t;throw new Error(n)},tue=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Zq;if(Xde(t))return{tag:"async",stripePromise:Promise.resolve(t).then(function(a){return a5(a,n)})};
612var r=a5(t,n);return r===null?{tag:"empty"}:{tag:"sync",stripe:r}},sue=function(t){!t||!t._registerWrapper||!t.registerAppInfo||(t._registerWrapper({name:"react-stripe-js",version:"3.10.0"}),t.registerAppInfo({name:"react-stripe-js",version:"3.10.0",url:"https://stripe.com/docs/stripe-js/react"}))},i1=he.createContext(null);i1.displayName="ElementsContext";var eW=function(t,n){if(!t)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(n," in an <Elements> provider."));return t},yv=function(t){var n=t.stripe,r=t.options,a=t.children,i=he.useMemo(function(){return tue(n)},[n]),o=he.useState(function(){return{stripe:i.tag==="sync"?i.stripe:null,elements:i.tag==="sync"?i.stripe.elements(r):null}}),l=Jq(o,2),c=l[0],d=l[1];he.useEffect(function(){var h=!0,p=function(y){d(function(g){return g.stripe?g:{stripe:y,elements:y.elements(r)}})};return i.tag==="async"&&!c.stripe?i.stripePromise.then(function(v){v&&h&&p(v)}):i.tag==="sync"&&!c.stripe&&p(i.stripe),function(){h=!1}},[i,c,r]);var m=pP(n);he.useEffect(function(){m!==null&&m!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[m,n]);var u=pP(r);return he.useEffect(function(){if(c.elements){var h=Xq(r,u,["clientSecret","fonts"]);h&&c.elements.update(h)}},[r,u,c.elements]),he.useEffect(function(){sue(c.stripe)},[c.stripe]),he.createElement(i1.Provider,{value:c},a)};
612yv.propTypes={stripe:vs.any,options:vs.object};var nue=function(t){var n=he.useContext(i1);return eW(n,t)},o1=function(){var t=nue("calls useElements()"),n=t.elements;return n};vs.func.isRequired;var tW=he.createContext(null);tW.displayName="CheckoutSdkContext";var rue=function(t,n){if(!t)throw new Error("Could not find CheckoutProvider context; You need to wrap the part of your app that ".concat(n," in an <CheckoutProvider> provider."));return t},aue=he.createContext(null);aue.displayName="CheckoutContext";vs.any,vs.shape({fetchClientSecret:vs.func.isRequired,elementsOptions:vs.object}).isRequired;var xP=function(t){var n=he.useContext(tW),r=he.useContext(i1);if(n&&r)throw new Error("You cannot wrap the part of your app that ".concat(t," in both <CheckoutProvider> and <Elements> providers."));return n?rue(n,t):eW(r,t)},iue=["mode"],oue=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},jr=function(t,n){var r="".concat(oue(t),"Element"),a=function(c){var d=c.id,m=c.className,u=c.options,h=u===void 0?{}:u,p=c.onBlur,v=c.onFocus,y=c.onReady,g=c.onChange,x=c.onEscape,b=c.onClick,w=c.onLoadError,j=c.onLoaderStart,N=c.onNetworksChange,C=c.onConfirm,P=c.onCancel,S=c.onShippingAddressChange,E=c.onShippingRateChange,T=c.onSavedPaymentMethodRemove,z=c.onSavedPaymentMethodUpdate,O=xP("mounts <".concat(r,">")),D="elements"in O?O.elements:null,k="checkoutSdk"in O?O.checkoutSdk:null,F=he.useState(null),W=Jq(F,2),q=W[0],H=W[1],_=he.useRef(null),L=he.useRef(null);Sa(q,"blur",p),Sa(q,"focus",v),Sa(q,"escape",x),Sa(q,"click",b),Sa(q,"loaderror",w),Sa(q,"loaderstart",j),Sa(q,"networkschange",N),Sa(q,"confirm",C),Sa(q,"cancel",P),Sa(q,"shippingaddresschange",S),Sa(q,"shippingratechange",E),Sa(q,"savedpaymentmethodremove",T),Sa(q,"savedpaymentmethodupdate",z),Sa(q,"change",g);var U;y&&(t==="expressCheckout"?U=y:U=function(){y(q)}),Sa(q,"ready",U),he.useLayoutEffect(function(){if(_.current===null&&L.current!==null&&(D||k)){var I=null;if(k)switch(t){case"payment":I=k.createPaymentElement(h);break;case"address":if("mode"in h){var re=h.mode,R=Kde(h,iue);if(re==="shipping")I=k.createShippingAddressElement(R);else if(re==="billing")I=k.createBillingAddressElement(R);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":I=k.createExpressCheckoutElement(h);break;case"currencySelector":I=k.createCurrencySelectorElement();break;case"taxId":I=k.createTaxIdElement(h);break;default:throw new Error("Invalid Element type ".concat(r,". You must use either the <PaymentElement />, <AddressElement options={{mode: 'shipping'}} />, <AddressElement options={{mode: 'billing'}} />, or <ExpressCheckoutElement />."))}else D&&(I=D.create(t,h));_.current=I,H(I),I&&I.mount(L.current)}},[D,k,h]);var J=pP(h);return he.useEffect(function(){if(_.current){var I=Xq(h,J,["paymentRequest"]);I&&"update"in _.current&&_.current.update(I)}},[h,J]),he.useLayoutEffect(function(){return function(){if(_.current&&typeof _.current.destroy=="function")try{_.current.destroy(),_.current=null}catch{}}},[]),he.createElement("div",{id:d,className:m,ref:L})},i=function(c){xP("mounts <".concat(r,">"));var d=c.id,m=c.className;return he.createElement("div",{id:d,className:m})},o=n?i:a;return o.propTypes={id:vs.string,className:vs.string,onChange:vs.func,onBlur:vs.func,onFocus:vs.func,onReady:vs.func,onEscape:vs.func,onClick:vs.func,onLoadError:vs.func,onLoaderStart:vs.func,onNetworksChange:vs.func,onConfirm:vs.func,onCancel:vs.func,onShippingAddressChange:vs.func,onShippingRateChange:vs.func,onSavedPaymentMethodRemove:vs.func,onSavedPaymentMethodUpdate:vs.func,options:vs.object},o.displayName=r,o.__elementType=t,o},Nr=typeof window>"u",lue=he.createContext(null);lue.displayName="EmbeddedCheckoutProviderContext";var l1=function(){var t=xP("calls useStripe()"),n=t.stripe;return n};jr("auBankAccount",Nr);var i5=jr("card",Nr);jr("cardNumber",Nr);jr("cardExpiry",Nr);jr("cardCvc",Nr);jr("fpxBank",Nr);jr("iban",Nr);jr("idealBank",Nr);jr("p24Bank",Nr);jr("epsBank",Nr);var MT=jr("payment",Nr);jr("expressCheckout",Nr);jr("currencySelector",Nr);jr("paymentRequestButton",Nr);jr("linkAuthentication",Nr);jr("address",Nr);jr("shippingAddress",Nr);jr("paymentMethodMessaging",Nr);jr("affirmMessage",Nr);jr("afterpayClearpayMessage",Nr);jr("taxId",Nr);function cue({selectedClasses:e,existingClient:t,instructorId:n,customerEmail:r,clientFormData:a,setClientFormData:i,agreedToTerms:o,setAgreedToTerms:l,currentFormIndex:c,setCurrentFormIndex:d,onBack:m,onConfirm:u,totalSteps:h,isBooking:p=!1}){var R;const{toast:v}=Yt(),g=e.map(Y=>Y.classData).filter((Y,M,se)=>M===se.findIndex(Q=>Q.id===Y.id)).filter(Y=>Y.requireOnboardingForm&&Y.onboardingFormId).map(Y=>({classId:Y.id,className:Y.name,formId:Y.onboardingFormId})),x=Y=>{if(!t||!t.onboardingData)return!1;const M=t.onboardingData;if(Array.isArray(M.formCompletions)){const te=M.formCompletions.find(G=>G.formId===Y);if(te&&te.completedAt){const G=new Date(te.completedAt),Z=new Date;return Z.setFullYear(Z.getFullYear()-1),G>Z}return!1}const se=M.formId,Q=M.completedAt;if(!Q)return!1;if(se===Y){const te=new Date(Q),G=new Date;return G.setFullYear(G.getFullYear()-1),te>G}return!1},w=g.filter(Y=>!x(Y.formId)).filter((Y,M,se)=>M===se.findIndex(Q=>Q.formId===Y.formId)),j=e.some(Y=>Y.classData.requireEmergencyContact!==!1),N=(t==null?void 0:t.emergencyContactName)&&(t==null?void 0:t.emergencyContactPhone),C=j&&!N,P=e.some(Y=>Y.classData.requirePhoneForBooking===!0),S=!!((t==null?void 0:t.phone)||"").trim(),E=P&&!S,T=E||C,z=(R=e[0])==null?void 0:R.classData,O=(z==null?void 0:z.termsAndConditionsUrl)||(z==null?void 0:z.termsAndConditionsText),D=w[c],{data:k,isLoading:F}=Ue({queryKey:[`/api/onboarding-forms/${D==null?void 0:D.formId}`],enabled:!!(D!=null&&D.formId)&&c>=0&&c<w.length}),W=T&&c===-1,q=!W&&c>=0&&c<w.length,H=!W&&c>=w.length&&O,_=h;console.log("🔍 FormsCollectionStep received totalSteps:",_,"from prop");const L=T?1:0,U=W?0:q?L+c:H?L+w.length:0;f.useEffect(()=>{console.log("🔍 FormsCollectionStep state:",{formsToComplete:g.length,formsToCompleteIds:g.map(Y=>Y.formId),requiredForms:w.length,requiredFormIds:w.map(Y=>Y.formId),currentFormIndex:c,currentForm:D==null?void 0:D.formId,currentFormData:k?"loaded":"not loaded",isLoadingForm:F,showingContactStep:W,showingForm:q,showingTerms:H,needsEmergencyContact:C,needsPhone:E,hasTerms:O,totalSteps:_,currentStepIndex:U,calculation:`${T?1:0} + ${w.length} + ${O?1:0} = ${_}`})},[g,w,c,D,k,F,W,q,H,T,C,E,O,_,U]);const J=()=>{if(W){if(E&&!(a.phone||"").trim()){v({title:"Required Fields Missing",description:"Please enter your phone number.",variant:"destructive"});return}if(C&&(!a.emergencyContactName.trim()||!a.emergencyContactPhone.trim())){v({title:"Required Fields Missing",description:"Please provide emergency contact name and phone number.",variant:"destructive"});return}w.length>0||O?d(0):I();return}if(q&&k){const Y=JSON.parse(k.questions||"[]"),M=[];for(const se of Y)if(se.required){const Q=a.onboardingData[se.id];(!Q||typeof Q=="string"&&Q.trim()===""||typeof Q=="boolean"&&!Q)&&M.push(se.label)}if(M.length>0){v({title:"Required Fields Missing",description:`Please complete: ${M.join(", ")}`,variant:"destructive"});return}c<w.length-1?d(c+1):O?d(w.length):I();return}},I=()=>
612{if(O&&!o){v({title:"Terms Required",description:"Please agree to the terms and conditions to continue.",variant:"destructive"});return}u()},re=()=>{if(W)return!(E&&!(a.phone||"").trim()||C&&(!a.emergencyContactName.trim()||!a.emergencyContactPhone.trim()));if(q&&k){const Y=JSON.parse(k.questions||"[]");for(const M of Y)if(M.required){const se=a.onboardingData[M.id];if(!se||typeof se=="string"&&se.trim()===""||typeof se=="boolean"&&!se)return!1}return!0}return!0};return s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[s.jsxs("div",{className:"flex-shrink-0 mb-4",children:[s.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Complete Required Information"}),s.jsxs("p",{className:"text-sm text-gray-600",children:["Step ",U+1," of ",_]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 min-h-0",children:[W&&s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h4",{className:"font-semibold text-lg mb-4",children:"Contact details"}),s.jsxs("div",{className:"space-y-4",children:[E&&s.jsxs("div",{children:[s.jsx(V,{htmlFor:"bundleClientPhone",children:"Phone number *"}),s.jsx(me,{id:"bundleClientPhone",type:"tel",value:a.phone||"",onChange:Y=>i({...a,phone:Y.target.value}),required:!0})]}),C&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"emergencyContactName",children:"Emergency Contact Name *"}),s.jsx(me,{id:"emergencyContactName",value:a.emergencyContactName,onChange:Y=>i({...a,emergencyContactName:Y.target.value}),required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"emergencyContactPhone",children:"Emergency Contact Phone *"}),s.jsx(me,{id:"emergencyContactPhone",value:a.emergencyContactPhone,onChange:Y=>i({...a,emergencyContactPhone:Y.target.value}),required:!0})]})]})]})]})}),q&&(F?s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full mx-auto mb-4"}),s.jsx("p",{className:"text-gray-600",children:"Loading form..."})]})})}):k?s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h4",{className:"font-semibold text-lg mb-4",children:k.name}),s.jsx("div",{className:"space-y-6",children:JSON.parse(k.questions||"[]").map((Y,M)=>{var se,Q;return s.jsxs("div",{children:[Y.type!=="single-checkbox"&&s.jsxs(V,{htmlFor:Y.id,className:"text-sm font-medium",children:[Y.label," ",Y.required?"*":""]}),Y.type==="text"&&s.jsx(me,{id:Y.id,value:a.onboardingData[Y.id]||"",onChange:te=>i({...a,onboardingData:{...a.onboardingData,[Y.id]:te.target.value}}),placeholder:Y.placeholder||"",required:Y.required}),Y.type==="textarea"&&s.jsx(Is,{id:Y.id,value:a.onboardingData[Y.id]||"",onChange:te=>i({...a,onboardingData:{...a.onboardingData,[Y.id]:te.target.value}}),rows:3,placeholder:Y.placeholder||"",required:Y.required}),Y.type==="select"&&s.jsxs(Bt,{value:a.onboardingData[Y.id]||"",onValueChange:te=>i({...a,onboardingData:{...a.onboardingData,[Y.id]:te}}),children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:Y.placeholder})}),s.jsx(It,{children:(se=Y.options)==null?void 0:se.map((te,G)=>s.jsx(ce,{value:te,children:te},G))})]}),Y.type==="radio"&&s.jsx(Sl,{value:a.onboardingData[Y.id]||"",onValueChange:te=>i({...a,onboardingData:{...a.onboardingData,[Y.id]:te}}),className:"mt-2",children:(Q=Y.options)==null?void 0:Q.map((te,G)=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($r,{value:te,id:`${Y.id}-${G}`}),s.jsx(V,{htmlFor:`${Y.id}-${G}`,className:"text-sm",children:te})]},G))}),Y.type==="checkbox"&&Y.options&&s.jsx("div",{className:"space-y-2 mt-2",children:Y.options.map((te,G)=>s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(Xt,{id:`${Y.id}-${G}`,checked:Array.isArray(a.onboardingData[Y.id])?a.onboardingData[Y.id].includes(te):!1,onCheckedChange:Z=>{const ie=Array.isArray(a.onboardingData[Y.id])?a.onboardingData[Y.id]:[],A=Z?[...ie,te]:ie.filter(ge=>ge!==te);i({...a,onboardingData:{...a.onboardingData,[Y.id]:A}})}}),s.jsx(V,{htmlFor:`${Y.id}-${G}`,className:"text-sm",children:te})]},G))}),Y.type==="single-checkbox"&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:Y.id,checked:a.onboardingData[Y.id]||!1,onCheckedChange:te=>
612i({...a,onboardingData:{...a.onboardingData,[Y.id]:te}})}),s.jsxs(V,{htmlFor:Y.id,className:"text-sm",children:[Y.label," ",Y.required?"*":""]})]})]},M)})})]})}):s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6",children:s.jsx("p",{className:"text-red-600",children:"Error loading form. Please try again."})})})),H&&s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h4",{className:"font-semibold text-lg mb-4",children:"Terms and Conditions"}),s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Xt,{id:"terms",checked:o,onCheckedChange:l}),s.jsx(V,{htmlFor:"terms",className:"text-sm text-slate-700 leading-relaxed cursor-pointer",children:z!=null&&z.termsAndConditionsUrl?s.jsxs(s.Fragment,{children:["I agree to the"," ",s.jsx("a",{href:z.termsAndConditionsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",onClick:Y=>Y.stopPropagation(),children:"Terms and Conditions"})]}):z!=null&&z.termsAndConditionsText?s.jsxs(s.Fragment,{children:["I agree to the"," ",s.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),alert(z.termsAndConditionsText)},className:"text-blue-600 hover:text-blue-800 underline",children:"Terms and Conditions"})]}):"I agree to the terms and conditions"})]})]})})]}),s.jsxs("div",{className:"flex gap-3 pt-4 border-t flex-shrink-0 bg-background sticky bottom-0",children:[s.jsx(B,{variant:"outline",onClick:m,className:"flex-1",children:"Back"}),W||q?s.jsx(B,{onClick:J,disabled:!re()||p,className:"flex-1",children:p?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Booking..."]}):c<w.length-1?"Next":"Continue"}):s.jsx(B,{onClick:I,disabled:O&&!o||p,className:"flex-1",children:p?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Booking..."]}):`Confirm ${e.length} Booking${e.length!==1?"s":""}`})]})]})}function due({bundleCode:e,bundle:t,bundleInfo:n,instructorId:r,instructorSubdomain:a,customerEmail:i,customerName:o,onClose:l,onBookingComplete:c,onBack:d}){var ie;const[m,u]=f.useState([]),[h,p]=f.useState(!1),[v,y]=f.useState(null),[g,x]=f.useState(!1),[b,w]=f.useState({phone:"",emergencyContactName:"",emergencyContactPhone:"",onboardingData:{}}),[j,N]=f.useState(!1),[C,P]=f.useState(-1),[S,E]=f.useState(null),{toast:T}=Yt(),z=jn();f.useEffect(()=>{console.log("🔍 BundleClassSelection render:",{instructorId:r,instructorSubdomain:a||"UNDEFINED",bundleInfo:n?"loaded":"not loaded",enabled:!!a&&!!r})},[r,a,n]);const{data:O=[],isLoading:D,error:k}=Ue({queryKey:["/api/public/classes",a],enabled:!!a&&!!r,queryFn:async()=>{if(console.log("🔍 Fetching classes for subdomain:",a),!a)throw new Error("Instructor subdomain is required");const A=await fetch(`/api/public/classes?subdomain=${a}`);if(console.log("📡 Classes fetch response status:",A.status),!A.ok){const je=await A.text();throw console.error("❌ Failed to fetch classes:",je),new Error(`Failed to fetch classes: ${A.status} ${je}`)}const ge=await A.json();return console.log("✅ Fetched classes:",ge.length,"classes"),ge}}),F=n?O.filter(A=>n.applicableClassMode==="all"?!0:n.applicableClassMode==="selected"?n.applicableClassIds&&n.applicableClassIds.includes(A.id):!1):O,W=()=>{const A=[],ge=new Date;ge.setDate(1);for(let je=0;je<3;je++){const ke=new Date(ge.getFullYear(),ge.getMonth()+je,1);A.push(ke)}return A},H=(()=>{const A=W(),ge=[],je=new Date;je.setHours(0,0,0,0);for(const ke of A){const Ie=new Date(ke.getFullYear(),ke.getMonth()+1,0);for(let $e=1;$e<=Ie.getDate();$e++){const qe=new Date(ke.getFullYear(),ke.getMonth(),$e),ft=new Date(qe);if(ft.setHours(0,0,0,0),!(ft<je))for(const be of F){const Fe=qe.getDay(),_e=qe.getFullYear(),ze=String(qe.getMonth()+1).padStart(2,"0"),ue=String(qe.getDate()).padStart(2,"0"),Me=`${_e}-${ze}-${ue}`;let pt=!1;if(be.exceptionalDates)try{JSON.parse(be.exceptionalDates).find(le=>le.new_date===Me)&&(pt=!0)}catch{}if(!pt)if(be.frequency==="daily"){if(be.enabledDays)try{pt=JSON.parse(be.enabledDays).includes(Fe)}catch{}}else pt=Fe===be.dayOfWeek;if(pt){if(be.startDate&&Me<be.startDate||be.endDate&&Me>be.endDate||be.excludeDates&&be.excludeDates.split(`
613`).map(fe=>fe.trim()).includes(Me))continue;ge.push({classData:be,date:qe,dateString:Me})}}}}return ge.sort((ke,Ie)=>{const $e=ke.date.getTime()-Ie.date.getTime();if($e!==0)return $e;const qe=(de,fe)=>{if(typeof de.startTime=="string")try{const le=JSON.parse(de.startTime);if(typeof le=="object"&&le!==null){const Ke=fe.getDay().toString();return le[Ke]||Object.values(le)[0]||de.startTime}}catch{return de.startTime}return de.startTime||"09:00"},ft=qe(ke.classData,ke.date),be=qe(Ie.classData,Ie.date),[Fe,_e]=(ft||"09:00").split(":").map(Number),[ze,ue]=(be||"09:00").split(":").map(Number),Me=(Fe||0)*60+(_e||0),pt=(ze||0)*60+(ue||0);return Me-pt}),ge})(),_=H.length>0?H[0].dateString:"",L=H.length>0?H[H.length-1].dateString:"",{data:U={},isLoading:J}=Ue({queryKey:[`/api/instructor/${r}/class-availability?startDate=${_}&endDate=${L}`],enabled:!!r&&H.length>0&&!!_&&!!L,queryFn:async()=>{const A=await fetch(`/api/instructor/${r}/class-availability?startDate=${_}&endDate=${L}`);if(!A.ok)throw new Error("Failed to fetch availability");return A.json()}}),I=(A,ge,je,ke)=>{if(m.some($e=>$e.classId===A&&$e.date===ge))u($e=>$e.filter(qe=>!(qe.classId===A&&qe.date===ge)));else{if(m.length>=t.sessionCount){T({title:"Selection Limit Reached",description:`You can only select up to ${t.sessionCount} classes.`,variant:"destructive"});return}u($e=>[...$e,{classId:A,date:ge,dateString:ge,classData:je}])}},{data:re}=Ue({queryKey:[`/api/clients/${i}?instructorId=${r}`],enabled:!!i&&!!r,staleTime:0}),R=m.map(A=>A.classData).filter((A,ge,je)=>ge===je.findIndex(ke=>ke.id===A.id)&&A.requireOnboardingForm&&A.onboardingFormId).map(A=>({classId:A.id,className:A.name,formId:A.onboardingFormId})),Y=A=>{if(!re||!re.onboardingData)return console.log(`🔍 hasCompletedForm(${A}): No existingClient or onboardingData`),!1;const ge=re.onboardingData;if(Array.isArray(ge.formCompletions)){const Ie=ge.formCompletions.find($e=>$e.formId===A);if(Ie&&Ie.completedAt){const $e=new Date(Ie.completedAt),qe=new Date;return qe.setFullYear(qe.getFullYear()-1),$e>qe}return!1}const je=ge.formId,ke=ge.completedAt;if(console.log(`🔍 hasCompletedForm(${A}): Checking - completedFormId: ${je}, completedAt: ${ke}`),!ke)return console.log(`🔍 hasCompletedForm(${A}): No completion date`),!1;if(je===A){const Ie=new Date(ke),$e=new Date;$e.setFullYear($e.getFullYear()-1);const qe=Ie>$e;return console.log(`🔍 hasCompletedForm(${A}): Form matches! Completion date: ${Ie}, One year ago: ${$e}, Is recent: ${qe}`),qe}return console.log(`🔍 hasCompletedForm(${A}): Form ID mismatch (stored: ${je}, checking: ${A})`),!1};R.filter(A=>!Y(A.formId)),m.some(A=>A.classData.requireEmergencyContact!==!1),re!=null&&re.emergencyContactName&&(re==null||re.emergencyContactPhone);const M=(ie=m[0])==null?void 0:ie.classData;M!=null&&M.termsAndConditionsUrl||(M==null||M.termsAndConditionsText);const se=()=>{var ue;if(m.length===0){T({title:"No Classes Selected",description:"Please select at least one class to book.",variant:"destructive"});return}const A=m.some(Me=>Me.classData.requireEmergencyContact!==!1),ge=(re==null?void 0:re.emergencyContactName)&&(re==null?void 0:re.emergencyContactPhone),je=A&&!ge,ke=m.some(Me=>Me.classData.requirePhoneForBooking===!0),Ie=!!((re==null?void 0:re.phone)||"").trim(),$e=ke&&!Ie,qe=$e||je,be=m.map(Me=>Me.classData).filter((Me,pt,de)=>pt===de.findIndex(fe=>fe.id===Me.id)&&Me.requireOnboardingForm&&Me.onboardingFormId).map(Me=>({classId:Me.id,className:Me.name,formId:Me.onboardingFormId})).filter(Me=>!Y(Me.formId)).filter((Me,pt,de)=>pt===de.findIndex(fe=>fe.formId===Me.formId)),Fe=(ue=m[0])==null?void 0:ue.classData,_e=(Fe==null?void 0:Fe.termsAndConditionsUrl)||(Fe==null?void 0:Fe.termsAndConditionsText),ze=(qe?1:0)+be.length+(_e?1:0);if(console.log("🔍 Calculating total steps:",{needsContactStepCalc:qe,needsEmergencyContactCalc:je,needsPhoneCalc:$e,uniqueRequiredFormsCalcCount:be.length,uniqueRequiredFormsCalc:be.map(Me=>({formId:Me.formId,className:Me.className})),hasTermsCalc:_e,totalStepsCalc:ze}),E(ze),qe||be.length>0||_e){P(qe?-1:0),x(!0);return}Q()},Q=async()=>{p(!0);let A=0,ge=0;for(const je of m)try{let ke=je.classData.startTime;
613if(typeof ke=="string")try{const Fe=JSON.parse(ke);if(typeof Fe=="object"&&Fe!==null){const ze=new Date(je.date+"T00:00:00").getDay().toString();ke=Fe[ze]||Object.values(Fe)[0]||ke}}catch{}const[Ie,$e]=(ke||"09:00").split(":").map(Number),qe=new Date(je.date+"T00:00:00");qe.setHours(Ie||9,$e||0,0,0);const ft={paymentIntentId:`free_${Date.now()}_${m.indexOf(je)}`,clientData:{name:o,email:i,phone:(b.phone||"").trim()||((re==null?void 0:re.phone)||"").trim()||"",emergencyContactName:b.emergencyContactName||(re==null?void 0:re.emergencyContactName)||"",emergencyContactPhone:b.emergencyContactPhone||(re==null?void 0:re.emergencyContactPhone)||"",onboardingData:b.onboardingData||(re==null?void 0:re.onboardingData)||{}},bookingType:"single",classId:je.classId,classDate:In(qe),amount:"0.00",currency:"GBP",testMode:!1,couponCode:e};(await fetch("/api/confirm-booking",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ft)})).ok?A++:ge++}catch(ke){console.error("Error booking class:",ke),ge++}y({success:A,failed:ge}),p(!1),A>0&&i&&z.invalidateQueries({queryKey:[`/api/clients/${i}?instructorId=${r}`]}),A>0&&T({title:"Bookings Complete!",description:`Successfully booked ${A} class${A!==1?"es":""}.${ge>0?` ${ge} failed.`:""}`})},te=(A,ge)=>{var je;return((je=U[A])==null?void 0:je[ge])||{availableSpots:0,maxCapacity:0,isAvailable:!1}},G=(A,ge)=>{if(typeof A.startTime=="string")try{const je=JSON.parse(A.startTime);if(typeof je=="object"&&je!==null){const ke=ge.getDay().toString();return je[ke]||Object.values(je)[0]||A.startTime}}catch{return A.startTime}return A.startTime||"09:00"},Z=H.filter(A=>te(A.classData.id,A.dateString).isAvailable);if(v){const A=t.sessionCount-v.success;return s.jsxs("div",{className:"text-center space-y-6",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(qt,{className:"h-16 w-16 text-green-500"})}),s.jsxs("div",{children:[s.jsxs("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:["All ",v.success," Class",v.success!==1?"es":""," Booked!"]}),s.jsx("p",{className:"text-gray-600",children:"You'll receive confirmation emails for each booking."}),A>0&&s.jsxs("p",{className:"text-blue-600 mt-2 font-medium",children:["You have ",A," session",A!==1?"s":""," remaining in your bundle."]})]}),s.jsx(B,{onClick:c,className:"w-full",children:"Close"})]})}return g?s.jsx(cue,{selectedClasses:m,existingClient:re,instructorId:r,customerEmail:i,clientFormData:b,setClientFormData:w,agreedToTerms:j,setAgreedToTerms:N,currentFormIndex:C,setCurrentFormIndex:P,onBack:()=>{x(!1),E(null)},onConfirm:Q,totalSteps:S||1,isBooking:h}):s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[s.jsxs("div",{className:"text-center flex-shrink-0 mb-4",children:[s.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Select Classes to Book"}),s.jsxs("p",{className:"text-sm text-gray-600",children:["Choose up to ",t.sessionCount," classes. ",m.length," of ",t.sessionCount," selected."]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto space-y-2 min-h-0",children:[(!a||D||J)&&s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full mx-auto mb-4"}),s.jsx("p",{className:"text-gray-600",children:"Loading classes..."})]}),k&&s.jsxs("div",{className:"text-center py-8",children:[s.jsx("p",{className:"text-red-600 mb-2",children:"Failed to load classes"}),s.jsx("p",{className:"text-sm text-gray-600",children:k.message})]}),!D&&!k&&!J&&Z.length===0&&F.length>0&&s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-600",children:"No classes currently available to book."})}),!D&&!k&&!J&&H.length===0&&F.length===0&&s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-600",children:"No eligible classes found for this bundle."})}),!D&&!k&&!J&&Z.map(A=>{const ge=te(A.classData.id,A.dateString),je=m.some(Ie=>Ie.classId===A.classData.id&&Ie.date===A.dateString),ke=!je&&m.length>=t.sessionCount||!ge.isAvailable;
613return s.jsx(Ce,{className:`cursor-pointer transition-colors ${je?"border-2 border-primary bg-primary/5":""} ${ke?"opacity-50":""}`,onClick:()=>!ke&&I(A.classData.id,A.dateString,A.classData,A.date),children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(Xt,{checked:je,onCheckedChange:Ie=>{I(A.classData.id,A.dateString,A.classData,A.date)},onClick:Ie=>{Ie.stopPropagation()},disabled:ke,className:"mt-1"}),s.jsx("div",{className:"flex-1",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"font-semibold text-gray-900",children:A.classData.name}),s.jsxs("div",{className:"flex items-center space-x-4 mt-1 text-sm text-gray-600",children:[s.jsxs("span",{className:"flex items-center",children:[s.jsx(Ls,{className:"h-4 w-4 mr-1"}),A.date.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"})]}),s.jsxs("span",{className:"flex items-center",children:[s.jsx(ei,{className:"h-4 w-4 mr-1"}),G(A.classData,A.date)]})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsxs("div",{className:"text-sm font-medium text-gray-900",children:[ge.availableSpots," / ",ge.maxCapacity," spots"]}),!ge.isAvailable&&s.jsx("div",{className:"text-xs text-red-600",children:"Full"})]})]})})]})})},`${A.classData.id}-${A.dateString}`)}),!D&&!k&&!J&&Z.length===0&&null]}),s.jsxs("div",{className:"flex space-x-3 pt-4 border-t flex-shrink-0 bg-background sticky bottom-0",children:[s.jsx(B,{variant:"outline",onClick:d,className:"flex-1",disabled:h,children:"Back"}),s.jsx(B,{onClick:se,className:"flex-1",disabled:m.length===0||h,children:h?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Booking..."]}):`Book ${m.length} Class${m.length!==1?"es":""}`})]})]})}function uue({bundle:e,instructorId:t,instructorCurrency:n="GBP",onSuccess:r,onClose:a,privateLinkToken:i}){const o=mt(n),l=typeof e.discountValue=="string"?parseFloat(e.discountValue):e.discountValue,[c,d]=f.useState(""),[m,u]=f.useState(""),[h,p]=f.useState(!1),[v,y]=f.useState(!1),[g,x]=f.useState(""),[b,w]=f.useState(!1),[j,N]=f.useState(null),[C,P]=f.useState("stripe"),[S,E]=f.useState(!1),T=l1(),z=o1(),{toast:O}=Yt(),D=xt({mutationFn:async L=>{const U=await fetch("/api/coupons/bundles/create-payment-intent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(L)});if(!U.ok){const J=await U.json();throw new Error(J.message||"Failed to create payment intent")}return U.json()}}),k=xt({mutationFn:async L=>{const U=await fetch(`/api/coupons/bundles/${e.id}/purchase`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(L)});if(!U.ok){const J=await U.json();throw new Error(J.message||"Failed to complete purchase")}return U.json()}}),F=async L=>{if(L.preventDefault(),!c||!m){O({title:"Error",description:"Please fill in all required fields",variant:"destructive"});return}const U=typeof e.discountValue=="string"?parseFloat(e.discountValue):e.discountValue;if(U===0&&!isNaN(U)){p(!0);try{const J=await k.mutateAsync({customerEmail:c,customerName:m,paymentIntentId:`free_${Date.now()}`,paymentMethod:"free",privateLinkToken:i||void 0});x(J.bundleCode),y(!0),E(!1);const I=`classta_bundles_${t}`;try{const re=JSON.parse(localStorage.getItem(I)||"[]");re.includes(J.bundleCode)||(re.push(J.bundleCode),localStorage.setItem(I,JSON.stringify(re)))}catch{}r(J.bundleCode,c,m);try{localStorage.setItem("classta-user-data",JSON.stringify({name:m,email:c,phone:"",emergencyContactName:"",emergencyContactPhone:""}))}catch{}O({title:"Bundle added!",description:`Your bundle code is: ${J.bundleCode}`})}catch(J){O({title:"Something went wrong",description:J.message,variant:"destructive"})}finally{p(!1)}return}if(C==="cash"){p(!0);try{const J=typeof e.discountValue=="string"?parseFloat(e.discountValue):e.discountValue;if(J==null||isNaN(J)||J<0)throw new Error("Invalid bundle price");const I=await k.mutateAsync({customerEmail:c,customerName:m,paymentIntentId:`cash_${Date.now()}`,paymentMethod:"cash",privateLinkToken:i||void 0});x(I.bundleCode),y(!0),E(!0);const re=`classta_bundles_${t}`;try{const R=JSON.parse(localStorage.getItem(re)||"[]");R.includes(I.bundleCode)||(R.push(I.bundleCode),localStorage.setItem(re,JSON.stringify(R)),console.log(`✅ Stored bundle code ${I.bundleCode} in localStorage for instructor ${t}`))}catch(R){console.error("Error storing bundle code:",R)}if(r(I.bundleCode,c,m),c&&m)try{const R={name:m,email:c,phone:"",emergencyContactName:"",emergencyContactPhone:""};localStorage.setItem("classta-user-data",JSON.stringify(R)),console.log("✅ Saved user data to localStorage after bundle purchase")}catch(R){console.error("Error saving user data to localStorage:",R)}O({title:"Purchase Successful!",description:`Your bundle code is: ${I.bundleCode}`})}catch(J){console.error("Purchase error:",J),O({title:"Purchase Failed",description:J.message,variant:"destructive"})}finally{p(!1)}return}if(!T||!z){O({title:"Error",description:"Payment system not ready. Please try again.",variant:"destructive"});return}p(!0);try{const J=typeof e.discountValue=="string"?parseFloat(e.discountValue):e.discountValue;if(J==null||isNaN(J)||J<=0)throw new Error("Invalid bundle price");const I={amount:J,instructorId:t,clientEmail:c,bundleId:e.id},re=await D.mutateAsync(I),{clientSecret:R,stripeAccountId:Y}=re,M=z.getElement(i5);if(!M)throw new Error("Card element not found");const se={payment_method:{card:M,billing_details:{name:m,email:c}}},{paymentIntent:Q,error:te}=await T.confirmCardPayment(R,se);if(te)throw new Error(te.message);if((Q==null?void 0:Q.status)==="succeeded"){const G=await k.mutateAsync({customerEmail:c,paymentIntentId:Q.id,privateLinkToken:i||void 0});x(G.bundleCode),y(!0),E(!1);const Z=`classta_bundles_${t}`;try{const ie=JSON.parse(localStorage.getItem(Z)||"[]");ie.includes(G.bundleCode)||(ie.push(G.bundleCode),localStorage.setItem(Z,JSON.stringify(ie)),console.log(`✅ Stored bundle code ${G.bundleCode} in localStorage for instructor ${t}`))}catch(ie){console.error("Error storing bundle code:",ie)}if(r(G.bundleCode,c,m),c&&m)try{const ie={name:m,email:c,phone:"",emergencyContactName:"",emergencyContactPhone:""};localStorage.setItem("classta-user-data",JSON.stringify(ie)),console.log("✅ Saved user data to localStorage after bundle purchase")}catch(ie){console.error("Error saving user data to localStorage:",ie)}O({title:"Purchase Successful!",description:`Your bundle code is: ${G.bundleCode}`})}}catch(J){console.error("Purchase error:",J),O({title:"Purchase Failed",description:J.message,variant:"destructive"})}finally{p(!1)}},{data:W,isLoading:q}=Ue({queryKey:[`/api/instructor/by-id/${t}`],enabled:v&&!!t,queryFn:async()=>{console.log("🔍 Fetching instructor data for ID:",t);const L=await fetch(`/api/instructor/by-id/${t}?t=${Date.now()}`);if(!L.ok)throw new Error("Failed to fetch instructor");const U=await L.json();return console.log("✅ Instructor data loaded:",{id:U.id,subdomain:U.subdomain}),U.subdomain||console.error("⚠️ WARNING: Instructor data missing subdomain!",U),U},staleTime:0}),{data:H}=Ue({queryKey:[`/api/coupons/bundles/info/${t}/${g}`],enabled:v&&!!g,queryFn:async()=>{const L=await fetch(`/api/coupons/bundles/info/${t}/${g}`);if(!L.ok)throw new Error("Failed to fetch bundle info");return L.json()}});if(v&&j===null){const L=H||e;if(v&&g&&!H)return s.jsxs("div",{className:"text-center space-y-6",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-2 border-primary border-t-transparent roun
613ded-full"})}),s.jsx("p",{className:"text-gray-600",children:"Loading bundle information..."})]});const U=(L==null?void 0:L.allowServices)===!0&&(L==null?void 0:L.applicableClassMode)==="selected"&&(!(L!=null&&L.applicableClassIds)||L.applicableClassIds.length===0);return v&&console.log("🔍 Bundle service-only check:",{allowServices:L==null?void 0:L.allowServices,applicableClassMode:L==null?void 0:L.applicableClassMode,applicableClassIds:L==null?void 0:L.applicableClassIds,applicableServiceIds:L==null?void 0:L.applicableServiceIds,isServiceOnly:U}),U?s.jsxs("div",{className:"text-center space-y-6 pb-4",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(qt,{className:"h-16 w-16 text-green-500"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Purchase Successful!"}),s.jsx("p",{className:"text-gray-600",children:"Your bundle has been purchased successfully."}),S&&s.jsx("div",{className:"mt-4 p-4 bg-yellow-50 border border-yellow-200 rounded-lg",children:s.jsxs("p",{className:"text-sm text-yellow-800",children:[s.jsx("strong",{children:"Cash Payment:"})," Please now book a session and bring ",o,l," to your session to pay the instructor in person."]})})]}),s.jsxs("div",{className:"bg-gray-50 rounded-lg p-6",children:[s.jsx(V,{className:"text-sm font-medium text-gray-700",children:"Your Bundle Code"}),s.jsxs("div",{className:"mt-2 flex items-center justify-center gap-2",children:[s.jsx("code",{className:"text-2xl font-mono font-bold text-primary bg-white px-4 py-2 rounded border cursor-pointer hover:bg-gray-50",onClick:()=>{navigator.clipboard.writeText(g),O({title:"Copied!",description:"Bundle code copied to clipboard"})},children:g}),s.jsx(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{navigator.clipboard.writeText(g),O({title:"Copied!",description:"Bundle code copied to clipboard"})},children:s.jsx(pr,{className:"h-4 w-4"})})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"We've also sent this code to your email address. Click the code or button to copy."})]}),s.jsxs("div",{className:"bg-blue-50 rounded-lg p-4 text-left",children:[s.jsx("h4",{className:"font-medium text-blue-900 mb-2",children:"How to use your bundle:"}),s.jsxs("ul",{className:"text-sm text-blue-800 space-y-2",children:[e.allowGiftSharing&&s.jsx("li",{children:"• Gift-enabled: this code can be shared, and ownership locks to the first person who redeems it"}),s.jsx("li",{children:"• Your bundle works like credit - you don't need to book all sessions right away"}),s.jsx("li",{children:"• Find a service (121) in the calendar and click to book it"}),s.jsx("li",{children:`• During checkout, you'll see the option to "Use Your Bundle"`}),s.jsx("li",{children:"• Your bundle code will automatically apply - the booking will be free"}),s.jsx("li",{children:"• Repeat this for each session you want to book, one at a time"}),s.jsxs("li",{children:["• Your bundle remains valid until you've used all ",e.sessionCount," sessions"]})]})]}),s.jsx(B,{onClick:a,className:"w-full",children:"Close"})]}):s.jsxs("div",{className:"text-center space-y-6 pb-4",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(qt,{className:"h-16 w-16 text-green-500"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Purchase Successful!"}),s.jsxs("p",{className:"text-gray-600",children:["Your bundle has been purchased successfully. Your bundle code: ",s.jsx("code",{className:"font-mono font-bold bg-gray-100 px-2 py-1 rounded",children:g})]}),S&&s.jsx("div",{className:"mt-4 p-4 bg-yellow-50 border border-yellow-200 rounded-lg",children:s.jsxs("p",{className:"text-sm text-yellow-800",children:[s.jsx("strong",{children:"Cash Payment:"})," Please now book a class and bring ",o,l," to your class to pay the instructor in person."]})})]}),s.jsxs("div",{className:"bg-gray-50 rounded-lg p-6",children:[s.jsx(V,{className:"text-sm font-medium text-gray-700",children:"Your Bundle Code"}),s.jsxs("div",{className:"mt-2 flex items-center justify-center gap-2",children:[s.jsx("code",{className:"text-2xl font-mono font-bold text-primary bg-white px-4 py-2 rounded border cursor-pointer hover:bg-gray-50",onClick:()=>{navigator.clipboard.writeText(g),O({title:"Copied!",description:"Bundle code copied to clipboard"})},children:g}),s.jsx(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{navigator.clipboard.writeText(g),O({title:"Copied!",description:"Bundle code copied to clipboard"})},children:s.jsx(pr,{className:"h-4 w-4"})})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"We've also sent this code to your email address. Click the code or button to copy."})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("h4",{className:"font-medium text-gray-900",children:"What would you like to do next?"}),s.jsxs(B,{onClick:()=>N("now"),className:"w-full",size:"lg",children:[s.jsx(Ls,{className:"h-5 w-5 mr-2"}),"Book Classes Now"]}),s.jsx(B,{onClick:()=>N("later"),variant:"outline",className:"w-full",size:"lg",children:"Book Later"})]})]})}if(v&&j==="later")return s.jsxs("div",{className:"text-center space-y-6 pb-4",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(qt,{className:"h-16 w-16 text-green-500"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Bundle Purchased!"}),s.jsx("p",{className:"text-gray-600",children:"Your bundle code is stored and ready to use."})]}),s.jsxs("div",{className:"bg-gray-50 rounded-lg p-6",children:[s.jsx(V,{className:"text-sm font-medium text-gray-700",children:"Your Bundle Code"}),s.jsxs("div",{className:"mt-2 flex items-center justify-center gap-2",children:[s.jsx("code",{className:"text-2xl font-mono font-bold text-primary bg-white px-4 py-2 rounded border cursor-pointer hover:bg-gray-50",onClick:()=>{navigator.clipboard.writeText(g),O({title:"Copied!",description:"Bundle code copied to clipboard"})},children:g}),s.jsx(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{navigator.clipboard.writeText(g),O({title:"Copied!",description:"Bundle code copied to clipboard"})},children:s.jsx(pr,{className:"h-4 w-4"})})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Click the code or button to copy to clipboard"})]}),s.jsxs("div",{className:"bg-blue-50 rounded-lg p-4 text-left",children:[s.jsx("h4",{className:"font-medium text-blue-900 mb-2",children:"How to use your bundle:"}),s.jsxs("ul",{className:"text-sm text-blue-800 space-y-2",children:[e.allowGiftSharing&&s.jsx("li",{children:"• Gift-enabled: this code can be shared, and ownership locks to the first person who redeems it"}),e.allowServices?s.jsxs(s.Fragment,{children:[s.jsx("li",{children:"• Your bundle works like credit - you don't need to book all sessions right away"}),s.jsx("li",{children:"• Find a class or service (121) in the calendar and click to book it"}),s.jsx("li",{children:`• During checkout, you'll see the option to "Use Your Bundle"`}),s.jsx("li",{children:"• Your bundle code will automatically apply - the booking will be free"}),s.jsx("li",{children:"• Repeat this for each session you want to book, one at a time"}),s.jsxs("li",{children:["• Your bundle remains valid until you've used all ",e.sessionCount," sessions"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("li",{children:"• Your bundle works like credit - you don't need to book all classes right away"}),s.jsx("li",{children:"• Find a class in the calendar and click to book it"}),s.jsx("li",{children:`• During checkout, you'll see the option to "Use Your Bundle"`}),s.jsx("li",{children:"• Your bundle code will automatically apply - the booking will be free"}),s.jsx("li",{children:"• Repeat this for each class you want to book, one at a time"}),s.jsxs("li",{children:["• Your bundle remains valid until you've used all ",e.sessionCount," sessions"]})]})]})]}),s.jsx(B,{onClick:a,className:"w-full",children:"Close"})]});
613if(v&&j==="now")return!W||!W.subdomain?s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full mx-auto mb-4"}),s.jsx("p",{className:"text-gray-600",children:"Loading class information..."})]}):s.jsx(due,{bundleCode:g,bundle:e,bundleInfo:H,instructorId:t,instructorSubdomain:W.subdomain,customerEmail:c,customerName:m,onClose:a,onBookingComplete:()=>{a()},onBack:()=>N(null)});const _=(typeof e.discountValue=="number"?e.discountValue:parseFloat(String(e.discountValue)))===0;return s.jsxs("form",{onSubmit:F,className:"flex flex-col h-full min-h-0",children:[s.jsxs("div",{className:"flex-1 overflow-y-auto space-y-6 min-h-0 pb-4 pl-2 pr-2",children:[s.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(jg,{className:"h-8 w-8 text-primary"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold text-gray-900",children:e.name}),e.description&&s.jsx("p",{className:"text-sm text-gray-600",children:e.description})]})]}),s.jsxs(Je,{variant:"secondary",children:[e.sessionCount," sessions"]})]}),s.jsxs("div",{className:"mt-4 flex justify-between items-center",children:[s.jsx("span",{className:"text-sm text-gray-600",children:"Total Price:"}),s.jsx("span",{className:"text-2xl font-bold text-gray-900",children:_?"Free":`${o}${l}`})]}),_&&s.jsx("p",{className:"text-sm text-gray-600 mt-2",children:"Enter your details below to get your bundle code—no payment required."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"customerName",children:"Full Name"}),s.jsx(me,{id:"customerName",type:"text",value:m,onChange:L=>u(L.target.value),placeholder:"Enter your full name",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"customerEmail",children:"Email Address"}),s.jsx(me,{id:"customerEmail",type:"email",value:c,onChange:L=>d(L.target.value),placeholder:"Enter your email address",required:!0}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:e.allowGiftSharing?"Your bundle code will be sent here. You can share it as a gift and it locks to the first person who redeems it.":"Your bundle code will be sent to this email"})]})]}),!_&&e.allowCashPayments&&s.jsxs("div",{children:[s.jsx(V,{className:"mb-3 block",children:"Payment Method"}),s.jsx(Sl,{value:C,onValueChange:L=>P(L),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center space-x-2 p-4 border rounded-lg cursor-pointer hover:bg-gray-50",onClick:()=>P("stripe"),children:[s.jsx($r,{value:"stripe",id:"stripe"}),s.jsx(V,{htmlFor:"stripe",className:"flex-1 cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-medium",children:"Pay with Card"}),s.jsx("div",{className:"text-sm text-gray-500",children:"Secure payment via Stripe"})]}),s.jsx(ti,{className:"h-5 w-5 text-gray-400"})]})})]}),s.jsxs("div",{className:"flex items-center space-x-2 p-4 border rounded-lg cursor-pointer hover:bg-gray-50",onClick:()=>P("cash"),children:[s.jsx($r,{value:"cash",id:"cash"}),s.jsx(V,{htmlFor:"cash",className:"flex-1 cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-medium",children:"Pay with Cash"}),s.jsx("div",{className:"text-sm text-gray-500",children:"Pay in person when you attend your class"})]}),s.jsx(FN,{className:"h-5 w-5 text-gray-400"})]})})]})]})}),C==="cash"&&s.jsx("div",{className:"mt-3 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:s.jsx("p",{className:"text-sm text-blue-800",children:"By selecting cash payment, you agree to pay the instructor in person on arrival at your class."})})]}),!_&&C==="stripe"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsxs(V,{className:"flex items-center space-x-2 mb-3",children:[s.jsx(ti,{className:"h-4 w-4"}),s.jsx("span",{children:"Payment Details"})]}),s.jsx("div",{className:"border rounded-lg p-4",children:s.jsx(i5,{options:{style:{base
613:{fontSize:"16px",color:"#424770","::placeholder":{color:"#aab7c4"}}}}})})]}),s.jsxs("div",{className:"bg-green-50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(qt,{className:"h-5 w-5 text-green-600"}),s.jsx("span",{className:"text-sm font-medium text-green-800",children:"Secure Payment"})]}),s.jsx("p",{className:"text-sm text-green-700 mt-1",children:"Your payment information is processed securely by Stripe"})]})]})]}),s.jsxs("div",{className:"flex space-x-3 pt-4 border-t flex-shrink-0 bg-background",style:{paddingBottom:"calc(1.5rem + env(safe-area-inset-bottom, 0px))"},children:[s.jsx(B,{type:"button",variant:"outline",onClick:a,className:"flex-1",disabled:h,children:"Cancel"}),s.jsx(B,{type:"submit",className:"flex-1",disabled:h||!_&&C==="stripe"&&!T,children:h?"Processing...":_?"Get my free bundle":C==="cash"?`Confirm Cash Payment (${o}${l})`:`Pay ${o}${l}`})]})]})}function sW({bundle:e,instructorId:t,instructorCurrency:n="GBP",isOpen:r,onClose:a,onSuccess:i,privateLinkToken:o}){const[l,c]=f.useState(null),[d,m]=f.useState(!0);return f.useEffect(()=>{r&&e&&!l&&(m(!0),(async()=>{try{const h=await fetch(`/api/coupons/bundles/stripe-config/${t}`);if(h.ok){const{stripePublicKey:p,stripeAccountId:v}=await h.json();c(v?od(p,{stripeAccount:v}):od(p))}else console.error("Failed to get Stripe configuration"),c(od(void 0))}catch(h){console.error("Error loading Stripe configuration:",h),c(od(void 0))}finally{m(!1)}})())},[r,e,t,l]),e?s.jsx(Ct,{open:r,onOpenChange:a,children:s.jsxs(St,{className:"sm:max-w-[500px] max-h-[90dvh] overflow-hidden flex flex-col w-[95vw] sm:w-full p-4 max-sm:top-4 max-sm:translate-y-0 max-sm:max-h-[calc(100dvh-2rem)]",onInteractOutside:u=>u.preventDefault(),onPointerDownOutside:u=>u.preventDefault(),children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Purchase Bundle"}),s.jsx(yn,{children:"Complete your purchase to receive your bundle code"})]}),s.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:d?s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{children:"Loading payment form..."})}):l?s.jsx(yv,{stripe:l,children:s.jsx(uue,{bundle:e,instructorId:t,instructorCurrency:n,onSuccess:i,onClose:a,privateLinkToken:o})}):s.jsxs("div",{className:"text-center py-8",children:[s.jsx("p",{className:"text-red-600",children:"Failed to load payment form. Please try again."}),s.jsx(B,{onClick:a,className:"mt-4",children:"Close"})]})})]})}):null}const nW="classta_class_access_code_";function Pg(e){try{const t=sessionStorage.getItem(`${nW}${e}`);return t&&t.trim()?t:null}catch{return null}}function mue(e,t){try{sessionStorage.setItem(`${nW}${e}`,t.trim())}catch{}}function rW(e){return e.isLocked===!0||e.bookingLocked===!0}function hue(e,t){return t==="unpaid_for_month"?"Your membership is active but this month's payment hasn't been recorded yet. Update your payment method in My Account, or contact your instructor.":t==="unpaid_for_billing_period"?"Your membership is active but payment for the current billing period hasn't been recorded. Update your payment method in My Account, or contact your instructor.":t==="past_due"?"Your membership payment is past due. Update your payment method in My Account to book member classes.":t==="period_expired"?"Your membership period has ended. Renew or contact your instructor to book this class.":e?"This class isn't included in your current membership, or member benefits aren't available right now. Check My Account or buy a membership to book.":"This class is for members. Log in if you already have a membership, or buy one to book."}function fue(e,t){var r;const n=(r=e.fixedPackageStartDate)==null?void 0:r.trim();if(n){const a=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n);if(a){const i=parseInt(a[1],10),o=parseInt(a[2],10)-1,l=parseInt(a[3],10);return new Date(i,o,l)}}return t?new Date(t.getFullYear(),t.getMonth(),t.getDate()):new Date}function pue(e){if(!e)return e;const t=/(https?:\/\/[^\s]+)/g;return e.split(t).map((r,a)=>t.test(r)?s.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:r},a):s.jsx("span",{children:r},a))}function $T({classData:e,onClose:t,instructor:n,privateBooking:r=!1,privateLinkToken:a}){var zt,K,$,pe,ye,Be,Ze,es,Ns,ls;const[i,o]=f.useState(r&&!e.date?0:1),[l]=cn(),[c,d]=f.useState(!1),m={bookingAccessCode:Pg(e.id),privateLinkToken:a||null},{data:u}=Ue({queryKey:[`/api/instructors/${e.instructorId}`],enabled:!n&&!!e.instructorId}),h=n||u,p=(h==null?void 0:h.id)??e.instructorId,{data:v}=Ue({queryKey:[`/api/instructor/by-id/${p}`],enabled:!!p&&!(h!=null&&h.subdomain)}),y=(h==null?void 0:h.subdomain)??(v==null?void 0:v.subdomain)??null,g=(zt=e.instructorName)==null?void 0:zt.trim(),x=g&&g.length>
6130?g:((K=h==null?void 0:h.instructorName)==null?void 0:K.trim())||"TBC",{data:b}=Ue({queryKey:[`/api/classes/${e.id}/memberships/public`],enabled:!!e.id}),w=f.useMemo(()=>b&&Array.isArray(b)&&b.length>0,[b]),[j,N]=f.useState(null),[C,P]=f.useState(null),[S,E]=f.useState(!1),[T,z]=f.useState(!1),[O,D]=f.useState(null),[k,F]=f.useState(null);f.useEffect(()=>{if(!(h!=null&&h.id)||!(e!=null&&e.id))return;(async()=>{try{const Re=localStorage.getItem(`client_token_${h.id}`);if(!Re)return;const Le=await fetch(`/api/member/${h.id}/class-pricing/${e.id}`,{headers:{Authorization:`Bearer ${Re}`}});if(Le.ok){z(!0);const Ye=await Le.json();console.log("🔍 Member pricing response:",Ye),Ye.memberPrice!==void 0?(E(!0),P(Ye.memberPrice),N(Ye.member),D(null)):(E(!1),P(null),N(null),D(Ye.ineligibleReason??null))}else z(!1),E(!1),P(null),N(null),D(null)}catch(Re){console.error("Error checking member pricing:",Re),z(!1)}})()},[h==null?void 0:h.id,e==null?void 0:e.id]);const W=f.useMemo(()=>mt(h&&h.currency||"GBP"),[h]);f.useEffect(()=>{sessionStorage.setItem("bookingOriginUrl",l)},[]);const q=(ae,Re=new Date)=>{const Le=[],Ye=new Date(Re),Ve=(ae-Ye.getDay()+7)%7;Ve===0&&Ye.getHours()>parseInt(e.startTime.split(":")[0])?Ye.setDate(Ye.getDate()+7):Ye.setDate(Ye.getDate()+Ve);for(let nt=0;nt<30;nt++)Le.push(new Date(Ye)),Ye.setDate(Ye.getDate()+7);return Le},H=r&&!e.date?q(e.dayOfWeek):[],[_,L]=f.useState(e.date||(H.length>0?H[0]:null)),[U,J]=f.useState([]),[I,re]=f.useState(()=>{const ae={bookingType:void 0,clientData:{name:"",email:"",phone:"",emergencyContactName:"",emergencyContactPhone:"",onboardingData:{healthConditions:"",fitnessLevel:"beginner",currentInjuries:"",pastInjuries:"",exerciseHistory:"",goals:"",healthDeclaration:!1}}};try{const Re=localStorage.getItem("classta-user-data");if(Re){const Le=JSON.parse(Re);return{...ae,clientData:{...ae.clientData,name:Le.name??"",email:Le.email??"",phone:Le.phone??"",emergencyContactName:Le.emergencyContactName??"",emergencyContactPhone:Le.emergencyContactPhone??""}}}}catch{}return ae}),[R,Y]=f.useState(!1),[M,se]=f.useState(!1),[Q,te]=f.useState(!0),[G,Z]=f.useState(!1),[ie,A]=f.useState(null),[ge,je]=f.useState(null),[ke,Ie]=f.useState(null),[$e,qe]=f.useState(!1),[ft,be]=f.useState(""),[Fe,_e]=f.useState(null),[ze,ue]=f.useState(!1),{toast:Me}=Yt();jn();const[,pt]=cn();f.useEffect(()=>{const ae=localStorage.getItem("classta-user-data");if(ae)try{const Re=JSON.parse(ae);re(Le=>({...Le,clientData:{...Le.clientData,name:Re.name||"",email:Re.email||"",phone:Re.phone||"",emergencyContactName:Re.emergencyContactName||"",emergencyContactPhone:Re.emergencyContactPhone||""}})),Re.email}catch(Re){console.error("Failed to load saved user data:",Re)}},[]),f.useEffect(()=>{j&&re(ae=>({...ae,clientData:{...ae.clientData,name:j.name||ae.clientData.name,email:j.email||ae.clientData.email}}))},[j]);const de=()=>{if(Q){const ae={name:I.clientData.name,email:I.clientData.email,phone:I.clientData.phone,emergencyContactName:I.clientData.emergencyContactName,emergencyContactPhone:I.clientData.emergencyContactPhone};localStorage.setItem("classta-user-data",JSON.stringify(ae))}else localStorage.removeItem("classta-user-data")},{data:fe}=Ue({queryKey:[`/api/onboarding-forms/${e.onboardingFormId}`],enabled:!!(e.requireOnboardingForm&&e.onboardingFormId)}),{data:le=[]}=Ue({queryKey:[`/api/classes/${e.id}/packages`]}),Ke=f.useMemo(()=>e.allowSingleBooking===!0,[e.allowSingleBooking]),We=f.useMemo(()=>!e.allowSingleBooking&&le.length===0&&w,[e.allowSingleBooking,le.length,w]),vt=f.useMemo(()=>{const ae=w&&S&&(!k||k.limit===null||k.hasQuota),Re=C!==null&&(C===""||C==="0"||parseFloat(C)===0);return ae&&Re},[w,S,k,C]);f.useEffect(()=>{if(!(h!=null&&h.id)||!(e!=null&&e.id)||!w||!S)return;(async()=>{try{const Re=localStorage.getItem(`client_token_${h.id}`);if(!Re)return;const Le=await fetch(`/api/member/${h.id}/quota-check/${e.id}`,{headers:{Authorization:`Bearer ${Re}`}});if(Le.ok){const Ye=await Le.json();F(Ye)}}catch(Re){console.error("Error checking quota:",Re)}})()},[h==null?void 0:h.id,e==null?void 0:e.id,w,S]),f.useEffect(()=>{w&&S&&(!I.bookingType||I.bookingType==="single")&&(!k||k.limit===null||k.hasQuota)&&re(ae=>({...ae,bookingType:"single",bundleCode:void 0,selectedBundle:void 0}))},[w,S,k]);const Zt=(($=I.clientData.email)==null?void 0:$.trim())||"",Ht=h!=null&&h.id&&e.id?`/api/coupons/bundles/for-class/${h.id}/${e.id}${Zt?`?email=${encodeURIComponent(Zt)}`:""}`:"",{data:Tt=[]}=Ue({queryKey:[Ht],enabled:!!(h!=null&&h.id)&&!!e.id&&!!Ht}),[Ot,Ft]=f.useState([]),[is,Cs]=f.useState(0);f.useEffect(()=>{if(!(h!=null&&h.id)||!e.id)return;const ae=`classta_bundles_${h.id}`;try{const Re=JSON.parse(localStorage.getItem(ae)||"[]");Re.length>0?Promise.all(Re.map(async Le=>{try{const Ye=await fetch(`/api/coupons/bundles/info/${h.id}/${Le}?t=${Date.now()}`);if(Ye.ok){const Ve=await Ye.json();
613return Ve.isValid&&(Ve.applicableClassMode==="all"||Ve.applicableClassMode==="selected"&&Ve.applicableClassIds&&Ve.applicableClassIds.includes(e.id))?Ve:null}return null}catch(Ye){return console.error(`Error fetching bundle info for ${Le}:`,Ye),null}})).then(Le=>{const Ye=Le.filter(Ve=>Ve!==null&&Ve.isValid);Ft(Ye)}):Ft([])}catch(Re){console.error("Error loading stored bundles:",Re),Ft([])}},[h==null?void 0:h.id,e.id,is]),f.useEffect(()=>{i===1&&Cs(ae=>ae+1)},[i]);const Ne=le.some(ae=>ae.id.toString()===I.selectedRadioValue);f.useEffect(()=>{var ae;if(i===1&&Ot.length>0&&!I.bundleCode&&I.selectedRadioValue!=="single"&&I.selectedRadioValue!=="membership"&&!((ae=I.selectedRadioValue)!=null&&ae.startsWith("bundle-"))&&!Ne){const Re=Ot[0];if(Re&&Re.isValid&&Re.hasSessions&&!Re.isExpired){const Le=`stored-bundle-${Re.bundleCode}`;re(Ye=>({...Ye,bookingType:"single",selectedRadioValue:Le,selectedPackage:void 0,selectedBundle:void 0,bundleCode:Re.bundleCode}))}}},[Ot,i,I.bundleCode,I.selectedRadioValue,Ne,le]);const rt=f.useMemo(()=>!!(We&&w||Ke&&(!We||j&&C!==null||j&&Ot.length>0||j&&(k!=null&&k.canUseBundle))||le.length>0||Tt.length>0||Ot.length>0||w&&j&&C!==null),[Ke,We,j,C,Ot.length,k==null?void 0:k.canUseBundle,le.length,Tt.length,w]),[ht,Mt]=f.useState("");f.useEffect(()=>{var Le;const ae=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Re=((Le=I.clientData.email)==null?void 0:Le.trim())||"";if(!Re||Re.length>=5&&ae.test(Re)){const Ye=setTimeout(()=>{Mt(Re)},500);return()=>clearTimeout(Ye)}else Mt("")},[I.clientData.email]);const{data:Qt}=Ue({queryKey:["/api/clients/lookup",ht,h==null?void 0:h.id],enabled:!!(ht&&ht.length>=5&&(h!=null&&h.id)&&(e.requireOnboardingForm||e.requirePhoneForBooking)),queryFn:async()=>{const ae=`/api/clients/${encodeURIComponent(ht)}?instructorId=${h.id}`,Re=await fetch(ae,{credentials:"include"});if(Re.status===404)return null;if(!Re.ok){const Le=await Re.text();throw new Error(Le||Re.statusText)}return Re.json()},staleTime:6e4,refetchOnMount:!1,refetchOnWindowFocus:!1}),{data:ts,refetch:Js}=Ue({queryKey:[`/api/classes/${e.id}/has-booked`,e.id,ht],queryFn:async()=>{if(!ht||ht.length<5)return{hasBooked:!1};const ae=await Pe("GET",`/api/classes/${e.id}/has-booked?email=${encodeURIComponent(ht)}`);return ae.ok?ae.json():{hasBooked:!1}},enabled:!!(ht&&ht.length>=5&&(e.offerFreeTrial||e.offerFirstUsePrice)&&(h!=null&&h.id)),staleTime:0,refetchOnMount:!0,refetchOnWindowFocus:!0});f.useEffect(()=>{ht&&ht.length>=5&&(e.offerFreeTrial||e.offerFirstUsePrice)&&Js()},[ht,e.offerFreeTrial,e.offerFirstUsePrice,Js]),f.useEffect(()=>{ht&&ht.length>=5&&(e.offerFreeTrial||e.offerFirstUsePrice)&&console.log(`[BookingModal] Class ${e.id}, Email: ${ht}, hasBookedClass: ${(ts==null?void 0:ts.hasBooked)??!1}`)},[e.id,ht,ts==null?void 0:ts.hasBooked,e.offerFreeTrial,e.offerFirstUsePrice]);const xn=ht&&ht.length>=5?(ts==null?void 0:ts.freeTrialUnavailable)??(ts==null?void 0:ts.hasBooked)??!1:!1,Xs=!!(e.offerFreeTrial&&!xn&&(Ke||We)),nn=I.selectedRadioValue==="free-trial"||!I.selectedRadioValue&&!I.bundleCode&&!I.selectedPackage&&!I.selectedBundle&&Xs,Vt=We&&!S&&!T&&!I.bundleCode&&!nn,Te=ht&&ht.length>=5?(ts==null?void 0:ts.firstUseUnavailable)??(ts==null?void 0:ts.hasBooked)??(ts==null?void 0:ts.isExcludedFromFreeTrial)??!1:!1,at=f.useMemo(()=>I.selectedRadioValue==="membership"||!I.selectedRadioValue&&We&&j&&!I.bundleCode&&!I.selectedBundle?!(We&&(!S||k&&k.limit!==null&&!k.hasQuota&&!Ot.length)):I.selectedRadioValue==="free-trial"||!I.selectedRadioValue&&!I.bundleCode&&!I.selectedPackage&&!I.selectedBundle&&Xs?!0:I.bookingType==="single"&&!I.bundleCode&&!I.selectedPackage&&!I.selectedBundle?!(We&&(!S||k&&k.limit!==null&&!k.hasQuota&&!Ot.length)):!!(I.selectedPackage||!Ke&&le.length>0&&!I.selectedRadioValue&&!I.bundleCode&&!I.selectedBundle||I.bundleCode||I.selectedBundle),[I.bookingType,I.selectedRadioValue,I.bundleCode,I.selectedPackage,I.selectedBundle,We,S,k,Ot.length,Xs,Ke]);f.useEffect(()=>{var ae,Re,Le;if(!I.selectedRadioValue&&!I.bundleCode&&!I.selectedPackage&&!I.selectedBundle){const Ye=We&&j&&!I.bundleCode&&!I.selectedBundle||vt,Ve=!Ke&&le.length>0,nt=!Ye&&!Ve&&Xs,ys=Ot.length>0&&((ae=Ot[0])==null?void 0:ae.isValid)&&((Re=Ot[0])==null?void 0:Re.hasSessions)&&!((Le=Ot[0])!=null&&Le.isExpired),Fs=!Ye&&!Ve&&!nt&&Ke&&!ys;
613if(Ye)re(dn=>({...dn,bookingType:"single",selectedRadioValue:"membership"}));else if(Ve){const dn=le[0];dn&&re(rn=>({...rn,bookingType:dn.id.toString(),selectedRadioValue:dn.id.toString(),selectedPackage:dn}))}else nt?re(dn=>({...dn,bookingType:"single",selectedRadioValue:"free-trial"})):Fs&&re(dn=>({...dn,bookingType:"single",selectedRadioValue:"single"}))}},[I.selectedRadioValue,I.bundleCode,I.selectedPackage,I.selectedBundle,Xs,xn,Ke,We,j,le,Ot,vt,S]),f.useEffect(()=>{I.selectedRadioValue==="free-trial"&&xn&&re(Ke?ae=>({...ae,bookingType:"single",selectedRadioValue:"single"}):ae=>({...ae,bookingType:"single",selectedRadioValue:S?"membership":void 0}))},[I.selectedRadioValue,xn,Ke,S]);const ss=(()=>{if(!(Qt!=null&&Qt.onboardingData)||!e.onboardingFormId)return!1;const ae=Qt.onboardingData,Re=e.onboardingFormId;if(Array.isArray(ae.formCompletions)){const Le=ae.formCompletions.find(Ye=>Ye.formId===Re);if(Le&&Le.completedAt){const Ye=new Date(Le.completedAt),Ve=new Date;return Ve.setFullYear(Ve.getFullYear()-1),Ye>Ve}return!1}if(ae.formId===Re&&ae.completedAt){const Le=new Date(ae.completedAt),Ye=new Date;return Ye.setFullYear(Ye.getFullYear()-1),Le>Ye}return!1})(),ps=e.requireOnboardingForm&&fe?!ss:!e.requireOnboardingForm&&!Qt;console.log("Existing client:",Qt),console.log("Has onboarding data:",Qt==null?void 0:Qt.onboardingData),console.log("Class onboarding form ID:",e.onboardingFormId),console.log("Client completed form ID (legacy):",(pe=Qt==null?void 0:Qt.onboardingData)==null?void 0:pe.formId),console.log("Has completed THIS form:",ss),console.log("Should show health assessment:",ps);const bs=e.requireEmergencyContact!==!1,xs=I.bookingType==="single"&&(I.selectedRadioValue==="single"||!I.selectedRadioValue)&&e.allowMultiDateSingleBooking===!0&&!I.bundleCode&&!I.selectedPackage&&!I.selectedBundle,hs=()=>xs?!0:I.bookingType==="single"?!1:I.selectedPackage?I.selectedPackage.numberOfWeeks>1:!1,gs=()=>{const ae=[],Re=xs;if(!Re&&!I.selectedPackage)return ae;const Le=Re?new Date((_||e.date||new Date).getFullYear(),(_||e.date||new Date).getMonth(),(_||e.date||new Date).getDate()):fue(I.selectedPackage,e.date),Ye=Re?e.frequency==="daily"?365:52:Math.max(I.selectedPackage.bookingWindowWeeks||I.selectedPackage.numberOfWeeks,I.selectedPackage.numberOfWeeks);let Ve=[];if(e.excludeDates)try{const nt=e.excludeDates.trim();nt&&(Ve=nt.split(/[,\n]+/).map(ys=>ys.trim()).filter(ys=>ys.length>0),console.log("🚫 Parsed excluded dates:",Ve))}catch(nt){console.error("Error parsing excludeDates:",nt)}if(e.frequency==="daily"){const nt=e.enabledDays?JSON.parse(e.enabledDays):[1,2,3,4,5],ys=e.endDate?new Date(e.endDate):null;ys&&ys.setHours(23,59,59,999);let Fs=new Date(Le),dn=0;const rn=Ye*21;for(let ar=0;ar<rn&&dn<Ye&&!(ys&&Fs>ys);ar++){const gr=Fs.getDay(),js=`${Fs.getFullYear()}-${String(Fs.getMonth()+1).padStart(2,"0")}-${String(Fs.getDate()).padStart(2,"0")}`;nt.includes(gr)&&!Ve.includes(js)&&(ae.push(new Date(Fs)),dn++),Fs.setDate(Fs.getDate()+1)}}else{const nt=new Date(Le),ys=nt.getFullYear(),Fs=String(nt.getMonth()+1).padStart(2,"0"),dn=String(nt.getDate()).padStart(2,"0"),rn=`${ys}-${Fs}-${dn}`;let ar=!1,gr=[];if(e.exceptionalDates)try{gr=JSON.parse(e.exceptionalDates),ar=gr.some(js=>js.new_date===rn)}catch(js){console.error("Error parsing exceptionalDates:",js)}if(ar){const js=e.endDate?new Date(e.endDate):null;js&&js.setHours(23,59,59,999);const Cn=Ve.includes(rn);!Cn&&(!js||nt<=js)&&ae.push(new Date(nt));const Ho=e.dayOfWeek;let en=new Date(nt);for(en.setDate(en.getDate()+1);en.getDay()!==Ho;)en.setDate(en.getDate()+1);let Mn=Cn||js&&nt>js?0:1;const yr=Ye*3;for(let Qn=0;Qn<yr&&Mn<Ye;Qn++){const Ae=new Date(en);if(Ae.setDate(en.getDate()+Qn*7),js&&Ae>js)break;const ri=`${Ae.getFullYear()}-${String(Ae.getMonth()+1).padStart(2,"0")}-${String(Ae.getDate()).padStart(2,"0")}`,Tl=gr.some(_m=>_m.original_date===ri),Zd=Ve.includes(ri);console.log(`🗓️ Checking date ${ri}: moved=${Tl}, excluded=${Zd}, excludedDates:`,Ve),!Tl&&!Zd&&(ae.push(new Date(Ae)),Mn++)}}else{const js=e.endDate?new Date(e.endDate):null;js&&js.setHours(23,59,59,999);let Cn=0;const Ho=Ye*3;for(let en=0;en<Ho&&Cn<Ye;en++){const Mn=Le.getFullYear(),yr=Le.getMonth(),Qn=Le.getDate()+en*7,Ae=new Date(Mn,yr,Qn);if(js&&Ae>js)break;const ri=`${Ae.getFullYear()}
613-${String(Ae.getMonth()+1).padStart(2,"0")}-${String(Ae.getDate()).padStart(2,"0")}`,Tl=gr.some(_m=>_m.original_date===ri),Zd=Ve.includes(ri);console.log(`🗓️ Checking date ${ri}: moved=${Tl}, excluded=${Zd}, excludedDates:`,Ve),!Tl&&!Zd&&(ae.push(Ae),Cn++)}gr.forEach(en=>{const Mn=new Date(en.new_date),yr=`${Mn.getFullYear()}-${String(Mn.getMonth()+1).padStart(2,"0")}-${String(Mn.getDate()).padStart(2,"0")}`;Mn>=Le&&!Ve.includes(yr)&&(!js||Mn<=js)&&Math.floor((Mn.getTime()-Le.getTime())/6048e5)<Ye*3&&!ae.some(ri=>`${ri.getFullYear()}-${String(ri.getMonth()+1).padStart(2,"0")}-${String(ri.getDate()).padStart(2,"0")}`===yr)&&ae.length<Ye&&ae.push(Mn)}),ae.sort((en,Mn)=>en.getTime()-Mn.getTime()),ae.length>Ye&&ae.splice(Ye)}}if(e.endDate){const nt=new Date(e.endDate);return nt.setHours(23,59,59,999),ae.filter(Fs=>Fs<=nt)}return ae};f.useLayoutEffect(()=>{I.selectedPackage&&re(ae=>({...ae,selectedDates:[]}))},[(ye=I.selectedPackage)==null?void 0:ye.id,(Be=I.selectedPackage)==null?void 0:Be.fixedPackageStartDate]),f.useEffect(()=>{var ae;if(I.selectedPackage&&hs()){const Re=I.selectedPackage.numberOfWeeks,Le=I.selectedPackage.bookingWindowWeeks||Re;if(Math.max(Le,Re)===Re&&!((ae=I.selectedDates)!=null&&ae.length)){const Ve=gs();if(Ve.length>=Re){const nt=Ve.slice(0,Re);re(ys=>({...ys,selectedDates:nt}))}}}},[I.selectedPackage,(Ze=I.selectedPackage)==null?void 0:Ze.id,(es=I.selectedPackage)==null?void 0:es.fixedPackageStartDate,e.date,i]);const Os=xt({mutationFn:async ae=>(await Pe("POST","/api/create-payment-intent",ae)).json(),onSuccess:ae=>{var Ye,Ve,nt,ys;if(ae.cashPaymentOnly){const Fs={...e,date:e.date?new Date(e.date.getFullYear(),e.date.getMonth(),e.date.getDate()):e.date},dn=(Ye=I.selectedDates)==null?void 0:Ye.map(rn=>new Date(rn.getFullYear(),rn.getMonth(),rn.getDate()));sessionStorage.setItem("pendingBooking",JSON.stringify({...I,classData:{...Fs,allowCashPayments:!0},selectedDates:dn,cashPaymentOnly:!0,testMode:!1,memberPrice:C,selectedPaymentMethod:ge||"cash",...m,privateBooking:r})),pt("/checkout");return}if(ae.paypalOnly){const Fs={...e,date:e.date?new Date(e.date.getFullYear(),e.date.getMonth(),e.date.getDate()):e.date},dn=(Ve=I.selectedDates)==null?void 0:Ve.map(rn=>new Date(rn.getFullYear(),rn.getMonth(),rn.getDate()));sessionStorage.setItem("pendingBooking",JSON.stringify({...I,classData:Fs,selectedDates:dn,clientSecret:null,stripePublicKey:null,testMode:!1,memberPrice:C,originalAmount:ae.originalAmount,finalAmount:ae.finalAmount,couponApplied:ae.couponApplied,discountAmount:ae.discountAmount,a
613ppliedCouponCode:ae.couponCode||I.bundleCode||null,selectedPaymentMethod:ge||"paypal",...m,privateBooking:r})),pt("/checkout");return}if(ae.isFreeBooking){const Fs={...e,date:e.date?new Date(e.date.getFullYear(),e.date.getMonth(),e.date.getDate()):e.date},dn=(nt=I.selectedDates)==null?void 0:nt.map(rn=>new Date(rn.getFullYear(),rn.getMonth(),rn.getDate()));sessionStorage.setItem("pendingBooking",JSON.stringify({...I,classData:Fs,selectedDates:dn,isFreeBooking:!0,testMode:!1,memberPrice:C,originalAmount:ae.originalAmount,finalAmount:ae.finalAmount,couponApplied:ae.couponApplied,discountAmount:ae.discountAmount,appliedCouponCode:ae.couponCode||I.bundleCode||null,selectedPaymentMethod:ge||"stripe",...m,privateBooking:r})),pt("/checkout");return}const Re={...e,date:e.date?new Date(e.date.getFullYear(),e.date.getMonth(),e.date.getDate()):e.date},Le=(ys=I.selectedDates)==null?void 0:ys.map(Fs=>new Date(Fs.getFullYear(),Fs.getMonth(),Fs.getDate()));sessionStorage.setItem("pendingBooking",JSON.stringify({...I,classData:Re,selectedDates:Le,clientSecret:ae.clientSecret,paymentIntentId:ae.paymentIntentId,stripePublicKey:ae.stripePublicKey,testMode:ae.testMode||!1,memberPrice:C,selectedPaymentMethod:ge||"stripe",...m,privateBooking:r})),pt("/checkout")},onError:ae=>{Me({title:"Payment Error",description:ae.message,variant:"destructive"})}}),cs=()=>{var ae,Re;if(I.bundleCode)return 0;if(I.bookingType==="single"){if(I.selectedRadioValue==="free-trial"&&e.offerFreeTrial&&!xn&&!C)return 0;if(e.offerFirstUsePrice&&!Te&&!C){const Ve=parseFloat(String(e.firstUsePrice??"")),nt=parseFloat(e.singlePrice||"0");if(!Number.isNaN(Ve)&&Ve>=0){if(xs){const ys=((ae=I.selectedDates)==null?void 0:ae.length)||0;return ys<=1?Ve:Ve+(ys-1)*nt}return Ve}}const Le=C||e.singlePrice||"0",Ye=parseFloat(Le);if(xs){const Ve=((Re=I.selectedDates)==null?void 0:Re.length)||0;return Ye*Ve}return Ye}return I.selectedPackage?C!==null&&(C===""||C==="0"||parseFloat(C)===0)?0:parseFloat(I.selectedPackage.price||"0"):0},Tr=()=>I.bookingType==="single"?"Single "+(h==null?void 0:h.terminologySingular)||"Class":I.selectedPackage?I.selectedPackage.name:"",rr=(ae,Re)=>{if(!ae)return"Date to be selected";const Le={weekday:"long",year:"numeric",month:"long",day:"numeric"};let Ye=Re.startTime;if(console.log("🕒 DEBUG formatDateTime:",{originalStartTime:Re.startTime,frequency:Re.frequency,dayOfWeek:ae.getDay(),dateInput:ae}),Re.frequency==="daily")try{const ar=JSON.parse(Re.startTime);if(typeof ar=="object"&&ar!==null){const gr=ae.getDay().toString();Ye=ar[gr]||Object.values(ar)[0]||"09:00",console.log("🕒 DEBUG daily time extraction:",{parsed:ar,dayKey:gr,extractedTime:Ye})}}catch(ar){console.log("🕒 DEBUG JSON parse error:",ar)}const[Ve,nt]=Ye.split(":");if(!Ve||!nt||isNaN(parseInt(Ve))||isNaN(parseInt(nt)))return`${ae.toLocaleDateString("en-US",Le)} at TBD`;const ys=parseInt(Ve),Fs=ys===0?12:ys>12?ys-12:ys,dn=ys>=12?"PM":"AM",rn=(h==null?void 0:h.timezone)==="Europe/London"?" (UK time)":` (${(h==null?void 0:h.timezone)||"UTC"})`;return`${ae.toLocaleDateString("en-US",Le)} at ${Fs}:${nt} ${dn}${rn}`},xe=ae=>!ae||!ae.trim()?!1:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(ae.trim()),He=()=>{var ae;if(!((ae=I.clientData.name)!=null&&ae.trim()))return{isValid:!1,message:"Please enter your full name."};if(!I.clientData.email||!R)return{isValid:!1,message:"Please fill in all required fields and agree to terms."};if(!xe(I.clientData.email))return{isValid:!1,message:"Please enter a valid email address."};if(e.requirePhoneForBooking){const Re=(I.clientData.phone||"").trim(),Le=((Qt==null?void 0:Qt.phone)||"").trim();if(!Re&&!Le)return{isValid:!1,message:"Please enter your phone number."}}if(bs){const Re=[];if((!I.clientData.emergencyContactName||I.clientData.emergencyContactName.trim()==="")&&Re.push("Emergency Contact Name"),(!I.clientData.emergencyContactPhone||I.clientData.emergencyContactPhone.trim()==="")&&Re.push("Emergency Contact Phone"),Re.length>0)return{isValid:!1,message:`Please complete these required fields: ${Re.join(", ")}`}}if(ps&&fe){const Re=JSON.parse(fe.questions),Le=[];for(const Ye of Re)if(Ye.required&&Ye.type!=="info"){const nt=I.clientData.onboardingData[Ye.id];(!nt||typeof nt=="string"&&nt.trim()===""||typeof nt=="boolean"&&!nt)&&Le.push(Ye.label)}if(Le.length>0)return{isValid:!1,message:`Please complete these required fields: ${Le.join(", ")}`}}return{isValid:!0,message:""}},tt=(ae,Re,Le)=>{const Ye=`classta_bundles_${(h==null?void 0:h.id)||""}`;try{const Ve=JSON.parse(localStorage.getItem(Ye)||"[]");Ve.includes(ae)||(Ve.push(ae),localStorage.setItem(Ye,JSON.stringify(Ve)))}catch(Ve){console.error("Error storing bundle code:",Ve)}re(Ve=>({...Ve,bookingType:"single",bundleCode:ae,clientData:{...Ve.clientData,email:Re,name:Le}})),Z(!1),A(null),o(2),Me({title:"Bundle Purchased!",description:"Your bundle code has been applied. Continue with your booking below."})},Jt=()=>{Z(!1),A(null),re(ae=>({...ae,bookingType:"single",selectedBundle:void 0}))},ds=async()=>{const ae=ft.trim().toUpperCase();if(!(!ae||!(h!=null&&h.id)||!e.id)){_e(null),ue(!0);try{const Re=await fetch(`/api/coupons/bundles/info/${h.id}/${encodeURIComponent(ae)}`),Le=await Re.json();
613if(!Re.ok){_e(Le.message||"Could not validate code.");return}if(!Le.isValid){_e(Le.message||"Invalid bundle code.");return}if(!Le.hasSessions){_e("This bundle has no sessions remaining.");return}if(!(Le.applicableClassMode==="all"||Le.applicableClassMode==="selected"&&Le.applicableClassIds&&Array.isArray(Le.applicableClassIds)&&Le.applicableClassIds.includes(e.id))){_e("This bundle is not valid for this class.");return}const Ve=`classta_bundles_${h.id}`;try{const nt=JSON.parse(localStorage.getItem(Ve)||"[]");nt.includes(ae)||(nt.push(ae),localStorage.setItem(Ve,JSON.stringify(nt)))}catch{}re(nt=>({...nt,bookingType:"single",selectedRadioValue:`stored-bundle-${ae}`,selectedPackage:void 0,selectedBundle:void 0,bundleCode:ae})),Cs(nt=>nt+1),qe(!1),be(""),_e(null),Me({title:"Bundle applied",description:`${Le.bundleName||ae} — ${Le.remainingSessions} session${Le.remainingSessions!==1?"s":""} remaining. Continue below to complete your booking.`})}catch{_e("Something went wrong. Please try again.")}finally{ue(!1)}}},zs=async(ae,Re)=>{var Ye;if(I.bookingType!=="single")return!0;const Le=(Ye=I.clientData.email)==null?void 0:Ye.trim();if(!Le)return!0;try{const nt=await(await Pe("POST","/api/bookings/check-duplicate",{classId:e.id,classDate:ae,selectedDates:Re,bookingType:I.bookingType,clientEmail:Le})).json();return nt!=null&&nt.hasDuplicate?window.confirm(`${nt.message}
614
615Do you still want to continue to checkout?`):!0}catch(Ve){return console.error("Duplicate pre-check failed:",Ve),!0}},De=async()=>{var ae,Re,Le,Ye,Ve,nt,ys,Fs,dn,rn,ar,gr;if(console.log("🔥 BUTTON CLICKED - Current step:",i),console.log("🔥 needsDateSelection:",hs()),console.log("🔥 bookingType:",I.bookingType),i===1){if((ae=I.bookingType)!=null&&ae.startsWith("bundle-")&&I.selectedBundle){A(I.selectedBundle),Z(!0);return}if(xs){const js=gs(),Cn=e.date||_||null,en=(Cn?js.find(Mn=>Mn.toDateString()===new Date(Cn.getFullYear(),Cn.getMonth(),Cn.getDate()).toDateString()):null)||js[0];if(en){const Mn=en.toDateString();((Re=I.selectedDates)==null?void 0:Re.some(Qn=>Qn.toDateString()===Mn))||!1||re(Qn=>({...Qn,selectedDates:[...Qn.selectedDates||[],en]}))}}o(2)}else if(i===2)if(hs()){const js=((Le=I.selectedDates)==null?void 0:Le.length)||0;if(xs){if(js<1){Me({title:"Select Dates",description:"Please select at least one date before continuing.",variant:"destructive"});return}}else{const Cn=((Ye=I.selectedPackage)==null?void 0:Ye.numberOfWeeks)||1,en=gs().length;if(en<Cn){if(js!==en){Me({title:"Select Dates",description:`Please select all ${en} available date${en!==1?"s":""} before the class ends. You have selected ${js}.`,variant:"destructive"});return}}else if(js!==Cn){Me({title:"Select Dates",description:`Please select exactly ${Cn} dates for your package. You have selected ${js}.`,variant:"destructive"});return}}o(3)}else{const js=He();if(!js.isValid){Me({title:"Missing Information",description:js.message,variant:"destructive"});return}o(3)}else if(i===3)if(hs()){const js=He();if(!js.isValid){Me({title:"Missing Information",description:js.message,variant:"destructive"});return}o(4)}else{console.log("🔥 PAYMENT STEP CLICKED - Step:",i),console.log("🔥 needsDateSelection:",hs()),console.log("🔥 bookingType:",I.bookingType),console.log("PAYMENT STEP - Current booking data:",I),console.log("PAYMENT STEP - Selected dates:",I.selectedDates);const js=In(e.date),Cn=(Ve=I.selectedDates)==null?void 0:Ve.map(yr=>In(yr));if(!await zs(js,Cn))return;de();const en=cs();if(en===0&&!I.bundleCode){console.log("🆓 Free booking detected (no bundle), going to checkout for confirmation");const yr={...e,date:e.date?new Date(e.date.getFullYear(),e.date.getMonth(),e.date.getDate()):e.date},Qn=(nt=I.selectedDates)==null?void 0:nt.map(Ae=>new Date(Ae.getFullYear(),Ae.getMonth(),Ae.getDate()));sessionStorage.setItem("pendingBooking",JSON.stringify({...I,classData:yr,selectedDates:Qn,amount:"0.00",currency:(h==null?void 0:h.currency)||"GBP",paymentIntentId:`free_${Date.now()}`,isFreeBooking:!0,testMode:e.testMode||!1,appliedCouponCode:I.bundleCode||null,selectedPaymentMethod:ge||"stripe",bookingAccessCode:Pg(e.id),privateLinkToken:a||null,privateBooking:r})),pt("/checkout");return}const Mn={bookingType:I.bookingType,classId:e.id,classDate:js,selectedDates:Cn,selectedPackageId:(ys=I.selectedPackage)==null?void 0:ys.id,selectedPackage:I.selectedPackage?{id:I.selectedPackage.id,name:I.selectedPackage.name,numberOfWeeks:I.selectedPackage.numberOfWeeks}:void 0,clientData:I.clientData,amount:en,currency:(h==null?void 0:h.currency)||"GBP",couponCode:I.bundleCode||null,testMode:e.testMode||!1,...m,metadata:{memberPrice:C,privateBooking:r,instructorId:h==null?void 0:h.id}};if(I.bundleCode)Os.mutate({amount:en,classId:e.id,clientEmail:I.clientData.email,bookingType:I.bookingType,classDate:js,testMode:e.testMode||!1,couponCode:I.bundleCode||null,pendingBooking:Mn,...m});else{const yr={...e,date:e.date?new Date(e.date.getFullYear(),e.date.getMonth(),e.date.getDate()):e.date},Qn=(Fs=I.selectedDates)==null?void 0:Fs.map(Ae=>new Date(Ae.getFullYear(),Ae.getMonth(),Ae.getDate()));sessionStorage.setItem("pendingBooking",JSON.stringify({...I,classData:yr,selectedDates:Qn,amount:en.toString(),currency:(h==null?void 0:h.currency)||"GBP",stripePublicKey:(h==null?void 0:h.stripePublicKey)||null,stripeAccountId:(h==null?void 0:h.stripeConnectAccountId)||(h==null?void 0:h.stripeExpressAccountId)||null,testMode:e.testMode||!1,memberPrice:C,selectedPaymentMethod:ge||"stripe",...m,privateBooking:r})),pt("/checkout")}}else if(i===4){console.log("🔥 PAYMENT STEP CLICKED - Step:",i),console.log("🔥 needsDateSelection:",hs()),console.log("🔥 bookingType:",I.bookingType),console.log("PAYMENT STEP - Current booking data:",I),console.log("PAYMENT STEP - Selected dates:",I.selectedDates);const js=In(e.date),Cn=(dn=I.selectedDates)==null?void 0:dn.map(yr=>In(yr));if(!await zs(js,Cn))return;de();const en=cs();if(en===0&&!I.bundleCode){console.log("🆓 Free booking detected (no bundle), going to checkout for confirmation");const yr={...e,date:e.date?new Date(e.date.getFullYear(),e.date.getMonth(),e.date.getDate()):e.date},Qn=(rn=I.selectedDates)==null?void 0:rn.map(Ae=>new Date(Ae.getFullYear(),Ae.getMonth(),Ae.getDate()));sessionStorage.setItem("pendingBooking",JSON.stringify({...I,classData:yr,selectedDates:Qn,amount:"0.00",currency:(h==null?void 0:h.currency)||"GBP",paymentIntentId:`free_${Date.now()}`,isFreeBooking:!0,testMode:e.testMode||!1,appliedCouponCode:I.bundleCode||null,selectedPaymentMethod:ge||"stripe",...m,privateBooking:r})),pt("/checkout");return}const Mn={bookingType:I.bookingType,classId:e.id,classDate:js,selectedDates:Cn,selectedPackageId:(ar=I.selectedPackage)==null?void 0:ar.id,selectedPackage:I.selectedPackage?{id:I.selectedPackage.id,name:I.selectedPackage.name,numberOfWeeks:I.selectedPackage.numberOfWeeks}:void 0,clientData:I.clientData,amount:en,currency:(h==null?void 0:h.currency)||"GBP",couponCode:I.bundleCode||null,testMode:e.testMode||!1,...m,metadata:{memberPrice:C,privateBooking:r,instructorId:h==null?void 0:h.id}};if(I.bundleCode)Os.mutate({amount:en,classId:e.id,clientEmail:I.clientData.email,bookingType:I.bookingType,classDate:js,testMode:e.testMode||!1,couponCode:I.bundleCode||null,pendingBooking:Mn,...m});else{const yr={...e,date:e.date?new Date(e.date.getFullYear(),e.date.getMonth(),e.date.getDate()):e.date},Qn=(gr=I.selectedDates)==null?void 0:gr.map(Ae=>new Date(Ae.getFullYear(),Ae.getMonth(),Ae.getDate()));sessionStorage.setItem("pendingBooking",JSON.stringify({...I,classData:yr,selectedDates:Qn,amount:en.toString(),currency:(h==null?void 0:h.currency)||"GBP",stripePublicKey:(h==null?void 0:h.stripePublicKey)||null,stripeAccountId:(h==null?void 0:h.stripeConnectAccountId)||(h==null?void 0:h.stripeExpressAccountId)||null,testMode:e.testMode||!1,memberPrice:C,selectedPaymentMethod:ge||"stripe",...m,privateBooking:r})),pt("/checkout")}}},we=()=>{i>1&&o(i-1)};console.log("BookingModal render - currentStep:",i),console.log("BookingModal render - needsDateSelection():",hs()),console.log("BookingModal render - bookingData.bookingType:",I.bookingType),Cl(!0);const ot=typeof window<"u"&&window.self!==window.top,_t=f.useRef(null);return s.jsxs(Ct,{open:!0,onOpenChange:t,children:[s.jsxs(St,{className:"max-w-2xl max-h-[90vh] overflow-y-auto w-[95vw] sm:w-full",onInteractOutside:ae=>ae.preventDefault(),onPointerDownOutside:ae=>ae.preventDefault(),onOpenAutoFocus:ae=>{var Re;ae.preventDefault(),(Re=_t.current)==null||Re.focus()}
615,children:[s.jsx("span",{ref:_t,tabIndex:-1,"aria-hidden":!0,className:"absolute size-0 overflow-hidden p-0 m-[-1px] whitespace-nowrap border-0"}),s.jsxs(kt,{children:[s.jsxs(Pt,{className:"text-lg sm:text-xl sr-only",children:["Book Your ",(h==null?void 0:h.terminologySingular)||"Class"]}),s.jsx("div",{className:"mt-4 w-full",children:hs()?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-center gap-4 sm:gap-8",children:[s.jsxs("div",{className:"flex items-center flex-shrink-0",children:[s.jsx("div",{className:`w-6 h-6 sm:w-8 sm:h-8 rounded-full flex items-center justify-center text-xs sm:text-sm font-medium ${i>=1?"bg-primary text-primary-foreground":"bg-slate-200 text-slate-600"}`,children:"1"}),s.jsx("span",{className:`ml-1 sm:ml-2 text-xs sm:text-sm font-medium whitespace-nowrap ${i>=1?"text-primary":"text-slate-600"}`,children:(h==null?void 0:h.terminologySingular)||"Class"})]}),s.jsxs("div",{className:"flex items-center flex-shrink-0",children:[s.jsx("div",{className:`w-6 h-6 sm:w-8 sm:h-8 rounded-full flex items-center justify-center text-xs sm:text-sm font-medium ${i>=2?"bg-primary text-primary-foreground":"bg-slate-200 text-slate-600"}`,children:"2"}),s.jsx("span",{className:`ml-1 sm:ml-2 text-xs sm:text-sm whitespace-nowrap ${i>=2?"text-primary":"text-slate-600"}`,children:"Select Dates"})]})]}),s.jsxs("div",{className:"flex items-center justify-center gap-4 sm:gap-8",children:[s.jsxs("div",{className:"flex items-center flex-shrink-0",children:[s.jsx("div",{className:`w-6 h-6 sm:w-8 sm:h-8 rounded-full flex items-center justify-center text-xs sm:text-sm font-medium ${i>=3?"bg-primary text-primary-foreground":"bg-slate-200 text-slate-600"}`,children:"3"}),s.jsx("span",{className:`ml-1 sm:ml-2 text-xs sm:text-sm whitespace-nowrap ${i>=3?"text-primary":"text-slate-600"}`,children:"Personal Info"})]}),s.jsxs("div",{className:"flex items-center flex-shrink-0",children:[s.jsx("div",{className:`w-6 h-6 sm:w-8 sm:h-8 rounded-full flex items-center justify-center text-xs sm:text-sm font-medium ${i>=4?"bg-primary text-primary-foreground":"bg-slate-200 text-slate-600"}`,children:"4"}),s.jsx("span",{className:`ml-1 sm:ml-2 text-xs sm:text-sm whitespace-nowrap ${i>=4?"text-primary":"text-slate-600"}`,children:"Payment"})]})]})]}):s.jsxs("div",{className:"flex items-center justify-center gap-2 sm:gap-4 pb-2",children:[s.jsxs("div",{className:"flex items-center flex-shrink-0",children:[s.jsx("div",{className:`w-6 h-6 sm:w-8 sm:h-8 rounded-full flex items-center justify-center text-xs sm:text-sm font-medium ${i>=1?"bg-primary text-primary-foreground":"bg-slate-200 text-slate-600"}`,children:"1"}),s.jsx("span",{className:`ml-1 sm:ml-2 text-xs sm:text-sm font-medium whitespace-nowrap ${i>=1?"text-primary":"text-slate-600"}`,children:(h==null?void 0:h.terminologySingular)||"Class"})]}),s.jsxs("div",{className:"flex items-center flex-shrink-0",children:[s.jsx("div",{className:`w-6 h-6 sm:w-8 sm:h-8 rounded-full flex items-center justify-center text-xs sm:text-sm font-medium ${i>=2?"bg-primary text-primary-foreground":"bg-slate-200 text-slate-600"}`,children:"2"}),s.jsx("span",{className:`ml-1 sm:ml-2 text-xs sm:text-sm whitespace-nowrap ${i>=2?"text-primary":"text-slate-600"}`,children:"Personal Info"})]}),s.jsxs("div",{className:"flex items-center flex-shrink-0",children:[s.jsx("div",{className:`w-6 h-6 sm:w-8 sm:h-8 rounded-full flex items-center justify-center text-xs sm:text-sm font-medium ${i>=3?"bg-primary text-primary-foreground":"bg-slate-200 text-slate-600"}`,children:"3"}),s.jsx("span",{className:`ml-1 sm:ml-2 text-xs sm:text-sm whitespace-nowrap ${i>=3?"text-primary":"text-slate-600"}`,children:"Payment"})]})]})})]}),i===1&&s.jsxs("div",{className:`flex flex-col ${ot?"h-full min-h-0":"space-y-6"}`,children:[s.jsx(Ce,{className:`bg-slate-50 ${ot?"flex-shrink-0 mb-4":""}`,children:s.jsxs(Ee,{className:"p-6",children:[s.jsxs("div",{className:"flex items-center space-x-4",children:[s.jsx("div",{className:"w-3 h-3 bg-primary rounded-full"}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-lg font-semibold text-slate-900",children:e.name}),s.jsx("p",{className:"text-slate-600",children:_?rr(_,e):`${e.startTime} - Date to be selected`})]})]}),s.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-slate-600",children:"Instructor"}),s.jsx("div",{className:"font-medium text-slate-900",children:x})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-slate-600",children:"Duration"}),s.jsxs("div",{className:"font-medium text-slate-900",children:[e.duration," minutes"]})]}),!(h!=null&&h.hideSpotsRemaining)&&s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-slate-600",children:"Spots Available"}),s.jsx("div",{className:"font-medium text-slate-900",children:e.spotsLeft!==void 0?`${e.spotsLeft} remaining`:`${e.maxCapacity} total`})]}),e.description||e.photoUrl?s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-slate-600",children:"More Info"}),s.jsx("div",{className:"font-medium text-slate-900",children:s.jsxs(B,{variant:"link",size:"sm",tabIndex:-1,
615className:"text-xs text-blue-600 hover:text-blue-800 h-auto p-0 font-normal focus-visible:ring-0 focus-visible:ring-offset-0",onClick:()=>d(!0),children:[s.jsx(FN,{className:"h-3 w-3 mr-1"}),"View details"]})})]}):e.location&&s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-slate-600",children:"Location"}),s.jsxs("div",{className:"font-medium text-slate-900 flex items-center",children:["📍 ",e.location]})]}),e.location&&(e.description||e.photoUrl)&&s.jsxs("div",{className:"col-span-2",children:[s.jsx("span",{className:"text-sm text-slate-600",children:"Location"}),s.jsxs("div",{className:"font-medium text-slate-900 flex items-center",children:["📍 ",e.location]})]})]})]})}),(e.description||e.photoUrl)&&s.jsx(Ct,{open:c,onOpenChange:d,children:s.jsxs(St,{className:"max-w-md max-h-[90vh] flex flex-col",children:[s.jsx(kt,{children:s.jsx(Pt,{children:e.name})}),s.jsxs("div",{className:"mt-4 overflow-y-auto flex-1 pr-2 -mr-2",children:[e.description&&s.jsx("p",{className:"text-sm text-slate-600 leading-relaxed",children:pue(e.description)}),e.photoUrl&&s.jsx("div",{className:e.description?"mt-4":"",children:s.jsx("img",{src:e.photoUrl,alt:`${e.name} photo`,className:"w-full rounded-lg object-cover"})})]})]})}),s.jsxs("div",{className:`${ot?"flex-1 overflow-y-auto min-h-0 space-y-4 pb-24":"space-y-4"} `,children:[We&&!S&&s.jsx(Ce,{className:"bg-purple-50 border-purple-300 border-2",children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("h6",{className:"font-semibold text-purple-900",children:"Members Only Class"}),s.jsx("p",{className:"text-sm text-purple-700 mt-1",children:Xs?"New customers can book one free trial class below. After that, this class is for members only.":hue(T,O)})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[!T&&s.jsx(B,{variant:"default",size:"sm",disabled:!y,onClick:()=>{if(!y)return;const ae=window.open(`/my-account/${y}?returnTo=booking`,"clientLogin","width=500,height=600,scrollbars=yes,resizable=yes"),Re=setInterval(()=>{ae!=null&&ae.closed&&(clearInterval(Re),setTimeout(async()=>{try{const Le=localStorage.getItem(`client_token_${h.id}`);if(!Le){z(!1),E(!1),P(null),N(null),D(null);return}const Ye=await fetch(`/api/member/${h.id}/class-pricing/${e.id}`,{headers:{Authorization:`Bearer ${Le}`}});if(Ye.ok){z(!0);const Ve=await Ye.json();Ve.memberPrice!==void 0?(E(!0),P(Ve.memberPrice),N(Ve.member),D(null)):(E(!1),P(null),N(null),D(Ve.ineligibleReason??null))}else z(!1),E(!1),P(null),N(null),D(null)}catch(Le){console.error("Error checking member auth:",Le),z(!1),E(!1),P(null),N(null)}},500))},100)},children:"Log In"}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>{y&&window.open(`/classes/${y}/memberships`,"_blank")},className:"border-purple-200 text-purple-900 hover:bg-purple-100",disabled:!y,children:"Buy Membership"})]})]})})}),!C&&w&&!We&&!S&&s.jsx(Ce,{className:"bg-blue-50 border-blue-200",children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h6",{className:"font-medium text-blue-900",children:"Are you a member?"}),s.jsx("p",{className:"text-sm text-blue-700",children:T?"Buy a membership to see member pricing.":"Log in to see your special member pricing"})]}),T?s.jsx(B,{variant:"outline",size:"sm",onClick:()=>{y&&window.open(`/classes/${y}/memberships`,"_blank")},className:"border-blue-300 text-blue-700 hover:bg-blue-100",disabled:!y,children:"Buy Membership"}):s.jsx(B,{variant:"outline",size:"sm",disabled:!y,onClick:()=>{if(!y)return;const ae=window.open(`/my-account/${y}?returnTo=booking`,"clientLogin","width=500,height=600,scrollbars=yes,resizable=yes"),Re=setInterval(()=>{ae!=null&&ae.closed&&(clearInterval(Re),setTimeout(async()=>{try{const Le=localStorage.getItem(`client_token_${h.id}`);if(!Le){z(!1),E(!1),P(null),N(null);return}const Ye=await fetch(`/api/member/${h.id}/class-pricing/${e.id}`,{headers:{Authorization:`Bearer ${Le}`}});if(Ye.ok){z(!0);const Ve=await Ye.json();Ve.memberPrice!==void 0?(E(!0),P(Ve.memberPrice),N(Ve.member)):(E(!1),P(null),N(null))}else z(!1),E(!1),P(null),N(null)}catch(Le){console.error("Error checking member pricing after login:",Le),z(!1),E(!1),P(null),N(null)}},500))},1e3)},className:"border-blue-300 text-blue-700 hover:bg-blue-100",children:"Member Login"})]})})}),s.jsx("h5",{className:"font-semibold text-slate-900",children:"Choose Your Booking Option"}),s.jsxs(Sl,{value:I.selectedRadioValue||(I.bundleCode?`stored-bundle-${I.bundleCode}`:(Ns=I.bookingType)!=null&&Ns.startsWith("bundle-")?I.bookingType:We&&j&&!I.bundleCode&&!I.selectedBundle||vt?"membership":Xs?"free-trial":Ke?"single":le.length>0?le[0].id.toString():"single"),onValueChange:ae=>{if(ae==="free-trial")re(Re=>({...Re,bookingType:"single",selectedRadioValue:"free-trial",selectedPackage:void 0,selectedBundle:void 0,bundleCode:void 0}));else if(ae==="single"||ae==="membership")re(Re=>({...Re,bookingType:"single",selectedRadioValue:ae,selectedPackage:void 0,selectedBundle:void 0,bundleCode:void 0}));else if(ae.startsWith("bundle-")){const Re=parseInt(ae.replace("bundle-","")),Le=Tt.find(Ye=>Ye.id===Re);re(Ye=>({...Ye,bookingType:ae,selectedRadioValue:ae,selectedPackage:void 0,selectedBundle:Le,bundleCode:void 0}))}else if(ae.startsWith("stored-bundle-")){const Re=ae.replace("stored-bundle-","");Ot.find(Le=>Le.bundleCode===Re),re(Le=>({...Le,bookingType:"single",selectedRadioValue:ae,selectedPackage:void 0,selectedBundle:void 0,bundleCode:Re}))}else{const Re=le.find(Le=>Le.id.toString()===ae);re(Le=>({...Le,bookingType:ae,selectedRadioValue:ae,selectedPackage:Re,selectedBundle:void 0,bundleCode:void 0}))}},className:"space-y-3",children:[w&&S&&s.jsxs("div",{className:`flex items-center space-x-3 p-4 border-2 rounded-lg ${k&&k.limit!==null&&!k.hasQuota?"border-gray-300 bg-gray-50 opacity-60":"border-primary bg-primary/5"}`,children:[s.jsx($r,{value:"membership",id:"membership",disabled:k?k.limit!==null&&!k.hasQuota:!1}),s.jsx(V,{htmlFor:"membership",className:`flex-1 ${k&&k.limit!==null&&!k.hasQuota?"cursor-not-allowed":"cursor-pointer"}`,children:s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-slate-900",children:"Use Membership"}),s.jsx("div",{className:"text-sm text-slate-600",children:k&&k.limit!==null?s.jsxs(s.Fragment,{children:[k.used," of ",k.limit," classes used this ",k.period,k.used<k.limit&&s.jsxs("span",{className:"text-green-600 font-medium ml-2",children:["(",k.limit-k.used," remaining)"]}),k.used>=k.limit&&s.jsx("span",{className:"text-orange-600 font-medium ml-2",children:"(Limit reached)"})]}):s.jsx("span",{children:"Unlimited access"})})]}),s.jsx("div",{className:"text-right",children:s.jsx("div",{className:"text-lg font-semibold text-slate-900",children:C?s.jsxs("span",{children:[W,C]}):s.jsx("span",{className:"text-green-600",children:"FREE"})})})]})})]}),Xs&&s.jsxs("div",{className:"flex items-center space-x-3 p-4 border-2 border-green-300 rounded-lg bg-green-50/50",children:[s.jsx($r,{value:"free-trial",id:"free-trial"}),s.jsx(V,{htmlFor:"free-trial",className:"flex-1 cursor-pointer",children:s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"font-medium text-slate-900 flex items-center gap-2",children:["Free Trial Class",s.jsx(Je,{variant:"secondary",className:"bg-green-100 text-green-700 border-green-300",children:"NEW CUSTOMER"})]}),s.jsx("div",{className:"text-sm text-slate-600",children:We?"Try this class for free. Further classes require a membership.":"Try this class for free - available to new customers only"})]}),s.jsx("div",{className:"text-right",children:s.jsx("div",{className:"text-lg font-semibold text-green-600",children:"FREE"})})]})})]}),Ot.map(ae=>s.jsxs("div",{className:"flex items-center space-x-3 p-4 border-2 border-green-300 rounded-lg bg-green-50/50",children:[s.jsx($r,{value:`stored-bundle-${ae.bundleCode}`,id:`stored-bundle-${ae.bundleCode}`}),s.jsx(V,{htmlFor:`stored-bundle-${ae.bundleCode}`,className:"flex-1 cursor-pointer",children:s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"font-medium text-slate-900 flex items-center gap-2",children:["Use Your Bundle",s.jsx(Je,{variant:"secondary",className:"bg-green-100 text-green-700 border-green-300",children:ae.bundleCode})]}),s.jsxs("div",{className:"text-sm text-slate-600",children:[ae.bundleName," • ",ae.remainingSessions," session",ae.remainingSessions!==1?"s":""," remaining"]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("div",{className:"text-lg font-semibold text-green-600",children:"FREE"}),s.jsx("div",{className:"text-xs text-slate-500",children:"Using bundle"})]})]})})]},ae.bundleCode)),Ke&&!(parseFloat(e.singlePrice||"0")===0&&e.onePerCustomer&&e.offerFreeTrial&&!xn)&&!vt&&s.jsxs("div",{className:"flex items-center space-x-3 p-4 border border-slate-200 rounded-lg",children:[s.jsx($r,{value:"single",id:"single"}),s.jsx(V,{htmlFor:"single",className:"flex-1 cursor-pointer",children:s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"font-medium text-slate-900",children:["Single ",(h==null?void 0:h.terminologySingular)||"Class"]}),s.jsxs("div",{className:"text-sm text-slate-600",children:["One-time booking",C&&s.jsx("span",{className:"block text-green-600 font-medium",children:"Member Discount Applied"}),e.onePerCustomer&&s.jsx("span",{className:"block text-orange-600 font-medium",children:"1 use per customer"}),e.offerFirstUsePrice&&!Te&&!C&&s.jsx("span",{className:"block text-green-600 font-medium",children:"First session"})]})]}),s.jsx("div",{className:"text-lg font-semibold text-slate-900",children:C?s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsxs("span",{className:"text-sm line-through text-slate-500",children:[W,e.singlePrice]}),s.jsxs("span",{className:"text-green-600",children:[W,C]})]}):e.offerFirstUsePrice&&!Te&&e.firstUsePrice!=null&&parseFloat(String(e.firstUsePrice))>=0?s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsxs("span",{className:"text-sm line-through text-slate-500",children:[W,e.singlePrice]}),s.jsxs("span",{className:"text-green-600",children:[W,e.firstUsePrice]})]}):s.jsxs("span",{children:[W,e.singlePrice]})})]})})]}),w&&S&&k&&!k.hasQuota&&k.limit!==null&&s.jsx("div",{className:"p-4 border-2 border-orange-300 rounded-lg bg-orange-50",children:s.jsxs("p",{className:"text-sm text-orange-800 text-center font-medium",children:["You've used all ",k.limit," discounted class bookings this ",k.period,"."]})}),We&&!S&&!T&&le.length===0&&!Xs&&s.jsx("div",{className:"p-4 border-2 border-purple-300 rounded-lg bg-purple-50",children:s.jsx("p",{className:"text-sm text-purple-800 text-center",children:"This class is for members only. Please log in above to book."})}),le.map((ae,Re)=>s.jsxs("div",{className:`flex items-center space-x-3 p-4 rounded-lg ${Re===0?"border-2 border-secondary bg-secondary/5":"border border-slate-200"}`,children:[s.jsx($r,{value:ae.id.toString(),id:`package-${ae.id}`}),s.jsx(V,{htmlFor:`package-${ae.id}`,className:"flex-1 cursor-pointer",children:s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-slate-900",children:ae.name}),s.jsxs("div",{className:"text-sm text-slate-600",children:[ae.numberOfWeeks,"-",e.frequency==="daily"?"day":"week"," package",C!==null&&(C===""||C==="0"||parseFloat(C)===0)&&s.jsx("span",{className:"block text-green-600 font-medium",children:"Member Discount Applied"}),e.singlePrice&&parseFloat(ae.price)<parseFloat(e.singlePrice)*ae.numberOfWeeks?" • Save money":"",Re===0&&s.jsx("div",{className:"mt-1",children:s.jsx(Je,{className:"bg-secondary text-xs",children:"Recommended"})})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("div",{className:"text-lg font-semibold text-slate-900",children:C!==null&&(C===""||C==="0"||parseFloat(C)===0)?s.jsxs("div",{className:"flex items-center space-x-2 justify-end",children:[s.jsxs("span",{className:"text-sm line-through text-slate-500",children:[W,ae.price]}),s.jsxs("span",{className:"text-green-600",children:[W,"0.00"]})]}):s.jsxs(s.Fragment,{children:[W,ae.price]})}),C!==null&&(C===""||C==="0"||parseFloat(C)===0)?null:e.singlePrice&&parseFloat(ae.price)<parseFloat(e.singlePrice)*ae.numberOfWeeks&&s.jsxs("div",{className:"text-sm text-slate-500 line-through",children:[W,(parseFloat(e.singlePrice)*ae.numberOfWeeks).toFixed(2)]})]})]})})]},ae.id)),Tt.map(ae=>{var Le,Ye;const Re=typeof ae.discountValue=="string"?parseFloat(ae.discountValue):ae.discountValue;return s.jsxs("div",{className:"flex items-center space-x-3 p-4 border border-purple-200 rounded-lg bg-purple-50/50",children:[s.jsx($r,{value:`bundle-${ae.id}`,id:`bundle-${ae.id}`}),s.jsx(V,{htmlFor:`bundle-${ae.id}`,className:"flex-1 cursor-pointer",children:s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"font-medium text-slate-900 flex items-center gap-2",children:[ae.name,s.jsx(Je,{variant:"secondary",className:"bg-purple-100 text-purple-700 border-purple-300",children:"Bundle"})]}),s.jsxs("div",{className:"text-sm text-slate-600",children:[ae.sessionCount," session",ae.sessionCount!==1?"s":"",ae.applicableClassMode!=="selected"?s.jsx(s.Fragment,{children:" • use across multiple class types"}):((Le=ae.applicableClassIds)==null?void 0:Le.length)===1&&ae.applicableClassIds[0]===e.id?s.jsx(s.Fragment,{children:" • for this class"}):s.jsxs(s.Fragment,{children:[" • for this and"," ",s.jsx("button",{type:"button",className:"underline underline-offset-2 hover:text-slate-900 focus:outline-none focus:ring-2 focus:ring-purple-300 rounded",onClick:Ve=>{Ve.preventDefault(),Ve.stopPropagation(),Ie(nt=>nt===ae.id?null:ae.id)},children:"other classes"}
615),ke===ae.id&&s.jsxs("div",{className:"mt-2 ml-0 p-3 rounded-md border border-slate-200 bg-white shadow-sm text-left",onClick:Ve=>Ve.stopPropagation(),children:[s.jsx("p",{className:"font-medium text-slate-900 mb-2",children:"Valid for:"}),s.jsx("ul",{className:"list-disc list-inside text-sm text-slate-600 space-y-1",children:(ae.applicableClassNames??((Ye=ae.applicableClassIds)==null?void 0:Ye.map(Ve=>({id:Ve,name:`Class #${Ve}`})))??[]).map(Ve=>s.jsx("li",{children:Ve.name},Ve.id))})]})]}),ae.description&&s.jsx("span",{className:"block text-xs text-slate-500 mt-1",children:ae.description})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsxs("div",{className:"text-lg font-semibold text-slate-900",children:[W,typeof Re=="number"?Re.toFixed(2):Re]}),s.jsx("div",{className:"text-xs text-slate-500",children:"Per bundle"})]})]})})]},ae.id)})]}),Tt.length>0&&s.jsx("div",{className:"mt-4",children:s.jsx("button",{type:"button",onClick:()=>{qe(!0),be(""),_e(null)},className:"text-sm text-primary hover:underline focus:outline-none focus:ring-2 focus:ring-primary/20 rounded",children:"Got a bundle code?"})}),Tt.length>0&&s.jsx("div",{className:"mt-4 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:s.jsxs("p",{className:"text-sm text-blue-800",children:[s.jsx("strong",{children:"Tip:"})," Bundles work like credits - purchase first, then use to book classes. After purchasing, we'll continue with your booking and your bundle will be automatically applied!"]})})]}),s.jsx(Ct,{open:$e,onOpenChange:qe,children:s.jsxs(St,{className:"sm:max-w-md",children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Enter your bundle code"})}),s.jsx("p",{className:"text-sm text-slate-600",children:"Enter the bundle code from your purchase email. We'll check it's valid for this class and has sessions left."}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(V,{htmlFor:"bundle-code-input",children:"Bundle code"}),s.jsx(me,{id:"bundle-code-input",value:ft,onChange:ae=>{be(ae.target.value),_e(null)},onKeyDown:ae=>{ae.key==="Enter"&&(ae.preventDefault(),ds())},placeholder:"e.g. ABC-123-XYZ",className:"font-mono uppercase",autoFocus:!0,disabled:ze}),Fe&&s.jsx("p",{className:"text-sm text-red-600",children:Fe})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[s.jsx(B,{type:"button",variant:"outline",onClick:()=>qe(!1),children:"Cancel"}),s.jsx(B,{type:"button",onClick:ds,disabled:!ft.trim()||ze,children:ze?"Checking…":"Apply code"})]})]})}),s.jsxs("div",{className:`flex justify-between items-center gap-2 sm:gap-4 flex-nowrap ${ot?"pt-4 border-t flex-shrink-0 bg-white sticky z-50 shadow-lg":"mt-6 mb-2"}`,style:ot?{bottom:"-1.5rem",paddingBottom:"calc(1.5rem + env(safe-area-inset-bottom))",left:0,right:0,marginLeft:"-1.5rem",marginRight:"-1.5rem",paddingLeft:"1.5rem",paddingRight:"1.5rem"}:void 0,children:[s.jsxs(B,{type:"button",variant:"outline",size:"icon",onClick:t,className:"shrink-0 h-9 w-9 sm:h-10 sm:w-auto sm:px-4","aria-label":"Cancel",children:[s.jsx(ja,{className:"h-4 w-4 sm:hidden"}),s.jsx("span",{className:"hidden sm:inline",children:"Cancel"})]}),rt?at?s.jsxs(B,{onClick:De,className:"flex-1 min-w-0 sm:flex-initial sm:min-w-[200px]",disabled:!at,children:[hs()?"Continue to Date Selection":"Continue to Personal Info",s.jsx(qn,{className:"h-4 w-4 ml-2"})]}):s.jsx("p",{className:"text-sm text-red-600 text-right flex-1 min-w-0",children:"Please select a valid booking option to continue."}):s.jsx("p",{className:"text-sm text-red-600 text-right flex-1 min-w-0",children:We&&!S&&!T?"Please log in or purchase a membership to continue.":We&&!S&&T?"Select a booking option (e.g. buy a bundle or single class) to continue.":"No booking options available. Please contact the instructor for more information."})]})]}),i===2&&hs()&&s.jsxs("div",{className:`flex flex-col ${ot?"h-full min-h-0":"space-y-6"}`,children:[s.jsx("div",{className:`${ot?"flex-1 overflow-y-auto min-h-0 space-y-6 pb-24":"space-y-6"}`,children:s.jsxs("div",{children:[s.jsx("h5",{className:"font-semibold text-slate-900 mb-2",children:"Select Your Class Dates"}),s.jsx("p",{className:"text-slate-600 mb-4",children:(()=>{var nt,ys;if(xs)return"Add one or more dates for this booking. You can choose any available dates shown below.";
615const ae=((nt=I.selectedPackage)==null?void 0:nt.numberOfWeeks)||1,Re=((ys=I.selectedPackage)==null?void 0:ys.bookingWindowWeeks)||ae,Le=Math.max(Re,ae),Ve=gs().length;return Le===ae?e.endDate&&Ve<ae?`Select all available dates (${Ve} date${Ve!==1?"s":""}) before the class ends on ${new Date(e.endDate).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})}`:`Your ${ae} class${ae>1?"es":""} will be scheduled on consecutive ${e.frequency==="daily"?"days":"weeks"}`:e.endDate&&Ve<ae?`Select all ${Ve} available date${Ve!==1?"s":""} before the class ends on ${new Date(e.endDate).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})}`:`Choose ${ae} date${ae>1?"s":""} from the ${Le}-${e.frequency==="daily"?"day":"week"} booking window`})()}),s.jsx("div",{className:"grid grid-cols-1 gap-3 max-h-[50vh] overflow-y-auto pr-1",children:gs().map((ae,Re)=>{var dn,rn,ar;const Le=(dn=I.selectedDates)==null?void 0:dn.some(gr=>gr.toDateString()===ae.toDateString()),Ye=((rn=I.selectedPackage)==null?void 0:rn.numberOfWeeks)||1,nt=gs().length,ys=((ar=I.selectedDates)==null?void 0:ar.length)||0,Fs=!Le&&(xs||ys<Ye||nt<Ye&&ys<nt);return s.jsx("div",{className:`p-4 border rounded-lg cursor-pointer transition-colors ${Le?"border-primary bg-primary/5":Fs?"border-slate-200 hover:border-slate-300":"border-slate-200 bg-slate-50 cursor-not-allowed opacity-50"}`,onClick:()=>{var gr;if(Le){const js=((gr=I.selectedDates)==null?void 0:gr.filter(Cn=>Cn.toDateString()!==ae.toDateString()))||[];console.log("Removing date:",ae.toDateString(),"New dates:",js),re(Cn=>({...Cn,selectedDates:js}))}else if(Fs){const js=[...I.selectedDates||[],ae];console.log("Adding date:",ae.toDateString(),"New dates:",js),re(Cn=>({...Cn,selectedDates:js}))}},children:s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"font-medium",children:[e.frequency==="daily"?"Day":"Week"," ",Re+1,":"," ",rr(ae,e)]}),s.jsxs("div",{className:"text-sm text-slate-600",children:[e.name," • ",e.duration," minutes"]})]}),s.jsx("div",{className:"flex items-center",children:Le&&s.jsx(Je,{variant:"default",className:"bg-primary",children:"Selected"})})]})},Re)})}),s.jsx("div",{className:"mt-4 p-3 bg-blue-50 rounded-lg",children:s.jsx("div",{className:"text-sm text-blue-800",children:(()=>{var Ve,nt;const ae=((Ve=I.selectedDates)==null?void 0:Ve.length)||0;if(xs)return`Selected: ${ae} ${ae===1?"class":"classes"}`;const Re=((nt=I.selectedPackage)==null?void 0:nt.numberOfWeeks)||1,Ye=gs().length;return e.endDate&&Ye<Re?`Selected: ${ae} of ${Ye} available date${Ye!==1?"s":""} (class ends ${new Date(e.endDate).toLocaleDateString("en-GB",{day:"numeric",month:"short"})})`:`Selected: ${ae} of ${Re} classes`})()})})]})}),s.jsxs("div",{className:`flex justify-between items-center ${ot?"pt-4 border-t flex-shrink-0 bg-white sticky z-50 shadow-lg":"mt-6 mb-2 sticky bottom-0 bg-white border-t py-3 z-10"}`,style:ot?{bottom:"-1.5rem",paddingBottom:"calc(1.5rem + env(safe-area-inset-bottom))",left:0,right:0,marginLeft:"-1.5rem",marginRight:"-1.5rem",paddingLeft:"1.5rem",paddingRight:"1.5rem"}:void 0,children:[s.jsxs(B,{variant:"outline",onClick:we,children:[s.jsx(xr,{className:"h-4 w-4 mr-2"}),"Back"]}),rt?at?s.jsxs(B,{onClick:De,disabled:!at,children:["Continue to Personal Info",s.jsx(qn,{className:"h-4 w-4 ml-2"})]}):s.jsx("p",{className:"text-sm text-red-600 text-right w-full",children:"Please select a valid booking option to continue."}):s.jsx("p",{className:"text-sm text-red-600 text-right w-full",children:We&&!S&&!T?"Please log in or purchase a membership to continue.":We&&!S&&T?"Select a booking option (e.g. buy a bundle or single class) to continue.":"No booking options available. Please contact the instructor for more information."})]})]}),(hs()&&i===3||!hs()&&i===2)&&s.jsxs("div",{className:`flex flex-col ${ot?"h-full min-h-0":"space-y-6"}`,children:[s.jsxs("div",{className:`${ot?"flex-1 overflow-y-auto min-h-0 space-y-6 pb-24":"space-y-6"}`,children:[s.jsxs("div",{children:[s.jsx("h5",{className:"font-semibold text-slate-900 mb-4",children:"Contact Information"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"name",children:"Full Name *"}),s.jsx(me,{id:"name",type:"text",value:I.clientData.name,onChange:ae=>re(Re=>({...Re,clientData:{...Re.clientData,name:ae.target.value}})),placeholder:"Your full name",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",children:"Email Address *"}),s.jsx(me,{id:"email",type:"email",value:I.clientData.email,onChange:ae=>re(Re=>({...Re,clientData:{...Re.clientData,email:ae.target.value}})),placeholder:"[email protected]",required:!0,className:I.clientData.email&&!xe(I.clientData.email)?"border-red-500 focus:border-red-500 focus:ring-red-500":""}),I.clientData.email&&!xe(I.clientData.email)&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:"Please enter a valid email address"})]}),s.jsxs("div",{children:[s.jsxs(V,{htmlFor:"phone",children:["Phone Number",e.requirePhoneForBooking?" *":""]}),s.jsx(me,{id:"phone",type:"tel",value:I.clientData.phone,onChange:ae=>re(Re=>({...Re,clientData:{...Re.clientData,phone:ae.target.value}})),placeholder:"07XXX XXX XXX",required:!!e.requirePhoneForBooking})]})]}),s.jsxs("div",{className:"flex items-center space-x-2 mt-4",children:[s.jsx(Xt,{id:"remember-me",checked:Q,onCheckedChange:ae=>te(ae)}),s.jsx(V,{htmlFor:"remember-me",className:"text-sm text-slate-600",children:"Remember my details for future bookings"})]})]}),ps&&(fe==null?void 0:fe.questions)&&s.jsxs("div",{children:[s.jsx("h5",{className:"font-semibold text-slate-900 mb-4",children:fe.name}),s.jsxs("div",{className:"space-y-6 p-6 bg-blue-50 border border-blue-200 rounded-lg",children:[console.log("Onboarding form data:",fe),console.log("Questions string:",fe.questions),JSON.parse(fe.questions).map((ae,Re)=>{var Le,Ye;return s.jsxs("div",{children:[ae.type!=="single-checkbox"&&s.jsxs(V,{htmlFor:ae.id,className:"text-sm font-medium",children:[ae.label," ",ae.required&&ae.type!=="info"?"*":""]}),ae.type==="text"&&s.jsx(me,{id:ae.id,value:I.clientData.onboardingData[ae.id]||"",onChange:Ve=>re(nt=>({...nt,clientData:{...nt.clientData,onboardingData:{...nt.clientData.onboardingData,[ae.id]:Ve.target.value}}})),placeholder:ae.placeholder||"",className:"bg-white",required:ae.required&&ae.type!=="info"}),ae.type==="date"&&s.jsx(me,{id:ae.id,type:"date",value:I.clientData.onboardingData[ae.id]||"",onChange:Ve=>re(nt=>({...nt,clientData:{...nt.clientData,onboardingData:{...nt.clientData.onboardingData,[ae.id]:Ve.target.value}}})),className:"bg-white",required:ae.required&&ae.type!=="info"}),ae.type==="textarea"&&s.jsx(Is,{id:ae.id,value:I.clientData.onboardingData[ae.id]||"",onChange:Ve=>re(nt=>({...nt,clientData:{...nt.clientData,onboardingData:{...nt.clientData.onboardingData,[ae.id]:Ve.target.value}}})),rows:3,placeholder:ae.placeholder||"",className:"bg-white",required:ae.required&&ae.type!=="info"}),ae.type==="select"&&s.jsxs(Bt,{value:I.clientData.onboardingData[ae.id]||"",onValueChange:Ve=>re(nt=>({...nt,clientData:{...nt.clientData,onboardingData:{...nt.clientData.onboardingData,[ae.id]:Ve}}})),children:[s.jsx($t,{className:"bg-white",children:s.jsx(Lt,{placeholder:ae.placeholder})}),s.jsx(It,{children:(Le=ae.options)==null?void 0:Le.map((Ve,nt)=>s.jsx(ce,{value:Ve,children:Ve},nt))})]}),ae.type==="radio"&&s.jsx(Sl,{value:I.clientData.onboardingData[ae.id]||"",onValueChange:Ve=>re(nt=>({...nt,clientData:{...nt.clientData,onboardingData:{...nt.clientData.onboardingData,[ae.id]:Ve}}})),className:"mt-2",children:(Ye=ae.options)==null?void 0:Ye.map((Ve,nt)=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($r,{value:Ve,id:`${ae.id}-${nt}`}),s.jsx(V,{htmlFor:`${ae.id}-${nt}`,className:"text-sm",children:Ve})]},nt))}),ae.type==="checkbox"&&ae.options&&s.jsx("div",{className:"space-y-2 mt-2",children:ae.options.map((Ve,nt)=>s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(Xt,{id:`${ae.id}-${nt}`,checked:Array.isArray(I.clientData.onboardingData[ae.id])?I.clientData.onboardingData[ae.id].includes(Ve):!1,onCheckedChange:ys=>{const Fs=Array.isArray(I.clientData.onboardingData[ae.id])?I.clientData.onboardingData[ae.id]:[];let dn;ys?dn=[...Fs,Ve]:dn=Fs.filter(rn=>rn!==Ve),re(rn=>({...rn,clientData:{...rn.clientData,onboardingData:{...rn.clientData.onboardingData,[ae.id]:dn}}}))},className:"mt-1"}),s.jsx(V,{htmlFor:`${ae.id}-${nt}`,className:"text-sm",children:Ve})]},nt))}),ae.type==="single-checkbox"&&s.jsxs("div",{className:"flex items-start space-x-3 mt-2",children:[s.jsx(Xt,{id:ae.id,checked:I.clientData.onboardingData[ae.id]||!1,onCheckedChange:Ve=>re(nt=>({...nt,clientData:{...nt.clientData,onboardingData:{...nt.clientData.onboardingData,[ae.id]:Ve}}})),className:"mt-1"}),s.jsxs(V,{htmlFor:ae.id,className:"text-sm",children:[ae.label," ",ae.required&&ae.type!=="info"?"*":""]})]}),ae.type==="info"&&s.jsxs("div",{className:"mt-2 p-4 bg-blue-50 border-l-4 border-blue-400 rounded-r",children:[s.jsx("h4",{className:"font-semibold text-blue-900 mb-2",children:ae.label}),ae.content&&s.jsx("div",{className:"text-sm text-blue-800 whitespace-pre-line",children:ae.content})]})]},Re)})]})]}),bs&&s.jsxs("div",{children:[s.jsx(V,{children:"Emergency Contact *"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-2",children:[s.jsx(me,{value:I.clientData.emergencyContactName,onChange:ae=>re(Re=>({...Re,clientData:{...Re.clientData,emergencyContactName:ae.target.value}})),placeholder:"Contact Name",required:!0}),s.jsx(me,{type:"tel",value:I.clientData.emergencyContactPhone,onChange:ae=>re(Re=>({...Re,clientData:{...Re.clientData,emergencyContactPhone:ae.target.value}})),placeholder:"Contact Phone",required:!0})]})]}),s.jsx(Ce,{className:"bg-slate-50",children:s.jsxs(Ee,{className:"p-4",children:[s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(Xt,{id:"terms",checked:R,onCheckedChange:ae=>Y(ae),required:!0}),s.jsx(V,{htmlFor:"terms",className:"text-sm text-slate-700 leading-relaxed",children:e.termsAndConditionsUrl?s.jsxs(s.Fragment,{children:["I agree to the"," ",s.jsx("a",{href:e.termsAndConditionsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Terms and Conditions"})," "]}):e.termsAndConditionsText?s.jsxs(s.Fragment,{children:["I agree to the"," ",s.jsx("button",{type:"button",onClick:()=>{alert(e.termsAndConditionsText)},className:"text-blue-600 hover:text-blue-800 underline",children:"Terms and Conditions"})," "]}):"I agree to the Terms and Conditions and I accept responsibility for my own health, safety, and participation."})]}),!(h!=null&&h.hideMarketingConsent)&&s.jsxs("div",{className:"flex items-center space-x-3 mt-4",children:[s.jsx(Xt,{id:"marketing-consent",checked:I.clientData.marketingConsent||!1,onCheckedChange:ae=>re(Re=>({...Re,clientData:{...Re.clientData,marketingConsent:ae}}))}),s.jsx(V,{htmlFor:"marketing-consent",className:"text-sm text-slate-600",children:"I would like to receive marketing emails about new classes and offers."})]})]})})]}),s.jsxs("div",{className:`flex justify-between items-center ${ot?"pt-4 border-t flex-shrink-0 bg-white sticky z-50 shadow-lg":"mt-6 mb-2"}`,style:ot?{bottom:"-1.5rem",paddingBottom:"calc(1.5rem + env(safe-area-inset-bottom))",left:0,right:0,marginLeft:"-1.5rem",marginRight:"-1.5rem",paddingLeft:"1.5rem",paddingRight:"1.5rem"}:void 0,children:[s.jsxs(B,{variant:"ghost",onClick:we,children:[s.jsx(xr,{className:"h-4 w-4 mr-2"}),"Back"]}),s.jsxs(B,{onClick:De,disabled:!R||!((ls=I.clientData.name)!=null&&ls.trim())||!I.clientData.email||Vt,children:[cs()===0?"Continue":"Continue to Payment",s.jsx(qn,{
615className:"h-4 w-4 ml-2"})]}),Vt&&s.jsx("p",{className:"text-sm text-red-600 mt-2",children:"This class is for members only. Please log in with your membership to continue."})]})]}),(hs()&&i===4||!hs()&&i===3)&&s.jsxs("div",{className:`flex flex-col ${ot?"h-full min-h-0":"space-y-6"}`,children:[s.jsxs("div",{className:`${ot?"flex-1 overflow-y-auto min-h-0 space-y-6 pb-24":"space-y-6"}`,children:[s.jsx(Ce,{className:"bg-slate-50",children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h5",{className:"font-semibold text-slate-900 mb-4",children:"Booking Summary"}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:justify-between",children:[s.jsx("span",{className:"text-slate-600 mb-1 sm:mb-0",children:"Event"}),s.jsx("span",{className:"font-medium text-slate-900 text-right sm:text-right",children:e.name})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:justify-between",children:[s.jsx("span",{className:"text-slate-600 mb-1 sm:mb-0",children:"Instructor"}),s.jsx("span",{className:"font-medium text-slate-900 text-right sm:text-right",children:x})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:justify-between",children:[s.jsx("span",{className:"text-slate-600 mb-1 sm:mb-0",children:"Date & Time"}),s.jsx("span",{className:"font-medium text-slate-900 text-right sm:text-right",children:rr(e.date,e)})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:justify-between",children:[s.jsx("span",{className:"text-slate-600 mb-1 sm:mb-0",children:"Package"}),s.jsx("span",{className:"font-medium text-slate-900 text-right sm:text-right",children:Tr()})]}),s.jsxs("div",{className:"border-t border-slate-200 pt-3 flex flex-col sm:flex-row sm:justify-between",children:[s.jsx("span",{className:"font-semibold text-slate-900 mb-1 sm:mb-0",children:"Total"}),s.jsxs("span",{className:"font-semibold text-slate-900 text-lg text-right sm:text-right",children:[W,cs().toFixed(2)]})]})]})]})}),s.jsxs("div",{children:[s.jsx("h5",{className:"font-semibold text-slate-900 mb-4",children:"Payment Methods Available"}),(()=>{const ae=!!(h!=null&&h.stripePublicKey),Re=!!(h!=null&&h.paypalEnabled)&&!!(h!=null&&h.paypalClientId),Le=!!e.allowCashPayments,Ye=[ae,Re,Le].filter(Boolean).length;return ae&&Re||Ye>=2?s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-sm text-slate-600 mb-3",children:"You can pay using any of these options:"}),s.jsxs("div",{className:`grid gap-3 ${Ye===3?"grid-cols-3":"grid-cols-2"}`,children:[ae&&s.jsx(Ce,{className:"bg-slate-50 border cursor-pointer hover:bg-slate-100 transition-colors",onClick:Ve=>{Ve.stopPropagation(),je("stripe"),De()},children:s.jsxs(Ee,{className:"p-4 text-center",children:[s.jsx(ti,{className:"h-6 w-6 mx-auto mb-2 text-slate-600"}),s.jsx("div",{className:"text-sm font-medium text-slate-900",children:"Credit Card"}),s.jsx("div",{className:"text-xs text-slate-500",children:"Stripe"}),s.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"Visa, Mastercard, Amex + more"})]})}),Re&&s.jsx(Ce,{className:"bg-slate-50 border cursor-pointer hover:bg-slate-100 transition-colors",onClick:Ve=>{Ve.stopPropagation(),je("paypal"),De()},children:s.jsxs(Ee,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-[#0070ba] font-bold text-lg mb-1",children:"PayPal"}),s.jsx("div",{className:"text-xs text-slate-500",children:"Secure payments"}),s.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"PayPal balance, cards, bank"})]})}),Le&&s.jsx(Ce,{className:"bg-slate-50 border cursor-pointer hover:bg-slate-100 transition-colors",onClick:Ve=>{Ve.stopPropagation(),je("cash"),De()},children:s.jsxs(Ee,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-2xl mb-1",children:"💵"}),s.jsx("div",{className:"text-sm font-medium text-slate-900",children:"Cash"}),s.jsx("div",{className:"text-xs text-slate-500",children:"Pay on arrival"}),s.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"Bring exact amount"})]})})]}),s.jsx("div",{className:"text-xs text-slate-500 text-center",children:Le?"Choose your preferred payment option on the next page.":"All payment methods are secure and encrypted. Choose your preferred option on the next page."})]}):null})(),(()=>{const ae=!!(h!=null&&h.stripePublicKey),Re=!!(h!=null&&h.paypalEnabled)&&!!(h!=null&&h.paypalClientId),Le=!!e.allowCashPayments;
615return ae&&Re||[ae,Re,Le].filter(Boolean).length>=2?null:s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-sm text-slate-600 mb-3",children:e.allowCashPayments?"You can pay using either option:":h!=null&&h.paypalEnabled&&(h!=null&&h.paypalClientId)?"Secure payment powered by PayPal":"Secure payment powered by Stripe"}),s.jsxs("div",{className:`grid gap-3 ${e.allowCashPayments?"grid-cols-2":"grid-cols-1"}`,children:[(!(h!=null&&h.paypalEnabled)||!(h!=null&&h.paypalClientId))&&s.jsx(Ce,{className:"bg-slate-50 border cursor-pointer hover:bg-slate-100 transition-colors",onClick:Ye=>{Ye.stopPropagation(),je("stripe"),De()},children:s.jsxs(Ee,{className:"p-4 text-center",children:[s.jsx(ti,{className:"h-6 w-6 mx-auto mb-2 text-slate-600"}),s.jsx("div",{className:"text-sm font-medium text-slate-900",children:"Credit Card"}),s.jsx("div",{className:"text-xs text-slate-500",children:"Stripe"}),s.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"Visa, Mastercard, Amex + more"})]})}),(h==null?void 0:h.paypalEnabled)&&(h==null?void 0:h.paypalClientId)&&s.jsx(Ce,{className:"bg-slate-50 border cursor-pointer hover:bg-slate-100 transition-colors",onClick:Ye=>{Ye.stopPropagation(),je("paypal"),De()},children:s.jsxs(Ee,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-[#0070ba] font-bold text-lg mb-1",children:"PayPal"}),s.jsx("div",{className:"text-xs text-slate-500",children:"Secure payments"}),s.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"PayPal balance, cards, bank"})]})}),e.allowCashPayments&&s.jsx(Ce,{className:"bg-slate-50 border cursor-pointer hover:bg-slate-100 transition-colors",onClick:Ye=>{Ye.stopPropagation(),je("cash"),De()},children:s.jsxs(Ee,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-2xl mb-1",children:"💵"}),s.jsx("div",{className:"text-sm font-medium text-slate-900",children:"Cash"}),s.jsx("div",{className:"text-xs text-slate-500",children:"Pay on arrival"}),s.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"Bring exact amount"})]})})]}),e.allowCashPayments&&s.jsx("div",{className:"text-xs text-slate-500 text-center",children:"Choose your preferred payment option on the next page."})]})})()]})]}),s.jsxs("div",{className:`flex justify-between items-center gap-2 ${ot?"pt-4 border-t flex-shrink-0 bg-white sticky z-50 shadow-lg":"mt-6 mb-2"}`,style:ot?{bottom:"-1.5rem",paddingBottom:"calc(1.5rem + env(safe-area-inset-bottom))",left:0,right:0,marginLeft:"-1.5rem",marginRight:"-1.5rem",paddingLeft:"1.5rem",paddingRight:"1.5rem"}:void 0,children:[s.jsxs(B,{variant:"ghost",onClick:we,className:"flex-shrink-0",children:[s.jsx(xr,{className:"h-4 w-4 mr-1 sm:mr-2"}),s.jsx("span",{className:"hidden sm:inline",children:"Back"})]}),s.jsx(B,{onClick:De,className:"px-3 sm:px-6 md:px-8 py-2 sm:py-3 text-xs sm:text-sm md:text-base font-semibold flex-1 sm:flex-initial min-w-0 text-center",disabled:Os.isPending||e.spotsLeft===0,children:Os.isPending?s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Processing..."]}):e.spotsLeft===0?"Class is Full":cs()===0?"Confirm Booking":s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"hidden sm:inline",children:"Complete Booking - "}),s.jsx("span",{className:"sm:hidden",children:"Book - "}),W,cs().toFixed(2)]})})]})]})]}),G&&ie&&(h==null?void 0:h.id)&&s.jsx(sW,{bundle:ie,instructorId:h.id,instructorCurrency:(h==null?void 0:h.currency)||"GBP",isOpen:G,onClose:Jt,onSuccess:tt})]})}function aW({open:e,classId:t,className:n,onClose:r,onVerified:a}){const[i,o]=f.useState(""),[l,c]=f.useState(null),[d,m]=f.useState(!1);f.useEffect(()=>{e&&t&&(o(Pg(t)||""),c(null))},[e,t]);const u=p=>{p||(o(""),c(null),r())},h=async p=>{if(p.preventDefault(),!t)return;const v=i.trim();if(!v){c("Please enter the access code");return}m(!0),c(null);try{const y=await Pe("POST",`/api/classes/${t}/verify-access-code`,{code:v}),g=await y.json();if(!y.ok||g.ok===!1){c(g.message||"Incorrect access code");return}mue(t,v),o(""),a(v)}catch(y){c((y==null?void 0:y.message)||"Could not verify access code. Please try again.")}finally{m(!1)}};return s.jsx(Ct,{open:e,onOpenChange:u,children:s.jsxs(St,{className:"sm:max-w-md",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Access code required"}),s.jsx(yn,{children:n?`"${n}" is locked. Enter the access code from your instructor to continue booking.`:"This class is locked. Enter the access code from your instructor to continue booking."})]}),s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"class-access-code",children:"Access code"}),s.jsx(me,{id:"class-access-code",type:"text",autoComplete:"off",autoFocus:!0,value:i,onChange:p=>{o(p.target.value),l&&c(null)},placeholder:"Enter access code","data-testid":"class-access-code-input"}),l&&s.jsx("p",{className:"text-sm text-destructive","data-testid":"class-access-code-error",children:l})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(B,{t
615ype:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),s.jsx(B,{type:"submit",disabled:d,"data-testid":"class-access-code-submit",children:d?"Checking…":"Continue"})]})]})]})})}function iW({service:e,isOpen:t,onClose:n,instructorCurrency:r}){const[a,i]=f.useState(null),[o,l]=f.useState(null),[c,d]=f.useState(new Date),[m,u]=f.useState({name:"",email:"",phone:"",emergencyContactName:"",emergencyContactPhone:"",marketingConsent:!1}),[h,p]=f.useState([]),[v,y]=f.useState(!1),[g,x]=f.useState(!1),[b,w]=f.useState(null),[j,N]=f.useState(null),[C,P]=f.useState(null),[S,E]=f.useState([]),[T,z]=f.useState(!1),[O,D]=f.useState(""),{toast:k}=Yt();jn();const[F,W]=cn(),{data:q}=Ue({queryKey:[`/api/instructors/${e==null?void 0:e.instructorId}`],enabled:!!(e!=null&&e.instructorId)});f.useEffect(()=>{t&&(sessionStorage.setItem("bookingOriginUrl",F),q!=null&&q.subdomain&&sessionStorage.setItem("currentInstructorSubdomain",q.subdomain))},[t,F,q==null?void 0:q.subdomain]),f.useEffect(()=>{var G;const Q=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,te=((G=m.email)==null?void 0:G.trim())||"";if(!te||te.length>=5&&Q.test(te)){const Z=setTimeout(()=>{D(te)},500);return()=>clearTimeout(Z)}else D("")},[m.email]),f.useEffect(()=>{if(!(e!=null&&e.instructorId)||!(e!=null&&e.id)||!t){E([]);return}(async()=>{z(!0);try{const te=O||(()=>{const je=localStorage.getItem("classta-user-data");return je?JSON.parse(je).email:null})(),G=`classta_bundles_${e.instructorId}`,Z=JSON.parse(localStorage.getItem(G)||"[]");console.log("🔍 Service booking - Loading bundles:",{email:te||"none",formEmail:m.email,storedCodesCount:Z.length,storedCodes:Z});let ie=[],A=!1;te?(A=!0,ie=Z):Z.length>0&&(ie=Z);let ge=[];if(A&&te)try{const je=await fetch(`/api/coupons/bundles/by-email/${e.instructorId}/${encodeURIComponent(te)}`);if(je.ok){ge=await je.json(),console.log("✅ Bundles found by email from server:",ge);const ke=ge.map(Ie=>Ie.code);ke.length>0?(localStorage.setItem(G,JSON.stringify(ke)),console.log("✅ Updated localStorage with bundles from server (replaced old bundles):",ke)):(localStorage.removeItem(G),console.log("ℹ️ No bundles for this email, cleared localStorage")),ie=ke}else console.warn("⚠️ Failed to fetch bundles by email from server")}catch(je){console.error("❌ Error fetching bundles by email:",je)}if(ie.length>0){const ke=(await Promise.all(ie.map(async Ie=>{try{let $e=null;if(ge.length>0&&($e=ge.find(ft=>ft.code===Ie)),!$e){const ft=await fetch(`/api/coupons/bundles/info/${e.instructorId}/${Ie}`);if(ft.ok){const be=await ft.json();$e={code:Ie,name:be.bundleName,allowServices:be.allowServices,applicableClassMode:be.applicableClassMode,applicableServiceIds:be.applicableServiceIds||[]}}}if(!$e)return null;if(!$e.allowServices)return console.log(`⚠️ Bundle ${Ie} does not allow services`),null;if($e.applicableClassMode==="selected"&&(!$e.applicableServiceIds||!$e.applicableServiceIds.includes(e.id)))return console.log(`⚠️ Bundle ${Ie}
615 is not valid for service ${e.id}`),null;const qe=await fetch(`/api/coupons/bundles/info/${e.instructorId}/${Ie}`);if(qe.ok){const ft=await qe.json();if(ft.isValid&&ft.hasSessions&&!ft.isExpired)return console.log(`✅ Bundle ${Ie} is valid for service ${e.id}:`,ft),{bundleCode:Ie,bundleName:ft.bundleName||$e.name||`Bundle ${Ie}`,remainingSessions:ft.remainingSessions||0,isValid:!0};console.log(`⚠️ Bundle ${Ie} is not valid (expired or no sessions):`,ft)}return null}catch($e){return console.error(`❌ Error validating bundle ${Ie}:`,$e),null}}))).filter(Ie=>Ie!==null&&Ie.isValid);console.log("✅ Valid bundles for service:",ke),E(ke)}else E([])}catch(te){console.error("❌ Error loading bundles:",te),E([])}finally{z(!1)}})()},[e==null?void 0:e.instructorId,e==null?void 0:e.id,t,O]);const{data:H}=Ue({queryKey:[`/api/services/${e==null?void 0:e.id}/memberships/public`],enabled:!!(e!=null&&e.id)}),_=f.useMemo(()=>H&&Array.isArray(H)&&H.length>0,[H]);f.useEffect(()=>{if(!(e!=null&&e.instructorId)||!(e!=null&&e.id))return;(async()=>{try{const te=localStorage.getItem(`client_token_${e.instructorId}`);if(!te)return;const G=await fetch(`/api/member/${e.instructorId}/service-pricing/${e.id}`,{headers:{Authorization:`Bearer ${te}`}});if(G.ok){const ie=await G.json();ie.memberPrice&&(w(ie.memberPrice),N(ie.member))}const Z=await fetch(`/api/client/my-account/${e.instructorId}`,{headers:{Authorization:`Bearer ${te}`}});if(Z.ok){const ie=await Z.json();if(ie.client){const A=ie.client;u(ge=>({...ge,name:A.name||ge.name,email:A.email||ge.email,phone:A.phone||ge.phone}))}}}catch(te){console.error("Error checking member pricing:",te)}})()},[e==null?void 0:e.instructorId,e==null?void 0:e.id,t]);const L=async Q=>{if(!e)return[];y(!0);const te=[];for(let G=0;G<7;G++){const Z=new Date(Q);Z.setDate(Q.getDate()+G);const ie=Z.toISOString().split("T")[0];try{const ge=await(await fetch(`/api/services/service/${e.id}/availability/${ie}`)).json(),je=[];ge.isAvailable&&ge.availableSlots.length>0&&ge.availableSlots.forEach(ke=>{je.push({time:ke,available:!0})}),te.push({date:Z,dateString:ie,slots:je,hasAvailability:je.length>0})}catch(A){console.error("Error fetching availability:",A),te.push({date:Z,dateString:ie,slots:[],hasAvailability:!1})}}return y(!1),te};f.useEffect(()=>{e&&t&&L(c).then(p)},[e,c,t]),f.useEffect(()=>{t||(i(null),l(null),u({name:"",email:"",phone:"",emergencyContactName:"",emergencyContactPhone:"",marketingConsent:!1}),d(new Date),w(null),N(null),P(null))},[t]);const U=Q=>{const te=new Date(c);te.setDate(c.getDate()+(Q==="next"?7:-7)),d(te),i(null),l(null)},J=Q=>{i(Q),l(null)},I=Q=>{l(Q)},re=xt({mutationFn:async Q=>(await Pe("POST","/api/create-payment-intent-service",Q)).json(),onSuccess:Q=>{if(Q.cashPaymentOnly){const[ge,je]=o.split(":"),ke=new Date(a);ke.setHours(parseInt(ge),parseInt(je),0,0);const Ie=b||e.price;sessionStorage.setItem("pendingBooking",JSON.stringify({bookingType:"service",serviceId:e.id,serviceData:e,classDate:ke.toISOString(),clientData:m,amount:Ie,currency:r,cashPaymentOnly:!0,testMode:!1,memberPrice:b,couponCode:C||null})),W("/checkout");return}if(Q.paypalOnly){const[ge,je]=o.split(":"),ke=new Date(a);ke.setHours(parseInt(ge),parseInt(je),0,0);const Ie=b||e.price;sessionStorage.setItem("pendingBooking",JSON.stringify({bookingType:"service",serviceId:e.id,serviceData:e,classDate:ke.toISOString(),clientData:m,amount:Q.finalAmount||Ie,currency:r,clientSecret:null,stripePublicKey:null,testMode:!1,originalAmount:Q.originalAmount,finalAmount:Q.finalAmount,couponApplied:Q.couponApplied,discountAmount:Q.discountAmount,a
615ppliedCouponCode:Q.couponCode||C||null,couponCode:C||null,memberPrice:b})),W("/checkout");return}const[te,G]=o.split(":"),Z=new Date(a);Z.setHours(parseInt(te),parseInt(G),0,0);const ie=b||e.price,A=!!(Q.couponApplied&&(Q.discountAmount>0||Q.finalAmount===0));sessionStorage.setItem("pendingBooking",JSON.stringify({bookingType:"service",serviceId:e.id,serviceData:e,classDate:Z.toISOString(),clientData:m,amount:A&&Q.finalAmount!==void 0?Q.finalAmount:ie,originalAmount:A&&Q.originalAmount!==void 0?Q.originalAmount:ie,finalAmount:A&&Q.finalAmount!==void 0?Q.finalAmount:ie,currency:r,clientSecret:Q.clientSecret,paymentIntentId:Q.paymentIntentId,stripePublicKey:Q.stripePublicKey,stripeAccountId:Q.stripeAccountId,testMode:!1,memberPrice:b,couponCode:C||(A?Q.couponCode:null)||null,appliedCouponCode:C||(A?Q.couponCode:null)||null,couponApplied:A?Q.couponApplied:null,discountAmount:A&&Q.discountAmount!==void 0?Q.discountAmount:0,isFreeBooking:A&&(Q.isFreeBooking===!0||Q.finalAmount===0)})),W("/checkout")},onError:Q=>{k({title:"Payment Error",description:Q.message||"Unable to process payment. Please try again.",variant:"destructive"}),x(!1)}}),R=Q=>!Q||!Q.trim()?!1:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Q.trim()),Y=async Q=>{if(Q.preventDefault(),!e||!a||!o){k({title:"Missing Information",description:"Please select a date and time for your booking.",variant:"destructive"});return}if(!m.name||!m.email){k({title:"Missing Information",description:"Please provide your name and email.",variant:"destructive"});return}if(!R(m.email)){k({title:"Invalid Email",description:"Please enter a valid email address.",variant:"destructive"});return}x(!0);try{const[te,G]=o.split(":"),Z=new Date(a);Z.setHours(parseInt(te),parseInt(G),0,0);const ie=b||e.price,A=parseFloat(ie);if(A===0){sessionStorage.setItem("pendingBooking",JSON.stringify({bookingType:"service",serviceId:e.id,serviceData:e,classDate:Z.toISOString(),clientData:m,amount:"0.00",currency:r,paymentIntentId:`free_${Date.now()}`,isFreeBooking:!0,testMode:!1,memberPrice:b,couponCode:C||null})),W("/checkout");return}const ge={bookingType:"service",serviceId:e.id,serviceDateTime:Z.toISOString(),clientData:m,amount:A,currency:r,couponCode:C||null,testMode:!1,memberPrice:b,metadata:{instructorId:e.instructorId,selectedTime:o}};re.mutate({amount:A,serviceId:e.id,clientEmail:m.email,bookingType:"service",serviceDateTime:Z.toISOString(),testMode:!1,pendingBooking:{...ge,couponCode:C||null}})}catch{x(!1)}},M=Q=>Q.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}),se=Q=>{const te=new Date(Q);te.setDate(Q.getDate()+6);const G=Q.toLocaleDateString("en-US",{month:"short",day:"numeric"}),Z=te.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return`${G} - ${Z}`};return e?s.jsx(Ct,{open:t,onOpenChange:n,children:s.jsxs(St,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsx(kt,{children:s.jsxs(Pt,{className:"text-2xl font-bold",children:["Book ",e.name]})}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-4",children:[s.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Service Details"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center text-sm",children:[s.jsx(ei,{className:"h-4 w-4 mr-2 text-slate-400"}),s.jsxs("span",{children:[e.duration," minutes"]})]}),s.jsxs("div",{className:"flex items-center text-sm",children:[s.jsx(Ph,{className:"h-4 w-4 mr-2 text-slate-400"}),b?s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsxs("span",{className:"line-through text-slate-500",children:[mt(r),e.price]}),s.jsxs("span",{className:"font-semibold text-green-600",children:[mt(r),b]})]}):s.jsxs("span",{className:"font-semibold",children:[mt(r),e.price]})]}),!b&&_&&s.jsx(Ce,{className:"bg-blue-50 border-blue-200 mt-3",children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h6",{className:"font-medium text-blue-900",children:"Are you a member?"}),s.jsx("p",{className:"text-sm text-blue-700",children:"Log in to see your special member pricing"})]}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>{const Q=window.open(`/my-account/${q==null?void 0:q.subdomain}?returnTo=booking`,"clientLogin","width=500,height=600,scrollbars=yes,resizable=yes"),te=setInterval(()=>{Q!=null&&Q.closed&&(clearInterval(te),setTimeout(async()=>{try{const G=localStorage.getItem(`client_token_${e.instructorId}`);if(!G)return;const Z=await fetch(`/api/member/${e.instructorId}/service-pricing/${e.id}`,{headers:{Authorization:`Bearer ${G}`}});if(Z.ok){const A=await Z.json();A.memberPrice&&(w(A.memberPrice),N(A.member))}const ie=await fetch(`/api/client/my-account/${e.instructorId}`,{headers:{Authorization:`Bearer ${G}`}});if(ie.ok){const A=await ie.json();if(A.client){const ge=A.client;u(je=>({...je,name:ge.name||je.name,email:ge.email||je.email,phone:ge.phone||je.phone}))}}}catch(G){console.error("Error checking member pricing after login:",G)}},500))},1e3)},className:"border-blue-300 text-blue-700 hover:bg-blue-100",children:"Member Login"})]})})}),e.location&&s.jsxs("div",{className:"flex items-center text-sm",children:[s.jsx(si,{className:"h-4 w-4 mr-2 text-slate-400"}),s.jsx("span",{children:e.location})]}),e.description&&s.jsx("div",{className:"mt-3",children:s.jsx("p",{className:"text-sm text-slate-600",children:e.description})})]})]})}),s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Select Date"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>U("prev"),disabled:v,children:s.jsx(lm,{className:"h-4 w-4"})}),s.jsx("span",{className:"text-sm font-medium min-w-[120px] text-center",children:se(c)}),s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>U("next"),disabled:v,children:s.jsx(Ji,{className:"h-4 w-4"})})]})]}),v?s.jsx("div",{className:"text-center py-4",children:s.jsx("div",{className:"animate-spin w-6 h-6 border-2 border-primary border-t-transparent roun
615ded-full mx-auto"})}):s.jsx("div",{className:"grid grid-cols-2 gap-2",children:h.map(Q=>s.jsxs(B,{variant:(a==null?void 0:a.toDateString())===Q.date.toDateString()?"default":"outline",size:"sm",onClick:()=>J(Q.date),disabled:!Q.hasAvailability,className:"h-auto py-3 flex flex-col",children:[s.jsx("span",{className:"font-medium",children:M(Q.date)}),s.jsxs("span",{className:"text-xs opacity-75",children:[Q.slots.length," slot",Q.slots.length!==1?"s":""]})]},Q.dateString))})]})}),a&&s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-4",children:[s.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Select Time"}),(()=>{const Q=h.find(te=>te.date.toDateString()===a.toDateString());return!Q||Q.slots.length===0?s.jsx("p",{className:"text-sm text-slate-500",children:"No available times for this date."}):s.jsx("div",{className:"grid grid-cols-3 gap-2",children:Q.slots.map(te=>s.jsx(B,{variant:o===te.time?"default":"outline",size:"sm",onClick:()=>I(te.time),disabled:!te.available,children:te.time},te.time))})})()]})})]}),s.jsx("div",{children:s.jsxs("form",{onSubmit:Y,className:"space-y-4",children:[s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-4",children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Your Details"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"name",children:"Full Name *"}),s.jsx(me,{id:"name",value:m.name,onChange:Q=>u({...m,name:Q.target.value}),required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",children:"Email Address *"}),s.jsx(me,{id:"email",type:"email",value:m.email,onChange:Q=>u({...m,email:Q.target.value}),required:!0,className:m.email&&!R(m.email)?"border-red-500 focus:border-red-500 focus:ring-red-500":""}),m.email&&!R(m.email)&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:"Please enter a valid email address"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"phone",children:"Phone Number"}),s.jsx(me,{id:"phone",value:m.phone,onChange:Q=>u({...m,phone:Q.target.value})})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"emergencyContactName",children:"Emergency Contact Name"}),s.jsx(me,{id:"emergencyContactName",value:m.emergencyContactName,onChange:Q=>u({...m,emergencyContactName:Q.target.value})})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"emergencyContactPhone",children:"Emergency Contact Phone"}),s.jsx(me,{id:"emergencyContactPhone",value:m.emergencyContactPhone,onChange:Q=>u({...m,emergencyContactPhone:Q.target.value})})]})]})]})}),(T||S.length>0)&&s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-4",children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Payment Method"}),T?s.jsxs("div",{className:"text-center py-4",children:[s.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-primary border-t-transparent rounded-full mx-auto mb-2"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Checking for available bundles..."})]}):S.length>0?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",id:"pay-full-price",name:"payment-method",checked:!C,onChange:()=>P(null),className:"w-4 h-4"}),s.jsxs(V,{htmlFor:"pay-full-price",className:"cursor-pointer",children:["Pay Full Price (",mt(r),b||e.price,")"]})]}),S.map(Q=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",id:`bundle-${Q.bundleCode}`,name:"payment-method",checked:C===Q.bundleCode,onChange:()=>P(Q.bundleCode),className:"w-4 h-4"}),s.jsxs(V,{htmlFor:`bundle-${Q.bundleCode}`,className:"cursor-pointer flex-1",children:[s.jsxs("span",{className:"font-medium",children:["Use Your Bundle: ",Q.bundleName]}),s.jsxs("span",{className:"text-sm text-slate-600 ml-2",children:["(",Q.remainingSessions," session",Q.remainingSessions!==1?"s":""," remaining)"]})]})]},Q.bundleCode))]}):null]})}),a&&o&&s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-4",children:[s.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Booking Summary"}),s.jsxs("div",{className:"space-y-2 text-sm",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Service:"}),s.jsx("span",{className:"font-medium",children:e.name})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Date:"}),s.jsx("span",{className:"font-medium",children:a.toLocaleDateString()})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Time:"}),s.jsx("span",{className:"font-medium",children:o})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Duration:"}),s.jsxs("span",{className:"font-medium",children:[e.duration," minutes"]})]}),s.jsxs("div",{className:"flex justify-between font-semibold text-lg pt-2 border-t",children:[s.jsx("span",{children:"Total:"}),b?s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsxs("span",{className:"text-sm line-through text-slate-500",children:[mt(r),e.price]}),s.jsxs("span",{className:"text-green-600",children:[mt(r),b]})]}):s.jsxs("span",{children:[mt(r),e.price]})]})]})]})}
vendor: 4,103 bytes, line 615
615),s.jsxs("div",{className:"flex space-x-3",children:[s.jsx(B,{type:"button",variant:"outline",onClick:n,className:"flex-1",children:"Cancel"}),s.jsx(B,{type:"submit",disabled:!a||!o||g,className:"flex-1",children:g?"Booking...":"Confirm Booking"})]})]})})]})]})}):null}const xue={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},gue=(e,t,n)=>{let r;const a=xue[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function yS(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const yue={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},vue={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},bue={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},wue={date:yS({formats:yue,defaultWidth:"full"}),time:yS({formats:vue,defaultWidth:"full"}),dateTime:yS({formats:bue,defaultWidth:"full"})},jue={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Nue=(e,t,n,r)=>jue[e];function Zp(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):o;a=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}const Cue={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Sue={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},kue={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Pue={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Eue={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Due={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Aue=(e,t)=>
vendor: 16,461 bytes, line 615
615{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Tue={ordinalNumber:Aue,era:Zp({values:Cue,defaultWidth:"wide"}),quarter:Zp({values:Sue,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Zp({values:kue,defaultWidth:"wide"}),day:Zp({values:Pue,defaultWidth:"wide"}),dayPeriod:Zp({values:Eue,defaultWidth:"wide",formattingValues:Due,defaultFormattingWidth:"wide"})};function ex(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const o=i[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?Fue(l,u=>u.test(o)):Oue(l,u=>u.test(o));let d;d=e.valueCallback?e.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const m=t.slice(o.length);return{value:d,rest:m}}}function Oue(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Fue(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function _ue(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const a=r[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const l=t.slice(a.length);return{value:o,rest:l}}}const Mue=/^(\d+)(th|st|nd|rd)?/i,$ue=/\d+/i,Iue={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Rue={any:[/^b/i,/^(a|c)/i]},Bue={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Lue={any:[/1/i,/2/i,/3/i,/4/i]},Uue={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},zue={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},que={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Wue={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Hue={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Vue={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Kue={ordinalNumber:_ue({matchPattern:Mue,parsePattern:$ue,valueCallback:e=>parseInt(e,10)}),era:ex({matchPatterns:Iue,defaultMatchWidth:"wide",parsePatterns:Rue,defaultParseWidth:"any"}),quarter:ex({matchPatterns:Bue,defaultMatchWidth:"wide",parsePatterns:Lue,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ex({matchPatterns:Uue,defaultMatchWidth:"wide",parsePatterns:zue,defaultParseWidth:"any"}),day:ex({matchPatterns:que,defaultMatchWidth:"wide",parsePatterns:Wue,defaultParseWidth:"any"}),dayPeriod:ex({matchPatterns:Hue,defaultMatchWidth:"any",parsePatterns:Vue,defaultParseWidth:"any"})},IT={code:"en-US",formatDistance:gue,formatLong:wue,formatRelative:Nue,localize:Tue,match:Kue,options:{weekStartsOn:0,firstWeekContainsDate:1}};let Gue={};function vv(){return Gue}const oW=6048e5,Yue=864e5,lW=6e4,cW=36e5;function Di(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function o5(e){const t=Di(e);return t.setHours(0,0,0,0),t}function l5(e){const t=Di(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Que(e,t){const n=o5(e),r=o5(t),a=+n-l5(n),i=+r-l5(r);return Math.round((a-i)/Yue)}function fc(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Jue(e){const t=Di(e),n=fc(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Xue(e){const t=Di(e);return Que(t,Jue(t))+1}function Eg(e,t){var l,c,d,m;const n=vv(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((m=(d=n.locale)==null?void 0:d.options)==null?void 0:m.weekStartsOn)??0,a=Di(e),i=a.getDay(),o=(i<r?7:0)+i-r;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function Sw(e){return Eg(e,{weekStartsOn:1})}function dW(e){const t=Di(e),n=t.getFullYear(),r=fc(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const a=Sw(r),i=fc(e,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const o=Sw(i);return t.getTime()>=a.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function Zue(e){const t=dW(e),n=fc(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Sw(n)}function eme(e){const t=Di(e),n=+Sw(t)-+Zue(t);return Math.round(n/oW)+1}function uW(e,t){var m,u,h,p;const n=Di(e),r=n.getFullYear(),a=vv(),i=(t==null?void 0:t.firstWeekContainsDate)??((u=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:u.firstWeekContainsDate)??a.firstWeekContainsDate??((p=(h=a.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,o=fc(e,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const l=Eg(o,t),c=fc(e,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const d=Eg(c,t);return n.getTime()>=l.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function tme(e,t){var l,c,d,m;const n=vv(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((m=(d=n.locale)==null?void 0:d.options)==null?void 0:m.firstWeekContainsDate)??1,a=uW(e,t),i=fc(e,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),Eg(i,t)}function sme(e,t){const n=Di(e),r=+Eg(n,t)-+tme(n,t);return Math.round(r/oW)+1}function Dn(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Ac={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return Dn(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Dn(n+1,2)},d(e,t){return Dn(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Dn(e.getHours()%12||12,t.length)},H(e,t){return Dn(e.getHours(),t.length)},m(e,t){return Dn(e.getMinutes(),t.length)},s(e,t){return Dn(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return Dn(a,t.length)}},Um={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},c5={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return Ac.y(e,t)},Y:function(e,t,n,r){const a=uW(e,r),i=a>0?a:1-a;if(t==="YY"){const o=i%100;return Dn(o,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):Dn(i,t.length)},R:function(e,t){const n=dW(e);return Dn(n,t.length)},u:function(e,t){const n=e.getFullYear();return Dn(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Dn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Dn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Ac.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Dn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const a=sme(e,r);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):Dn(a,t.length)},I:function(e,t,n){const r=eme(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):Dn(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Ac.d(e,t)},D:function(e,t,n){const r=Xue(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Dn(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const a=e.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Dn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const a=e.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Dn(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return Dn(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let a;switch(r===12?a=Um.noon:r===0?a=Um.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let a;switch(r>=17?a=Um.evening:r>=12?a=Um.afternoon:r>=4?a=Um.morning:a=Um.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Ac.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Ac.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Dn(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):Dn(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Ac.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Ac.s(e,t)},S:function(e,t){return Ac.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return u5(r);case"XXXX":case"XX":return au(r);case"XXXXX":case"XXX":default:return au(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return u5(r);case"xxxx":case"xx":return au(r);case"xxxxx":case"xxx":default:return au(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+d5(r,":");case"OOOO":default:return"GMT"+au(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+d5(r,":");case"zzzz":default:return"GMT"+au(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return Dn(r,t.length)},T:function(e,t,n){const r=e.getTime();return Dn(r,t.length)}};function d5(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),i=r%60;return i===0?n+String(a):n+String(a)+t+Dn(i,2)}function u5(e,t){return e%60===0?(e>0?"-":"+")+Dn(Math.abs(e)/60,2):au(e,t)}function au(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Dn(Math.trunc(r/60),2),i=Dn(r%60,2);return n+a+t+i}const m5=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},mW=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},nme=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return m5(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",m5(r,t)).replace("{{time}}",mW(a,t))},rme={p:mW,P:nme},ame=/^D+$/,ime=/^Y+$/,ome=["D","DD","YY","YYYY"];function lme(e){return ame.test(e)}function cme(e){return ime.test(e)}function dme(e,t,n){const r=ume(e,t,n);if(console.warn(r),ome.includes(e))throw new RangeError(r)}function ume(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function mme(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function hme(e){if(!mme(e)&&typeof e!="number")return!1;const t=Di(e);return!isNaN(Number(t))}const fme=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,pme=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,xme=/^'([^]*?)'?$/,gme=/''/g,yme=/[a-zA-Z]/;function Sr(e,t,n){var m,u,h,p,v,y,g,x;const r=vv(),a=(n==null?void 0:n.locale)??r.locale??IT,i=(n==null?void 0:n.firstWeekContainsDate)??((u=(m=n==null?void 0:n.locale)==null?void 0:m.options)==null?void 0:u.firstWeekContainsDate)??r.firstWeekContainsDate??((p=(h=r.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((y=(v=n==null?void 0:n.locale)==null?void 0:v.options)==null?void 0:y.weekStartsOn)??r.weekStartsOn??((x=(g=r.locale)==null?void 0:g.options)==null?void 0:x.weekStartsOn)??0,l=Di(e);if(!hme(l))throw new RangeError("Invalid time value");let c=t.match(pme).map(b=>{const w=b[0];if(w==="p"||w==="P"){const j=rme[w];return j(b,a.formatLong)}return b}).join("").match(fme).map(b=>{if(b==="''")return{isToken:!1,value:"'"};const w=b[0];if(w==="'")return{isToken:!1,value:vme(b)};if(c5[w])return{isToken:!0,value:b};
vendor: 4,732 bytes, line 615
615if(w.match(yme))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");return{isToken:!1,value:b}});a.localize.preprocessor&&(c=a.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return c.map(b=>{if(!b.isToken)return b.value;const w=b.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&cme(w)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&lme(w))&&dme(w,t,String(e));const j=c5[w[0]];return j(l,w,a.localize,d)}).join("")}function vme(e){const t=e.match(xme);return t?t[1].replace(gme,"'"):e}function hW(e,t){const n=Di(e);if(isNaN(t))return fc(e,NaN);if(!t)return n;const r=n.getDate(),a=fc(e,n.getTime());a.setMonth(n.getMonth()+t+1,0);const i=a.getDate();return r>=i?a:(n.setFullYear(a.getFullYear(),a.getMonth(),r),n)}function h5(e){const t=Di(e);return t.setDate(1),t.setHours(0,0,0,0),t}function bme(){return Object.assign({},vv())}function Wx(e,t){const r=Cme(e);let a;if(r.date){const c=Sme(r.date,2);a=kme(c.restDateString,c.year)}if(!a||isNaN(a.getTime()))return new Date(NaN);const i=a.getTime();let o=0,l;if(r.time&&(o=Pme(r.time),isNaN(o)))return new Date(NaN);if(r.timezone){if(l=Eme(r.timezone),isNaN(l))return new Date(NaN)}else{const c=new Date(i+o),d=new Date(0);return d.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),d.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),d}return new Date(i+o+l)}const y0={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},wme=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,jme=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Nme=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Cme(e){const t={},n=e.split(y0.dateTimeDelimiter);let r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],y0.timeZoneDelimiter.test(t.date)&&(t.date=e.split(y0.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){const a=y0.timezone.exec(r);a?(t.time=r.replace(a[1],""),t.timezone=a[1]):t.time=r}return t}function Sme(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};const a=r[1]?parseInt(r[1]):null,i=r[2]?parseInt(r[2]):null;return{year:i===null?a:i*100,restDateString:e.slice((r[1]||r[2]).length)}}function kme(e,t){if(t===null)return new Date(NaN);const n=e.match(wme);if(!n)return new Date(NaN);const r=!!n[4],a=tx(n[1]),i=tx(n[2])-1,o=tx(n[3]),l=tx(n[4]),c=tx(n[5])-1;if(r)return Fme(t,l,c)?Dme(t,l,c):new Date(NaN);{const d=new Date(0);return!Tme(t,i,o)||!Ome(t,a)?new Date(NaN):(d.setUTCFullYear(t,i,Math.max(a,o)),d)}}function tx(e){return e?parseInt(e):1}function Pme(e){const t=e.match(jme);if(!t)return NaN;const n=vS(t[1]),r=vS(t[2]),a=vS(t[3]);return _me(n,r,a)?n*cW+r*lW+a*1e3:NaN}function vS(e){return e&&parseFloat(e.replace(",","."))||0}function Eme(e){if(e==="Z")return 0;const t=e.match(Nme);if(!t)return 0;const n=t[1]==="+"?-1:1,r=parseInt(t[2]),a=t[3]&&parseInt(t[3])||0;return Mme(r,a)?n*(r*cW+a*lW):NaN}function Dme(e,t,n){const r=new Date(0);r.setUTCFullYear(e,0,4);const a=r.getUTCDay()||7,i=(t-1)*7+n+1-a;return r.setUTCDate(r.getUTCDate()+i),r}const Ame=[31,null,31,30,31,30,31,31,30,31,30,31];function fW(e){return e%400===0||e%4===0&&e%100!==0}function Tme(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Ame[t]||(fW(e)?29:28))}function Ome(e,t){return t>=1&&t<=(fW(e)?366:365)}function Fme(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function _me(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Mme(e,t){return t>=0&&t<=59}function $me(e,t){return hW(e,-1)}function f5(e,t,n){const r=bme(),a=Bme(e,n.timeZone,n.locale??r.locale);return"formatToParts"in a?Ime(a,t):Rme(a,t)}function Ime(e,t){const n=e.formatToParts(t);for(let r=n.length-1;r>=0;--r)if(n[r].type==="timeZoneName")return n[r].value}function Rme(e,t){const n=e.format(t).replace(/\u200E/g,""),r=/ [\w-+ ]+$/.exec(n);return r?r[0].substr(1):""}function Bme(e,t,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}function Lme(e,t){const n=Hme(t);return"formatToParts"in n?zme(n,e):qme(n,e)}const Ume={year:0,month:1,day:2,hour:3,minute:4,second:5};function zme(e,t){try{const n=e.formatToParts(t),r=[];for(let a=0;a<n.length;a++){const i=Ume[n[a].type];i!==void 0&&(r[i]=parseInt(n[a].value,10))}return r}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function qme(e,t){const n=e.format(t),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(r[3],10),parseInt(r[1],10),parseInt(r[2],10),parseInt(r[4],10),parseInt(r[5],10),parseInt(r[6],10)]}const bS={},p5=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/Ne
615w_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),Wme=p5==="06/25/2014, 00:00:00"||p5==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function Hme(e){return bS[e]||(bS[e]=Wme?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),bS[e]}function pW(e,t,n,r,a,i,o){const l=new Date(0);return l.setUTCFullYear(e,t,n),l.setUTCHours(r,a,i,o),l}const x5=36e5,Vme=6e4,wS={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function RT(e,t,n){if(!e)return 0;let r=wS.timezoneZ.exec(e);if(r)return 0;let a,i;if(r=wS.timezoneHH.exec(e),r)return a=parseInt(r[1],10),g5(a)?-(a*x5):NaN;if(r=wS.timezoneHHMM.exec(e),r){a=parseInt(r[2],10);const o=parseInt(r[3],10);return g5(a,o)?(i=Math.abs(a)*x5+o*Vme,r[1]==="+"?-i:i):NaN}if(Yme(e)){t=new Date(t||Date.now());const o=n?t:Kme(t),l=gP(o,e);return-(n?l:Gme(t,l,e))}return NaN}function Kme(e){return pW(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function gP(e,t){const n=Lme(e,t),r=pW(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime();let a=e.getTime();const i=a%1e3;return a-=i>=0?i:1e3+i,r-a}function Gme(e,t,n){let a=e.getTime()-t;const i=gP(new Date(a),n);if(t===i)return t;a-=i-t;const o=gP(new Date(a),n);return i===o?i:Math.max(i,o)}function g5(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}const y5={};function Yme(e){if(y5[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),y5[e]=!0,!0}catch{return!1}}const Qme=60*1e3,Jme={X:function(e,t,n){const r=jS(n.timeZone,e);if(r===0)return"Z";switch(t){case"X":return v5(r);case"XXXX":case"XX":return eh(r);case"XXXXX":case"XXX":default:return eh(r,":")}},x:function(e,t,n){const r=jS(n.timeZone,e);switch(t){case"x":return v5(r);case"xxxx":case"xx":return eh(r);case"xxxxx":case"xxx":default:return eh(r,":")}},O:function(e,t,n){const r=jS(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+Xme(r,":");case"OOOO":default:return"GMT"+eh(r,":")}},z:function(e,t,n){switch(t){case"z":case"zz":case"zzz":return f5("short",e,n);case"zzzz":default:return f5("long",e,n)}}};function jS(e,t){const n=e?RT(e,t,!0)/Qme:(t==null?void 0:t.getTimezoneOffset())??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function kw(e,t){const n=e<0?"-":"";let r=Math.abs(e).toString();for(;r.length<t;)r="0"+r;return n+r}function eh(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=kw(Math.floor(r/60),2),i=kw(Math.floor(r%60),2);return n+a+t+i}function v5(e,t){return e%60===0?(e>0?"-":"+")+kw(Math.abs(e)/60,2):eh(e,t)}function Xme(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.floor(r/60),i=r%60;return i===0?n+String(a):n+String(a)+t+kw(i,2)}function b5(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const Zme=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,NS=36e5,w5=6e4,ehe=2,Fa={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Zme};function xW(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(e===null)return new Date(NaN);const n=t.additionalDigits==null?ehe:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]")return new Date(e.getTime());if(typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]")return new Date(e);if(Object.prototype.toString.call(e)!=="[object String]")return new Date(NaN);const r=the(e),{year:a,restDateString:i}=she(r.date,n),o=nhe(i,a);if(o===null||isNaN(o.getTime()))return new Date(NaN);if(o){const l=o.getTime();let c=0,d;if(r.time&&(c=rhe(r.time),c===null||isNaN(c)))return new Date(NaN);if(r.timeZone||t.timeZone){if(d=RT(r.timeZone||t.timeZone,new Date(l+c)),isNaN(d))return new Date(NaN)}else d=b5(new Date(l+c)),d=b5(new Date(l+c+d));return new Date(l+c+d)}else return new Date(NaN)}function the(e){const t={};let n=Fa.dateTimePattern.exec(e),r;if(n?(t.date=n[1],r=n[3]):(n=Fa.datePattern.exec(e),n?(t.date=n[1],r=n[2]):(t.date=null,r=e)),r){const a=Fa.timeZone.exec(r);a?(t.time=r.replace(a[1],""),t.timeZone=a[1].trim()):t.time=r}return t}function she(e,t){if(e){const n=Fa.YYY[t],r=Fa.YYYYY[t];let a=Fa.YYYY.exec(e)||r.exec(e);if(a){const i=a[1];return{year:parseInt(i,10),restDateString:e.slice(i.length)}}if(a=Fa.YY.exec(e)||n.exec(e),a){const i=a[1];return{year:parseInt(i,10)*100,restDateString:e.slice(i.length)}}}return{year:null}}function nhe(e,t){if(t===null)return null;let n,r,a;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=Fa.MM.exec(e);if(i)return n=new Date(0),r=parseInt(i[1],10)-1,N5(t,r)?(n.setUTCFullYear(t,r),n):new Date(NaN);if(i=Fa.DDD.exec(e),i){n=new Date(0);const o=parseInt(i[1],10);return ohe(t,o)?(n.setUTCFullYear(t,0,o),n):new Date(NaN)}if(i=Fa.MMDD.exec(e),i){n=new Date(0),r=parseInt(i[1],10)-1;const o=parseInt(i[2],10);return N5(t,r,o)?(n.setUTCFullYear(t,r,o),n):new Date(NaN)}if(i=Fa.Www.exec(e),i)return a=parseInt(i[1],10)-1,C5(a)?j5(t,a):new Date(NaN);if(i=Fa.WwwD.exec(e),i){a=parseInt(i[1],10)-1;const o=parseInt(i[2],10)-1;return C5(a,o)?j5(t,a,o):new Date(NaN)}return null}function rhe(e){let t,n,r=Fa.HH.exec(e);if(r)return t=parseFloat(r[1].replace(",",".")),CS(t)?t%24*NS:NaN;if(r=Fa.HHMM.exec(e),r)return t=parseInt(r[1],10),n=parseFloat(r[2].replace(",",".")),CS(t,n)?t%24*NS+n*w5:NaN;if(r=Fa.HHMMSS.exec(e),r){t=parseInt(r[1],10),n=parseInt(r[2],10);const a=parseFloat(r[3].replace(",","."));return CS(t,n,a)?t%24*NS+n*w5+a*1e3:NaN}return null}
615function j5(e,t,n){t=t||0,n=n||0;const r=new Date(0);r.setUTCFullYear(e,0,4);const a=r.getUTCDay()||7,i=t*7+n+1-a;return r.setUTCDate(r.getUTCDate()+i),r}const ahe=[31,28,31,30,31,30,31,31,30,31,30,31],ihe=[31,29,31,30,31,30,31,31,30,31,30,31];function gW(e){return e%400===0||e%4===0&&e%100!==0}function N5(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;const r=gW(e);if(r&&n>ihe[t]||!r&&n>ahe[t])return!1}return!0}function ohe(e,t){if(t<1)return!1;const n=gW(e);return!(n&&t>366||!n&&t>365)}function C5(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function CS(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}const lhe=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function che(e,t,n={}){t=String(t);const r=t.match(lhe);if(r){const a=xW(n.originalDate||e,n);t=r.reduce(function(i,o){if(o[0]==="'")return i;const l=i.indexOf(o),c=i[l-1]==="'",d=i.replace(o,"'"+Jme[o[0]](a,o,n)+"'");return c?d.substring(0,l-1)+d.substring(l+1):d},t)}return Sr(e,t,n)}function dhe(e,t,n){e=xW(e,n);const r=RT(t,e,!0),a=new Date(e.getTime()-r),i=new Date(0);return i.setFullYear(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()),i.setHours(a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds()),i}function yW(e,t,n,r){return r={...r,timeZone:t,originalDate:e},che(dhe(e,t,{timeZone:r.timeZone}),n,r)}function Ud(e){return e?yW(new Date(e),"UTC","EEE, MMM d, yyyy, h:mm a",{locale:IT}):"TBC"}function S5(e){return e?yW(new Date(e),"UTC","MMM d, yyyy",{locale:IT}):"TBC"}const uhe=365*24*60*60*1e3;function vW(e){if(!e)return[];let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return[]}return Array.isArray(t)?t.filter(n=>!!n&&typeof n=="object"&&typeof n.id=="string"):[]}function mhe(e,t,n=uhe){if(!e||!t)return!1;const r=e,a=i=>{if(!i)return!1;const o=new Date(i);return Number.isNaN(o.getTime())?!1:Date.now()-o.getTime()<n};if(Array.isArray(r.formCompletions)){const i=r.formCompletions.find(o=>o.formId===t);return a(i==null?void 0:i.completedAt)}return r.formId===t?a(r.completedAt):!1}function hhe(e,t){const n=[];for(const r of e){if(!r.required||r.type==="info")continue;const a=t==null?void 0:t[r.id],i=r.label||r.id;if(r.type==="checkbox"){(!Array.isArray(a)||a.length===0)&&n.push(i);continue}(a==null||typeof a=="string"&&a.trim()===""||typeof a=="boolean"&&!a)&&n.push(i)}return n}function eu(e,t,n,r){t({...e,[n]:r})}function fhe({field:e,values:t,onChange:n}){var a,i;const r=t[e.id];if(e.type==="text")return s.jsx(me,{id:e.id,value:typeof r=="string"?r:"",onChange:o=>eu(t,n,e.id,o.target.value),placeholder:e.placeholder||"",className:"bg-white mt-2",required:!!e.required});if(e.type==="date")return s.jsx(me,{id:e.id,type:"date",value:typeof r=="string"?r:"",onChange:o=>eu(t,n,e.id,o.target.value),className:"bg-white mt-2",required:!!e.required});if(e.type==="textarea")return s.jsx(Is,{id:e.id,value:typeof r=="string"?r:"",onChange:o=>eu(t,n,e.id,o.target.value),rows:3,placeholder:e.placeholder||"",className:"bg-white mt-2",required:!!e.required});if(e.type==="select")return s.jsxs(Bt,{value:typeof r=="string"?r:"",onValueChange:o=>eu(t,n,e.id,o),children:[s.jsx($t,{className:"bg-white mt-2",children:s.jsx(Lt,{placeholder:e.placeholder})}),s.jsx(It,{children:(a=e.options)==null?void 0:a.map((o,l)=>s.jsx(ce,{value:o,children:o},l))})]});if(e.type==="radio")return s.jsx(Sl,{value:typeof r=="string"?r:"",onValueChange:o=>eu(t,n,e.id,o),className:"mt-2",children:(i=e.options)==null?void 0:i.map((o,l)=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($r,{value:o,id:`${e.id}-${l}`}),s.jsx(V,{htmlFor:`${e.id}-${l}`,className:"text-sm",children:o})]},l))});if(e.type==="checkbox"&&e.options){const o=Array.isArray(r)?r.filter(l=>typeof l=="string"):[];return s.jsx("div",{className:"space-y-2 mt-2",children:e.options.map((l,c)=>s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(Xt,{id:`${e.id}-${c}`,checked:o.includes(l),onCheckedChange:d=>{const m=d?[...o.filter(u=>typeof u=="string"),l]:o.filter(u=>u!==l);eu(t,n,e.id,m)},className:"mt-1"}),s.jsx(V,{htmlFor:`${e.id}-${c}`,className:"text-sm",children:l})]},c))})}return e.type==="single-checkbox"?s.jsxs("div",{className:"flex items-start space-x-3 mt-2",children:[s.jsx(Xt,{id:e.id,checked:r===!0,onCheckedChange:o=>eu(t,n,e.id,o===!0),className:"mt-1"}),s.jsxs(V,{htmlFor:e.id,className:"text-sm",children:[e.label," ",e.required?"*":""]})]}):e.type==="info"?s.jsxs("div",{className:"mt-2 p-4 bg-blue-50 border-l-4 border-blue-400 rounded-r",children:[s.jsx("h4",{className:"font-semibold text-blue-900 mb-2",children:e.label}),e.content&&s.jsx("div",{className:"text-sm text-blue-800 whitespace-pre-line",children:e.content})]}):null}function phe({formName:e,questions:t,values:n,onChange:r}){const a=vW(t);return a.length===0?null:s.jsxs("div",{children:[e&&s.jsx("h5",{className:"font-semibold text-slate-900 mb-4",children:e}),s.jsx("div",{className:"space-y-6 p-6 bg-blue-50 border border-blue-200 rounded-lg",children:a.map((i,o)=>s.jsxs("div",{children:[i.type!=="single-checkbox"&&i.type!=="info"&&s.jsxs(V,{htmlFor:i.id,className:"text-sm font-medium",children:[i.label," ",i.required?"*":""]}),s.jsx(fhe,{field:i,values:n,onChange:r})]},i.id||o))})]})}function BT({event:e,instructor:t,onClose:n}){const[r,a]=f.useState(1),[i,o]=f.useState(null),[l,c]=f.useState(""),[d,m]=f.useState(""),[u,h]=f.useState("1"),[p,v]=f.useState([]),[y,g]=f.useState(""),[x,b]=f.useState({}),[w,j]=f.useState(""),{toast:N}=Yt(),[,C]=cn(),P=!!(e.requireOnboardingForm&&e.onboardingFormId),{data:S,isError:E}=Ue({queryKey:[`/api/onboarding-forms/${e.onboardingFormId}`],enabled:P});f.useEffect(()=>{const _=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,L=d.trim();if(!L||L.length>=5&&_.test(L)){const U=setTimeout(()=>j(L),500);return()=>clearTimeout(U)}j("")},[d]);const{data:T}=Ue({queryKey:["/api/clients/lookup",w,e.accountId],enabled:!!(P&&w&&w.length>=5&&e.accountId),queryFn:async()=>{const _=`/api/clients/${encodeURIComponent(w)}?instructorId=${e.accountId}`,L=await fetch(_,{credentials:"include"});if(L.status===404)return null;if(!L.ok){const U=await L.text();throw new Error(U||L.statusText)}return L.json()},staleTime:6e4,refetchOnMount:!1,refetchOnWindowFocus:!1}),z=mhe(T==null?void 0:T.onboardingData,e.onboardingFormId),O=P&&!!S&&!z;f.useEffect(()=>{if(e.ticketTypes.length===1){const _=e.ticketTypes[0];o(_.remaining>0?_:null)}else o(null)},[e.ticketTypes]);const D=mt(e.currency||(t==null?void 0:t.currency)||"GBP"),k=Math.min(e.maxPerOrder??10,i?i.remaining:1),F=(()=>{const _=parseInt(u,10);return Number.isNaN(_)||_<1?1:Math.min(k,_)})(),W=()=>{if(!i){N({title:"Select a ticket type",variant:"destructive"});return}if(i.remaining<1){N({title:"No tickets left for this type",variant:"destructive"});return}h("1"),v([]),g(""),b({}),a(2)},q=()=>{var Y;if(!i)return;const _=l.trim(),L=d.trim();if(!_||!L){N({title:"Name and email required",variant:"destructive"});return}if(P&&!z&&!S){N({title:E?"Form unavailable":"Please wait",description:E?"The required form could not be loaded. Please try again.":"The required form is still loading.",variant:"destructive"});return}if(O){const M=vW(S==null?void 0:S.questions),se=hhe(M,x);if(se.length>0){N({title:"Please complete the form",description:`Required: ${se.join(", ")}`,variant:"destructive"});return}}const U=F,J=U*i.price_minor,I=(J/100).toFixed(2),re=!!i.pay_on_door,R={bookingType:"event",eventId:e.id,ticketTypeId:i.id,ticketTypeName:i.name,quantity:U,attendees:U>1?p.slice(0,U):void 0,amount:parseFloat(I),currency:(e.currency||"GBP").toUpperCase(),isFreeBooking:J===0,isPayOnDoor:re,eventData:{title:e.title,startsAt:e.startsAt,accountId:e.accountId,bookingInfoFieldEnabled:!!e.bookingInfoFieldEnabled,bookingInfoFieldLabel:e.bookingInfoFieldLabel??null,requireOnboardingForm:!!e.requireOnboardingForm,onboardingFormId:e.onboardingFormId??null},eventBookingInfo:e.bookingInfoFieldEnabled&&y.trim()||void 0,clientData:{name:_,email:L,phone:"",emergencyContactName:"",emergencyContactPhone:"",onboardingData:O?x:{}},stripePublicKey:t==null?void 0:t.stripePublicKey,stripeAccountId:t==null?void 0:t.stripeConnectAccountId};try{sessionStorage.setItem("pendingBooking",JSON.stringify(R)),sessionStorage.setItem("bookingOriginUrl",window.location.pathname+window.location.search);
615const M=(Y=window.location.pathname.match(/\/classes\/([^/]+)/))==null?void 0:Y[1];M&&sessionStorage.setItem("currentInstructorSubdomain",M),C("/checkout"),n()}catch{N({title:"Could not start checkout",description:"Try again or use a different browser.",variant:"destructive"})}};return s.jsx(Ct,{open:!0,onOpenChange:_=>!_&&n(),children:s.jsxs(St,{className:`${O?"sm:max-w-lg":"sm:max-w-md"} max-h-[min(90dvh,calc(100svh-2rem))] flex flex-col overflow-hidden gap-4`,children:[s.jsxs(kt,{className:"shrink-0",children:[s.jsxs(Pt,{className:"flex items-center gap-2",children:[s.jsx(um,{className:"h-5 w-5"}),r===1?"Choose ticket type":"Your details"]}),s.jsx(yn,{children:r===1?"Select one ticket type for this order.":O?"Enter your details and complete the required form.":"Enter buyer details. You can add attendee names for each ticket."})]}),r===1&&s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[s.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-y-contain pr-1 -mr-1",children:[s.jsx("p",{className:"text-sm text-slate-600",children:e.title}),s.jsx("p",{className:"text-xs text-slate-500",children:Ud(e.startsAt)}),s.jsx("div",{className:"space-y-2",children:e.ticketTypes.map(_=>s.jsx(Ce,{className:`cursor-pointer transition-colors ${(i==null?void 0:i.id)===_.id?"ring-2 ring-primary border-primary":"hover:bg-slate-50"} ${_.remaining<1?"opacity-60 pointer-events-none":""}`,onClick:()=>_.remaining>=1&&o(_),children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:_.name}),_.description&&s.jsx("p",{className:"text-sm text-slate-500 mt-0.5",children:_.description}),s.jsxs("p",{className:"text-sm text-slate-600 mt-1",children:[_.remaining," left"]})]}),s.jsx("p",{className:"font-semibold",children:_.pay_on_door?"Pay on door":_.price_minor===0?"Free":`${D}${(_.price_minor/100).toFixed(2)}`})]})})},_.id))})]}),s.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-border pt-4 pb-[max(0px,env(safe-area-inset-bottom))]",children:[s.jsx(B,{variant:"outline",onClick:n,children:"Cancel"}),s.jsxs(B,{onClick:W,children:["Next ",s.jsx(qn,{className:"h-4 w-4 ml-1"})]})]})]}),r===2&&i&&s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[s.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-y-contain pr-1 -mr-1",children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-slate-600",children:i.name}),s.jsx("span",{className:"font-medium",children:i.pay_on_door?`Pay on door · ${D}${(i.price_minor*F/100).toFixed(2)} due`:i.price_minor===0?"Free":`${D}${(i.price_minor/100).toFixed(2)} × ${F} = ${D}${(i.price_minor*F/100).toFixed(2)}`})]}),s.jsxs("div",{className:"grid gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"buyerName",children:"Your name *"}),s.jsx(me,{id:"buyerName",value:l,onChange:_=>c(_.target.value),placeholder:"Full name",className:"mt-1"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"buyerEmail",children:"Email *"}),s.jsx(me,{id:"buyerEmail",type:"email",value:d,onChange:_=>m(_.target.value),placeholder:"[email protected]",className:"mt-1"})]}),s.jsxs("div",{children:[s.jsxs(V,{children:["Number of tickets (max ",k,")"]}),s.jsx(me,{type:"number",min:1,max:k,value:u,onChange:_=>{const L=_.target.value;h(L);const U=parseInt(L,10);if(!Number.isNaN(U)&&U>=1){const J=Math.min(k,U);v(I=>{const re=[...I];for(;re.length<J-1;)re.push("");return re.slice(0,J-1)})}},onBlur:()=>{u===""||Number.isNaN(parseInt(u,10))||parseInt(u,10)<1?h("1"):parseInt(u,10)>k&&h(String(k))},className:"mt-1"})]}),F>1&&s.jsxs("div",{children:[s.jsx(V,{children:"Attendee names (optional)"}),s.jsx("p",{className:"text-xs text-slate-500 mb-1",children:"One name per ticket, excluding yourself"}),Array.from({length:F-1}).map((_,L)=>s.jsx(me,{value:p[L]??"",onChange:U=>{const J=[...p];J[L]=U.target.value,v(J)},placeholder:`Attendee ${L+2}`,className:"mt-1"},L))]}),e.bookingInfoFieldEnabled&&s.jsxs("div",{children:[s.jsxs(V,{htmlFor:"event-booking-info",children:[(e.bookingInfoFieldLabel||"").trim()||"Additional information"," ",s.jsx("span",{className:"text-slate-400 font-normal",children:"(optional)"})]}),s.jsx(Is,{id:"event-booking-info",value:y,onChange:_=>g(_.target.value.slice(0,2e3)),placeholder:"Your answer",rows:3,className:"mt-1"})]}),O&&s.jsx(phe,{formName:S==null?void 0:S.name,questions:S==null?void 0:S.questions,values:x,onChange:b}),P&&z&&s.jsx("p",{className:"text-xs text-slate-500",children:"You already completed this form in the last 12 months, so you do not need to fill it in again."})]})]}),s.jsxs("div",{className:"flex shrink-0 justify-between gap-2 border-t border-border pt-4 pb-[max(0px,env(safe-area-inset-bottom))]",children:[s.jsxs(B,{variant:"outline",onClick:()=>a(1),children:[s.jsx(xr,{className:"h-4 w-4 mr-1"})," Back"]}),s.jsx(B,{onClick:q,children:i.pay_on_door?"Reserve tickets":"Proceed to payment"})]})]})]})})}const bW=2e3;function wW(e){return(e||"").trim()||"Additional information"}function LT(e,t,n){if(!(t!=null&&t.enabled))return e;const r=n.trim().slice(0,bW);return r?`${e.trimEnd()}
616
617${wW(t.label)}:
618${r}`:e}function UT({id:e="event-booking-info",enabled:t,label:n,value:r,onChange:a}){return t?s.jsxs("div",{children:[s.jsxs(V,{htmlFor:e,children:[wW(n)," ",s.jsx("span",{className:"text-slate-400 font-normal",children:"(optional)"})]}),s.jsx(Is,{id:e,value:r,onChange:i=>a(i.target.value.slice(0,bW)),placeholder:"Your answer",rows:3,className:"mt-1"})]}):null}function Pw({instructorId:e,instructorCurrency:t="GBP",className:n=""}){const[r,a]=f.useState(null),[i,o]=f.useState(!1),[l,c]=f.useState(null);Cl(i);const m=new URLSearchParams(typeof window<"u"?window.location.search:"").get("token")||null,{data:u=[],isLoading:h,error:p}=Ue({queryKey:[`/api/coupons/bundles/public/${e}`,m],queryFn:async()=>{const w=`/api/coupons/bundles/public/${e}${m?`?token=${encodeURIComponent(m)}`:""}`;return(await fetch(w)).json()},enabled:!!e});f.useEffect(()=>{console.log("🔍 BundlePromoSection Debug:",{instructorId:e,isLoading:h,error:p,bundlesCount:(u==null?void 0:u.length)||0,bundles:u})},[e,h,p,u]);const v=w=>{a(w),o(!0)},y=(w,j,N)=>{const C=`classta_bundles_${e}`;try{const P=JSON.parse(localStorage.getItem(C)||"[]");P.includes(w)||(P.push(w),localStorage.setItem(C,JSON.stringify(P)),console.log(`✅ Stored bundle code ${w} in localStorage for instructor ${e}`))}catch(P){console.error("Error storing bundle code:",P)}c(w)},g=()=>{o(!1),a(null)};if(h)return console.log("🔍 BundlePromoSection: Still loading..."),null;if(!u||u.length===0)return console.log("🔍 BundlePromoSection: No bundles found",{bundles:u,bundlesLength:u==null?void 0:u.length,instructorId:e}),null;console.log("✅ BundlePromoSection: Rendering with",u.length,"bundles");const x=!!m,b=u.length===1;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`bg-gradient-to-r from-primary/5 to-primary/10 rounded-lg p-6 mb-8 ${n}`,children:[s.jsxs("div",{className:"text-center mb-6",children:[s.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-2",children:[s.jsx(jl,{className:"h-6 w-6 text-primary"}),s.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:x||b?"Bundle Available":"Class Bundles Available"}),s.jsx(jl,{className:"h-6 w-6 text-primary"})]}),s.jsx("p",{className:"text-gray-600",children:x||b?"Purchase this bundle package to save on your bookings!":"Save money with our multi-session packages. Use your bundle code for any eligible class!"})]}),l&&s.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4 mb-6",children:[s.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[s.jsx(qt,{className:"h-5 w-5 text-green-600"}),s.jsx("span",{className:"font-medium text-green-800",children:"Bundle Purchased Successfully!"})]}),s.jsxs("p",{className:"text-green-700 text-sm",children:["Your bundle code: ",s.jsx("code",{className:"font-mono font-bold bg-white px-2 py-1 rounded",children:l})]}),s.jsx("p",{className:"text-green-600 text-sm mt-1",children:"Use this code during checkout to book your classes for free!"})]}),s.jsx("div",{className:x||b?"max-w-2xl mx-auto":"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:u.map(w=>s.jsxs(Ce,{className:`relative overflow-hidden hover:shadow-lg transition-shadow ${x||b?"w-full":""}`,children:[!x&&!b&&u.indexOf(w)===0&&s.jsx("div",{className:"absolute top-3 right-3",children:s.jsx(Je,{className:"bg-primary text-white",children:"Popular"})}),s.jsxs(Ee,{className:x||b?"p-8":"p-6",children:[s.jsxs("div",{className:`flex items-center space-x-3 ${x||b?"mb-6":"mb-4"}`,children:[s.jsx("div",{className:`p-2 bg-primary/10 rounded-lg ${x||b?"p-3":""}`,children:s.jsx(jg,{className:`text-primary ${x||b?"h-8 w-8":"h-6 w-6"}`})}),s.jsxs("div",{children:[s.jsx("h3",{className:`font-semibold text-gray-900 ${x||b?"text-xl":""}`,children:w.name}),s.jsxs("div",{className:"flex items-center space-x-1 text-sm text-gray-600",children:[s.jsx(ei,{className:"h-4 w-4"}),s.jsxs("span",{children:[w.sessionCount," sessions"]})]})]})]}),w.description&&s.jsx("p",{className:`text-gray-600 ${x||b?"text-base mb-6":"text-sm mb-4"}`,children:w.description}),s.jsxs("div",{className:x||b?"space-y-4":"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:x||b?"text-base text-gray-600":"text-sm text-gray-600",children:"Total Package Price:"}),s.jsxs("span",{className:`font-bold text-primary ${x||b?"text-3xl":"text-2xl"}`,children:[mt(t),w.discountValue]})]}),s.jsx("div",{className:`text-green-600 bg-green-50 rounded px-2 py-1 ${x||b?"text-sm":"text-xs"}`,children:"💰 Great value - pay upfront and save on individual bookings!"}),s.jsxs(B,{onClick:()=>v(w),className:"w-full",size:x||b?"default":"sm",children:["Buy Bundle - ",mt(t),w.discountValue]})]})]})]},w.id))}),!x&&s.jsx("div",{className:"text-center mt-6",children:s.jsxs("div",{className:"bg-white/50 rounded-lg p-4 inline-block",children:[s.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:"How Bundle Credits Work:"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-sm text-gray-600",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"w-6 h-6 bg-primary text-white rounded-full flex items-center justify-center text-xs font-bold",children:"1"}),s.jsx("span",{children:"Purchase a bundle above"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"w-6 h-6 bg-primary text-white rounded-full flex items-center justify-center text-xs font-bold",children:"2"}),s.jsx("span",{children:"Receive unique bundle code"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"w-6 h-6 bg-primary text-white rounded-full flex items-center justify-center text-xs font-bold",children:"3"}),s.jsx("span",{children:"Use code when booking classes"})]})]})]})})]}),s.jsx(sW,{bundle:r,instructorId:e,instructorCurrency:t,isOpen:i,onClose:g,onSuccess:y,privateLinkToken:m})]})}const xhe=()=>
618{const e="G-Q49YXL0ZXE",t=document.createElement("script");t.async=!0,t.src=`https://www.googletagmanager.com/gtag/js?id=${e}`,document.head.appendChild(t);const n=document.createElement("script");n.textContent=`
619    window.dataLayer = window.dataLayer || [];
620    function gtag(){dataLayer.push(arguments);}
621    gtag('js', new Date());
622    gtag('config', '${e}');
623    gtag('config', 'AW-17123389975');
624  `,document.head.appendChild(n)},ghe=e=>{if(typeof window>"u"||!window.gtag)return;window.gtag("config","G-Q49YXL0ZXE",{page_path:e})},Zs=(e,t,n,r)=>{typeof window>"u"||!window.gtag||window.gtag("event",e,{event_category:t,event_label:n,value:r})};function jW({attemptedPath:e}){const[t]=cn();f.useEffect(()=>{Zs("instructor_not_found_view","navigation",e||t,0)},[t,e]);const n=()=>{Zs("instructor_not_found_start_trial","conversion",e||t,0)},r=()=>{Zs("instructor_not_found_how_it_works","engagement",e||t,0)},i=(()=>{if(e){const c=e.match(/\/(?:cal|classes)\/([^/]+)/);return c?c[1]:null}const l=t.match(/\/(?:cal|classes)\/([^/]+)/);return l?l[1]:null})(),o=i?`/${t.includes("/cal/")?"cal":"classes"}/${i}`:t;return s.jsxs(s.Fragment,{children:[s.jsx(zo,{children:s.jsx("title",{children:"Booking page not found | Classta"})}),s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center px-4",children:s.jsxs("div",{className:"max-w-2xl w-full space-y-6",children:[s.jsx(Ce,{children:s.jsx(Ee,{className:"pt-8 pb-8 px-6",children:s.jsxs("div",{className:"text-center mb-6",children:[s.jsx("div",{className:"flex justify-center mb-4",children:s.jsx("div",{className:"w-16 h-16 rounded-full bg-slate-100 flex items-center justify-center",children:s.jsx(Ls,{className:"h-8 w-8 text-slate-400"})})}),s.jsx("h1",{className:"text-3xl font-bold text-slate-900 mb-3",children:"We couldn't find a booking page at this address"}),s.jsx("p",{className:"text-slate-600 mb-2",children:"It may have been removed, renamed, or is no longer active."}),s.jsx("p",{className:"text-slate-600 mb-4",children:"If you're trying to book, ask the instructor for their latest link."}),i&&s.jsxs("p",{className:"text-sm text-slate-500 mt-4",children:["We couldn't find an instructor at ",s.jsx("code",{className:"bg-slate-100 px-2 py-1 rounded text-slate-700",children:o}),"."]})]})})}),s.jsxs(Ce,{className:"border-primary/20 bg-primary/5",children:[s.jsx(gt,{children:s.jsx(Nt,{className:"text-xl text-slate-900",children:"Are you an instructor?"})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsx("p",{className:"text-slate-700",children:"Create your own booking page in minutes with Classta — reminders, payments, QR check-in and more."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{className:"w-full sm:w-auto",size:"lg",onClick:n,children:[s.jsx(jl,{className:"h-4 w-4 mr-2"}),"Start free trial"]})}),s.jsx(dt,{href:"/features",children:s.jsxs(B,{variant:"outline",className:"w-full sm:w-auto",size:"lg",onClick:r,children:[s.jsx(wa,{className:"h-4 w-4 mr-2"}),"See how it works"]})})]})]})]})]})})]})}function yP(){const[e,t]=f.useState(null),[n,r]=f.useState(!1),[a,i]=f.useState(!1),[o,l]=f.useState(!1),[c,d]=f.useState(!1),[m,u]=f.useState(!1),[h,p]=f.useState(!1),{toast:v}=Yt();f.useEffect(()=>{if(window.matchMedia("(display-mode: standalone)").matches){console.log("📱 App already installed (standalone mode)"),u(!0);return}const g=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);p(g);const x=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;l(x);const b=/Android/i.test(navigator.userAgent);d(b),console.log("📱 Device detection:",{mobile:g,iOS:x,android:b,userAgent:navigator.userAgent});const w=N=>
624{console.log("🎯 beforeinstallprompt event fired!"),N.preventDefault(),t(N)};window.addEventListener("beforeinstallprompt",w);const j=document.querySelector('link[rel="manifest"]');return j?console.log("📄 Manifest link found:",j.getAttribute("href")):console.warn("⚠️ No manifest link found in document"),"serviceWorker"in navigator&&navigator.serviceWorker.getRegistration().then(N=>{N?console.log("✅ Service worker registered:",N.scope):console.warn("⚠️ No service worker registration found")}),()=>{window.removeEventListener("beforeinstallprompt",w)}},[]);const y=async()=>{if(console.log("🔘 Add to Home Screen clicked",{deferredPrompt:!!e,isIOS:o,isAndroid:c}),!e){o?(console.log("📱 Showing iOS instructions"),r(!0)):c?(console.log("🤖 Showing Android instructions"),i(!0)):v({title:"Installation not available",description:"Your browser doesn't support installing this app. Try using Chrome on Android or Safari on iOS.",variant:"destructive"});return}try{console.log("🎯 Calling deferredPrompt.prompt()"),await e.prompt();const{outcome:g}=await e.userChoice;console.log("👤 User choice:",g),g==="accepted"?(v({title:"Installing...",description:"The app is being added to your home screen."}),t(null)):v({title:"Installation cancelled",description:"You can try again later."})}catch(g){console.error("❌ Error showing install prompt:",g),v({title:"Error",description:"Failed to show installation prompt. Please try using your browser's menu to add to home screen.",variant:"destructive"})}};return m||!h||o?null:s.jsxs(s.Fragment,{children:[s.jsxs(B,{onClick:y,variant:"outline",size:"sm",className:"gap-2",children:[s.jsx(Li,{className:"h-4 w-4"}),"Add to Home Screen"]}),s.jsx(Ct,{open:n,onOpenChange:r,children:s.jsxs(St,{className:"sm:max-w-md",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Add to Home Screen"}),s.jsx(yn,{children:"Follow these steps to add Classta to your home screen:"})]}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center font-semibold text-primary",children:"1"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"font-medium",children:"Tap the Share button"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Look for the ",s.jsx(X9,{className:"inline h-4 w-4"})," Share icon at the bottom of your Safari browser"]})]})]}),s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center font-semibold text-primary",children:"2"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"font-medium",children:'Select "Add to Home Screen"'}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Scroll down in the share menu and tap ",s.jsx(Gs,{className:"inline h-4 w-4"}),' "Add to Home Screen"']})]})]}),s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center font-semibold text-primary",children:"3"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"font-medium",children:"Confirm"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:'Tap "Add" in the top right corner'})]})]})]}),s.jsx("div",{className:"flex justify-end",children:s.jsx(B,{onClick:()=>r(!1),children:"Got it"})})]})}),s.jsx(Ct,{open:a,onOpenChange:i,children:s.jsxs(St,{className:"sm:max-w-md",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Add to Home Screen"}),s.jsx(yn,{children:"Follow these steps to add Classta to your home screen:"})]}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center font-semibold text-primary",children:"1"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"font-medium",children:"Open the browser menu"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Tap the three dots (⋮) in the top right corner of Chrome"})]})]}),s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center font-semibold text-primary",children:"2"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"font-medium",children:'Select "Add to Home screen" or "Install app"'}),s.jsx("p",{className:"text-sm text-muted-foreground",children:'Look for "Add to Home screen" or "Install app" in the menu'})]})]}),s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center font-semibold text-primary",children:"3"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"font-medium",children:"Confirm"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:'Tap "Add" or "Install" to confirm'})]})]})]}),s.jsx("div",{className:"flex justify-end",children:s.jsx(B,{onClick:()=>i(!1),children:"Got it"})})]})})]})}function v0({value:e,onSave:t,isAdmin:n,maxLength:r,multiline:a=!1,placeholder:i,className:o,displayClassName:l,inputClassName:c,showCharacterCount:d=!0,disabled:m=!1,onPolish:u,isPolishing:h=!1,editButtonClassName:p}){const[v,y]=f.useState(!1),[g,x]=f.useState(e),[b,w]=f.useState(!1),j=f.useRef(null),N=f.useRef(null),C=f.useRef(!1);f.useEffect(()=>{x(e)},[e]),f.useEffect(()=>{v&&j.current&&(j.current.focus(),j.current instanceof HTMLInputElement&&j.current.select())},[v]);const P=()=>{!n||m||(x(e),y(!0))},S=()=>{x(e),y(!1)},E=async()=>
624{if(!C.current){if(g===e){y(!1);return}if(!(r&&g.length>r)){w(!0);try{await t(g),y(!1)}catch(O){console.error("Failed to save:",O)}finally{w(!1)}}}},T=O=>{N.current&&N.current.contains(O.relatedTarget)||C.current||E()},z=O=>{O.key==="Enter"&&!a||O.key==="Enter"&&a&&(O.metaKey||O.ctrlKey)?(O.preventDefault(),E()):O.key==="Escape"&&(O.preventDefault(),S())};if(!n)return s.jsx("span",{className:o,children:e||i});if(v){const O=a?Is:me,D=g.length,k=r?D>r:!1;return s.jsxs("div",{className:bt("relative",o),children:[s.jsxs("div",{className:"relative",children:[s.jsx(O,{ref:j,value:g,onChange:F=>x(F.target.value),onKeyDown:z,onBlur:T,maxLength:r,placeholder:i,className:bt("pr-20",k&&"border-red-500 focus-visible:ring-red-500",c),disabled:b,rows:a?3:void 0}),s.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:b?s.jsx(Qr,{className:"h-4 w-4 animate-spin text-slate-400"}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:E,disabled:k||b,className:"p-1 hover:bg-slate-100 rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Save (Enter)",children:s.jsx(bn,{className:"h-4 w-4 text-green-600"})}),s.jsx("button",{onClick:S,disabled:b,className:"p-1 hover:bg-slate-100 rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Cancel (Esc)",children:s.jsx(ja,{className:"h-4 w-4 text-red-600"})})]})})]}),d&&r&&s.jsxs("div",{className:bt("text-xs mt-1",k?"text-red-500":"text-slate-500"),children:[D,"/",r," characters"]}),u&&s.jsx("div",{className:"flex items-center gap-2 mt-2",children:s.jsxs(B,{ref:N,type:"button",variant:"outline",size:"sm",onMouseDown:F=>{F.preventDefault()},onClick:async F=>{if(F.preventDefault(),F.stopPropagation(),!!g.trim()){C.current=!0;try{const W=await u(g);x(W),setTimeout(()=>{j.current&&(j.current.focus(),j.current instanceof HTMLInputElement&&j.current.select())},100)}catch(W){console.error("Polish error:",W)}finally{C.current=!1}}},disabled:h||!g.trim()||b,className:"text-xs bg-white border-slate-300 text-slate-700 hover:bg-slate-50 hover:text-slate-900",children:[s.jsx(lr,{className:"w-3 h-3 mr-1"}),h?"Polishing...":"Polish with AI"]})})]})}return s.jsxs("div",{className:bt("group relative flex items-start gap-2",o),children:[s.jsx("span",{className:bt(l,"flex-1 min-w-0"),children:e||i}),!m&&s.jsx("button",{onClick:P,className:"p-1 hover:bg-black/10 dark:hover:bg-white/10 rounded flex-shrink-0 mt-0.5 transition-colors",title:"Click to edit","aria-label":"Edit",children:s.jsx(Ur,{className:bt("h-4 w-4",p||"text-slate-500 hover:text-slate-700")})})]})}function yhe(e,t,n){const r=[];return e.forEach(a=>typeof a!="string"?r.push(a):t[Symbol.split](a).forEach((i,o,l)=>{i!==""&&r.push(i),o<l.length-1&&r.push(n)})),r}/**
625 * Takes a string with placeholder variables like `%{smart_count} file selected`
626 * and replaces it with values from options `{smart_count: 5}`
627 *
628 * @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
629 * taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
630 *
631 * @param phrase that needs interpolation, with placeholders
632 * @param options with values that will be used to replace placeholders
633 */function k5(e,t){const n=/\$/g,r="$$$$";let a=[e];if(t==null)return a;for(const i of Object.keys(t))if(i!=="_"){let o=t[i];typeof o=="string"&&(o=n[Symbol.replace](o,r)),a=yhe(a,new RegExp(`%\\{${i}\\}`,"g"),o)}return a}const vhe=e=>{throw new Error(`missing string: ${e}`)};var _y,My,vP;class NW{constructor(t,{onMissingKey:n=vhe}={}){Qe(this,My);Ge(this,"locale");Qe(this,_y);this.locale={strings:{},pluralize(r){return r===1?0:1}},Array.isArray(t)?t.forEach(ct(this,My,vP),this):ct(this,My,vP).call(this,t),et(this,_y,n)}translate(t,n){return this.translateArray(t,n).join("")}translateArray(t,n){let r=this.locale.strings[t];if(r==null&&(X(this,_y).call(this,t),r=t),typeof r=="object"){if(n&&typeof n.smart_count<"u"){const i=this.locale.pluralize(n.smart_count);return k5(r[i],n)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof r!="string")throw new Error("string was not a string");return k5(r,n)}}_y=new WeakMap,My=new WeakSet,vP=function(t){if(!(t!=null&&t.strings))return;const n=this.locale;Object.assign(this.locale,{strings:{...n.strings,...t.strings},pluralize:t.pluralize||n.pluralize})};class CW{constructor(t,n){Ge(this,"uppy");Ge(this,"opts");Ge(this,"id");Ge(this,"defaultLocale");Ge(this,"i18n");Ge(this,"i18nArray");Ge(this,"type");Ge(this,"VERSION");
vendor: 12,048 bytes, line 633
633this.uppy=t,this.opts=n??{}}getPluginState(){const{plugins:t}=this.uppy.getState();return(t==null?void 0:t[this.id])||{}}setPluginState(t){const{plugins:n}=this.uppy.getState();this.uppy.setState({plugins:{...n,[this.id]:{...n[this.id],...t}}})}setOptions(t){this.opts={...this.opts,...t},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const t=new NW([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.setPluginState(void 0)}addTarget(t){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(t){}afterUpdate(){}}function SS(e){return e<10?`0${e}`:e.toString()}function Ab(){const e=new Date,t=SS(e.getHours()),n=SS(e.getMinutes()),r=SS(e.getSeconds());return`${t}:${n}:${r}`}const bhe={debug:()=>{},warn:()=>{},error:(...e)=>console.error(`[Uppy] [${Ab()}]`,...e)},whe={debug:(...e)=>console.debug(`[Uppy] [${Ab()}]`,...e),warn:(...e)=>console.warn(`[Uppy] [${Ab()}]`,...e),error:(...e)=>console.error(`[Uppy] [${Ab()}]`,...e)};function SW(e){return typeof e!="object"||e===null||!("nodeType"in e)?!1:e.nodeType===Node.ELEMENT_NODE}function jhe(e,t=document){return typeof e=="string"?t.querySelector(e):SW(e)?e:null}function kW(e){for(;e&&!e.dir;)e=e.parentNode;return e==null?void 0:e.dir}var bv,Hs,PW,hu,P5,EW,DW,AW,zT,bP,wP,Dg={},TW=[],Nhe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,wv=Array.isArray;function pl(e,t){for(var n in t)e[n]=t[n];return e}function qT(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ag(e,t,n){var r,a,i,o={};for(i in t)i=="key"?r=t[i]:i=="ref"?a=t[i]:o[i]=t[i];if(arguments.length>2&&(o.children=arguments.length>3?bv.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)o[i]===void 0&&(o[i]=e.defaultProps[i]);return Hx(e,o,r,a,null)}function Hx(e,t,n,r,a){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++PW,__i:-1,__u:0};return a==null&&Hs.vnode!=null&&Hs.vnode(i),i}function Che(){return{current:null}}function To(e){return e.children}function Xa(e,t){this.props=e,this.context=t}function If(e,t){if(t==null)return e.__?If(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?If(e):null}function OW(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return OW(e)}}function E5(e){(!e.__d&&(e.__d=!0)&&hu.push(e)&&!Ew.__r++||P5!=Hs.debounceRendering)&&((P5=Hs.debounceRendering)||EW)(Ew)}function Ew(){for(var e,t,n,r,a,i,o,l=1;hu.length;)hu.length>l&&hu.sort(DW),e=hu.shift(),l=hu.length,e.__d&&(n=void 0,r=void 0,a=(r=(t=e).__v).__e,i=[],o=[],t.__P&&((n=pl({},r)).__v=r.__v+1,Hs.vnode&&Hs.vnode(n),WT(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[a]:null,i,a??If(r),!!(32&r.__u),o),n.__v=r.__v,n.__.__k[n.__i]=n,MW(i,n,o),r.__e=r.__=null,n.__e!=a&&OW(n)));Ew.__r=0}function FW(e,t,n,r,a,i,o,l,c,d,m){var u,h,p,v,y,g,x,b=r&&r.__k||TW,w=t.length;for(c=She(n,t,b,c,w),u=0;u<w;u++)(p=n.__k[u])!=null&&(h=p.__i==-1?Dg:b[p.__i]||Dg,p.__i=u,g=WT(e,p,h,a,i,o,l,c,d,m),v=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&HT(h.ref,null,p),m.push(p.ref,p.__c||v,p)),y==null&&v!=null&&(y=v),(x=!!(4&p.__u))||h.__k===p.__k?c=_W(p,c,e,x):typeof p.type=="function"&&g!==void 0?c=g:v&&(c=v.nextSibling),p.__u&=-7);return n.__e=y,c}function She(e,t,n,r,a){var i,o,l,c,d,m=n.length,u=m,h=0;for(e.__k=new Array(a),i=0;i<a;i++)(o=t[i])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=e.__k[i]=Hx(null,o,null,null,null):wv(o)?o=e.__k[i]=Hx(To,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[i]=Hx(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[i]=o,c=i+h,o.__=e,o.__b=e.__b+1,l=null,(d=o.__i=khe(o,n,c,u))!=-1&&(u--,(l=n[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(a>m?h--:a<m&&h++),typeof o.type!="function"&&(o.__u|=4)):d!=c&&(d==c-1?h--:d==c+1?h++:(d>c?h--:h++,o.__u|=4))):e.__k[i]=null;if(u)for(i=0;i<m;i++)(l=n[i])!=null&&!(2&l.__u)&&(l.__e==r&&(r=If(l)),IW(l,l));return r}function _W(e,t,n,r){var a,i;if(typeof e.type=="function"){for(a=e.__k,i=0;a&&i<a.length;i++)a[i]&&(a[i].__=e,t=_W(a[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=If(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ko(e,t){return t=t||[],e==null||typeof e=="boolean"||(wv(e)?e.some(function(n){ko(n,t)}):t.push(e)),t}function khe(e,t,n,r){var a,i,o,l=e.key,c=e.type,d=t[n],m=d!=null&&(2&d.__u)==0;if(d===null&&l==null||m&&l==d.key&&c==d.type)return n;if(r>(m?1:0)){for(a=n-1,i=n+1;a>=0||i<t.length;)if((d=t[o=a>=0?a--:i++])!=null&&!(2&d.__u)&&l==d.key&&c==d.type)return o}return-1}function D5(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Nhe.test(t)?n:n+"px"}function b0(e,t,n,r,a){var i,o;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||D5(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||D5(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(AW,"$1")),o=t.toLowerCase(),t=o in e||t=="onFocusOut"||t=="onFocusIn"?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=zT,e.addEventListener(t,i?wP:bP,i)):e.removeEventListener(t,i?wP:bP,i);else{if(a=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function A5(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=zT++;else if(t.t<n.u)return;return n(Hs.event?Hs.event(t):t)}}}function WT(e,t,n,r,a,i,o,l,c,d){var m,u,h,p,v,y,g,x,b,w,j,N,C,P,S,E,T,z=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),i=[l=t.__e=n.__e]),(m=Hs.__b)&&m(t);e:if(typeof z=="function")try{if(x=t.props,b="prototype"in z&&z.prototype.render,w=(m=z.contextType)&&r[m.__c],j=m?w?w.props.value:m.__:r,n.__c?g=(u=t.__c=n.__c).__=u.__E:(b?t.__c=u=new z(x,j):(t.__c=u=new Xa(x,j),u.constructor=z,u.render=Ehe),w&&w.sub(u),u.state||(u.state={}),u.__n=r,h=u.__d=!0,u.__h=[],u._sb=[]),b&&u.__s==null&&(u.__s=u.state),b&&z.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=pl({},u.__s)),pl(u.__s,z.getDerivedStateFromProps(x,u.__s))),p=u.props,v=u.state,u.__v=t,h)b&&z.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),b&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(b&&z.getDerivedStateFromProps==null&&x!==p&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(x,j),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(x,u.__s,j)===!1){for(t.__v!=n.__v&&(u.props=x,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(O){O&&(O.__=t)}),N=0;N<u._sb.length;N++)u.__h.push(u._sb[N]);u._sb=[],u.__h.length&&o.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(x,u.__s,j),b&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(p,v,y)})}if(u.context=j,u.props=x,u.__P=e,u.__e=!1,C=Hs.__r,P=0,b){for(u.state=u.__s,u.__d=!1,C&&C(t),m=u.render(u.props,u.state,u.context),S=0;S<u._sb.length;S++)u.__h.push(u._sb[S]);u._sb=[]}else do u.__d=!1,C&&C(t),m=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++P<25);u.state=u.__s,u.getChildContext!=null&&(r=pl(pl({},r),u.getChildContext())),b&&!h&&u.getSnapshotBeforeUpdate!=null&&(y=u.getSnapshotBeforeUpdate(p,v)),E=m,m!=null&&m.type===To&&m.key==null&&(E=$W(m.props.children)),l=FW(e,wv(E)?E:[E],t,n,r,a,i,o,l,c,d),u.base=t.__e,t.__u&=-161,u.__h.length&&o.push(u),g&&(u.__E=u.__=null)}catch(O){if(t.__v=null,c||i!=null)if(O.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;i[i.indexOf(l)]=null,t.__e=l}else{for(T=i.length;T--;)qT(i[T]);jP(t)}else t.__e=n.__e,t.__k=n.__k,O.then||jP(t);Hs.__e(O,t,n)}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=Phe(n.__e,t,n,r,a,i,o,c,d);return(m=Hs.diffed)&&m(t),128&t.__u?void 0:l}function jP(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(jP)}function MW(e,t,n){for(var r=0;r<n.length;r++)HT(n[r],n[++r],n[++r]);Hs.__c&&Hs.__c(t,e),e.some(function(a){try{e=a.__h,a.__h=[],e.some(function(i){i.call(a)})}catch(i){Hs.__e(i,a.__v)}})}function $W(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:wv(e)?e.map($W):pl({},e)}function Phe(e,t,n,r,a,i,o,l,c){var d,m,u,h,p,v,y,g=n.props||Dg,x=t.props,b=t.type;if(b=="svg"?a="http://www.w3.org/2000/svg":b=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),i!=null){for(d=0;d<i.length;d++)if((p=i[d])&&"setAttribute"in p==!!b&&(b?p.localName==b:p.nodeType==3)){e=p,i[d]=null;break}}if(e==null){if(b==null)return document.createTextNode(x);e=document.createElementNS(a,b,x.is&&x),l&&(Hs.__m&&Hs.__m(t,i),l=!1),i=null}if(b==null)g===x||l&&e.data==x||(e.data=x);else{if(i=i&&bv.call(e.childNodes),!l&&i!=null)for(g={},d=0;d<e.attributes.length;d++)g[(p=e.attributes[d]).name]=p.value;for(d in g)if(p=g[d],d!="children"){if(d=="dangerouslySetInnerHTML")u=p;else if(!(d in x)){if(d=="value"&&"defaultValue"in x||d=="checked"&&"defaultChecked"in x)continue;b0(e,d,null,p,a)}}for(d in x)p=x[d],d=="children"?h=p:d=="dangerouslySetInnerHTML"?m=p:d=="value"?v=p:d=="checked"?y=p:l&&typeof p!="function"||g[d]===p||b0(e,d,p,g[d],a);if(m)l||u&&(m.__html==u.__html||m.__html==e.innerHTML)||(e.innerHTML=m.__html),t.__k=[];else if(u&&(e.innerHTML=""),FW(t.type=="template"?e.content:e,wv(h)?h:[h],t,n,r,b=="foreignObject"?"http://www.w3.org/1999/xhtml":a,i,o,i?i[0]:n.__k&&If(n,0),l,c),i!=null)for(d=i.length;d--;)qT(i[d]);l||(d="value",b=="progress"&&v==null?e.removeAttribute("value"):v!=null&&(v!==e[d]||b=="progress"&&!v||b=="option"&&v!=g[d])&&b0(e,d,v,g[d],a),d="checked",y!=null&&y!=e[d]&&b0(e,d,y,g[d],a))}return e}function HT(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(a){Hs.__e(a,n)}}function IW(e,t,n){var r,a;if(Hs.unmount&&Hs.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||HT(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){Hs.__e(i,t)}r.base=r.__P=null}if(r=e.__k)for(a=0;a<r.length;a++)r[a]&&IW(r[a],t,n||typeof e.type!="function");n||qT(e.__e),e.__c=e.__=e.__e=void 0}function Ehe(e,t,n){return this.constructor(e,n)}function Dhe(e,t,n){var r,a,i,o;t==document&&(t=document.documentElement),Hs.__&&Hs.__(e,t),a=(r=!1)?null:t.__k,i=[],o=[],WT(t,e=t.__k=Ag(To,null,[e]),a||Dg,Dg,t.namespaceURI,a?null:t.firstChild?bv.call(t.childNodes):null,i,a?a.__e:t.firstChild,r,o),MW(i,e,o)}function RW(e,t,n){var r,a,i,o,l=pl({},e.props);for(i in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)i=="key"?r=t[i]:i=="ref"?a=t[i]:l[i]=t[i]===void 0&&o!=null?o[i]:t[i];return arguments.length>2&&(l.children=arguments.length>3?bv.call(arguments,2):n),Hx(e.type,l,r||e.key,a||e.ref,null)}bv=TW.slice,Hs={__e:function(e,t,n,r){for(var a,i,o;t=t.__;)if((a=t.__c)&&!a.__)try{if((i=a.constructor)&&i.getDerivedStateFromError!=null&&(a.setState(i.getDerivedStateFromError(e)),o=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(e,r||{}),o=a.__d),o)return a.__E=a}catch(l){e=l}throw e}},PW=0,Xa.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=pl({},this.state),typeof e=="function"&&(e=e(pl({},n),this.props)),e&&pl(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),E5(this))},Xa.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),E5(this))},Xa.prototype.render=To,hu=[],EW=typeof Promise=="function"?Promise.prototype.then.bind(Prom
vendor: 6,936 bytes, line 633
633ise.resolve()):setTimeout,DW=function(e,t){return e.__v.__b-t.__v.__b},Ew.__r=0,AW=/(PointerCapture)$|Capture$/i,zT=0,bP=A5(!1),wP=A5(!0);var Tg,vr,kS,T5,Og=0,BW=[],kr=Hs,O5=kr.__b,F5=kr.__r,_5=kr.diffed,M5=kr.__c,$5=kr.unmount,I5=kr.__;function VT(e,t){kr.__h&&kr.__h(vr,e,Og||t),Og=0;var n=vr.__H||(vr.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Dw(e){return Og=1,Ahe(UW,e)}function Ahe(e,t,n){var r=VT(Tg++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):UW(void 0,t),function(l){var c=r.__N?r.__N[0]:r.__[0],d=r.t(c,l);c!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=vr,!vr.__f)){var a=function(l,c,d){if(!r.__c.__H)return!0;var m=r.__c.__H.__.filter(function(h){return!!h.__c});if(m.every(function(h){return!h.__N}))return!i||i.call(this,l,c,d);var u=r.__c.props!==l;return m.forEach(function(h){if(h.__N){var p=h.__[0];h.__=h.__N,h.__N=void 0,p!==h.__[0]&&(u=!0)}}),i&&i.call(this,l,c,d)||u};vr.__f=!0;var i=vr.shouldComponentUpdate,o=vr.componentWillUpdate;vr.componentWillUpdate=function(l,c,d){if(this.__e){var m=i;i=void 0,a(l,c,d),i=m}o&&o.call(this,l,c,d)},vr.shouldComponentUpdate=a}return r.__N||r.__}function NP(e,t){var n=VT(Tg++,3);!kr.__s&&LW(n.__H,t)&&(n.__=e,n.u=t,vr.__H.__h.push(n))}function Tb(e){return Og=5,KT(function(){return{current:e}},[])}function KT(e,t){var n=VT(Tg++,7);return LW(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function The(e,t){return Og=8,KT(function(){return e},t)}function Ohe(){for(var e;e=BW.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ob),e.__H.__h.forEach(CP),e.__H.__h=[]}catch(t){e.__H.__h=[],kr.__e(t,e.__v)}}kr.__b=function(e){vr=null,O5&&O5(e)},kr.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),I5&&I5(e,t)},kr.__r=function(e){F5&&F5(e),Tg=0;var t=(vr=e.__c).__H;t&&(kS===vr?(t.__h=[],vr.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.forEach(Ob),t.__h.forEach(CP),t.__h=[],Tg=0)),kS=vr},kr.diffed=function(e){_5&&_5(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(BW.push(t)!==1&&T5===kr.requestAnimationFrame||((T5=kr.requestAnimationFrame)||Fhe)(Ohe)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),kS=vr=null},kr.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Ob),n.__h=n.__h.filter(function(r){return!r.__||CP(r)})}catch(r){t.some(function(a){a.__h&&(a.__h=[])}),t=[],kr.__e(r,n.__v)}}),M5&&M5(e,t)},kr.unmount=function(e){$5&&$5(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Ob(r)}catch(a){t=a}}),n.__H=void 0,t&&kr.__e(t,n.__v))};var R5=typeof requestAnimationFrame=="function";function Fhe(e){var t,n=function(){clearTimeout(r),R5&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);R5&&(t=requestAnimationFrame(n))}function Ob(e){var t=vr,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),vr=t}function CP(e){var t=vr;e.__c=e.__(),vr=t}function LW(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function UW(e,t){return typeof t=="function"?t(e):t}function _he(e,t){for(var n in t)e[n]=t[n];return e}function B5(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function L5(e,t){this.props=e,this.context=t}(L5.prototype=new Xa).isPureReactComponent=!0,L5.prototype.shouldComponentUpdate=function(e,t){return B5(this.props,e)||B5(this.state,t)};var U5=Hs.__b;Hs.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),U5&&U5(e)};var Mhe=Hs.__e;Hs.__e=function(e,t,n,r){if(e.then){for(var a,i=t;i=i.__;)if((a=i.__c)&&a.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),a.__c(e,t)}Mhe(e,t,n,r)};var z5=Hs.unmount;function zW(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=_he({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return zW(r,t,n)})),e}function qW(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return qW(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function PS(){this.__u=0,this.o=null,this.__b=null}function WW(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function w0(){this.i=null,this.l=null}Hs.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),z5&&z5(e)},(PS.prototype=new Xa).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var a=WW(r.__v),i=!1,o=function(){i||(i=!0,n.__R=null,a?a(l):l())};n.__R=o;var l=function(){if(!--r.__u){if(r.state.__a){var c=r.state.__a;r.__v.__k[0]=qW(c,c.__c.__P,c.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.o.pop();)d.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},PS.prototype.componentWillUnmount=function(){this.o=[]},PS.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=zW(this.__b,n,r.__O=r.__P)}this.__b=null}var a=t.__a&&Ag(To,null,e.fallback);return a&&(a.__u&=-33),[Ag(To,null,t.__a?null:e.children),a]};var q5=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(w0.prototype=new Xa).__a=function(e){var t=this,n=WW(t.__v),r=t.l.get(e);return r[0]++,function(a){var i=function(){t.props.revealOrder?(r.push(a),q5(t,e,r)):a()};n?n(i):i()}},w0.prototype.render=function(e){this.i=null,this.l=new Map;var t=ko(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},w0.prototype.componentDidUpdate=w0.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){q5(e,n,t)})};var $he=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Ihe=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Rhe=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Bhe=/[A-Z0-9]/g,Lhe=typeof document<"u",Uhe=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function W5(e,t,n){return t.__k==null&&(t.textContent=""),Dhe(e,t),typeof n=="function"&&n(),e?e.__c:null}Xa.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Xa.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var H5=Hs.event;function zhe(){}function qhe(){return this.cancelBubble}function Whe(){return this.defaultPrevented}Hs.event=function(e){return H5&&(e=H5(e)),e.persist=zhe,e.isPropagationStopped=qhe,e.isDefaultPrevented=Whe,e.nativeEvent=e};
633var Hhe={enumerable:!1,configurable:!0,get:function(){return this.class}},V5=Hs.vnode;Hs.vnode=function(e){typeof e.type=="string"&&function(t){var n=t.props,r=t.type,a={},i=r.indexOf("-")===-1;for(var o in n){var l=n[o];if(!(o==="value"&&"defaultValue"in n&&l==null||Lhe&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var c=o.toLowerCase();o==="defaultValue"&&"value"in n&&n.value==null?o="value":o==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?o="ondblclick":c!=="onchange"||r!=="input"&&r!=="textarea"||Uhe(n.type)?c==="onfocus"?o="onfocusin":c==="onblur"?o="onfocusout":Rhe.test(o)&&(o=c):c=o="oninput":i&&Ihe.test(o)?o=o.replace(Bhe,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&a[o=c]&&(o="oninputCapture"),a[o]=l}}r=="select"&&a.multiple&&Array.isArray(a.value)&&(a.value=ko(n.children).forEach(function(d){d.props.selected=a.value.indexOf(d.props.value)!=-1})),r=="select"&&a.defaultValue!=null&&(a.value=ko(n.children).forEach(function(d){d.props.selected=a.multiple?a.defaultValue.indexOf(d.props.value)!=-1:a.defaultValue==d.props.value})),n.class&&!n.className?(a.class=n.class,Object.defineProperty(a,"className",Hhe)):(n.className&&!n.class||n.class&&n.className)&&(a.class=a.className=n.className),t.props=a}(e),e.$$typeof=$he,V5&&V5(e)};var K5=Hs.__r;Hs.__r=function(e){K5&&K5(e),e.__c};var G5=Hs.diffed;Hs.diffed=function(e){G5&&G5(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value)};function Vhe(e){let t=null,n;return(...r)=>(n=r,t||(t=Promise.resolve().then(()=>(t=null,e(...n)))),t)}var $y;const Jj=class Jj extends CW{constructor(){super(...arguments);Qe(this,$y);Ge(this,"isTargetDOMEl");Ge(this,"el");Ge(this,"parent");Ge(this,"title")}getTargetPlugin(n){let r;if(typeof(n==null?void 0:n.addTarget)=="function")r=n,r instanceof Jj||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:r,UIPlugin:Jj}}));else if(typeof n=="function"){const a=n;this.uppy.iteratePlugins(i=>{i instanceof a&&(r=i)})}return r}mount(n,r){const a=r.id,i=jhe(n);if(i){this.isTargetDOMEl=!0;const c=document.createElement("div");return c.classList.add("uppy-Root"),et(this,$y,Vhe(d=>{this.uppy.getPlugin(this.id)&&(W5(this.render(d,c),c),this.afterUpdate())})),this.uppy.log(`Installing ${a} to a DOM element '${n}'`),this.opts.replaceTargetContent&&(i.innerHTML=""),W5(this.render(this.uppy.getState(),c),c),this.el=c,i.appendChild(c),c.dir=this.opts.direction||kW(c)||"ltr",this.onMount(),this.el}const o=this.getTargetPlugin(n);
633if(o)return this.uppy.log(`Installing ${a} to ${o.id}`),this.parent=o,this.el=o.addTarget(r),this.onMount(),this.el;this.uppy.log(`Not installing ${a}`);let l=`Invalid target option given to ${a}.`;throw typeof n=="function"?l+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":l+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(l)}render(n,r){throw new Error("Extend the render method to add your plugin to a DOM element")}update(n){var r;this.el!=null&&((r=X(this,$y))==null||r.call(this,n))}unmount(){var n;this.isTargetDOMEl&&((n=this.el)==null||n.remove()),this.onUnmount()}onMount(){}onUnmount(){}};$y=new WeakMap;let Rf=Jj;const Khe="4.3.2",Ghe={version:Khe};var tf,Xj,VW;class HW{constructor(){Qe(this,Xj);Ge(this,"state",{});Qe(this,tf,new Set)}getState(){return this.state}setState(t){const n={...this.state},r={...this.state,...t};this.state=r,ct(this,Xj,VW).call(this,n,r,t)}subscribe(t){return X(this,tf).add(t),()=>{X(this,tf).delete(t)}}}tf=new WeakMap,Xj=new WeakSet,VW=function(...t){X(this,tf).forEach(n=>{n(...t)})},Ge(HW,"VERSION",Ghe.version);function KW(e){const t=e.lastIndexOf(".");return t===-1||t===e.length-1?{name:e,extension:void 0}:{name:e.slice(0,t),extension:e.slice(t+1)}}const Y5={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",msg:"application/vnd.ms-outlook",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function GW(e){var n;if(e.type)return e.type;const t=e.name?(n=KW(e.name).extension)==null?void 0:n.toLowerCase():null;return t&&t in Y5?Y5[t]:"application/octet-stream"}function Yhe(e){return e.charCodeAt(0).toString(32)}function Q5(e){let t="";return e.replace(/[^A-Z0-9]/gi,n=>(t+=`-${Yhe(n)}`,"/"))+t}function Qhe(e,t){let n=t||"uppy";return typeof e.name=="string"&&(n+=`-${Q5(e.name.toLowerCase())}`),e.type!==void 0&&(n+=`-${e.type}`),e.meta&&typeof e.meta.relativePath=="string"&&(n+=`-${Q5(e.meta.relativePath.toLowerCase())}`),e.data.size!==void 0&&(n+=`-${e.data.size}`),e.data.lastModified!==void 0&&(n+=`-${e.data.lastModified}`),n}function Jhe(e){return!e.isRemote||!e.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(e.remote.provider)}function Xhe(e,t){if(Jhe(e))return e.id;const n=GW(e);return Qhe({...e,type:n},t)}function Zhe(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var zd=Zhe;const Cp=Qs(zd);var efe=typeof xx=="object"&&xx&&xx.Object===Object&&xx,YW=efe,tfe=YW,sfe=typeof self=="object"&&self&&self.Object===Object&&self,nfe=tfe||sfe||Function("return this")(),Dl=nfe,rfe=Dl,afe=function(){return rfe.Date.now()},ife=afe,ofe=/\s/;function lfe(e){for(var t=e.length;t--&&ofe.test(e.charAt(t)););return t}var cfe=lfe,dfe=cfe,ufe=/^\s+/;function mfe(e){return e&&e.slice(0,dfe(e)+1).replace(ufe,"")}var hfe=mfe,ffe=Dl,pfe=ffe.Symbol,jv=pfe,J5=jv,QW=Object.prototype,xfe=QW.hasOwnProperty,gfe=QW.toString,sx=J5?J5.toStringTag:void 0;function yfe(e){var t=xfe.call(e,sx),n=e[sx];try{e[sx]=void 0;var r=!0}catch{}var a=gfe.call(e);return r&&(t?e[sx]=n:delete e[sx]),a}var vfe=yfe,bfe=Object.prototype,wfe=bfe.toString;function jfe(e){return wfe.call(e)}var Nfe=jfe,X5=jv,Cfe=vfe,Sfe=Nfe,kfe="[object Null]",Pfe="[object Undef
633ined]",Z5=X5?X5.toStringTag:void 0;function Efe(e){return e==null?e===void 0?Pfe:kfe:Z5&&Z5 in Object(e)?Cfe(e):Sfe(e)}var wc=Efe;function Dfe(e){return e!=null&&typeof e=="object"}var jc=Dfe,Afe=wc,Tfe=jc,Ofe="[object Symbol]";function Ffe(e){return typeof e=="symbol"||Tfe(e)&&Afe(e)==Ofe}var Sp=Ffe,_fe=hfe,e$=zd,Mfe=Sp,t$=NaN,$fe=/^[-+]0x[0-9a-f]+$/i,Ife=/^0b[01]+$/i,Rfe=/^0o[0-7]+$/i,Bfe=parseInt;function Lfe(e){if(typeof e=="number")return e;if(Mfe(e))return t$;if(e$(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=e$(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=_fe(e);var n=Ife.test(e);return n||Rfe.test(e)?Bfe(e.slice(2),n?2:8):$fe.test(e)?t$:+e}var JW=Lfe,Ufe=zd,ES=ife,s$=JW,zfe="Expected a function",qfe=Math.max,Wfe=Math.min;function Hfe(e,t,n){var r,a,i,o,l,c,d=0,m=!1,u=!1,h=!0;if(typeof e!="function")throw new TypeError(zfe);t=s$(t)||0,Ufe(n)&&(m=!!n.leading,u="maxWait"in n,i=u?qfe(s$(n.maxWait)||0,t):i,h="trailing"in n?!!n.trailing:h);function p(C){var P=r,S=a;return r=a=void 0,d=C,o=e.apply(S,P),o}function v(C){return d=C,l=setTimeout(x,t),m?p(C):o}function y(C){var P=C-c,S=C-d,E=t-P;return u?Wfe(E,i-S):E}function g(C){var P=C-c,S=C-d;return c===void 0||P>=t||P<0||u&&S>=i}function x(){var C=ES();if(g(C))return b(C);l=setTimeout(x,y(C))}function b(C){return l=void 0,h&&r?p(C):(r=a=void 0,o)}function w(){l!==void 0&&clearTimeout(l),d=0,r=c=a=l=void 0}function j(){return l===void 0?o:b(ES())}function N(){var C=ES(),P=g(C);if(r=arguments,a=this,c=C,P){if(l===void 0)return v(c);if(u)return clearTimeout(l),l=setTimeout(x,t),p(c)}return l===void 0&&(l=setTimeout(x,t)),o}return N.cancel=w,N.flush=j,N}var XW=Hfe;const ZW=Qs(XW);var Vfe=XW,Kfe=zd,Gfe="Expected a function";function Yfe(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(Gfe);return Kfe(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),Vfe(e,t,{leading:r,maxWait:t,trailing:a})}var Qfe=Yfe;const c1=Qs(Qfe);var Jfe=function(){var t={},n=t._fns={};t.emit=function(o,l,c,d,m,u,h){var p=r(o);p.length&&a(o,p,[l,c,d,m,u,h])},t.on=function(o,l){n[o]||(n[o]=[]),n[o].push(l)},t.once=function(o,l){function c(){l.apply(this,arguments),t.off(o,c)}this.on(o,c)},t.off=function(o,l){var c=[];if(o&&l){var d=this._fns[o],m=0,u=d?d.length:0;for(m;m<u;m++)d[m]!==l&&c.push(d[m])}c.length?this._fns[o]=c:delete this._fns[o]};function r(i){var o=n[i]?n[i]:[],l=i.indexOf(":"),c=l===-1?[i]:[i.substring(0,l),i.substring(l+1)],d=Object.keys(n),m=0,u=d.length;for(m;m<u;m++){var h=d[m];if(h==="*"&&(o=o.concat(n[h])),c.length===2&&c[0]===h){o=o.concat(n[h]);break}}return o}function a(i,o,l){var c=0,d=o.length;for(c;c<d&&o[c];
633c++)o[c].event=i,o[c].apply(o[c],l)}return t};const Xfe=Qs(Jfe);let Zfe="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",GT=(e=21)=>{let t="",n=e|0;for(;n--;)t+=Zfe[Math.random()*64|0];return t};const epe="4.5.3",tpe={version:epe};function spe(e,t){return t.name?t.name:e.split("/")[0]==="image"?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}const npe={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};var rpe=function(t){if(typeof t!="number"||Number.isNaN(t))throw new TypeError(`Expected a number, got ${typeof t}`);const n=t<0;let r=Math.abs(t);if(n&&(r=-r),r===0)return"0 B";const a=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],i=Math.min(Math.floor(Math.log(r)/Math.log(1024)),a.length-1),o=Number(r/1024**i),l=a[i];return`${o>=10||o%1===0?Math.round(o):o.toFixed(1)} ${l}`};const yu=Qs(rpe);function eH(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}eH.prototype.match=function(e){var t=!0,n=this.parts,r,a=n.length,i;if(typeof e=="string"||e instanceof String)if(!this.hasWild&&this.text!=e)t=!1;else{for(i=(e||"").split(this.separator),r=0;t&&r<a;r++)n[r]!=="*"&&(r<i.length?t=n[r]===i[r]:t=!1);t=t&&i}else if(typeof e.splice=="function")for(t=[],r=e.length;r--;)this.match(e[r])&&(t[t.length]=e[r]);else if(typeof e=="object"){t={};for(var o in e)this.match(o)&&(t[o]=e[o])}return t};var ape=function(e,t,n){var r=new eH(e,n||/[\/\.]/);return typeof t<"u"?r.match(t):r},ipe=ape,ope=/[\/\+\.]/,lpe=function(e,t){function n(r){var a=ipe(r,e,ope);return a&&a.length>=2}return t?n(t.split(";")[0]):n};const cpe=Qs(lpe),dpe={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};
633class wo extends Error{constructor(n,r){super(n);Ge(this,"isUserFacing");Ge(this,"file");Ge(this,"isRestriction",!0);this.isUserFacing=(r==null?void 0:r.isUserFacing)??!0,r!=null&&r.file&&(this.file=r.file)}}class upe{constructor(t,n){Ge(this,"getI18n");Ge(this,"getOpts");this.getI18n=n,this.getOpts=()=>{var a;const r=t();if(((a=r.restrictions)==null?void 0:a.allowedFileTypes)!=null&&!Array.isArray(r.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return r}}validateAggregateRestrictions(t,n){const{maxTotalFileSize:r,maxNumberOfFiles:a}=this.getOpts().restrictions;if(a&&t.filter(o=>!o.isGhost).length+n.length>a)throw new wo(`${this.getI18n()("youCanOnlyUploadX",{smart_count:a})}`);if(r){const i=[...t,...n].reduce((o,l)=>o+(l.size??0),0);if(i>r)throw new wo(this.getI18n()("aggregateExceedsSize",{sizeAllowed:yu(r),size:yu(i)}))}}validateSingleFile(t){const{maxFileSize:n,minFileSize:r,allowedFileTypes:a}=this.getOpts().restrictions;if(a&&!a.some(o=>o.includes("/")?t.type?cpe(t.type.replace(/;.*?$/,""),o):!1:o[0]==="."&&t.extension?t.extension.toLowerCase()===o.slice(1).toLowerCase():!1)){const o=a.join(", ");throw new wo(this.getI18n()("youCanOnlyUploadFileTypes",{types:o}),{file:t})}if(n&&t.size!=null&&t.size>n)throw new wo(this.getI18n()("exceedsSize",{size:yu(n),file:t.name??this.getI18n()("unnamed")}),{file:t});if(r&&t.size!=null&&t.size<r)throw new wo(this.getI18n()("inferiorSize",{size:yu(r)}),{file:t})}validate(t,n){n.forEach(r=>{this.validateSingleFile(r)}),this.validateAggregateRestrictions(t,n)}validateMinNumberOfFiles(t){const{minNumberOfFiles:n}=this.getOpts().restrictions;if(n&&Object.keys(t).length<n)throw new wo(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:n}))}getMissingRequiredMetaFields(t){const n=new wo(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:t.name??this.getI18n()("unnamed")})),{requiredMetaFields:r}=this.getOpts().restrictions,a=[];for(const i of r)(!Object.hasOwn(t.meta,i)||t.meta[i]==="")&&a.push(i);return{missingFields:a,error:n}}}function mpe(e){if(e==null&&typeof navigator<"u"&&(e=navigator.userAgent),!e)return!0;const t=/Edge\/(\d+\.\d+)/.exec(e);if(!t)return!0;const r=t[1].split(".",2),a=parseInt(r[0],10),i=parseInt(r[1],10);return a<15||a===15&&i<15063||a>18||a===18&&i>=18218}const j0={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null};var fo,po,Iy,Mu,sf,nf,$u,ws,iu,kP,tH,PP,sH,EP,DP,AP,TP,Zj,OP,Iu,nH,rH,ed,Ry,Nx,aH,Fb,Cx;const eN=class eN{constructor(t){Qe(this,ws);Qe(this,fo,Object.create(null));Qe(this,po);Qe(this,Iy);Qe(this,Mu,Xfe());Qe(this,sf,new Set);Qe(this,nf,new Set);Qe(this,$u,new Set);Ge(this,"defaultLocale");Ge(this,"locale");Ge(this,"opts");Ge(this,"store");Ge(this,"i18n");Ge(this,"i18nArray");Ge(this,"scheduledAutoProceed",null);Ge(this,"wasOffline",!1);Qe(this,Zj,(t,n)=>{const r=t?this.getFile(t.id):void 0;if(t==null||!r){this.log(`Not setting progress for a file that has been removed: ${t==null?void 0:t.id}`);return}if(r.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${t.id}`);return}const a={bytesTotal:n.bytesTotal,percentage:n.bytesTotal!=null&&Number.isFinite(n.bytesTotal)&&n.bytesTotal>0?Math.round(n.bytesUploaded/n.bytesTotal*100):void 0};r.progress.uploadStarted!=null?this.setFileState(t.id,{progress:{...r.progress,...a,bytesUploaded:n.bytesUploaded}}):this.setFileState(t.id,{progress:{...r.progress,...a}}),X(this,Iu).call(this)});Qe(this,Iu,c1(()=>ct(this,ws,OP).call(this),500,{leading:!0,trailing:!0}));Qe(this,ed,this.updateOnlineStatus.bind(this));Qe(this,Ry,new Map);this.defaultLocale=npe;const n={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:dpe,meta:{},onBeforeFileAdded:(a,i)=>!Object.hasOwn(i,a.id),onBeforeUpload:a=>a,store:new HW,logger:bhe,infoTimeout:5e3},r={...n,...t};this.opts={...r,restrictions:{...n.restrictions,...t==null?void 0:t.restrictions}},t!=null&&t.logger&&t.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):t!=null&&t.debug&&(this.opts.logger=whe),this.log(`Using Core v${eN.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...j0,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:mpe(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),et(this,po,new upe(()=>this.opts,()=>this.i18n)),et(this,Iy,this.store.subscribe((a,i,o)=>
633{this.emit("state-update",a,i,o),this.updateAll(i)})),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),ct(this,ws,rH).call(this)}emit(t,...n){X(this,Mu).emit(t,...n)}on(t,n){return X(this,Mu).on(t,n),this}once(t,n){return X(this,Mu).once(t,n),this}off(t,n){return X(this,Mu).off(t,n),this}updateAll(t){this.iteratePlugins(n=>{n.update(t)})}setState(t){this.store.setState(t)}getState(){return this.store.getState()}patchFilesState(t){const n=this.getState().files;this.setState({files:{...n,...Object.fromEntries(Object.entries(t).map(([r,a])=>[r,{...n[r],...a}]))}})}setFileState(t,n){if(!this.getState().files[t])throw new Error(`Can’t set state for ${t} (the file could have been removed)`);this.patchFilesState({[t]:n})}i18nInit(){const t=r=>this.log(`Missing i18n string: ${r}`,"error"),n=new NW([this.defaultLocale,this.opts.locale],{onMissingKey:t});this.i18n=n.translate.bind(n),this.i18nArray=n.translateArray.bind(n),this.locale=n.locale}setOptions(t){this.opts={...this.opts,...t,restrictions:{...this.opts.restrictions,...t==null?void 0:t.restrictions}},t.meta&&this.setMeta(t.meta),this.i18nInit(),t.locale&&this.iteratePlugins(n=>{n.setOptions(t)}),this.setState(void 0)}resetProgress(){const t={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},n={...this.getState().files},r=Object.create(null);Object.keys(n).forEach(a=>{r[a]={...n[a],progress:{...n[a].progress,...t},tus:void 0,transloadit:void 0}}),this.setState({files:r,...j0})}clear(){const{capabilities:t,currentUploads:n}=this.getState();if(Object.keys(n).length>0&&!t.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...j0,files:{}})}addPreProcessor(t){X(this,sf).add(t)}removePreProcessor(t){return X(this,sf).delete(t)}addPostProcessor(t){X(this,$u).add(t)}removePostProcessor(t){return X(this,$u).delete(t)}addUploader(t){X(this,nf).add(t)}removeUploader(t){return X(this,nf).delete(t)}setMeta(t){const n={...this.getState().meta,...t},r={...this.getState().files};Object.keys(r).forEach(a=>{r[a]={...r[a],meta:{...r[a].meta,...t}}}),this.log("Adding metadata:"),this.log(t),this.setState({meta:n,files:r})}setFileMeta(t,n){const r={...this.getState().files};if(!r[t]){this.log(`Was trying to set metadata for a file that has been removed: ${t}`);return}const a={...r[t].meta,...n};r[t]={...r[t],meta:a},this.setState({files:r})}getFile(t){return this.getState().files[t]}getFiles(){const{files:t}=this.getState();return Object.values(t)}getFilesByIds(t){return t.map(n=>this.getFile(n))}getObjectOfFilesPerState(){const{files:t,totalProgress:n,error:r}=this.getState(),a=Object.values(t),i=[],o=[],l=[],c=[],d=[],m=[],u=[],h=[],p=[];for(const v of a){const{progress:y}=v;!y.uploadComplete&&y.uploadStarted&&(i.push(v),v.isPaused||h.push(v)),y.uploadStarted||o.push(v),(y.uploadStarted||y.preprocess||y.postprocess)&&l.push(v),y.uploadStarted&&c.push(v),v.isPaused&&d.push(v),y.uploadComplete&&m.push(v),v.error&&u.push(v),(y.preprocess||y.postprocess)&&p.push(v)}return{newFiles:o,startedFiles:l,uploadStartedFiles:c,pausedFiles:d,completeFiles:m,erroredFiles:u,inProgressFiles:i,inProgressNotPausedFiles:h,processingFiles:p,isUploadStarted:c.length>0,isAllComplete:n===100&&m.length===a.length&&p.length===0,isAllErrored:!!r&&u.length===a.length,isAllPaused:i.length!==0&&d.length===i.length,isUploadInProgress:i.length>0,isSomeGhost:a.some(v=>v.isGhost)}}validateRestrictions(t,n=this.getFiles()){try{X(this,po).validate(n,[t])}catch(r){return r}return null}validateSingleFile(t){try{X(this,po).validateSingleFile(t)}catch(n){return n.message}return null}validateAggregateRestrictions(t){const n=this.getFiles();try{X(this,po).validateAggregateRestrictions(n,t)}catch(r){return r.message}return null}checkIfFileAlreadyExists(t){const{files:n}=this.getState();return!!(n[t]&&!n[t].isGhost)}addFile(t){ct(this,ws,PP).call(this,t);const{nextFilesState:n,validFilesToAdd:r,errors:a}=ct(this,ws,DP).call(this,[t]),i=a.filter(l=>l.isRestriction);if(ct(this,ws,iu).call(this,i),a.length>0)throw a[0];this.setState({files:n}
633);const[o]=r;return this.emit("file-added",o),this.emit("files-added",r),this.log(`Added file: ${o.name}, ${o.id}, mime type: ${o.type}`),ct(this,ws,EP).call(this),o.id}addFiles(t){ct(this,ws,PP).call(this);const{nextFilesState:n,validFilesToAdd:r,errors:a}=ct(this,ws,DP).call(this,t),i=a.filter(l=>l.isRestriction);ct(this,ws,iu).call(this,i);const o=a.filter(l=>!l.isRestriction);if(o.length>0){let l=`Multiple errors occurred while adding files:
634`;if(o.forEach(c=>{l+=`
635 * ${c.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:o.length}),details:l},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(o,l);{const c=new Error(l);throw c.errors=o,c}}this.setState({files:n}),r.forEach(l=>{this.emit("file-added",l)}),this.emit("files-added",r),r.length>5?this.log(`Added batch of ${r.length} files`):Object.values(r).forEach(l=>{this.log(`Added file: ${l.name}
636 id: ${l.id}
637 type: ${l.type}`)}),r.length>0&&ct(this,ws,EP).call(this)}removeFiles(t){const{files:n,currentUploads:r}=this.getState(),a={...n},i={...r},o=Object.create(null);t.forEach(m=>{n[m]&&(o[m]=n[m],delete a[m])});function l(m){return o[m]===void 0}
637Object.keys(i).forEach(m=>{const u=r[m].fileIDs.filter(l);if(u.length===0){delete i[m];return}const{capabilities:h}=this.getState();if(u.length!==r[m].fileIDs.length&&!h.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");i[m]={...r[m],fileIDs:u}});const c={currentUploads:i,files:a};Object.keys(a).length===0&&(c.allowNewUpload=!0,c.error=null,c.recoveredState=null),this.setState(c),X(this,Iu).call(this);const d=Object.keys(o);d.forEach(m=>{this.emit("file-removed",o[m])}),d.length>5?this.log(`Removed ${d.length} files`):this.log(`Removed files: ${d.join(", ")}`)}removeFile(t){this.removeFiles([t])}pauseResume(t){if(!this.getState().capabilities.resumableUploads||this.getFile(t).progress.uploadComplete)return;const n=this.getFile(t),a=!(n.isPaused||!1);return this.setFileState(t,{isPaused:a}),this.emit("upload-pause",n,a),a}pauseAll(){const t={...this.getState().files};Object.keys(t).filter(r=>!t[r].progress.uploadComplete&&t[r].progress.uploadStarted).forEach(r=>{const a={...t[r],isPaused:!0};t[r]=a}),this.setState({files:t}),this.emit("pause-all")}resumeAll(){const t={...this.getState().files};Object.keys(t).filter(r=>!t[r].progress.uploadComplete&&t[r].progress.uploadStarted).forEach(r=>{const a={...t[r],isPaused:!1,error:null};t[r]=a}),this.setState({files:t}),this.emit("resume-all")}async retryAll(){const t=await ct(this,ws,TP).call(this);return this.emit("complete",t),t}cancelAll(){this.emit("cancel-all");const{files:t}=this.getState(),n=Object.keys(t);n.length&&this.removeFiles(n),this.setState(j0)}retryUpload(t){this.setFileState(t,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(t));const n=ct(this,ws,Nx).call(this,[t],{forceAllowNewUpload:!0});return ct(this,ws,Cx).call(this,n)}logout(){this.iteratePlugins(t=>{var n,r;(r=(n=t.provider)==null?void 0:n.logout)==null||r.call(n)})}[Symbol.for("uppy test: updateTotalProgress")](){return ct(this,ws,OP).call(this)}updateOnlineStatus(){window.navigator.onLine??!0?(this.emit("is-online"),this.wasOffline&&(this.emit
637("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}getID(){return this.opts.id}use(t,...n){if(typeof t!="function"){const o=`Expected a plugin class, but got ${t===null?"null":typeof t}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(o)}const r=new t(this,...n),a=r.id;if(!a)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");const i=this.getPlugin(a);if(i){const o=`Already found a plugin named '${i.id}'. Tried to use: '${a}'.
638Uppy plugins must have unique \`id\` options.`;throw new Error(o)}return t.VERSION&&this.log(`Using ${a} v${t.VERSION}`),r.type in X(this,fo)?X(this,fo)[r.type].push(r):X(this,fo)[r.type]=[r],r.install(),this.emit("plugin-added",r),this}getPlugin(t){for(const n of Object.values(X(this,fo))){const r=n.find(a=>a.id===t);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](t){return X(this,fo)[t]}iteratePlugins(t){Object.values(X(this,fo)).flat(1).forEach(t)}removePlugin(t){this.log(`Removing plugin ${t.id}`),this.emit("plugin-remove",t),t.uninstall&&t.uninstall();const n=X(this,fo)[t.type],r=n.findIndex(o=>o.id===t.id);r!==-1&&n.splice(r,1);const i={plugins:{...this.getState().plugins,[t.id]:void 0}};this.setState(i)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),X(this,Iy).call(this),this.iteratePlugins(t=>{this.removePlugin(t)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",X(this,ed)),window.removeEventListener("offline",X(this,ed)))}hideInfo(){const{info:t}=this.getState();this.setState({info:t.slice(1)}),this.emit("info-hidden")}info(t,n="info",r=3e3){const a=typeof t=="object";this.setState({info:[...this.getState().info,{type:n,message:a?t.message:t,details:a?t.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(t,n){const{logger:r}=this.opts;switch(n){case"error":r.error(t);break;case"warning":r.warn(t);break;default:r.debug(t);break}}registerRequestClient(t,n){X(this,Ry).set(t,n)}
638getRequestClientForFile(t){if(!t.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${t.id}`);const n=X(this,Ry).get(t.remote.requestClientId);if(n==null)throw new Error(`requestClientId "${t.remote.requestClientId}" not registered for file "${t.id}"`);return n}restore(t){return this.log(`Core: attempting to restore upload "${t}"`),this.getState().currentUploads[t]?ct(this,ws,Cx).call(this,t):(ct(this,ws,Fb).call(this,t),Promise.reject(new Error("Nonexistent upload")))}[Symbol.for("uppy test: createUpload")](...t){return ct(this,ws,Nx).call(this,...t)}addResultData(t,n){if(!ct(this,ws,aH).call(this,t)){this.log(`Not setting result for an upload that has been removed: ${t}`);return}const{currentUploads:r}=this.getState(),a={...r[t],result:{...r[t].result,...n}};this.setState({currentUploads:{...r,[t]:a}})}async upload(){var a;(a=X(this,fo).uploader)!=null&&a.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();if(ct(this,ws,AP).call(this).length>0){const i=await ct(this,ws,TP).call(this);if(!(this.getFiles().filter(l=>l.progress.uploadStarted==null).length>0))return this.emit("complete",i),i;({files:t}=this.getState())}const r=this.opts.onBeforeUpload(t);return r===!1?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(r&&typeof r=="object"&&(t=r,this.setState({files:t})),Promise.resolve().then(()=>X(this,po).validateMinNumberOfFiles(t)).catch(i=>{throw ct(this,ws,iu).call(this,[i]),i}).then(()=>{if(!ct(this,ws,tH).call(this,t))throw new wo(this.i18n("missingRequiredMetaField"))}).catch(i=>{throw i}).then(async()=>{const{currentUploads:i}=this.getState(),o=Object.values(i).flatMap(m=>m.fileIDs),l=[];Object.keys(t).forEach(m=>{const u=this.getFile(m);!u.progress.uploadStarted&&o.indexOf(m)===-1&&l.push(u.id)});const c=ct(this,ws,Nx).call(this,l),d=await ct(this,ws,Cx).call(this,c);return this.emit("complete",d),d}).catch(i=>{throw this.emit("error",i),this.log(i,"error"),i}))}};fo=new WeakMap,po=new WeakMap,Iy=new WeakMap,Mu=new WeakMap,sf=new WeakMap,nf=new WeakMap,$u=new WeakMap,ws=new WeakSet,iu=function(t){for(const o of t)o.isRestriction?this.emit("restriction-failed",o.file,o):this.emit("error",o,o.file),this.log(o,"warning");const n=t.filter(o=>o.isUserFacing),r=4,a=n.slice(0,r),i=n.slice(r);a.forEach(({message:o,details:l=""})=>{this.info({message:o,details:l},"error",this.opts.infoTimeout)}),i.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:i.length})})},kP=function(t){const{missingFields:n,error:r}=X(this,po).getMissingRequiredMetaFields(t);return n.length>0?(this.setFileState(t.id,{missingRequiredMetaFields:n,error:r.message}),this.log(r.message),this.emit("restriction-failed",t,r),!1):(n.length===0&&t.missingRequiredMetaFields&&this.setFileState(t.id,{missingRequiredMetaFields:[]}),!0)},tH=function(t){let n=!0;for(const r of Object.values(t))ct(this,ws,kP).call(this,r)||(n=!1);return n},PP=function(t){const{allowNewUpload:n}=this.getState();if(n===!1){const r=new wo(this.i18n("noMoreFilesAllowed"),{file:t});throw ct(this,ws,iu).call(this,[r]),r}},sH=function(t){const n=t instanceof File?{name:t.name,type:t.type,size:t.size,data:t}:t,r=GW(n),a=spe(r,n),i=KW(a).extension,o=Xhe(n,this.getID()),l=n.meta||{};l.name=a,l.type=r;const c=Number.isFinite(n.data.size)?n.data.size:null;return{source:n.source||"",id:o,name:a,extension:i||"",meta:{...this.getState().meta,...l},type:r,data:n.data,progress:{percentage:0,bytesUploaded:!1,bytesTotal:c,uploadComplete:!1,uploadStarted:null},size:c,isGhost:!1,isRemote:n.isRemote||!1,remote:n.remote,preview:n.preview}},EP=function(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(t=>{t.isRestriction||this.log(t.stack||t.message||t)})},4))},DP=function(t){var o;let{files:n}=this.getState(),r={...n};const a=[],i=[];for(const l of t)try{let c=ct(this,ws,sH).call(this,l);const d=(o=n[c.id])==null?void 0:o.isGhost;d&&(c={...n[c.id],isGhost:!1,data:l.data},this.log(`Replaced the blob in the restored ghost file: ${c.name}, ${c.id}`));const m=this.opts.onBeforeFileAdded(c,r);if(n=this.getState().files,r={...n,...r},!m&&this.checkIfFileAlreadyExists(c.id))throw new wo(this.i18n("noDuplicates",{fileName:c.name??this.i18n("unnamed")}),{file:l});if(m===!1&&!d)throw new wo("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:l});typeof m=="object"&&m!==null&&(c=m),X(this,po).validateSingleFile(c),r[c.id]=c,a.push(c)}catch(c){i.push(c)}try{X(this,po).validateAggregateRestrictions(Object.values(n),a)}catch(l){return i.push(l),{nextFilesState:n,validFilesToAdd:[],errors:i}}return{nextFilesState:r,validFilesToAdd:a,errors:i}},AP=function(){const{files:t}=this.getState();return Object.keys(t).filter(n=>{const r=t[n];return r.error&&(!r.missingRequiredMetaFields||r.missingRequiredMetaFields.length===0)})},TP=async function(){const t=ct(this,ws,AP).call(this),n={...this.get
638State().files};if(t.forEach(a=>{n[a]={...n[a],isPaused:!1,error:null}}),this.setState({files:n,error:null}),this.emit("retry-all",this.getFilesByIds(t)),t.length===0)return{successful:[],failed:[]};const r=ct(this,ws,Nx).call(this,t,{forceAllowNewUpload:!0});return ct(this,ws,Cx).call(this,r)},Zj=new WeakMap,OP=function(){const t=ct(this,ws,nH).call(this);let n=null;t!=null&&(n=Math.round(t*100),n>100?n=100:n<0&&(n=0)),this.emit("progress",n??0),this.setState({totalProgress:n??0})},Iu=new WeakMap,nH=function(){const n=this.getFiles().filter(c=>c.progress.uploadStarted||c.progress.preprocess||c.progress.postprocess);if(n.length===0)return 0;if(n.every(c=>c.progress.uploadComplete))return 1;const r=c=>c.progress.bytesTotal!=null&&c.progress.bytesTotal!==0,a=n.filter(r),i=n.filter(c=>!r(c));if(a.every(c=>c.progress.uploadComplete)&&i.length>0&&!i.every(c=>c.progress.uploadComplete))return null;const o=a.reduce((c,d)=>c+(d.progress.bytesTotal??0),0),l=a.reduce((c,d)=>c+(d.progress.bytesUploaded||0),0);return o===0?0:l/o},rH=function(){const t=(a,i,o)=>{let l=a.message||"Unknown error";a.details&&(l+=` ${a.details}`),this.setState({error:l}),i!=null&&i.id in this.getState().files&&this.setFileState(i.id,{error:l,response:o})};this.on("error",t),this.on("upload-error",(a,i,o)=>{if(t(i,a,o),typeof i=="object"&&i.message){this.log(i.message,"error");const l=new Error(this.i18n("failedToUpload",{file:(a==null?void 0:a.name)??""}));l.isUserFacing=!0,l.details=i.message,i.details&&(l.details+=` ${i.details}`),ct(this,ws,iu).call(this,[l])}else ct(this,ws,iu).call(this,[i])});let n=null;this.on("upload-stalled",(a,i)=>{const{message:o}=a,l=i.map(c=>c.meta.name).join(", ");n||(this.info({message:o,details:l},"warning",this.opts.infoTimeout),n=setTimeout(()=>{n=null},this.opts.infoTimeout)),this.log(`${o} ${l}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});const r=a=>{const i=a.filter(l=>{const c=l!=null&&this.getFile(l.id);return c||this.log(`Not setting progress for a file that has been removed: ${l==null?void 0:l.id}`),c}),o=Object.fromEntries(i.map(l=>[l.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:l.size}}]));this.patchFilesState(o)};this.on("upload-start",r),this.on("upload-progress",X(this,Zj)),this.on("upload-success",(a,i)=>{if(a==null||!this.getFile(a.id)){this.log(`Not setting progress for a file that has been removed: ${a==null?void 0:a.id}`);return}const o=this.getFile(a.id).progress;this.setFileState(a.id,{progress:{...o,postprocess:X(this,$u).size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:o.bytesTotal},response:i,uploadURL:i.uploadURL,isPaused:!1}),a.size==null&&this.setFileState(a.id,{size:i.bytesUploaded||o.bytesTotal}),X(this,Iu).call(this)}),this.on("preprocess-progress",(a,i)=>{if(a==null||!this.getFile(a.id)){this.log(`Not setting progress for a file that has been removed: ${a==null?void 0:a.id}`);return}this.setFileState(a.id,{progress:{...this.getFile(a.id).progress,preprocess:i}})}),this.on("preprocess-complete",a=>{if(a==null||!this.getFile(a.id)){this.log(`Not setting progress for a file that has been removed: ${a==null?void 0:a.id}`);return}const i={...this.getState().files};i[a.id]={...i[a.id],progress:{...i[a.id].progress}},delete i[a.id].progress.preprocess,this.setState({files:i})}),this.on("postprocess-progress",(a,i)=>{if(a==null||!this.getFile(a.id)){this.log(`Not setting progress for a file that has been removed: ${a==null?void 0:a.id}`);return}this.setFileState(a.id,{progress:{...this.getState().files[a.id].progress,postprocess:i}})}),this.on("postprocess-complete",a=>{if(a==null||!this.getFile(a.id)){this.log(`Not setting progress for a file that has been removed: ${a==null?void 0:a.id}`);return}const i={...this.getState().files};i[a.id]={...i[a.id],progress:{...i[a.id].progress}},delete i[a.id].progress.postprocess,this.setState({files:i})}),this.on("restored",()=>{X(this,Iu).call(this)}),this.on("dashboard:file-edit-complete",a=>{a&&ct(this,ws,kP).call(this,a)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",X(this,ed)),window.addEventListener("offline",X(this,ed)),setTimeout(X(this,ed),3e3))},ed=new WeakMap,Ry=new WeakMap,Nx=function(t,n={}){const{forceAllowNewUpload:r=!1}=n,{allowNewUpload:a,currentUploads:i}=this.getState();if(!a&&!r)throw new Error("Cannot create a new upload: already uploading.");const o=GT();
638return this.emit("upload",o,this.getFilesByIds(t)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...i,[o]:{fileIDs:t,step:0,result:{}}}}),o},aH=function(t){const{currentUploads:n}=this.getState();return n[t]},Fb=function(t){const n={...this.getState().currentUploads};delete n[t],this.setState({currentUploads:n})},Cx=async function(t){const n=()=>{const{currentUploads:o}=this.getState();return o[t]};let r=n();const a=[...X(this,sf),...X(this,nf),...X(this,$u)];try{for(let o=r.step||0;o<a.length&&r;o++){const l=a[o];this.setState({currentUploads:{...this.getState().currentUploads,[t]:{...r,step:o}}});const{fileIDs:c}=r;await l(c,t),r=n()}}catch(o){throw ct(this,ws,Fb).call(this,t),o}if(r){r.fileIDs.forEach(d=>{const m=this.getFile(d);m!=null&&m.progress.postprocess&&this.emit("postprocess-complete",m)});const o=r.fileIDs.map(d=>this.getFile(d)),l=o.filter(d=>!d.error),c=o.filter(d=>d.error);this.addResultData(t,{successful:l,failed:c,uploadID:t}),r=n()}let i;return r&&(i=r.result,ct(this,ws,Fb).call(this,t)),i==null&&(this.log(`Not setting result for an upload that has been removed: ${t}`),i={successful:[],failed:[],uploadID:t}),i},Ge(eN,"VERSION",tpe.version);let SP=eN;var hpe=0;function ve(e,t,n,r,a,i){t||(t={});var o,l,c=t;if("ref"in c)for(l in c={},t)l=="ref"?o=t[l]:c[l]=t[l];var d={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--hpe,__i:-1,__u:0,__source:a,__self:i};if(typeof e=="function"&&(o=e.defaultProps))for(l in o)c[l]===void 0&&(c[l]=o[l]);return Hs.vnode&&Hs.vnode(d),d}const fpe="4.3.2",ppe={version:fpe},n$=300;class xpe extends Xa{constructor(){super(...arguments);Ge(this,"ref",Che())}componentWillEnter(n){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(n,n$)}componentWillLeave(n){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(n,n$)}render(){const{children:n}=this.props;return ve("div",{className:"uppy-Informer-animated",ref:this.ref,children:n})}}function gpe(e,t){return Object.assign(e,t)}function ype(e,t){return(e==null?void 0:e.key)??t}function vpe(e,t){const n=e._ptgLinkedRefs||(e._ptgLinkedRefs={});return n[t]||(n[t]=r=>{e.refs[t]=r})}function nx(e){const t={};for(let n=0;n<e.length;n++)if(e[n]!=null){const r=ype(e[n],n.toString(36));t[r]=e[n]}return t}function bpe(e,t){e=e||{},t=t||{};const n=o=>Object.hasOwn(t,o)?t[o]:e[o],r={};let a=[];for(const o in e)Object.hasOwn(t,o)?a.length&&(r[o]=a,a=[]):a.push(o);const i={};for(const o in t){if(Object.hasOwn(r,o))for(let l=0;l<r[o].length;l++){const c=r[o][l];i[r[o][l]]=n(c)}i[o]=n(o)}for(let o=0;o<a.length;o++)i[a[o]]=n(a[o]);return i}const wpe=e=>e;class iH extends Xa{constructor(t,n){super(t,n),this.refs={},this.state={children:nx(ko(ko(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){const t=this.state.children;for(const n in t)t[n]&&this.performAppear(n)}componentWillReceiveProps(t){const n=nx(ko(t.children)||[]),r=this.state.children;this.setState(i=>({children:bpe(i.children,n)}));let a;for(a in n)if(Object.hasOwn(n,a)){const i=r&&Object.hasOwn(r,a);n[a]&&i&&this.currentlyTransitioningKeys[a]?(this.keysToEnter.push(a),this.keysToAbortLeave.push(a)):n[a]&&!i&&!this.currentlyTransitioningKeys[a]&&this.keysToEnter.push(a)}for(a in r)if(Object.hasOwn(r,a)){const i=n&&Object.hasOwn(n,a);r[a]&&!i&&!this.currentlyTransitioningKeys[a]&&this.keysToLeave.push(a)}}componentDidUpdate(){const{keysToEnter:t}=this;this.keysToEnter=[],t.forEach(this.performEnter);const{keysToLeave:n}=this;this.keysToLeave=[],n.forEach(this.performLeave)}_finishAbort(t){const n=this.keysToAbortLeave.indexOf(t);n!==-1&&this.keysToAbortLeave.splice(n,1)}performAppear(t){this.currentlyTransitioningKeys[t]=!0;const n=this.refs[t];n!=null&&n.componentWillAppear?n.componentWillAppear(this._handleDoneAppearing.bind(this,t)):this._handleDoneAppearing(t)}_handleDoneAppearing(t){const n=this.refs[t];n!=null&&n.componentDidAppear&&n.componentDidAppear(),delete this.currentlyTransitioningKeys[t],this._finishAbort(t);const r=nx(ko(this.props.children)||[]);(!r||!Object.hasOwn(r,t))&&this.performLeave(t)}performEnter(t){this.currentlyTransitioningKeys[t]=!0;const n=this.refs[t];n!=null&&n.componentWillEnter?n.componentWillEnter(this._handleDoneEntering.bind(this,t)):this._handleDoneEntering(t)}_handleDoneEntering(t){const n=this.refs[t];n!=null&&n.componentDidEnter&&n.componentDidEnter(),delete this.currentlyTransitioningKeys[t],this._finishAbort(t);const r=nx(ko(this.props.children)||[]);(!r||!Object.hasOwn(r,t))&&this.performLeave(t)}performLeave(t){if(this.keysToAbortLeave.indexOf(t)!==-1)return;this.currentlyTransitioningKeys[t]=!0;const r=this.refs[t];r!=null&&r.componentWillLeave?r.componentWillLeave(this._handleDoneLeaving.bind(this,t)):this._handleDoneLeaving(t)}_handleDoneLeaving(t){if(this.keysToAbortLeave.indexOf(t)!==-1)return;const r=this.refs[t];r!=null&&r.componentDidLeave&&r.componentDidLeave(),delete this.currentlyTransitioningKeys[t];const a=nx(ko(this.props.children)||[]);if(a&&Object.hasOwn(a,t))this.performEnter(t);else{const i=gpe({},this.state.children);delete i[t],this.setState({children:i})}}render({childFactory:t,transitionLeave:n,transitionName:r,transitionAppear:a,transitionEnter:i,transitionLeaveTimeout:o,transitionEnterTimeout:l,transitionAppearTimeout:c,component:d,...m},{children:u}){const h=Object.entries(u).map(([p,v])=>{if(!v)return;const y=vpe(this,p);return RW(t(v),{ref:y,key:p})}
638).filter(Boolean);return Ag(d,m,h)}}iH.defaultProps={component:"span",childFactory:wpe};class oH extends Rf{constructor(n,r){super(n,r);Ge(this,"render",n=>ve("div",{className:"uppy uppy-Informer",children:ve(iH,{children:n.info.map(r=>ve(xpe,{children:ve("p",{role:"alert",children:[r.message," ",r.details&&ve("span",{"aria-label":r.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:()=>alert(`${r.message} 
639
640 ${r.details}`),children:"?"})]})},r.message))})}));this.type="progressindicator",this.id=this.opts.id||"Informer",this.title="Informer"}install(){const{target:n}=this.opts;n&&this.mount(n,this)}}Ge(oH,"VERSION",ppe.version);var lH={exports:{}};/*!
641	Copyright (c) 2018 Jed Watson.
642	Licensed under the MIT License (MIT), see
643	http://jedwatson.github.io/classnames
644*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",o=0;o<arguments.length;o++){var l=arguments[o];l&&(i=a(i,r(l)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var o="";for(var l in i)t.call(i,l)&&i[l]&&(o=a(o,l));return o}function a(i,o){return o?i?i+" "+o:i+o:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(lH);var jpe=lH.exports;const Lo=Qs(jpe),Npe={position:"relative",width:"100%",minHeight:"100%"},Cpe={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};class Spe extends Xa{constructor(n){super(n);Ge(this,"handleScroll",()=>{this.setState({offset:this.base.scrollTop})});Ge(this,"handleResize",()=>{this.resize()});this.focusElement=null,this.state={offset:0,height:0}}componentDidMount(){this.resize(),window.addEventListener("resize",this.handleResize)}componentWillUpdate(){this.base.contains(document.activeElement)&&(this.focusElement=document.activeElement)}componentDidUpdate(){var n;(n=this.focusElement)!=null&&n.parentNode&&document.activeElement!==this.focusElement&&this.focusElement.focus(),this.focusElement=null,this.resize()}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}resize(){const{height:n}=this.state;n!==this.base.offsetHeight&&this.setState({height:this.base.offsetHeight})}render({data:n,rowHeight:r,renderRow:a,overscanCount:i=10,...o}){const{offset:l,height:c}=this.state;let d=Math.floor(l/r),m=Math.floor(c/r);i&&(d=Math.max(0,d-d%i),m+=i);const u=d+m+4,h=n.slice(d,u),p={...Npe,height:n.length*r},v={...Cpe,top:d*r};return ve("div",{onScroll:this.handleScroll,...o,children:ve("div",{role:"presentation",style:p,children:ve("div",{role:"presentation",style:v,children:h.map(a)})})})}}function kpe(){return ve("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30",children:ve("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"})})}function r$(e,t,n,r){return e===t?e:r===0?t:e+(t-e)*2**(-r/n)}const Ppe="4.2.3",Epe={version:Ppe},Dpe={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",cancel:"Cancel",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",retryUpload:"Retry upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}},Zo={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};function Ape(e){const t=Math.floor(e/3600)%24,n=Math.floor(e/60)%60,r=Math.floor(e%60);return{hours:t,minutes:n,seconds:r}}function Tpe(e){const t=Ape(e),n=t.hours===0?"":`${t.hours}h`,r=t.minutes===0?"":`${t.hours===0?t.minutes:` ${t.minutes.toString(10).padStart(2,"0")}`}m`,a=t.hours!==0?"":`${t.minutes===0?t.seconds:` ${t.seconds.toString(10).padStart(2,"0")}`}s`;return`${n}${r}${a}`}const Ope="·",a$=()=>` ${Ope} `;function Fpe(e){const{newFiles:t,isUploadStarted:n,recoveredState:r,i18n:a,uploadState:i,isSomeGhost:o,startUpload:l}=e,c=Lo("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":i===Zo.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":o}),d=t&&n&&!r?a("uploadXNewFiles",{smart_count:t}):a("uploadXFiles",{smart_count:t});return ve("button",{type:"button",className:c,"aria-label":a("uploadXFiles",{smart_count:t}),onClick:l,disabled:o,"data-uppy-super-focusable":!0,children:d})}function _pe(e){const{i18n:t,uppy:n}=e;return ve("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":t("retryUpload"),onClick:()=>n.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",he
644ight:"10",viewBox:"0 0 8 10",children:ve("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})}),t("retry")]})}function Mpe(e){const{i18n:t,uppy:n}=e;return ve("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:t("cancel"),"aria-label":t("cancel"),onClick:()=>n.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0,children:ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:ve("g",{fill:"none",fillRule:"evenodd",children:[ve("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),ve("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"})]})})})}function $pe(e){const{isAllPaused:t,i18n:n,isAllComplete:r,resumableUploads:a,uppy:i}=e,o=n(t?"resume":"pause");function l(){if(!r){if(!a){i.cancelAll();return}if(t){i.resumeAll();return}i.pauseAll()}}return ve("button",{title:o,"aria-label":o,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:l,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:ve("g",{fill:"none",fillRule:"evenodd",children:[ve("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),ve("path",{fill:"#FFF",d:t?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}function Ipe(e){const{i18n:t,doneButtonHandler:n}=e;return ve("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:n,"data-uppy-super-focusable":!0,children:t("done")})}function cH(){return ve("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:ve("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"})})}function Rpe(e){const{progress:t}=e,{value:n,mode:r,message:a}=t;return ve("div",{className:"uppy-StatusBar-content",children:[ve(cH,{}),r==="determinate"?`${Math.round(n*100)}% · `:"",a]})}function Bpe(e){const{numUploads:t,complete:n,totalUploadedSize:r,totalSize:a,totalETA:i,i18n:o}=e,l=t>1,c=yu(r);return ve("div",{className:"uppy-StatusBar-statusSecondary",children:[l&&o("filesUploadedOfTotal",{complete:n,smart_count:t}),ve("span",{className:"uppy-StatusBar-additionalInfo",children:[l&&a$(),a!=null?o("dataUploadedOfTotal",{complete:c,total:yu(a)}):o("dataUploadedOfUnknown",{complete:c}),a$(),i!=null&&o("xTimeLeft",{time:Tpe(i)})]})]})}function dH(e){const{i18n:t,complete:n,numUploads:r}=e;return ve("div",{className:"uppy-StatusBar-statusSecondary",children:t("filesUploadedOfTotal",{complete:n,smart_count:r})})}function Lpe(e){const{i18n:t,newFiles:n,startUpload:r}=e,a=Lo("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return ve("div",{className:"uppy-StatusBar-statusSecondary",children:[ve("div",{className:"uppy-StatusBar-statusSecondaryHint",children:t("xMoreFilesAdded",{smart_count:n})}),ve("button",{type:"button",className:a,"aria-label":t("uploadXFiles",{smart_count:n}),onClick:r,children:t("upload")})]})}function Upe(e){const{i18n:t,supportsUploadProgress:n,totalProgress:r,showProgressDetails:a,isUploadStarted:i,isAllComplete:o,isAllPaused:l,newFiles:c,numUploads:d,complete:m,totalUploadedSize:u,totalSize:h,totalETA:p,startUpload:v}=e,y=c&&i;if(!i||o)return null;const g=t(l?"paused":"uploading");function x(){return!l&&!y&&a?n?ve(Bpe,{numUploads:d,complete:m,totalUploadedSize:u,totalSize:h,totalETA:p,i18n:t}):ve(dH,{i18n:t,complete:m,numUploads:d}):null}return ve("div",{className:"uppy-StatusBar-content",title:g,children:[l?null:ve(cH,{}),ve("div",{className:"uppy-StatusBar-status",children:[ve("div",{className:"uppy-StatusBar-statusPrimary",children:n&&r!==0?`${g}: ${r}%`:g}),x(),y?ve(Lpe,{i18n:t,newFiles:c,startUpload:v}):null]})]})}function zpe(e){const{i18n:t}=e;return ve("div",{className:"uppy-StatusBar-content",role:"status",title:t("complete"),children:ve("div",{className:"uppy-StatusBar-status",children:ve("div",{className:"uppy-StatusBar-statusPrimary",children:[ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:ve("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),t("complete")]})})})}function qpe(e){const{error:t,i18n:n,complete:r,numUploads:a}=e;function i(){const o=`${n("uploadFailed")} 
645
646 ${t}`;alert(o)}return ve("div",{className:"uppy-StatusBar-content",title:n("uploadFailed"),children:[ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:ve("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})}),ve("div",{className:"uppy-StatusBar-status",children:[ve("div",{className:"uppy-StatusBar-statusPrimary",children:[n("uploadFailed"),ve("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":n("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:i,type:"button",children:"?"})]}),ve(dH,{i18n:n,complete:r,numUploads:a})]})]})}function DS(e){const t=[];let n="indeterminate",r;for(const{progress:i}of Object.values(e)){const{preprocess:o,postprocess:l}=i;r==null&&(o||l)&&({mode:n,message:r}=o||l),(o==null?void 0:o.mode)==="determinate"&&t.push(o.value),(l==null?void 0:l.mode)==="determinate"&&t.push(l.value)}const a=t.reduce((i,o)=>i+o/t.length,0);return{mode:n,message:r,value:a}}const{STATE_ERROR:i$,STATE_WAITING:Wpe,STATE_PREPROCESSING:AS,STATE_UPLOADING:N0,STATE_POSTPROCESSING:TS,STATE_COMPLETE:C0}=Zo;function Hpe({newFiles:e,allowNewUpload:t,isUploadInProgress:n,isAllPaused:r,resumableUploads:a,error:i,hideUploadButton:o=void 0,hidePauseResumeButton:l=!1,hideCancelButton:c=!1,hideRetryButton:d=!1,recoveredState:m,uploadState:u,totalProgress:h,files:p,supportsUploadProgress:v,hideAfterFinish:y=!1,isSomeGhost:g,doneButtonHandler:x=void 0,isUploadStarted:b,i18n:w,startUpload:j,uppy:N,isAllComplete:C,showProgressDetail
646s:P=void 0,numUploads:S,complete:E,totalSize:T,totalETA:z,totalUploadedSize:O}){function D(){switch(u){case TS:case AS:{const se=DS(p);return se.mode==="determinate"?se.value*100:h}case i$:return null;case N0:return v?h:null;default:return h}}function k(){switch(u){case TS:case AS:{const{mode:se}=DS(p);return se==="indeterminate"}case N0:return!v;default:return!1}}const F=D(),W=F??100,q=!i&&e&&(!n&&!r||m)&&t&&!o,H=!c&&u!==Wpe&&u!==C0,_=a&&!l&&u===N0,L=i&&!C&&!d,U=x&&u===C0,J=Lo("uppy-StatusBar-progress",{"is-indeterminate":k()}),I=Lo("uppy-StatusBar",`is-${u}`,{"has-ghosts":g}),re=(()=>{switch(u){case AS:case TS:return ve(Rpe,{progress:DS(p)});case C0:return ve(zpe,{i18n:w});case i$:return ve(qpe,{error:i,i18n:w,numUploads:S,complete:E});case N0:return ve(Upe,{i18n:w,supportsUploadProgress:v,totalProgress:h,showProgressDetails:P,isUploadStarted:b,isAllComplete:C,isAllPaused:r,newFiles:e,numUploads:S,complete:E,totalUploadedSize:O,totalSize:T,totalETA:z,startUpload:j});default:return null}})();return!(q||L||_||H||U)&&!re||u===C0&&y?null:ve("div",{className:I,children:[ve("div",{className:J,style:{width:`${W}%`},role:"progressbar","aria-label":`${W}%`,"aria-valuetext":`${W}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":F}),re,ve("div",{className:"uppy-StatusBar-actions",children:[q?ve(Fpe,{newFiles:e,isUploadStarted:b,recoveredState:m,i18n:w,isSomeGhost:g,startUpload:j,uploadState:u}):null,L?ve(_pe,{i18n:w,uppy:N}):null,_?ve($pe,{isAllPaused:r,i18n:w,isAllComplete:C,resumableUploads:a,uppy:N}):null,H?ve(Mpe,{i18n:w,uppy:N}):null,U?ve(Ipe,{i18n:w,doneButtonHandler:x}):null]})]})}const Vpe=2e3,Kpe=2e3;function Gpe(e,t,n,r){if(e)return Zo.STATE_ERROR;if(t)return Zo.STATE_COMPLETE;if(n)return Zo.STATE_WAITING;let a=Zo.STATE_WAITING;const i=Object.keys(r);for(let o=0;o<i.length;o++){const{progress:l}=r[i[o]];if(l.uploadStarted&&!l.uploadComplete)return Zo.STATE_UPLOADING;l.preprocess&&(a=Zo.STATE_PREPROCESSING),l.postprocess&&a!==Zo.STATE_PREPROCESSING&&(a=Zo.STATE_POSTPROCESSING)}return a}const Ype={hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null};var $k,td,sd,Ru,Wl,tN,uH,By;let Qpe=($k=class extends Rf{constructor(n,r){super(n,{...Ype,...r});Qe(this,tN);Qe(this,td);Qe(this,sd);Qe(this,Ru);Qe(this,Wl);Ge(this,"startUpload",()=>this.uppy.upload().catch(()=>{}));Qe(this,By,()=>{const{recoveredState:n}=this.uppy.getState();if(et(this,Ru,null),et(this,Wl,null),n){et(this,sd,Object.values(n.files).reduce((r,{progress:a})=>r+a.bytesUploaded,0)),this.uppy.emit("restore-confirmed");return}et(this,td,performance.now()),et(this,sd,0)});this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=Dpe,this.i18nInit(),this.render=this.render.bind(this),this.install=this.install.bind(this)}render(n){const{capabilities:r,files:a,allowNewUpload:i,totalProgress:o,error:l,recoveredState:c}=n,{newFiles:d,startedFiles:m,completeFiles:u,isUploadStarted:h,isAllComplete:p,isAllPaused:v,isUploadInProgress:y,isSomeGhost:g}=this.uppy.getObjectOfFilesPerState(),x=c?Object.values(a):d,b=!!r.resumableUploads,w=r.uploadProgress!==!1;let j=null,N=0;m.every(P=>P.progress.bytesTotal!=null&&P.progress.bytesTotal!==0)?(j=0,m.forEach(P=>{j+=P.progress.bytesTotal||0,N+=P.progress.bytesUploaded||0})):m.forEach(P=>{N+=P.progress.bytesUploaded||0});const C=ct(this,tN,uH).call(this,{uploaded:N,total:j});return Hpe({error:l,uploadState:Gpe(l,p,c,n.files||{}),allowNewUpload:i,totalProgress:o,totalSize:j,totalUploadedSize:N,isAllComplete:!1,isAllPaused:v,isUploadStarted:h,isUploadInProgress:y,isSomeGhost:g,recoveredState:c,complete:u.length,newFiles:x.length,numUploads:m.length,totalETA:C,files:a,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:b,supportsUploadProgress:w,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideAfterFinish:this.opts.hideAfterFinish})}onMount(){const n=this.el;kW(n)||(n.dir="ltr")}install(){const{target:n}=this.opts;n&&this.mount(n,this),this.uppy.on("upload",X(this,By)),et(this,td,performance.now()),et(this,sd,this.uppy.getFiles().reduce((r,a)=>r+a.progress.bytesUploaded,0))}uninstall(){this.unmount(),this.uppy.off("upload",X(this,By))}},td=new WeakMap,sd=new WeakMap,Ru=new WeakMap,Wl=new WeakMap,tN=new WeakSet,uH=function(n){if(n.total==null||n.total===0)return null;const r=n.total-n.uploaded;if(r<=0)return null;X(this,td)??et(this,td,performance.now());const a=performance.now()-X(this,td);if(a===0)return Math.round((X(this,Wl)??0)/100)/10;const i=n.uploaded-X(this,sd);if(et(this,sd,n.uploaded),i<=0)return Math.round((X(this,Wl)??0)/100)/10;const o=i/a,l=X(this,Ru)==null?o:r$(o,X(this,Ru),Vpe,a);et(this,Ru,l);const c=r/l,d=Math.max(X(this,Wl)-a,0),m=X(this,Wl)==null?c:r$(c,d,Kpe,a);return et(this,Wl,m),et(this,td,performance.now()),Math.round(m/100)/10},By=new WeakMap,Ge($k,"VERSION",Epe.version),$k);const Jpe=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function Xpe(e,t,n){const r=Jpe.exec(e),a=t.mimeType??(r==null?void 0:r[1])??"plain/text";let i;if((r==null?void 0:r[2])!=null){const o=atob(decodeURIComponent(r[3])),l=new Uint8Array(o.length);for(let c=0;c<o.length;
vendor: 10,379 bytes, line 646
646c++)l[c]=o.charCodeAt(c);i=[l]}else(r==null?void 0:r[3])!=null&&(i=[decodeURIComponent(r[3])]);return new Blob(i,{type:a})}function o$(e){return e.startsWith("blob:")}function l$(e){return e?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(e):!1}function Pn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var mH=typeof self<"u"?self:global;const Fg=typeof navigator<"u",Zpe=Fg&&typeof HTMLImageElement>"u",c$=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),hH=mH.Buffer,fH=!!hH,exe=e=>e!==void 0;function pH(e){return e===void 0||(e instanceof Map?e.size===0:Object.values(e).filter(exe).length===0)}function Zr(e){let t=new Error(e);throw delete t.stack,t}function d$(e){let t=function(n){let r=0;return n.ifd0.enabled&&(r+=1024),n.exif.enabled&&(r+=2048),n.makerNote&&(r+=2048),n.userComment&&(r+=1024),n.gps.enabled&&(r+=512),n.interop.enabled&&(r+=100),n.ifd1.enabled&&(r+=1024),r+2048}(e);return e.jfif.enabled&&(t+=50),e.xmp.enabled&&(t+=2e4),e.iptc.enabled&&(t+=14e3),e.icc.enabled&&(t+=6e3),t}const OS=e=>String.fromCharCode.apply(null,e),u$=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0;let _g=class th{static from(t,n){return t instanceof this&&t.le===n?t:new th(t,void 0,void 0,n)}constructor(t,n=0,r,a){if(typeof a=="boolean"&&(this.le=a),Array.isArray(t)&&(t=new Uint8Array(t)),t===0)this.byteOffset=0,this.byteLength=0;else if(t instanceof ArrayBuffer){r===void 0&&(r=t.byteLength-n);let i=new DataView(t,n,r);this._swapDataView(i)}else if(t instanceof Uint8Array||t instanceof DataView||t instanceof th){r===void 0&&(r=t.byteLength-n),(n+=t.byteOffset)+r>t.byteOffset+t.byteLength&&Zr("Creating view outside of available memory in ArrayBuffer");let i=new DataView(t.buffer,n,r);this._swapDataView(i)}else if(typeof t=="number"){let i=new DataView(new ArrayBuffer(t));this._swapDataView(i)}else Zr("Invalid input argument for BufferView: "+t)}_swapArrayBuffer(t){this._swapDataView(new DataView(t))}_swapBuffer(t){this._swapDataView(new DataView(t.buffer,t.byteOffset,t.byteLength))}_swapDataView(t){this.dataView=t,this.buffer=t.buffer,this.byteOffset=t.byteOffset,this.byteLength=t.byteLength}_lengthToEnd(t){return this.byteLength-t}set(t,n,r=th){return t instanceof DataView||t instanceof th?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t instanceof Uint8Array||Zr("BufferView.set(): Invalid data argument."),this.toUint8().set(t,n),new r(this,n,t.byteLength)}subarray(t,n){return n=n||this._lengthToEnd(t),new th(this,t,n)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(t,n){return new Uint8Array(this.buffer,this.byteOffset+t,n)}getString(t=0,n=this.byteLength){return a=this.getUint8Array(t,n),u$?u$.decode(a):fH?Buffer.from(a).toString("utf8"):decodeURIComponent(escape(OS(a)));var a}getLatin1String(t=0,n=this.byteLength){let r=this.getUint8Array(t,n);return OS(r)}getUnicodeString(t=0,n=this.byteLength){const r=[];for(let a=0;a<n&&t+a<this.byteLength;a+=2)r.push(this.getUint16(t+a));return OS(r)}getInt8(t){return this.dataView.getInt8(t)}getUint8(t){return this.dataView.getUint8(t)}getInt16(t,n=this.le){return this.dataView.getInt16(t,n)}getInt32(t,n=this.le){return this.dataView.getInt32(t,n)}getUint16(t,n=this.le){return this.dataView.getUint16(t,n)}getUint32(t,n=this.le){return this.dataView.getUint32(t,n)}getFloat32(t,n=this.le){return this.dataView.getFloat32(t,n)}getFloat64(t,n=this.le){return this.dataView.getFloat64(t,n)}getFloat(t,n=this.le){return this.dataView.getFloat32(t,n)}getDouble(t,n=this.le){return this.dataView.getFloat64(t,n)}getUintBytes(t,n,r){switch(n){case 1:return this.getUint8(t,r);case 2:return this.getUint16(t,r);case 4:return this.getUint32(t,r);case 8:return this.getUint64&&this.getUint64(t,r)}}getUint(t,n,r){switch(n){case 8:return this.getUint8(t,r);case 16:return this.getUint16(t,r);case 32:return this.getUint32(t,r);case 64:return this.getUint64&&this.getUint64(t,r)}}toString(t){return this.dataView.toString(t,this.constructor.name)}ensureChunk(){}};function FP(e,t){Zr(`${e} '${t}' was not loaded, try using full build of exifr.`)}let YT=class extends Map{constructor(t){super(),this.kind=t}get(t,n){return this.has(t)||FP(this.kind,t),n&&(t in n||function(r,a){Zr(`Unknown ${r} '${a}'.`)}(this.kind,t),n[t].enabled||FP(this.kind,t)),super.get(t)}keyList(){return Array.from(this.keys())}};var xH=new YT("file parser"),jo=new YT("segment parser"),QT=new YT("file reader");let txe=mH.fetch;function m$(e,t){return(n=e).startsWith("data:")||n.length>1e4?MP(e,t,"base64"):c$&&e.includes("://")?_P(e,t,"url",h$):c$?MP(e,t,"fs"):Fg?_P(e,t,"url",h$):void Zr("Invalid input argument");var n}async function _P(e,t,n,r){return QT.has(n)?MP(e,t,n):r?async function(a,i){let o=await i(a);return new _g(o)}(e,r):void Zr(`Parser ${n} is not loaded`)}async function MP(e,t,n){let r=new(QT.get(n))(e,t);return await r.read(),r}const h$=e=>txe(e).then(t=>t.arrayBuffer()),$P=e=>new Promise((t,n)=>{let r=new FileReader;r.onloadend=()=>t(r.result||new ArrayBuffer),r.onerror=n,r.readAsArrayBuffer(e)}),JT=new Map,sxe=new Map,nxe=new Map,S0=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],gH=["jfif","xmp","icc","iptc","ihdr"],IP=["tiff",...gH],Hr=["ifd0","ifd1","exif","gps","interop"],k0=[...IP,...Hr],P0=["makerNote","userComment"],yH=["translateKeys","translateValues","reviveValues","multiSegment"],E0=[...yH,"sanitize","mergeOutput","silentErrors"];let vH=class{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},rx=class extends vH{get needed(){return this.enabled||this.deps.size>0}constructor(t,n,r,a){if(super(),Pn(this,"enabled",!1),Pn(this,"skip",new Set),Pn(this,"pick",new Set),Pn(this,"deps",new Set),Pn(this,"translateKeys",!1),Pn(this,"translateValues",!1),Pn(this,"reviveValues",!1),this.key=t,this.enabled=n,this.parse=this.enabled,this.applyInheritables(a),this.canBeFiltered=Hr.includes(t),this.canBeFiltered&&(this.dict=JT.get(t)),r!==void 0)if(Array.isArray(r))this.parse=this.enabled=!0,this.canBeFiltered&&r.length>0&&this.translateTagSet(r,this.pick);else if(typeof r=="object"){if(this.enabled=!0,this.parse=r.parse!==!1,this.canBeFiltered){let{pick:i,skip:o}=r;i&&i.length>0&&this.translateTagSet(i,this.pick),o&&o.length>0&&this.translateTagSet(o,this.skip)}this.applyInheritables(r)}else r===!0||r===!1?this.parse=this.enabled=r:Zr(`Invalid options argument: ${r}`)}applyInheritables(t){let n,r;for(n of yH)r=t[n],r!==void 0&&(this[n]=r)}translateTagSet(t,n){if(this.dict){let r,a,{tagKeys:i,tagValues:o}=this.dict;for(r of t)typeof r=="string"?(a=o.indexOf(r),a===-1&&(a=i.indexOf(Number(r))),a!==-1&&n.add(Number(i[a]))):n.add(r)}else for(let r of t)n.add(r)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,Aw(this.pick,this.deps)):this.enabled&&this.pick.size>0&&Aw(this.pick,this.deps)}};var Pa={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},f$=new Map;class XT extends vH{static useCached(t){let n=f$.get(t);return n!==void 0||(n=new this(t),f$.set(t,n)),n}constructor(t){super(),t===!0?this.setupFromTrue():t===void 0?this.setupFromUndefined():Array.isArray(t)?this.setupFromArray(t):typeof t=="object"?this.setupFromObject(t):Zr(`Invalid options argument ${t}`),this.firstChunkSize===void 0&&(this.firstChunkSize=Fg?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let t;for(t of S0)this[t]=Pa[t];for(t of E0)this[t]=Pa[t];for(t of P0)this[t]=Pa[t];for(t of k0)this[t]=new rx(t,Pa[t],void 0,this)}setupFromTrue(){let t;for(t of S0)this[t]=Pa[t];for(t of E0)this[t]=Pa[t];for(t of P0)this[t]=!0;for(t of k0)this[t]=new rx(t,!0,void 0,this)}setupFromArray(t){let n;for(n of S0)this[n]=Pa[n];for(n of E0)this[n]=Pa[n];for(n of P0)this[n]=Pa[n];for(n of k0)this[n]=new rx(n,!1,void 0,this);this.setupGlobalFilters(t,void 0,Hr)}setupFromObject(t){let n;for(n of(Hr.ifd0=Hr.ifd0||Hr.image,Hr.ifd1=Hr.ifd1||Hr.thumbnail,Object.assign(this,t),S0))this[n]=FS(t[n],Pa[n]);for(n of E0)this[n]=FS(t[n],Pa[n]);for(n of P0)this[n]=FS(t[n],Pa[n]);for(n of IP)this[n]=new rx(n,Pa[n],t[n],this);for(n of Hr)this[n]=new rx(n,Pa[n],t[n],this.tiff);this.setupGlobalFilters(t.pick,t.skip,Hr,k0),t.tiff===!0?this.batchEnableWithBool(Hr,!0):t.tiff===!1?this.batchEnableWithUserValue(Hr,t):Array.isArray(t.tiff)?this.setupGlobalFilters(t.tiff,void 0,Hr):typeof t.tiff=="object"&&this.setupGlobalFilters(t.tiff.pick,t.tiff.skip,Hr)}batchEnableWithBool(t,n){for(let r of t)this[r].enabled=n}batchEnableWithUserValue(t,n){for(let r of t){let a=n[r];this[r].enabled=a!==!1&&a!==void 0}}setupGlobalFilters(t,n,r,a=r){if(t&&t.length){for(let o of a)this[o].enabled=!1;let i=p$(t,r);for(let[o,l]of i)Aw(this[o].pick,l),this[o].enabled=!0}else if(n&&n.length){let i=p$(n,r);for(let[o,l]of i)Aw(this[o].skip,l)}}filterNestedSegmentTags(){let{ifd0:t,exif:n,xmp:r,iptc:a,icc:i}=this;this.makerNote?n.deps.add(37500):n.skip.add(37500),this.userComment?n.deps.add(37510):n.skip.add(37510),r.enabled||t.skip.add(700),a.enabled||t.skip.add(33723),i.enabled||t.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:t,exif:n,gps:r,interop:a}=this;a.needed&&(n.deps.add(40965),t.deps.add(40965)),n.needed&&t.deps.add(34665),r.needed&&t.deps.add(34853),this.tiff.enabled=Hr.some(i=>this[i].enabled===!0)||this.makerNote||this.userComment;for(let i of Hr)this[i].finalizeFilters()}get onlyTiff(){return!gH.map(t=>this[t].enabled).some(t=>t===!0)&&this.tiff.enabled}checkLoadedPlugins(){for(let t of IP)this[t].enabled&&!jo.has(t)&&FP("segment parser",t)}}function p$(e,t){let n,r,a,i,o=[];for(a of t){for(i of(n=JT.get(a),r=[],n))(e.includes(i[0])||e.includes(i[1]))&&r.push(i[0]);r.length&&o.push([a,r])}return o}function FS(e,t){return e!==void 0?e:t!==void 0?t:void 0}function Aw(e,t){for(let n of t)e.add(n)}Pn(XT,"default",Pa);
vendor: 16,761 bytes, lines 646-647
646let rxe=class{constructor(t){Pn(this,"parsers",{}),Pn(this,"output",{}),Pn(this,"errors",[]),Pn(this,"pushToErrors",n=>this.errors.push(n)),this.options=XT.useCached(t)}async read(t){this.file=await function(n,r){return typeof n=="string"?m$(n,r):Fg&&!Zpe&&n instanceof HTMLImageElement?m$(n.src,r):n instanceof Uint8Array||n instanceof ArrayBuffer||n instanceof DataView?new _g(n):Fg&&n instanceof Blob?_P(n,r,"blob",$P):void Zr("Invalid input argument")}(t,this.options)}setup(){if(this.fileParser)return;let{file:t}=this,n=t.getUint16(0);for(let[r,a]of xH)if(a.canHandle(t,n))return this.fileParser=new a(this.options,this.file,this.parsers),t[r]=!0;this.file.close&&this.file.close(),Zr("Unknown file format")}async parse(){let{output:t,errors:n}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),n.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&n.length>0&&(t.errors=n),pH(r=t)?void 0:r;var r}async executeParsers(){let{output:t}=this;await this.fileParser.parse();let n=Object.values(this.parsers).map(async r=>{let a=await r.parse();r.assignToOutput(t,a)});this.options.silentErrors&&(n=n.map(r=>r.catch(this.pushToErrors))),await Promise.all(n)}async extractThumbnail(){this.setup();let{options:t,file:n}=this,r=jo.get("tiff",t);var a;if(n.tiff?a={start:0,type:"tiff"}:n.jpeg&&(a=await this.fileParser.getOrFindSegment("tiff")),a===void 0)return;let i=await this.fileParser.ensureSegmentChunk(a),o=this.parsers.tiff=new r(i,t,n),l=await o.extractThumbnail();return n.close&&n.close(),l}};class ph{static findPosition(t,n){let r=t.getUint16(n+2)+2,a=typeof this.headerLength=="function"?this.headerLength(t,n,r):this.headerLength,i=n+a,o=r-a;return{offset:n,length:r,headerLength:a,start:i,size:o,end:i+o}}static parse(t,n={}){return new this(t,new XT({[this.type]:n}),t).parse()}normalizeInput(t){return t instanceof _g?t:new _g(t)}constructor(t,n={},r){Pn(this,"errors",[]),Pn(this,"raw",new Map),Pn(this,"handleError",a=>{if(!this.options.silentErrors)throw a;this.errors.push(a.message)}),this.chunk=this.normalizeInput(t),this.file=r,this.type=this.constructor.type,this.globalOptions=this.options=n,this.localOptions=n[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(t,n){let r=nxe.get(n),a=sxe.get(n),i=JT.get(n),o=this.options[n],l=o.reviveValues&&!!r,c=o.translateValues&&!!a,d=o.translateKeys&&!!i,m={};for(let[u,h]of t)l&&r.has(u)?h=r.get(u)(h):c&&a.has(u)&&(h=this.translateValue(h,a.get(u))),d&&i.has(u)&&(u=i.get(u)||u),m[u]=h;return m}translateValue(t,n){return n[t]||n.DEFAULT||t}assignToOutput(t,n){this.assignObjectToOutput(t,this.constructor.type,n)}assignObjectToOutput(t,n,r){if(this.globalOptions.mergeOutput)return Object.assign(t,r);t[n]?Object.assign(t[n],r):t[n]=r}}Pn(ph,"headerLength",4),Pn(ph,"type",void 0),Pn(ph,"multiSegment",!1),Pn(ph,"canHandle",()=>!1);function axe(e){return e===192||e===194||e===196||e===219||e===221||e===218||e===254}function ixe(e){return e>=224&&e<=239}function oxe(e,t,n){for(let[r,a]of jo)if(a.canHandle(e,t,n))return r}class x$ extends class{constructor(t,n,r){Pn(this,"errors",[]),Pn(this,"ensureSegmentChunk",async a=>{let i=a.start,o=a.size||65536;if(this.file.chunked)if(this.file.available(i,o))a.chunk=this.file.subarray(i,o);else try{a.chunk=await this.file.readChunk(i,o)}catch(l){Zr(`Couldn't read segment: ${JSON.stringify(a)}. ${l.message}`)}else this.file.byteLength>i+o?a.chunk=this.file.subarray(i,o):a.size===void 0?a.chunk=this.file.subarray(i):Zr("Segment unreachable: "+JSON.stringify(a));return a.chunk}),this.extendOptions&&this.extendOptions(t),this.options=t,this.file=n,this.parsers=r}injectSegment(t,n){this.options[t].enabled&&this.createParser(t,n)}createParser(t,n){let r=new(jo.get(t))(n,this.options,this.file);return this.parsers[t]=r}createParsers(t){for(let n of t){let{type:r,chunk:a}=n,i=this.options[r];if(i&&i.enabled){let o=this.parsers[r];o&&o.append||o||this.createParser(r,a)}}}async readSegments(t){let n=t.map(this.ensureSegmentChunk);await Promise.all(n)}}{constructor(...t){super(...t),Pn(this,"appSegments",[]),Pn(this,"jpegSegments",[]),Pn(this,"unknownSegments",[])}static canHandle(t,n){return n===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(t){t===!0?(this.findAll=!0,this.wanted=new Set(jo.keyList())):(t=t===void 0?jo.keyList().filter(n=>this.options[n].enabled):t.filter(n=>this.options[n].enabled&&jo.has(n)),this.findAll=!1,this.remaining=new Set(t),this.wanted=new Set(t)),this.unfinishedMultiSegment=!1}async findAppSegments(t=0,n){this.setupSegmentFinderArgs(n);let{file:r,findAll:a,wanted:i,remaining:o}=this;if(!a&&this.file.chunked&&(a=Array.from(i).some(l=>{let c=jo.get(l),d=this.options[l];return c.multiSegment&&d.multiSegment}),a&&await this.file.readWhole()),t=this.findAppSegmentsInRange(t,r.byteLength),!this.options.onlyTiff&&r.chunked){let l=!1;for(;o.size>0&&!l&&(r.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:c}=r,d=this.appSegments.some(m=>!this.file.available(m.offset||m.start,m.length||m.size));if(l=t>c&&!d?!await r.readNextChunk(t):!await r.readNextChunk(c),(t=this.findAppSegmentsInRange(t,r.byteLength))===void 0)return}}}findAppSegmentsInRange(t,n){n-=2;let r,a,i,o,l,c,{file:d,findAll:m,wanted:u,remaining:h,options:p}=this;for(;t<n;t++)if(d.getUint8(t)===255){if(r=d.getUint8(t+1),ixe(r)){if(a=d.getUint16(t+2),i=oxe(d,t,a),i&&u.has(i)&&(o=jo.get(i),l=o.findPosition(d,t),c=p[i],l.type=i,this.appSegments.push(l),!m&&(o.multiSegment&&c.multiSegment?(this.unfinishedMultiSegment=l.chunkNumber<l.chunkCount,this.unfinishedMultiSegment||h.delete(i)):h.delete(i),h.size===0)))break;p.recordUnknownSegments&&(l=ph.findPosition(d,t),l.marker=r,this.unknownSegments.push(l)),t+=a+1}else if(axe(r)){if(a=d.getUint16(t+2),r===218&&p.stopAfterSos!==!1)return;p.recordJpegSegments&&this.jpegSegments.push({offset:t,length:a,marker:r}),t+=a+1}}return t}mergeMultiSegments(){if(!this.appSegments.some(n=>n.multiSegment))return;let t=function(n,r){let a,i,o,l=new Map;for(let c=0;c<n.length;c++)a=n[c],i=a[r],l.has(i)?o=l.get(i):l.set(i,o=[]),o.push(a);return Array.from(l)}(this.appSegments,"type");this.mergedAppSegments=t.map(([n,r])=>{let a=jo.get(n,this.options);return a.handleMultiSegments?{type:n,chunk:a.handleMultiSegments(r)}:r[0]})}getSegment(t){return this.appSegments.find(n=>n.type===t)}async getOrFindSegment(t){let n=this.getSegment(t);return n===void 0&&(await this.findAppSegments(0,[t]),n=this.getSegment(t)),n}}Pn(x$,"type","jpeg"),xH.set("jpeg",x$);const lxe=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4];class cxe extends ph{parseHeader(){var t=this.chunk.getUint16();t===18761?this.le=!0:t===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(t,n,r=new Map){let{pick:a,skip:i}=this.options[n];a=new Set(a);let o=a.size>0,l=i.size===0,c=this.chunk.getUint16(t);t+=2;for(let d=0;d<c;d++){let m=this.chunk.getUint16(t);if(o){if(a.has(m)&&(r.set(m,this.parseTag(t,m,n)),a.delete(m),a.size===0))break}else!l&&i.has(m)||r.set(m,this.parseTag(t,m,n));t+=12}return r}parseTag(t,n,r){let{chunk:a}=this,i=a.getUint16(t+2),o=a.getUint32(t+4),l=lxe[i];if(l*o<=4?t+=8:t=a.getUint32(t+8),(i<1||i>13)&&Zr(`Invalid TIFF value type. block: ${r.toUpperCase()}, tag: ${n.toString(16)}, type: ${i}, offset ${t}`),t>a.byteLength&&Zr(`Invalid TIFF value offset. block: ${r.toUpperCase()}, tag: ${n.toString(16)}, type: ${i}, offset ${t} is outside of chunk size ${a.byteLength}`),i===1)return a.getUint8Array(t,o);if(i===2)return(c=function(d){for(;d.endsWith("\0");)d=d.slice(0,-1);return d}(c=a.getString(t,o)).trim())===""?void 0:c;var c;if(i===7)return a.getUint8Array(t,o);if(o===1)return this.parseTagValue(i,t);{let d=new(function(u){switch(u){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}}(i))(o),m=l;for(let u=0;u<o;u++)d[u]=this.parseTagValue(i,t),t+=m;return d}}parseTagValue(t,n){let{chunk:r}=this;switch(t){case 1:return r.getUint8(n);case 3:return r.getUint16(n);case 4:return r.getUint32(n);case 5:return r.getUint32(n)/r.getUint32(n+4);case 6:return r.getInt8(n);case 8:return r.getInt16(n);case 9:return r.getInt32(n);case 10:return r.getInt32(n)/r.getInt32(n+4);case 11:return r.getFloat(n);case 12:return r.getDouble(n);case 13:return r.getUint32(n);default:Zr(`Invalid tiff type ${t}`)}}}class _S extends cxe{static canHandle(t,n){return t.getUint8(n+1)===225&&t.getUint32(n+4)===1165519206&&t.getUint16(n+8)===0}async parse(){this.parseHeader();let{options:t}=this;return t.ifd0.enabled&&await this.parseIfd0Block(),t.exif.enabled&&await this.safeParse("parseExifBlock"),t.gps.enabled&&await this.safeParse("parseGpsBlock"),t.interop.enabled&&await this.safeParse("parseInteropBlock"),t.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(t){let n=this[t]();return n.catch!==void 0&&(n=n.catch(this.handleError)),n}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let t=this.chunk.getUint16(this.ifd0Offset),n=this.ifd0Offset+2+12*t;this.ifd1Offset=this.chunk.getUint32(n)}}parseBlock(t,n){let r=new Map;return this[n]=r,this.parseTags(t,n,r),r}async parseIfd0Block(){if(this.ifd0)return;let{file:t}=this;this.findIfd0Offset(),this.ifd0Offset<8&&Zr("Malformed EXIF data"),!t.chunked&&this.ifd0Offset>t.byteLength&&Zr(`IFD0 offset points to outside of file.
647this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${t.byteLength}`),t.tiff&&await t.ensureChunk(this.ifd0Offset,d$(this.options));let n=this.parseBlock(this.ifd0Offset,"ifd0");return n.size!==0?(this.exifOffset=n.get(34665),this.interopOffset=n.get(40965),this.gpsOffset=n.get(34853),this.xmp=n.get(700),this.iptc=n.get(33723),this.icc=n.get(34675),this.options.sanitize&&(n.delete(34665),n.delete(40965),n.delete(34853),n.delete(700),n.delete(33723),n.delete(34675)),n):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,d$(this.options));let t=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=t.get(40965)),this.makerNote=t.get(37500),this.userComment=t.get(37510),this.options.sanitize&&(t.delete(40965),t.delete(37500),t.delete(37510)),this.unpack(t,41728),this.unpack(t,41729),t}unpack(t,n){let r=t.get(n);r&&r.length===1&&t.set(n,r[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let t=this.parseBlock(this.gpsOffset,"gps");return t&&t.has(2)&&t.has(4)&&(t.set("latitude",g$(...t.get(2),t.get(1))),t.set("longitude",g$(...t.get(4),t.get(3)))),t}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(t=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||t))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let t=this.ifd1.get(513),n=this.ifd1.get(514);return this.chunk.getUint8Array(t,n)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let t,n,r,a={};for(n of Hr)if(t=this[n],!pH(t))if(r=this.canTranslate?this.translateBlock(t,n):Object.fromEntries(t),this.options.mergeOutput){if(n==="ifd1")continue;Object.assign(a,r)}else a[n]=r;return this.makerNote&&(a.makerNote=this.makerNote),this.userComment&&(a.userComment=this.userComment),a}assignToOutput(t,n){if(this.globalOptions.mergeOutput)Object.assign(t,n);else for(let[r,a]of Object.entries(n))this.assignObjectToOutput(t,r,a)}}function g$(e,t,n,r){var a=e+t/60+n/3600;return r!=="S"&&r!=="W"||(a*=-1),a}Pn(_S,"type","tiff"),Pn(_S,"headerLength",10),jo.set("tiff",_S);const ZT={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1};Object.assign({},ZT,{firstChunkSize:4e4,gps:[1,2,3,4]});Object.assign({},ZT,{tiff:!1,ifd1:!0,mergeOutput:!1});const dxe=Object.assign({},ZT,{firstChunkSize:4e4,ifd0:[274]});async function uxe(e){let t=new rxe(dxe);await t.read(e);let n=await t.parse();if(n&&n.ifd0)return n.ifd0[274]}const mxe=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}});let Sx=!0,kx=!0;if(typeof navigator=="object"){let e=navigator.userAgent;if(e.includes("iPad")||e.includes("iPhone")){let t=e.match(/OS (\d+)_(\d+)/);if(t){let[,n,r]=t;Sx=Number(n)+.1*Number(r)<13.4,kx=!1}}else if(e.includes("OS X 10")){let[,t]=e.match(/OS X 10[_.](\d+)/);Sx=kx=Number(t)<15}if(e.includes("Chrome/")){let[,t]=e.match(/Chrome\/(\d+)/);Sx=kx=Number(t)<81}else if(e.includes("Firefox/")){let[,t]=e.match(/Firefox\/(\d+)/);Sx=kx=Number(t)<77}}async function hxe(e){let t=await uxe(e);return Object.assign({canvas:Sx,css:kx},mxe[t])}class fxe extends _g{constructor(...t){super(...t),Pn(this,"ranges",new pxe),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(t,n,r){if(t===0&&this.byteLength===0&&r){let a=new DataView(r.buffer||r,r.byteOffset,r.byteLength);this._swapDataView(a)}else{let a=t+n;if(a>this.byteLength){let{dataView:i}=this._extend(a);this._swapDataView(i)}}}_extend(t){let n;n=fH?hH.allocUnsafe(t):new Uint8Array(t);let r=new DataView(n.buffer,n.byteOffset,n.byteLength);return n.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:n,dataView:r}}subarray(t,n,r=!1){return n=n||this._lengthToEnd(t),r&&this._tryExtend(t,n),this.ranges.add(t,n),super.subarray(t,n)}set(t,n,r=!1){r&&this._tryExtend(n,t.byteLength,t);let a=super.set(t,n);return this.ranges.add(n,a.byteLength),a}async ensureChunk(t,n){this.chunked&&(this.ranges.available(t,n)||await this.readChunk(t,n))}available(t,n){return this.ranges.available(t,n)}}class pxe{constructor(){Pn(this,"list",[])}get length(){return this.list.length}add(t,n,r=0){let a=t+n,i=this.list.filter(o=>y$(t,o.offset,a)||y$(t,o.end,a));if(i.length>0){t=Math.min(t,...i.map(l=>l.offset)),a=Math.max(a,...i.map(l=>l.end)),n=a-t;let o=i.shift();o.offset=t,o.length=n,o.end=a,this.list=this.list.filter(l=>!i.includes(l))}else this.list.push({offset:t,length:n,end:a})}available(t,n){let r=t+n;return this.list.some(a=>a.offset<=t&&r<=a.end)}}function y$(e,t,n){return e<=t&&t<=n}class xxe extends fxe{constructor(t,n){super(0),Pn(this,"chunksRead",0),this.input=t,this.options=n}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(t=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let n=this.options.chunkSize,r=await this.readChunk(t,n);return!!r&&r.byteLength===n}async readChunk(t,n){if(this.chunksRead++,(n=this.safeWrapAddress(t,n))!==0)return this._readChunk(t,n)}safeWrapAddress(t,n){return this.size!==void 0&&t+n>this.size?Math.max(0,this.size-t):n}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}}QT.set("blob",class extends xxe{async readWhole(){this.chunked=!1;let e=await $P(this.input);this._swapArrayBuffer(e)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}
647async _readChunk(e,t){let n=t?e+t:void 0,r=this.input.slice(e,n),a=await $P(r);return this.set(a,e,!0)}});const gxe="4.2.3",yxe={version:gxe},vxe={strings:{generatingThumbnails:"Generating thumbnails..."}};function bxe(e,t,n){try{e.getContext("2d").getImageData(0,0,1,1)}catch(r){if(r.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return e.toBlob?new Promise(r=>{e.toBlob(r,t,n)}).then(r=>{if(r===null)throw new Error("cannot read image, probably an svg with external resources");return r}):Promise.resolve().then(()=>Xpe(e.toDataURL(t,n),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}function wxe(e,t){let n=e.width,r=e.height;(t.deg===90||t.deg===270)&&(n=e.height,r=e.width);const a=document.createElement("canvas");a.width=n,a.height=r;const i=a.getContext("2d");return i.translate(n/2,r/2),t.canvas&&(i.rotate(t.rad),i.scale(t.scaleX,t.scaleY)),i.drawImage(e,-e.width/2,-e.height/2,e.width,e.height),a}function jxe(e){const t=e.width/e.height,n=5e6,r=4096;let a=Math.floor(Math.sqrt(n*t)),i=Math.floor(n/Math.sqrt(n*t));if(a>r&&(a=r,i=Math.round(a/t)),i>r&&(i=r,a=Math.round(t*i)),e.width>a){const o=document.createElement("canvas");return o.width=a,o.height=i,o.getContext("2d").drawImage(e,0,0,a,i),o}return e}const Nxe={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1};class bH extends Rf{constructor(n,r){super(n,{...Nxe,...r});Ge(this,"queue");Ge(this,"queueProcessing");Ge(this,"defaultThumbnailDimension");Ge(this,"thumbnailType");Ge(this,"onFileAdded",n=>{!n.preview&&n.data&&l$(n.type)&&!n.isRemote&&this.addToQueue(n.id)});Ge(this,"onCancelRequest",n=>{const r=this.queue.indexOf(n.id);r!==-1&&this.queue.splice(r,1)});Ge(this,"onFileRemoved",n=>{const r=this.queue.indexOf(n.id);r!==-1&&this.queue.splice(r,1),n.preview&&o$(n.preview)&&URL.revokeObjectURL(n.preview)});Ge(this,"onRestored",()=>{this.uppy.getFiles().filter(r=>r.isRestored).forEach(r=>{(!r.preview||o$(r.preview))&&this.addToQueue(r.id)})});Ge(this,"onAllFilesRemoved",()=>{this.queue=[]});Ge(this,"waitUntilAllProcessed",n=>{n.forEach(a=>{const i=this.uppy.getFile(a);
647this.uppy.emit("preprocess-progress",i,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});const r=()=>{n.forEach(a=>{const i=this.uppy.getFile(a);this.uppy.emit("preprocess-complete",i)})};return new Promise(a=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{r(),a()}):(r(),a())})});if(this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=vxe,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(n,r,a){const i=URL.createObjectURL(n.data),o=new Promise((c,d)=>{const m=new Image;m.src=i,m.addEventListener("load",()=>{URL.revokeObjectURL(i),c(m)}),m.addEventListener("error",u=>{URL.revokeObjectURL(i),d(u.error||new Error("Could not create thumbnail"))})}),l=hxe(n.data).catch(()=>1);return Promise.all([o,l]).then(([c,d])=>{const m=this.getProportionalDimensions(c,r,a,d.deg),u=wxe(c,d),h=this.resizeImage(u,m.width,m.height);return bxe(h,this.thumbnailType,80)}).then(c=>URL.createObjectURL(c))}getProportionalDimensions(n,r,a,i){let o=n.width/n.height;if((i===90||i===270)&&(o=n.height/n.width),r!=null){let l=r;return n.width<r&&(l=n.width),{width:l,height:Math.round(l/o)}}if(a!=null){let l=a;return n.height<a&&(l=n.height),{width:Math.round(l*o),height:l}}return{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/o)}}resizeImage(n,r,a){let i=jxe(n),o=Math.ceil(Math.log2(i.width/r));o<1&&(o=1);let l=r*2**(o-1),c=a*2**(o-1);const d=2;for(;o--;){const m=document.createElement("canvas");m.width=l,m.height=c,m.getContext("2d").drawImage(i,0,0,l,c),i=m,l=Math.round(l/d),c=Math.round(c/d)}return i}setPreviewURL(n,r){this.uppy.setFileState(n,{preview:r})}addToQueue(n){this.queue.push(n),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){const n=this.uppy.getFile(this.queue.shift());return n?this.requestThumbnail(n).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(n){return l$(n.type)&&!n.isRemote?this.createThumbnail(n,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(r=>{this.setPreviewURL(n.id,r),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${n.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(n.id),r)}).catch(r=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${n.id}:`,"warning"),this.uppy.log(r,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(n.id),r)}):Promise.resolve()}install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}}Ge(bH,"VERSION",yxe.version);function v$(e){if(typeof e=="string"){const t=document.querySelectorAll(e);return t.length===0?null:Array.from(t)}return typeof e=="object"&&SW(e)?[e]:null}const Vx=Array.from;function Cxe(e){const t=Vx(e.files);return Promise.resolve(t)}function wH(e,t,n,{onSuccess:r}){e.readEntries(a=>{const i=[...t,...a];a.length?queueMicrotask(()=>{wH(e,i,n,{onSuccess:r})}):r(i)},a=>{n(a),r(t)})}function jH(e,t){return e==null?e:{kind:e.isFile?"file":e.isDirectory?"directory":void 0,name:e.name,getFile(){return new Promise((n,r)=>e.file(n,r))},async*values(){const n=e.createReader();yield*await new Promise(a=>{wH(n,[],t,{onSuccess:i=>a(i.map(o=>jH(o,t)))})})},isSameEntry:void 0}}async function*NH(e,t,n=void 0){const r=()=>`${t}/${e.name}`;if(e.kind==="file"){const a=await e.getFile();a!=null?(a.relativePath=t?r():null,yield a):n!=null&&(yield n)}else if(e.kind==="directory")for await(const a of e.values())yield*NH(a,t?r():e.name);else n!=null&&(yield n)}async function*Sxe(e,t){const n=await Promise.all(Array.from(e.items,async r=>{let a;return a??(a=jH(typeof r.getAsEntry=="function"?r.getAsEntry():r.webkitGetAsEntry(),t)),{fileSystemHandle:a,lastResortFile:r.getAsFile()}}));for(const{lastResortFile:r,fileSystemHandle:a}of n)if(a!=null)try{yield*NH(a,"",r)}catch(i){r!=null?yield r:t(i)}else r!=null&&(yield r)}async function kxe(e,t){const n=(t==null?void 0:t.logDropError)??Function.prototype;try{const r=[];for await(const a of Sxe(e,n))r.push(a);return r}catch{return Cxe(e)}}const Pxe="4.4.3",Exe={version:Pxe};function Dxe(){const e=document.body;return!(!("draggable"in e)||!("ondragstart"in e&&"ondrop"in e)||!("FormData"in window)||!("FileReader"in window))}class CH extends Xa{constructor(){super(...arguments);Ge(this,"fileInput",null);Ge(this,"folderInput",null);Ge(this,"mobilePhotoFileInput",null);Ge(this,"mobileVideoFileInput",null);Ge(this,"triggerFileInputClick",()=>{var n;(n=this.fileInput)==null||n.click()});Ge(this,"triggerFolderInputClick",()=>{var n;(n=this.folderInput)==null||n.click()});Ge(this,"triggerVideoCameraInputClick",()=>{var n;(n=this.mobileVideoFileInput)==null||n.click()});Ge(this,"triggerPhotoCameraInputClick",()=>{var n;(n=this.mobilePhotoFileInput)==null||n.click()});Ge(this,"onFileInputChange",n=>{this.props.handleInputChange(n),n.currentTarget.value=""});
647Ge(this,"renderHiddenInput",(n,r)=>{var a;return ve("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:n,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:(a=this.props.allowedFileTypes)==null?void 0:a.join(", "),ref:r})});Ge(this,"renderHiddenCameraInput",(n,r,a)=>{const o={photo:"image/*",video:"video/*"}[n];return ve("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${n}`,onChange:this.onFileInputChange,capture:r===""?"environment":r,accept:o,ref:a})});Ge(this,"renderMyDeviceAcquirer",()=>ve("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice",children:ve("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick,children:[ve("div",{className:"uppy-DashboardTab-inner",children:ve("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:ve("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"})})}),ve("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("myDevice")})]})}));Ge(this,"renderPhotoCamera",()=>ve("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera",children:ve("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick,children:[ve("div",{className:"uppy-DashboardTab-inner",children:ve("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:ve("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"})})}),ve("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("takePictureBtn")})]})}));Ge(this,"renderVideoCamera",()=>ve("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera",children:ve("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick,children:[ve("div",{className:"uppy-DashboardTab-inner",children:ve("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",children:ve("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "})})}),ve("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("recordVideoBtn")})]})}));Ge(this,"renderBrowseButton",(n,r)=>{const a=this.props.acquirers.length;return ve("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:r,"data-uppy-super-focusable":a===0,children:n})});Ge(this,"renderDropPasteBrowseTagline",n=>{const r=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),a=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),i=this.props.fileManagerSelectionType,o=i.charAt(0).toUpperCase()+i.slice(1);return ve("div",{class:"uppy-Dashboard-AddFiles-title",children:this.props.disableLocalFiles?this.props.i18n("importFiles"):n>0?this.props.i18nArray(`dropPasteImport${o}`,{browseFiles:r,browseFolders:a,browse:r}):this.props.i18nArray(`dropPaste${o}`,{browseFiles:r,browseFolders:a,browse:r})})});Ge(this,"renderAcquirer",n=>{var r;return ve("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":n.id,children:ve("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":n.id,"aria-controls":`uppy-DashboardContent-panel--${n.id}`,"aria-selected":((r=this.props.activePickerPanel)==null?void 0:r.id)===n.id,"data-uppy-super-focusable":!0,onClick:()=>this.props.showPanel(n.id),children:[ve("div",{className:"uppy-DashboardTab-inner",children:n.icon()}),ve("div",{className:"uppy-DashboardTab-name",children:n.name})]})})});Ge(this,"renderAcquirers",n=>{const r=[...n],a=r.splice(n.length-2,n.length);return ve(To,{children:[r.map(i=>this.renderAcquirer(i)),ve("span",{role:"presentation",style:{"white-space":"nowrap"},children:a.map(i=>this.renderAcquirer(i))})]})});Ge(this,"renderSourcesList",(n,r)=>{const{showNativePhotoCameraButton:a,showNativeVideoCameraButton:i}=this.props;let o=[];const l="myDevice";r||o.push({key:l,elements:this.renderMyDeviceAcquirer()}),a&&o.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),i&&o.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),o.push(...n.map(u=>({key:u.id,elements:this.renderAcquirer(u)}))),o.length===1&&o[0].key===l&&(o=[]);const d=[...o],m=d.splice(o.length-2,o.length);return ve(To,{children:[this.renderDropPasteBrowseTagline(o.length),ve("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist",children:[d.map(({key:u,elements:h})=>ve(To,{children:h},u)),ve("span",{role:"presentation",style:{"white-space":"nowrap"},children:m.map(({key:u,elements:h})=>ve(To,{children:h},u))})]})]})})}[Symbol.for("uppy test: disable unused locale key warning")](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderPoweredByUppy(){const{i18nArray:n}=this.props,r=ve("span",{children:[ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",children:ve("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})}),ve("span",{className:"uppy-Dashboard-poweredByUppy",children:"Uppy"})]}),a=n("poweredBy",{uppy:r});return ve("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy",children:a})}render(){const{showNativePhotoCameraButton:n,showNativeVideoCameraButton:r,nativeCameraFacingMode:a}=this.props;return ve("div",{className:"uppy-Dashboard-AddFiles",children:[this.renderHiddenInput(!1,i=>{this.fileInput=i}),this.renderHiddenInput(!0,i=>{this.folderInput=i}),n&&this.renderHiddenCameraInput("photo",a,i=>{this.mobilePhotoFileInput=i}),r&&this.renderHiddenCameraInput("video",a,i=>{this.mobileVideoFileInput=i}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),ve("div",{className:"uppy-Dashboard-AddFiles-info",children:[this.props.note&&ve("div",{className:"uppy-Dashboard-note",children:this.props.note}),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()]})]})}}const Axe=e=>ve("div",{className:Lo("uppy-Dashboard-AddFilesPanel",e.className),"data-uppy-panelType":"AddFiles","aria-hidden":!e.showAddFilesPanel,children:[ve("div",{className:"uppy-DashboardContent-bar",children:[ve("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:e.i18n("addingMoreFiles")}),ve("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>e.toggleAddFilesPanel(!1),children:e.i18n("back")})]}),ve(CH,{...e})]});function Txe(e){const t=e.files[e.fileCardFor],n=()=>{e.uppy.emit("file-editor:cancel",t),e.closeFileEditor()};return ve("div",{className:Lo("uppy-DashboardContent-panel",e.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor",children:[ve("div",{className:"uppy-DashboardContent-bar",children:[ve("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:e.i18nArray("editing",{file:ve("span",{className:"uppy-DashboardContent-titleFile",children:t.meta?t.meta.name:t.name})})}),ve("button",{className:"uppy-DashboardContent-back",type:"button",onClick:n,children:e.i18n("c
647ancel")}),ve("button",{className:"uppy-DashboardContent-save",type:"button",onClick:e.saveFileEditor,children:e.i18n("save")})]}),ve("div",{className:"uppy-DashboardContent-panelBody",children:e.editors.map(r=>e.uppy.getPlugin(r.id).render(e.state))})]})}function Oxe(){return ve("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:ve("g",{fill:"#686DE0",fillRule:"evenodd",children:[ve("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),ve("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),ve("circle",{cx:"7.5",cy:"9.5",r:"1.5"})]})})}function Fxe(){return ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:ve("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"})})}function _xe(){return ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:ve("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"})})}function Mxe(){return ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:ve("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"})})}function $xe(){return ve("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:ve("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"})})}function Ixe(){return ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:ve("g",{fill:"#A7AFB7",fillRule:"nonzero",children:[ve("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),ve("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})]})})}function Rxe(){return ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:ve("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"})})}function eO(e){const t={color:"#838999",icon:Ixe()};if(!e)return t;const n=e.split("/")[0],r=e.split("/")[1];return n==="text"?{color:"#5a5e69",icon:Rxe()}:n==="image"?{color:"#686de0",icon:Oxe()}:n==="audio"?{color:"#068dbb",icon:Fxe()}:n==="video"?{color:"#19af67",icon:_xe()}:n==="application"&&r==="pdf"?{color:"#e25149",icon:Mxe()}:n==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:$xe()}:t}function ld(e){const{tagName:t}=e.target;if(t==="INPUT"||t==="TEXTAREA"){e.stopPropagation();return}e.preventDefault(),e.stopPropagation()}function SH(e){const{file:t}=e;
vendor: 5,778 bytes, line 647
647if(t.preview)return ve("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:t.name,src:t.preview});const{color:n,icon:r}=eO(t.type);return ve("div",{className:"uppy-Dashboard-Item-previewIconWrap",children:[ve("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:n},children:r}),ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76",children:ve("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})})]})}function Bxe(e){const{computedMetaFields:t,requiredMetaFields:n,updateMeta:r,form:a,formState:i}=e,o={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return t.map(l=>{const c=`uppy-Dashboard-FileCard-input-${l.id}`,d=n.includes(l.id);return ve("fieldset",{className:"uppy-Dashboard-FileCard-fieldset",children:[ve("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:c,children:l.name}),l.render!==void 0?l.render({value:i[l.id],onChange:m=>r(m,l.id),fieldCSSClasses:o,required:d,form:a.id},Ag):ve("input",{className:o.text,id:c,form:a.id,type:l.type||"text",required:d,value:i[l.id],placeholder:l.placeholder,onInput:m=>r(m.target.value,l.id),"data-uppy-super-focusable":!0})]},l.id)})}function Lxe(e){const{files:t,fileCardFor:n,toggleFileCard:r,saveFileCard:a,metaFields:i,requiredMetaFields:o,openFileEditor:l,i18n:c,i18nArray:d,className:m,canEditFile:u}=e,h=()=>typeof i=="function"?i(t[n]):i,p=t[n],v=h()??[],y=u(p),g={};v.forEach(P=>{g[P.id]=p.meta[P.id]??""});const[x,b]=Dw(g),w=The(P=>{P.preventDefault(),a(x,n)},[a,x,n]),j=(P,S)=>{b({...x,[S]:P})},N=()=>{r(!1)},[C]=Dw(()=>{const P=document.createElement("form");return P.setAttribute("tabindex","-1"),P.id=GT(),P});return NP(()=>(document.body.appendChild(C),C.addEventListener("submit",w),()=>{C.removeEventListener("submit",w),document.body.removeChild(C)}),[C,w]),ve("div",{className:Lo("uppy-Dashboard-FileCard",m),"data-uppy-panelType":"FileCard",onDragOver:ld,onDragLeave:ld,onDrop:ld,onPaste:ld,children:[ve("div",{className:"uppy-DashboardContent-bar",children:[ve("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:d("editing",{file:ve("span",{className:"uppy-DashboardContent-titleFile",children:p.meta?p.meta.name:p.name})})}),ve("button",{className:"uppy-DashboardContent-back",type:"button",form:C.id,title:c("finishEditingFile"),onClick:N,children:c("cancel")})]}),ve("div",{className:"uppy-Dashboard-FileCard-inner",children:[ve("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:eO(p.type).color},children:[ve(SH,{file:p}),y&&ve("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:P=>{w(P),l(p)},children:c("editImage")})]}),ve("div",{className:"uppy-Dashboard-FileCard-info",children:ve(Bxe,{computedMetaFields:v,requiredMetaFields:o,updateMeta:j,form:C,formState:x})}),ve("div",{className:"uppy-Dashboard-FileCard-actions",children:[ve("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:C.id,children:c("saveChanges")}),ve("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:N,form:C.id,children:c("cancel")})]})]})]})}function Uxe(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=Object.keys(e),r=Object.keys(t),a=n.length;if(r.length!==a)return!1;for(let i=0;i<a;i++){const o=n[i];if(e[o]!==t[o]||!Object.prototype.hasOwnProperty.call(t,o))return!1}return!0}function zxe(e,t="Copy the URL below"){return new Promise(n=>{const r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=e,document.body.appendChild(r),r.select();const a=()=>{document.body.removeChild(r),window.prompt(t,e),n()};try{return document.execCommand("copy")?(document.body.removeChild(r),n()):a()}catch{return document.body.removeChild(r),a()}})}function qxe({file:e,uploadInProgressOrComplete:t,metaFields:n,canEditFile:r,i18n:a,onClick:i}){return!t&&n&&n.length>0||!t&&r(e)?ve("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":a("editFileWithFilename",{file:e.meta.name}),title:a("editFileWithFilename",{file:e.meta.name}),onClick:()=>i(),children:ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14",children:ve("g",{fillRule:"evenodd",children:[ve("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),ve("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),ve("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})]})})}):null}function Wxe({i18n:e,onClick:t,file:n}){return ve("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":e("removeFile",{file:n.meta.name}),title:e("removeFile",{file:n.meta.name}),onClick:()=>t(),children:ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18",children:[ve("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),ve("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})]})})}function Hxe({file:e,uppy:t,i18n:n}){const r=a=>{zxe(e.uploadURL,n("copyLinkToClipboardFallback")).then(()=>{t.log("Link copied to clipboard."),t.info(n("copyLinkToClipboardSuccess"),"info",3e3)}).catch(t.log).then(()=>
647a.target.focus({preventScroll:!0}))};return ve("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":n("copyLink"),title:n("copyLink"),onClick:a=>r(a),children:ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12",children:ve("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})})})}function Vxe(e){const{uppy:t,file:n,uploadInProgressOrComplete:r,canEditFile:a,metaFields:i,showLinkToFileUploadResult:o,showRemoveButton:l,i18n:c,toggleFileCard:d,openFileEditor:m}=e;return ve("div",{className:"uppy-Dashboard-Item-actionWrapper",children:[ve(qxe,{i18n:c,file:n,uploadInProgressOrComplete:r,canEditFile:a,metaFields:i,onClick:()=>{i&&i.length>0?d(!0,n.id):m(n)}}),o&&n.uploadURL?ve(Hxe,{file:n,uppy:t,i18n:c}):null,l?ve(Wxe,{i18n:c,file:n,onClick:()=>t.removeFile(n.id)}):null]})}const MS="...";function kH(e,t){if(t===0)return"";if(e.length<=t)return e;if(t<=MS.length+1)return`${e.slice(0,t-1)}…`;const n=t-MS.length,r=Math.ceil(n/2),a=Math.floor(n/2);return e.slice(0,r)+MS+e.slice(-a)}const Kxe=(e,t)=>(typeof t=="function"?t():t).filter(a=>a.id===e)[0].name;function PH(e){const{file:t,toggleFileCard:n,i18n:r,metaFields:a}=e,{missingRequiredMetaFields:i}=t;if(!(i!=null&&i.length))return null;const o=i.map(l=>Kxe(l,a)).join(", ");return ve("div",{className:"uppy-Dashboard-Item-errorMessage",children:[r("missingRequiredMetaFields",{smart_count:i.length,fields:o})," ",ve("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:()=>n(!0,t.id),children:r("editFile")})]})}const Gxe=e=>{const{author:t,name:n}=e.file.meta;function r(){return e.isSingleFile&&e.containerHeight>=350?90:e.containerWidth<=352?35:e.containerWidth<=576?60:t?20:30}return ve("div",{className:"uppy-Dashboard-Item-name",title:n,children:kH(n,r())})},Yxe=e=>{var a;const{author:t}=e.file.meta,n=(a=e.file.remote)==null?void 0:a.providerName,r="·";return t?ve("div",{className:"uppy-Dashboard-Item-author",children:[ve("a",{href:`${t.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",children:kH(t.name,13)}),n?ve(To,{children:[` ${r} `,n,` ${r} `]}):null]}):null},Qxe=e=>e.file.size&&ve("div",{className:"uppy-Dashboard-Item-statusSize",children:yu(e.file.size)}),Jxe=e=>e.file.isGhost&&ve("span",{children:[" • ",ve("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:()=>e.toggleAddFilesPanel(!0),children:e.i18n("reSelect")})]}),Xxe=({file:e,onClick:t})=>e.error?ve("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":e.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:t,type:"button",children:"?"}):null;function Zxe(e){const{file:t,i18n:n,toggleFileCard:r,metaFields:a,toggleAddFilesPanel:i,isSingleFile:o,containerHeight:l,containerWidth:c}=e;return ve("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":t.source,children:[ve("div",{className:"uppy-Dashboard-Item-fileName",children:[Gxe({file:t,isSingleFile:o,containerHeight:l,containerWidth:c}),ve(Xxe,{file:t,onClick:()=>alert(t.error)})]}),ve("div",{className:"uppy-Dashboard-Item-status",children:[Yxe({file:t}),Qxe({file:t}),Jxe({file:t,toggleAddFilesPanel:i,i18n:n})]}),ve(PH,{file:t,i18n:n,toggleFileCard:r,metaFields:a})]})}function ege(e){const{file:t,i18n:n,toggleFileCard:r,metaFields:a,showLinkToFileUploadResult:i}
vendor: 3,913 bytes, line 647
647=e,l=t.preview?"rgba(255, 255, 255, 0.5)":eO(t.type).color;return ve("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:l},children:[i&&t.uploadURL&&ve("a",{className:"uppy-Dashboard-Item-previewLink",href:t.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":t.meta.name,children:ve("span",{hidden:!0,children:t.meta.name})}),ve(SH,{file:t}),ve(PH,{file:t,i18n:n,toggleFileCard:r,metaFields:a})]})}function tge(e){if(!e.isUploaded){if(e.error&&!e.hideRetryButton){e.uppy.retryUpload(e.file.id);return}e.resumableUploads&&!e.hidePauseResumeButton?e.uppy.pauseResume(e.file.id):e.individualCancellation&&!e.hideCancelButton&&e.uppy.removeFile(e.file.id)}}function b$(e){return e.isUploaded?e.i18n("uploadComplete"):e.error?e.i18n("retryUpload"):e.resumableUploads?e.file.isPaused?e.i18n("resumeUpload"):e.i18n("pauseUpload"):e.individualCancellation?e.i18n("cancelUpload"):""}function $S(e){return ve("div",{className:"uppy-Dashboard-Item-progress",children:ve("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":b$(e),title:b$(e),onClick:()=>tge(e),children:e.children})})}function D0({children:e}){return ve("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle",children:e})}function IS({progress:e}){const t=2*Math.PI*15;return ve("g",{children:[ve("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),ve("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":t,"stroke-dashoffset":t-t/100*e})]})}function sge(e){return!e.file.progress.uploadStarted||e.file.progress.percentage===void 0?null:e.isUploaded?ve("div",{className:"uppy-Dashboard-Item-progress",children:ve("div",{className:"uppy-Dashboard-Item-progressIndicator",children:ve(D0,{children:[ve("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),ve("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"})]})})}):e.recoveredState?null:e.error&&!e.hideRetryButton?ve($S,{...e,children:ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19",children:[ve("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),ve("path",{d:"M7.9 3H10v2H7.9z"}),ve("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),ve("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"})]})}):e.resumableUploads&&!e.hidePauseResumeButton?ve($S,{...e,children:ve(D0,{children:[ve(IS,{progress:e.file.progress.percentage}),e.file.isPaused?ve("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):ve("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)",children:[ve("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),ve("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})]})]})}):!e.resumableUploads&&e.individualCancellation&&!e.hideCancelButton?ve($S,{...e,children:ve(D0,{children:[ve(IS,{progress:e.file.progress.percentage}),ve("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"})]})}):ve("div",{className:"uppy-Dashboard-Item-progress",children:ve("div",{className:"uppy-Dashboard-Item-progressIndicator",children:ve(D0,{children:ve(IS,{progress:e.file.progress.percentage})})})})}class nge extends Xa{componentDidMount(){const{file:t}=this.props;
647t.preview||this.props.handleRequestThumbnail(t)}shouldComponentUpdate(t){return!Uxe(this.props,t)}componentDidUpdate(){const{file:t}=this.props;t.preview||this.props.handleRequestThumbnail(t)}componentWillUnmount(){const{file:t}=this.props;t.preview||this.props.handleCancelThumbnail(t)}render(){const{file:t}=this.props,n=t.progress.preprocess||t.progress.postprocess,r=!!t.progress.uploadComplete&&!n&&!t.error,a=!!t.progress.uploadStarted||!!n,i=t.progress.uploadStarted&&!t.progress.uploadComplete||n,o=t.error||!1,{isGhost:l}=t;let c=(this.props.individualCancellation||!i)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(c=!0);const d=Lo({"uppy-Dashboard-Item":!0,"is-inprogress":i&&!this.props.recoveredState,"is-processing":n,"is-complete":r,"is-error":!!o,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":l});return ve("div",{className:d,id:`uppy_${t.id}`,role:this.props.role,children:[ve("div",{className:"uppy-Dashboard-Item-preview",children:[ve(ege,{file:t,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),ve(sge,{uppy:this.props.uppy,file:t,error:o,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})]}),ve("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons",children:[ve(Zxe,{file:t,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),ve(Vxe,{file:t,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:c,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:a,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})]})]})}}function rge(e,t){const n=[];let r=[];return e.forEach(a=>{r.length<t?r.push(a):(n.push(r),r=[a])}),r.length&&n.push(r),n}function age({id:e,i18n:t,uppy:n,files:r,resumableUploads:a,hideRetryButton:i,hidePauseResumeButton:o,hideCancelButton:l,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:d,metaFields:m,isSingleFile:u,toggleFileCard:h,handleRequestThumbn
647ail:p,handleCancelThumbnail:v,recoveredState:y,individualCancellation:g,itemsPerRow:x,openFileEditor:b,canEditFile:w,toggleAddFilesPanel:j,containerWidth:N,containerHeight:C}){const P=x===1?71:200,S=KT(()=>{const T=(O,D)=>Number(r[D].isGhost)-Number(r[O].isGhost),z=Object.keys(r);return y&&z.sort(T),rge(z,x)},[r,x,y]),E=T=>ve("div",{class:"uppy-Dashboard-filesInner",role:"presentation",children:T.map(z=>ve(nge,{uppy:n,id:e,i18n:t,resumableUploads:a,individualCancellation:g,hideRetryButton:i,hidePauseResumeButton:o,hideCancelButton:l,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:d,metaFields:m,recoveredState:y,isSingleFile:u,containerWidth:N,containerHeight:C,toggleFileCard:h,handleRequestThumbnail:p,handleCancelThumbnail:v,role:"listitem",openFileEditor:b,canEditFile:w,toggleAddFilesPanel:j,file:r[z]},z))},T[0]);return u?ve("div",{class:"uppy-Dashboard-files",children:E(S[0])}):ve(Spe,{class:"uppy-Dashboard-files",role:"list",data:S,renderRow:E,rowHeight:P})}function ige({activePickerPanel:e,className:t,hideAllPanels:n,i18n:r,state:a,uppy:i}){const o=Tb(null);return ve("div",{className:Lo("uppy-DashboardContent-panel",t),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${e.id}`,onDragOver:ld,onDragLeave:ld,onDrop:ld,onPaste:ld,children:[ve("div",{className:"uppy-DashboardContent-bar",children:[ve("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:r("importFrom",{name:e.name})}),ve("button",{className:"uppy-DashboardContent-back",type:"button",onClick:n,children:r("cancel")})]}),ve("div",{ref:o,className:"uppy-DashboardContent-panelBody",children:i.getPlugin(e.id).render(a,o.current)})]})}const Go={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function oge(e,t,n,r={}){if(e)return Go.STATE_ERROR;if(t)return Go.STATE_COMPLETE;if(n)return Go.STATE_PAUSED;let a=Go.STATE_WAITING;const i=Object.keys(r);for(let o=0;o<i.length;o++){const{progress:l}=r[i[o]];if(l.uploadStarted&&!l.uploadComplete)return Go.STATE_UPLOADING;l.preprocess&&a!==Go.STATE_UPLOADING&&(a=Go.STATE_PREPROCESSING),l.postprocess&&a!==Go.STATE_UPLOADING&&a!==Go.STATE_PREPROCESSING&&(a=Go.STATE_POSTPROCESSING)}return a}function lge({files:e,i18n:t,isAllComplete:n,isAllErrored:r,isAllPaused:a,inProgressNotPausedFiles:i,newFiles:o,processingFiles:l}){switch(oge(r,n,a,e)){case"uploading":return t("uploadingXFiles",{smart_count:i.length});case"preprocessing":case"postprocessing":return t("processingXFiles",{smart_count:l.length});case"paused":return t("uploadPaused");case"waiting":return t("xFilesSelected",{smart_count:o.length});case"complete":return t("uploadComplete");case"error":return t("error")}}function cge(e){const{i18n:t,isAllComplete:n,hideCancelButton:r,maxNumberOfFiles:a,toggleAddFilesPanel:i,uppy:o}=e;let{allowNewUpload:l}=e;return l&&a&&(l=e.totalFileCount<e.maxNumberOfFiles),ve("div",{className:"uppy-DashboardContent-bar",children:[!n&&!r?ve("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>o.cancelAll(),children:t("cancel")}):ve("div",{}),ve("div",{className:"uppy-DashboardContent-title",children:ve(lge,{...e})}),l?ve("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":t("addMoreFiles"),title:t("addMoreFiles"),onClick:()=>i(!0),children:[ve("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15",children:ve("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})}),ve("span",{className:"uppy-DashboardContent-addMoreCaption",children:t("addMore")})]}):ve("div",{})]})}
647const zm="uppy-transition-slideDownUp",w$=250;function A0({children:e}){const[t,n]=Dw(null),[r,a]=Dw(""),i=Tb(),o=Tb(),l=Tb(),c=()=>{a(`${zm}-enter`),cancelAnimationFrame(l.current),clearTimeout(o.current),o.current=void 0,l.current=requestAnimationFrame(()=>{a(`${zm}-enter ${zm}-enter-active`),i.current=setTimeout(()=>{a("")},w$)})},d=()=>{a(`${zm}-leave`),cancelAnimationFrame(l.current),clearTimeout(i.current),i.current=void 0,l.current=requestAnimationFrame(()=>{a(`${zm}-leave ${zm}-leave-active`),o.current=setTimeout(()=>{n(null),a("")},w$)})};return NP(()=>{const m=ko(e)[0];t!==m&&(m&&!t?c():t&&!m&&!o.current&&d(),n(m))},[e,t]),NP(()=>()=>{clearTimeout(i.current),clearTimeout(o.current),cancelAnimationFrame(l.current)},[]),t?RW(t,{className:Lo(r,t.props.className)}):null}const j$=900,N$=700,RS=576,C$=330;function dge(e){const t=e.totalFileCount===0,n=e.totalFileCount===1,r=e.containerWidth>RS,a=e.containerHeight>C$,i=Lo({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":e.disabled,"uppy-Dashboard--animateOpenClose":e.animateOpenClose,"uppy-Dashboard--isClosing":e.isClosing,"uppy-Dashboard--isDraggingOver":e.isDraggingOver,"uppy-Dashboard--modal":!e.inline,"uppy-size--md":e.containerWidth>RS,"uppy-size--lg":e.containerWidth>N$,"uppy-size--xl":e.containerWidth>j$,"uppy-size--height-md":e.containerHeight>C$,"uppy-Dashboard--isAddFilesPanelVisible":e.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":e.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":e.singleFileFullScreen&&n&&a});let o=1;e.containerWidth>j$?o=5:e.containerWidth>N$?o=4:e.containerWidth>RS&&(o=3);const l=e.showSelectedFiles&&!t,c=e.recoveredState?Object.keys(e.recoveredState.files).length:null,d=e.files?Object.keys(e.files).filter(h=>e.files[h].isGhost).length:0,m=()=>d>0?e.i18n("recoveredXFiles",{smart_count:d}):e.i18n("recoveredAllFiles");return ve("div",{className:i,"data-uppy-theme":e.theme,"data-uppy-num-acquirers":e.acquirers.length,"data-uppy-drag-drop-supported":!e.disableLocalFiles&&Dxe(),"aria-hidden":e.inline?"false":e.isHidden,"aria-disabled":e.disabled,"aria-label":e.inline?e.i18n("dashboardTitle"):e.i18n("dashboardWindowTitle"),onPaste:e.handlePaste,onDragOver:e.handleDragOver,onDragLeave:e.handleDragLeave,onDrop:e.handleDrop,children:[ve("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:e.handleClickOutside}),ve("div",{className:"uppy-Dashboard-inner",role:e.inline?void 0:"dialog",style:{width:e.inline&&e.width?e.width:"",height:e.inline&&e.height?e.height:""},children:[e.inline?null:ve("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":e.i18n("closeModal"),title:e.i18n("closeModal"),onClick:e.closeModal,children:ve("span",{"aria-hidden":"true",children:"×"})}),ve("div",{className:"uppy-Dashboard-innerWrap",children:[ve("div",{className:"uppy-Dashboard-dropFilesHereHint",children:e.i18n("dropHint")}),l&&ve(cge,{...e}),c&&ve("div",{className:"uppy-Dashboard-serviceMsg",children:[ve("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:ve("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[ve("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),ve("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),ve("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),ve("strong",{className:"uppy-Dashboard-serviceMsg-title",children:e.i18n("sessionRestored")}),ve("div",{className:"uppy-Dashboard-serviceMsg-text",children:m()})]}),l?ve(age,{id:e.id,i18n:e.i18n,uppy:e.uppy,files:e.files,resumableUploads:e.resumableUploads,hideRetryButton:e.hideRetryButton,hidePauseResumeButton:e.hidePauseResumeButton,hideCancelButton:e.hideCancelButton,showLinkToFileUploadResult:e.showLinkToFileUploadResult,showRemoveButtonAfterComplete:e.showRemoveButtonAfterComplete,metaFields:e.metaFields,toggleFileCard:e.toggleFileCard,handleRequestThumbn
647ail:e.handleRequestThumbnail,handleCancelThumbnail:e.handleCancelThumbnail,recoveredState:e.recoveredState,individualCancellation:e.individualCancellation,openFileEditor:e.openFileEditor,canEditFile:e.canEditFile,toggleAddFilesPanel:e.toggleAddFilesPanel,isSingleFile:n,itemsPerRow:o,containerWidth:e.containerWidth,containerHeight:e.containerHeight}):ve(CH,{i18n:e.i18n,i18nArray:e.i18nArray,acquirers:e.acquirers,handleInputChange:e.handleInputChange,maxNumberOfFiles:e.maxNumberOfFiles,allowedFileTypes:e.allowedFileTypes,showNativePhotoCameraButton:e.showNativePhotoCameraButton,showNativeVideoCameraButton:e.showNativeVideoCameraButton,nativeCameraFacingMode:e.nativeCameraFacingMode,showPanel:e.showPanel,activePickerPanel:e.activePickerPanel,disableLocalFiles:e.disableLocalFiles,fileManagerSelectionType:e.fileManagerSelectionType,note:e.note,proudlyDisplayPoweredByUppy:e.proudlyDisplayPoweredByUppy}),ve(A0,{children:e.showAddFilesPanel?ve(Axe,{...e,isSizeMD:r},"AddFiles"):null}),ve(A0,{children:e.fileCardFor?ve(Lxe,{...e},"FileCard"):null}),ve(A0,{children:e.activePickerPanel?ve(ige,{...e},"Picker"):null}),ve(A0,{children:e.showFileEditor?ve(Txe,{...e},"Editor"):null}),ve("div",{className:"uppy-Dashboard-progressindicators",children:e.progressindicators.map(h=>e.uppy.getPlugin(h.id).render(e.state))})]})]})]})}const uge={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video"}},EH=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not
647([tabindex^="-"]):not([inert]):not([aria-hidden])'];function DH(e,t){if(t){const n=e.querySelector(`[data-uppy-paneltype="${t}"]`);if(n)return n}return e}function mge(){let e=!1;return ZW((n,r)=>{const a=DH(n,r),i=a.contains(document.activeElement);if(i&&e)return;const o=a.querySelector("[data-uppy-super-focusable]");if(!(i&&!o))if(o)o.focus({preventScroll:!0}),e=!0;else{const l=a.querySelector(EH);l==null||l.focus({preventScroll:!0}),e=!1}},260)}function S$(e,t){const n=t[0];n&&(n.focus(),e.preventDefault())}function hge(e,t){const n=t[t.length-1];n&&(n.focus(),e.preventDefault())}function fge(e){return e.contains(document.activeElement)}function AH(e,t,n){const r=DH(n,t),a=Vx(r.querySelectorAll(EH)),i=a.indexOf(document.activeElement);fge(r)?e.shiftKey&&i===0?hge(e,a):!e.shiftKey&&i===a.length-1&&S$(e,a):S$(e,a)}function pge(e,t,n){t===null||AH(e,t,n)}const k$=9,xge=27;function P$(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const gge={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:kpe,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,disabled:!1,disableLocalFiles:!1,nativeCameraFacingMode:"",onDragLeave:()=>{},onDragOver:()=>{},onDrop:()=>{},plugins:[],doneButtonHandler:void 0,onRequestCloseModal:null,inline:!1,animateOpenClose:!0,browserBackButtonClose:!1,closeAfterFinish:!1,closeModalOnClickOutside:!1,disablePageScrollWhenModalOpen:!0,trigger:null,width:750,height:550};var Ik,rf,Bu,Ly,af,sN,nN,rN,Lu,aN,iN,of,ta,RP,BP,TH,LP,UP,OH;let yge=(Ik=class extends Rf{constructor(n,r){var i;const a=(r==null?void 0:r.autoOpen)??null;super(n,{...gge,...r,autoOpen:a});Qe(this,ta);Qe(this,rf);Ge(this,"modalName",`uppy-Dashboard-${GT()}`);Ge(this,"superFocus",mge());Ge(this,"ifFocusedOnUppyRecently",!1);Ge(this,"dashboardIsDisabled");Ge(this,"savedScrollPosition");Ge(this,"savedActiveElement");Ge(this,"resizeObserver");Ge(this,"darkModeMediaQuery");Ge(this,"makeDashboardInsidesVisibleAnywayTimeout");Ge(this,"removeTarget",n=>{const a=this.getPluginState().targets.filter(i=>i.id!==n.id);this.setPluginState({targets:a})});Ge(this,"addTarget",n=>{const r=n.id||n.constructor.name,a=n.title||r,i=n.type;if(i!=="acquirer"&&i!=="progressindicator"&&i!=="editor")return this.up
647py.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;const o={id:r,name:a,type:i},c=this.getPluginState().targets.slice();return c.push(o),this.setPluginState({targets:c}),this.el});Ge(this,"hideAllPanels",()=>{var a;const n=this.getPluginState(),r={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};n.activePickerPanel===r.activePickerPanel&&n.showAddFilesPanel===r.showAddFilesPanel&&n.showFileEditor===r.showFileEditor&&n.activeOverlayType===r.activeOverlayType||(this.setPluginState(r),this.uppy.emit("dashboard:close-panel",(a=n.activePickerPanel)==null?void 0:a.id))});Ge(this,"showPanel",n=>{const{targets:r}=this.getPluginState(),a=r.find(i=>i.type==="acquirer"&&i.id===n);this.setPluginState({activePickerPanel:a,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",n)});Ge(this,"canEditFile",n=>{const{targets:r}=this.getPluginState();return X(this,Lu).call(this,r).some(i=>this.uppy.getPlugin(i.id).canEditFile(n))});Ge(this,"openFileEditor",n=>{const{targets:r}=this.getPluginState(),a=X(this,Lu).call(this,r);this.setPluginState({showFileEditor:!0,fileCardFor:n.id||null,activeOverlayType:"FileEditor"}),a.forEach(i=>{this.uppy.getPlugin(i.id).selectFile(n)})});Ge(this,"closeFileEditor",()=>{const{metaFields:n}=this.getPluginState();n&&n.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})});Ge(this,"saveFileEditor",()=>{const{targets:n}=this.getPluginState();X(this,Lu).call(this,n).forEach(a=>{this.uppy.getPlugin(a.id).save()}),this.closeFileEditor()});Ge(this,"openModal",()=>{const{promise:n,resolve:r}=P$();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){const a=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",a,!1),r()};this.el.addEventListener("animationend",a,!1)}else this.setPluginState({isHidden:!1}),r();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),n});Ge(this,"closeModal",n=>{var c;const r=(n==null?void 0:n.manualClose)??!0,{isHidden:a,isClosing:i}=this.getPluginState();if(a||i)return;const{promise:o,resolve:l}=P$();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});const d=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",d,!1),l()};this.el.addEventListener("animationend",d,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),l();return document.removeEventListener("keydown",this.handleKeyDownInModal),r&&this.opts.browserBackButtonClose&&(c=history.state)!=null&&c[this.modalName]&&history.back(),this.uppy.emit("dashboard:modal-closed"),o});Ge(this,"isModalOpen",()=>!this.getPluginState().isHidden||!1);Ge(this,"requestCloseModal",()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal());Ge(this,"setDarkModeCapability",n=>{const{capabilities:r}=this.uppy.getState();this.uppy.setState({capabilities:{...r,darkMode:n}})});Ge(this,"handleSystemDarkModeChange",n=>{const r=n.matches;this.uppy.log(`[Dashboard] Dark mode is ${r?"on":"off"}`),this.setDarkModeCapability(r)});Ge(this,"toggleFileCard",(n,r)=>{const a=this.uppy.getFile(r);n?this.uppy.emit("dashboard:file-edit-start",a):this.uppy.emit("dashboard:file-edit-complete",a),this.setPluginState({fileCardFor:n?r:null,activeOverlayType:n?"FileCard":null})});Ge(this,"toggleAddFilesPanel",n=>{this.setPluginState({showAddFilesPanel:n,activeOverlayType:n?"AddFiles":null})});Ge(this,"addFiles",n=>{const r=n.map(a=>({source:this.id,name:a.name,type:a.type,data:a,meta:{relativePath:a.relativePath||a.webkitRelativePath||null}}));
647try{this.uppy.addFiles(r)}catch(a){this.uppy.log(a)}});Ge(this,"startListeningToResize",()=>{this.resizeObserver=new ResizeObserver(n=>{const r=n[0],{width:a,height:i}=r.contentRect;this.setPluginState({containerWidth:a,containerHeight:i,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{const n=this.getPluginState(),r=!this.opts.inline&&n.isHidden;!n.areInsidesReadyToBeVisible&&!r&&(this.uppy.log("[Dashboard] resize event didn’t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)});Ge(this,"stopListeningToResize",()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)});Ge(this,"recordIfFocusedOnUppyRecently",n=>{this.el.contains(n.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())});Ge(this,"disableInteractiveElements",n=>{const r=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],a=X(this,rf)??Vx(this.el.querySelectorAll(r)).filter(i=>!i.classList.contains("uppy-Dashboard-close"));for(const i of a)i.tagName==="A"?i.setAttribute("aria-disabled",n):i.disabled=n;n?et(this,rf,a):et(this,rf,null),this.dashboardIsDisabled=n});Ge(this,"updateBrowserHistory",()=>{var n;(n=history.state)!=null&&n[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)});Ge(this,"handlePopState",n=>{var r;this.isModalOpen()&&(!n.state||!n.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&((r=n.state)!=null&&r[this.modalName])&&history.back()});Ge(this,"handleKeyDownInModal",n=>{n.keyCode===xge&&this.requestCloseModal(),n.keyCode===k$&&AH(n,this.getPluginState().activeOverlayType,this.el)});Ge(this,"handleClickOutside",()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()});Ge(this,"handlePaste",n=>{this.uppy.iteratePlugins(a=>{var i;a.type==="acquirer"&&((i=a.handleRootPaste)==null||i.call(a,n))});const r=Vx(n.clipboardData.files);r.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(r))});Ge(this,"handleInputChange",n=>{n.preventDefault();const r=Vx(n.currentTarget.files||[]);r.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(r))});Ge(this,"handleDragOver",n=>{n.preventDefault(),n.stopPropagation();const r=()=>{let l=!0;
647return this.uppy.iteratePlugins(c=>{var d;(d=c.canHandleRootDrop)!=null&&d.call(c,n)&&(l=!0)}),l},a=()=>{const{types:l}=n.dataTransfer;return l.some(c=>c==="Files")},i=r(),o=a();if(!i&&!o||this.opts.disabled||this.opts.disableLocalFiles&&(o||!i)||!this.uppy.getState().allowNewUpload){n.dataTransfer.dropEffect="none";return}n.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(n)});Ge(this,"handleDragLeave",n=>{n.preventDefault(),n.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(n)});Ge(this,"handleDrop",async n=>{n.preventDefault(),n.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(o=>{var l;o.type==="acquirer"&&((l=o.handleRootDrop)==null||l.call(o,n))});let r=!1;const a=o=>{this.uppy.log(o,"error"),r||(this.uppy.info(o.message,"error"),r=!0)};this.uppy.log("[Dashboard] Processing dropped files");const i=await kxe(n.dataTransfer,{logDropError:a});i.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(i)),this.opts.onDrop(n)});
647Ge(this,"handleRequestThumbnail",n=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",n)});Ge(this,"handleCancelThumbnail",n=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",n)});Ge(this,"handleKeyDownInInline",n=>{n.keyCode===k$&&pge(n,this.getPluginState().activeOverlayType,this.el)});Ge(this,"handlePasteOnBody",n=>{this.el.contains(document.activeElement)&&this.handlePaste(n)});Ge(this,"handleComplete",({failed:n})=>{this.opts.closeAfterFinish&&!(n!=null&&n.length)&&this.requestCloseModal()});Ge(this,"handleCancelRestore",()=>{this.uppy.emit("restore-canceled")});Qe(this,Bu,()=>{if(this.opts.disableThumbnailGenerator)return;const n=600,r=this.uppy.getFiles();if(r.length===1){const a=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);a==null||a.setOptions({thumbnailWidth:n});const i={...r[0],preview:void 0};a==null||a.requestThumbnail(i).then(()=>{a==null||a.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}});Qe(this,Ly,n=>{const r=n[0],{metaFields:a}=this.getPluginState(),i=a&&a.length>0,o=this.canEditFile(r);i&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,r.id):o&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(r)});Ge(this,"initEvents",()=>{if(this.opts.trigger&&!this.opts.inline){const n=v$(this.opts.trigger);n?n.forEach(r=>r.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openM
647odal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",X(this,of)),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",X(this,Bu)),this.uppy.on("file-removed",X(this,Bu)),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",X(this,Ly))});Ge(this,"removeEvents",()=>{const n=v$(this.opts.trigger);!this.opts.inline&&n&&n.forEach(r=>r.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",X(this,of)),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",X(this,Bu)),this.uppy.off("file-removed",X(this,Bu)),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",X(this,Ly))});Ge(this,"superFocusOnEachUpdate",()=>{const n=this.el.contains(document.activeElement),r=document.activeElement===document.body||document.activeElement===null,a=this.uppy.getState().info.length===0,i=!this.opts.inline;a&&(i||n||r&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()});Ge(this,"afterUpdate",()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()});Ge(this,"saveFileCard",(n,r)=>{this.uppy.setFileMeta(r,n),this.toggleFileCard(!1,r)});Qe(this,af,n=>{const r=this.uppy.getPlugin(n.id);return{...n,icon:r.icon||this.opts.defaultPickerIcon,render:r.render}});Qe(this,sN,n=>{const r=this.uppy.getPlugin(n.id);return typeof r.isSupported!="function"?!0:r.isSupported()});Qe(this,nN,n=>n.filter(r=>r.type==="acquirer"&&X(this,sN).call(this,r)).map(X(this,af)));Qe(this,rN,n=>n.filter(r=>r.type==="progressindicator").map(X(this,af)));Qe(this,Lu,n=>n.filter(r=>r.type==="editor").map(X(this,af)));Ge(this,"render",n=>{const r=this.getPluginState(),{files:a,capabilities:i,allowNewUpload:o}=n,{newFiles:l,uploadStartedFiles:c,completeFiles:d,erroredFiles:m,inProgressFiles:u,inProgressNotPausedFiles:h,processingFiles:p,isUploadStarted:v,isAllComplete:y,isAllPaused:g}=this.uppy.getObjectOfFilesPerState(),x=X(this,nN).call(this,r.targets),b=X(this,rN).call(this,r.targets),w=X(this,Lu).call(this,r.targets);let j;return this.opts.theme==="auto"?j=i.darkMode?"dark":"light":j=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),dge({state:n,isHidden:r.isHidden,files:a,newFiles:l,uploadStartedFiles:c,completeFiles:d,erroredFiles:m,inProgressFiles:u,inProgressNotPausedFiles:h,processingFiles:p,isUploadStarted:v,isAllComplete:y,isAllPaused:g,totalFileCount:Object.keys(a).length,totalProgress:n.totalProgress,allowNewUpload:o,acquirers:x,theme:j,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:r.activePickerPanel,showFileEditor:r.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:r.isClosing,progressindicators:b,editors:w,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:n.recoveredState,metaFields:r.metaFields,resumableUploads:i.resumableUploads||!1,individualCancellation:i.individualCancellation,isMobileDevice:i.isMobileDevice,fileCardFor:r.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:r.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,f
647ileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,hideCancelButton:this.opts.hideCancelButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:r.containerWidth,containerHeight:r.containerHeight,areInsidesReadyToBeVisible:r.areInsidesReadyToBeVisible,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleCancelRestore:this.handleCancelRestore,handleRequestThumbnail:this.handleRequestThumbn
647ail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:r.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop})});Qe(this,aN,()=>{const{plugins:n}=this.opts;n.forEach(r=>{const a=this.uppy.getPlugin(r);a?a.mount(this,a):this.uppy.log(`[Uppy] Dashboard could not find plugin '${r}', make sure to uppy.use() the plugins you are specifying`,"warning")})});Qe(this,iN,()=>{this.uppy.iteratePlugins(X(this,of))});Qe(this,of,n=>{var a;const r=["acquirer","editor"];n&&!((a=n.opts)!=null&&a.target)&&r.includes(n.type)&&(this.getPluginState().targets.some(o=>n.id===o.id)||n.mount(this,n))});Ge(this,"install",()=>{var c;this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});const{inline:n,closeAfterFinish:r}=this.opts;if(n&&r)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");const{allowMultipleUploads:a,allowMultipleUploadBatches:i}=this.uppy.opts;(a||i)&&r&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");const{target:o}=this.opts;o&&this.mount(o,this),this.opts.disableStatusBar||this.uppy.use(Qpe,{id:ct(this,ta,LP).call(this),target:this,...ct(this,ta,RP).call(this)}),this.opts.disableInformer||this.uppy.use(oH,{id:ct(this,ta,OH).call(this),target:this,...ct(this,ta,TH).call(this)}),this.opts.disableThumbnailGenerator||this.uppy.use(bH,{id:ct(this,ta,UP).call(this),...ct(this,ta,BP).call(this)}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;const l=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;this.uppy.log(`[Dashboard] Dark mode is ${l?"on":"off"}`),this.setDarkModeCapability(l),this.opts.theme==="auto"&&((c=this.darkModeMediaQuery)==null||c.addListener(this.handleSystemDarkModeChange)),X(this,aN).call(this),X(this,iN).call(this),this.initEvents()});Ge(this,"uninstall",()=>{var r;if(!this.opts.disableInformer){const a=this.uppy.getPlugin(`${this.id}:Informer`);a&&this.uppy.removePlugin(a)}if(!this.opts.disableStatusBar){const a=this.uppy.getPlugin(`${this.id}:StatusBar`);a&&this.uppy.removePlugin(a)}if(!this.opts.disableThumbnailGenerator){const a=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);a&&this.uppy.removePlugin(a)}const{plugins:n}=this.opts;n.forEach(a=>{const i=this.uppy.getPlugin(a);i&&i.unmount()}),this.opts.theme==="auto"&&((r=this.darkModeMediaQuery)==null||r.removeListener(this.handleSystemDarkModeChange)),this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()});this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=uge,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),(i=this.opts).onRequestCloseModal??(i.onRequestCloseModal=()=>this.closeModal()),this.i18nInit()}setOptions(n){var r,a;super.setOptions(n),(r=this.uppy.getPlugin(ct(this,ta,LP).call(this)))==null||r.setOptions(ct(this,ta,RP).call(this)),(a=this.uppy.getPlugin(ct(this,ta,UP).call(this)))==null||a.setOptions(ct(this,ta,BP).call(this))}},rf=new WeakMap,Bu=new WeakMap,Ly=new WeakMap,af=new WeakMap,sN=new WeakMap,nN=new WeakMap,rN=new WeakMap,Lu=new WeakMap,aN=new WeakMap,iN=new WeakMap,of=new WeakMap,ta=new WeakSet,RP=function(){const{hideUploadButton:n,hideRetryButton:r,hidePauseResumeButton:a,hideCancelButton:i,showProgressDetails:o,hideProgressAfterFinish:l,locale:c,doneButtonHandler:d}=this.opts;return{hideUploadButton:n,hideRetryButton:r,hidePauseResumeButton:a,hideCancelButton:i,showProgressDetail
647s:o,hideAfterFinish:l,locale:c,doneButtonHandler:d}},BP=function(){const{thumbnailWidth:n,thumbnailHeight:r,thumbnailType:a,waitForThumbnailsBeforeUpload:i}=this.opts;return{thumbnailWidth:n,thumbnailHeight:r,thumbnailType:a,waitForThumbnailsBeforeUpload:i,lazy:!i}},TH=function(){return{}},LP=function(){return`${this.id}:StatusBar`},UP=function(){return`${this.id}:ThumbnailGenerator`},OH=function(){return`${this.id}:Informer`},Ge(Ik,"VERSION",Exe.version),Ik);const vge=["defaultChecked","defaultValue","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML","accessKey","className","contentEditable","contextMenu","dir","draggable","hidden","id","lang","placeholder","slot","spellCheck","style","tabIndex","title","translate","radioGroup","role","about","datatype","inlist","prefix","property","resource","typeof","vocab","autoCapitalize","autoCorrect","autoSave","color","itemProp","itemScope","itemType","itemID","itemRef","results","security","unselectable","inputMode","is","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],bge=/^(aria-|data-)/,FH=e=>Object.fromEntries(Object.entries(e).filter(([t])=>bge.test(t)||vge.includes(t)));function wge(e,t){const n=FH(e);return Object.keys(e).some(r=>!Object.hasOwn(n,r)&&e[r]!==t[r])}class _H extends f.Component{constructor(){super(...arguments);Ge(this,"container");Ge(this,"plugin")}componentDidMount(){this.installPlugin()}componentDidUpdate(n){const{uppy:r,open:a,onRequestClose:i}=this.props;if(n.uppy!==r)this.uninstallPlugin(n),this.installPlugin();else if(wge(this.props,n)){const{uppy:o,...l}
647={...this.props,inline:!1,onRequestCloseModal:i};this.plugin.setOptions(l)}n.open&&!a?this.plugin.closeModal():!n.open&&a&&this.plugin.openModal()}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{target:n=this.container,open:r,onRequestClose:a,uppy:i,...o}=this.props,l={id:"DashboardModal",...o,inline:!1,target:n,open:r,onRequestCloseModal:a};i.use(yge,l),this.plugin=i.getPlugin(l.id),r&&this.plugin.openModal()}uninstallPlugin(n=this.props){const{uppy:r}=n;r.removePlugin(this.plugin)}render(){return f.createElement("div",{className:"uppy-Container",ref:n=>{this.container=n},...FH(this.props)})}}Ge(_H,"defaultProps",{open:void 0,onRequestClose:void 0});f.createContext({uppy:void 0,status:"init",progress:0});var jge={};/**
648 * @license React
649 * use-sync-external-store-with-selector.production.js
650 *
651 * Copyright (c) Meta Platforms, Inc. and affiliates.
652 *
653 * This source code is licensed under the MIT license found in the
654 * LICENSE file in the root directory of this source tree.
655 */var Nv=f;function Nge(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Cge=typeof Object.is=="function"?Object.is:Nge,Sge=Nv.useSyncExternalStore,kge=Nv.useRef,Pge=Nv.useEffect,Ege=Nv.useMemo,Dge=Nv.useDebugValue;jge.useSyncExternalStoreWithSelector=function(e,t,n,r,a){var i=kge(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=Ege(function(){function c(p){if(!d){if(d=!0,m=p,p=r(p),a!==void 0&&o.hasValue){var v=o.value;if(a(v,p))return u=v}return u=p}if(v=u,Cge(m,p))return v;var y=r(p);return a!==void 0&&a(v,y)?(m=p,v):(m=p,u=y)}var d=!1,m,u,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,r,a]);var l=Sge(e,i[0],i[1]);return Pge(function(){o.hasValue=!0,o.value=l},[l]),Dge(l),l};function MH(e,t){return Object.hasOwn(e,t)}class Age extends Error{constructor(n,r){super(n);Ge(this,"isNetworkError");Ge(this,"cause");this.cause=r==null?void 0:r.cause,this.cause&&MH(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}}class Tge extends Error{constructor(n,r=null){super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.");Ge(this,"cause");Ge(this,"isNetworkError");Ge(this,"request");this.cause=n,this.isNetworkError=!0,this.request=r}}function Oge(...e){return fetch(...e).catch(t=>{throw t.name==="AbortError"?t:new Tge(t)})}function Fge(e){var a;const n=(a=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?([^\n]+)/i.exec(e))==null?void 0:a[1];return`${/^http:\/\//i.test(e)?"ws":"wss"}://${n}`}class _ge extends Error{constructor(){super(...arguments);Ge(this,"name","UserFacingApiError")}}var $H={};function Xi(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var Mge=Xi;Xi.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Xi.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Xi.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0};Xi.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Xi.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};Xi.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};Xi.prototype.start=Xi.prototype.try;Xi.prototype.errors=function(){return this._errors};Xi.prototype.attempts=function(){return this._attempts};Xi.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var a=this._errors[r],i=a.message,o=(e[i]||0)+1;e[i]=o,o>=n&&(t=a,n=o)}return t};(function(e){var t=Mge;e.operation=function(n){var r=e.timeouts(n);return new t(r,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(n){if(n instanceof Array)return[].concat(n);var r={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var a in n)r[a]=n[a];if(r.minTimeout>r.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],o=0;o<r.retries;o++)i.push(this.createTimeout(o,r));return n&&n.forever&&!i.length&&i.push(this.createTimeout(o,r)),i.sort(function(l,c){return l-c}),i},e.createTimeout=function(n,r){var a=r.randomize?Math.random()+1:1,i=Math.round(a*Math.max(r.minTimeout,1)*Math.pow(r.factor,n));return i=Math.min(i,r.maxTimeout),i},e.wrap=function(n,r,a){if(r instanceof Array&&(a=r,r=null),!a){a=[];for(var i in n)typeof n[i]=="function"&&a.push(i)}for(var o=0;o<a.length;o++){var l=a[o],c=n[l];n[l]=(function(m){var u=e.operation(r),h=Array.prototype.slice.call(arguments,1
655),p=h.pop();h.push(function(v){u.retry(v)||(v&&(arguments[0]=u.mainError()),p.apply(this,arguments))}),u.attempt(function(){m.apply(n,h)})}).bind(n,c),n[l].options=r}}})($H);var $ge=$H;const Ige=Qs($ge),Rge=Object.prototype.toString,Bge=e=>Rge.call(e)==="[object Error]",Lge=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function Uge(e){if(!(e&&Bge(e)&&e.name==="TypeError"&&typeof e.message=="string"))return!1;const{message:n,stack:r}=e;return n==="Load failed"?r===void 0||"__sentry_captured__"in e:n.startsWith("error sending request for url")?!0:Lge.has(n)}class zP extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,{message:t}=t):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}const E$=(e,t,n)=>{const r=n.retries-(t-1);return e.attemptNumber=t,e.retriesLeft=r,e};async function D$(e,t){return new Promise((n,r)=>{t={...t},t.onFailedAttempt??(t.onFailedAttempt=()=>{}),t.shouldRetry??(t.shouldRetry=()=>!0),t.retries??(t.retries=10);const a=Ige.operation(t),i=()=>{var l;a.stop(),r((l=t.signal)==null?void 0:l.reason)};t.signal&&!t.signal.aborted&&t.signal.addEventListener("abort",i,{once:!0});const o=()=>{var l;(l=t.signal)==null||l.removeEventListener("abort",i),a.stop()};a.attempt(async l=>{try{const c=await e(l);o(),n(c)}catch(c){try{if(!(c instanceof Error))throw new TypeError(`Non-error was thrown: "${c}". You should only throw errors.`);if(c instanceof zP)throw c.originalError;if(c instanceof TypeError&&!Uge(c))throw c;if(E$(c,l,t),await t.shouldRetry(c)||(a.stop(),r(c)),await t.onFailedAttempt(c),!a.retry(c))throw a.mainError()}catch(d){E$(d,l,t),o(),r(d)}}})})}const zge="4.5.2",qge={version:zge};class Wge extends Error{constructor(){super("Authorization required");Ge(this,"isAuthError");this.name="AuthError",this.isAuthError=!0}}function Hge(e){return e.replace(/\/$/,"")}const A$=10,Vge=5*60*1e3,Kge=401;class Gge extends Error{constructor({statusCode:n,message:r}){super(r);Ge(this,"statusCode");this.name="HttpError",this.statusCode=n}}async function Yge(e){if(e.status===Kge)throw new Wge;if(e.ok)return e.json();let t=`Failed request with status: ${e.status}. ${e.statusText}`,n;try{n=await e.json(),n.message&&(t=`${t} message: ${n.message}`),n.requestId&&(t=`${t} request-Id: ${n.requestId}`)}catch(r){throw new Error(t,{cause:r})}throw e.status>=400&&e.status<=499&&n.message?new _ge(n.message):new Gge({statusCode:e.status,message:t})}function Qge(e,t,n){const{progress:r,bytesUploaded:a,bytesTotal:i}=t;r&&(e.uppy.log(`Upload progress: ${r}`),e.uppy.emit("upload-progress",n,{uploadStarted:n.progress.uploadStarted??0,bytesUploaded:a,bytesTotal:i}))}var Uu,Fd,qP,oN,WP;class IH{constructor(t,n){Qe(this,Fd);Qe(this,Uu);Ge(this,"uppy");Ge(this,"opts");Qe(this,oN,async({file:t,postBody:n,signal:r})=>{var i;if(((i=t.remote)==null?void 0:i.url)==null)throw new Error("Cannot connect to an undefined URL");return(await this.post(t.remote.url,{...t.remote.body,...n},{signal:r})).token});this.uppy=t,this.opts=n,this.onReceiveResponse=this.onReceiveResponse.bind(this),et(this,Uu,n.companionHeaders)}setCompanionHeaders(t){et(this,Uu,t)}[Symbol.for("uppy test: getCompanionHeaders")](){return X(this,Uu)}get hostname(){const{companion:t}=this.uppy.getState(),n=this.opts.companionUrl;return Hge(t!=null&&t[n]?t[n]:n)}async headers(t=!1){return{...{Accept:"application/json",...t?void 0:{"Content-Type":"application/json"}},...X(this,Uu)}}onReceiveResponse(t){const{headers:n}=t,a=this.uppy.getState().companion||{},i=this.opts.companionUrl;n.has("i-am")&&n.get("i-am")!==a[i]&&this.uppy.setState({companion:{...a,[i]:n.get("i-am")}})}async request({path:t,method:n="GET",data:r,skipPostResponse:a,signal:i}){try{const o=await this.headers(!r),l=await Oge(ct(this,Fd,qP).call(this,t),{method:n,signal:i,headers:o,credentials:this.opts.companionCookiesRule||"same-origin",body:r?JSON.stringify(r):null});return a||this.onReceiveResponse(l),await Yge(l)}catch(o){throw o.isAuthError||o.name==="UserFacingApiError"||o.name==="AbortError"?o:new Age(`Could not ${n} ${ct(this,Fd,qP).call(this,t)}`,{cause:o})}}async get(t,n){return this.request({...n,path:t})}async post(t,n,r){return this.request({...r,path:t,method:"POST",data:n})}async delete(t,n,r){return this.request({...r,path:t,method:"DELETE",data:n})}async uploadRemoteFile(t,n,r){try{const{signal:a,getQueue:i}=r||{};return await D$(async()=>{var d;const o=(d=this.uppy.getFile(t.id))==null?void 0:d.serverToken;
655if(o!=null)return this.uppy.log(`Connecting to exiting websocket ${o}`),ct(this,Fd,WP).call(this,{file:t,queue:i(),signal:a});const c=await i().wrapPromiseFunction(async(...m)=>{try{return await X(this,oN).call(this,...m)}catch(u){if(u.isAuthError)throw new zP(u);if(u.cause==null)throw u;const h=u.cause,p=()=>[408,409,429,418,423].includes(h.statusCode)||h.statusCode>=500&&h.statusCode<=599&&![501,505].includes(h.statusCode);throw h.name==="HttpError"&&!p()?new zP(h):h}},{priority:-1})({file:t,postBody:n,signal:a}).abortOn(a);if(this.uppy.getFile(t.id))return this.uppy.setFileState(t.id,{serverToken:c}),ct(this,Fd,WP).call(this,{file:this.uppy.getFile(t.id),queue:i(),signal:a})},{retries:A$,signal:a,onFailedAttempt:o=>this.uppy.log(`Retrying upload due to: ${o.message}`,"warning")})}catch(a){if(a.name==="AbortError")return;throw this.uppy.emit("upload-error",t,a),a}}}Uu=new WeakMap,Fd=new WeakSet,qP=function(t){return/^(https?:|)\/\//.test(t)?t:`${this.hostname}/${t}`},oN=new WeakMap,WP=async function({file:t,queue:n,signal:r}){let a;const{capabilities:i}=this.uppy.getState();try{return await new Promise((o,l)=>{const c=t.serverToken,d=Fge(t.remote.companionUrl);let m,u,h,{isPaused:p}=t;const v=(P,S)=>{if(m==null||m.readyState!==m.OPEN){this.uppy.log(`Cannot send "${P}" to socket ${t.id} because the socket state was ${String(m==null?void 0:m.readyState)}`,"warning");return}m.send(JSON.stringify({action:P,payload:S??{}}))};function y(){i.resumableUploads&&v(p?"pause":"resume")}const g=async()=>{u&&u.abort(),u=new AbortController;const P=E=>{var T;this.uppy.setFileState(t.id,{serverToken:null}),(T=u==null?void 0:u.abort)==null||T.call(u),l(E)};function S(){clearTimeout(h),!p&&(h=setTimeout(()=>P(new Error("Timeout waiting for message from Companion socket")),Vge))}try{await n.wrapPromiseFunction(async()=>{await D$(async()=>new Promise((T,z)=>{m=new WebSocket(`${d}/api/${c}`),S(),m.addEventListener("close",()=>{m=void 0,z(new Error("Socket closed unexpectedly"))}),m.addEventListener("error",D=>{this.uppy.log(`Companion socket error ${JSON.stringify(D)}, closing socket`,"warning"),m==null||m.close()}),m.addEventListener("open",()=>{y()}),m.addEventListener("message",D=>{var k,F,W;S();try{const{action:q,payload:H}=JSON.parse(D.data);switch(q){case"progress":{Qge(this,H,this.uppy.getFile(t.id));break}case"success":{const _=(k=H.response)==null?void 0:k.responseText;this.uppy.emit("upload-success",this.uppy.getFile(t.id),{uploadURL:H.url,status:((F=H.response)==null?void 0:F.status)??200,body:_?JSON.parse(_):void 0}),(W=u==null?void 0:u.abort)==null||W.call(u),o();break}case"error":{const{message:_}=H.error;throw Object.assign(new Error(_),{cause:H.error})}default:this.uppy.log(`Companion socket unknown action ${q}`,"warning")}}catch(q){P(q)}});const O=()=>{this.uppy.log(`Closing socket ${t.id}`),clearTimeout(h),m&&m.close(),m=void 0};u.signal.addEventListener("abort",()=>{O()})}),{retries:A$,signal:u.signal,onFailedAttempt:()=>{u.signal.aborted||this.uppy.log(`Retrying websocket ${t.id}`)}})})().abortOn(u.signal)}catch(E){if(u.signal.aborted)return;P(E)}},x=P=>{i.resumableUploads&&(p=P,m&&y())},b=P=>{var S;i.individualCancellation&&P.id===t.id&&(v("cancel"),(S=u==null?void 0:u.abort)==null||S.call(u),this.uppy.log(`upload ${t.id} was removed`),o())},w=()=>{var P;v("cancel"),(P=u==null?void 0:u.abort)==null||P.call(u),this.uppy.log(`upload ${t.id} was canceled`),o()},j=(P,S)=>{(P==null?void 0:P.id)===t.id&&x(S)},N=()=>x(!0),C=()=>x(!1);this.uppy.on("file-removed",b),this.uppy.on("cancel-all",w),this.uppy.on("upload-pause",j),this.uppy.on("pause-all",N),this.uppy.on("resume-all",C),a=()=>{this.uppy.off("file-removed",b),this.uppy.off("cancel-all",w),this.uppy.off("upload-pause",j),this.uppy.off("pause-all",N),this.uppy.off("resume-all",C)},r.addEventListener("abort",()=>{u==null||u.abort()}),g()})}finally{a==null||a()}},Ge(IH,"VERSION",qge.version);var il,Uy;class Jge{constructor(t){Qe(this,il);Qe(this,Uy,[]);et(this,il,t)}on(t,n){return X(this,Uy).push([t,n]),X(this,il).on(t,n)}remove(){for(const[t,n]of X(this,Uy).splice(0))X(this,il).off(t,n)}onFilePause(t,n){this.on("upload-pause",(r,a)=>{t===(r==null?void 0:r.id)&&n(a)})}onFileRemove(t,n){this.on("file-removed",r=>
655{t===r.id&&n(r.id)})}onPause(t,n){this.on("upload-pause",(r,a)=>{t===(r==null?void 0:r.id)&&n(a)})}onRetry(t,n){this.on("upload-retry",r=>{t===(r==null?void 0:r.id)&&n()})}onRetryAll(t,n){this.on("retry-all",()=>{X(this,il).getFile(t)&&n()})}onPauseAll(t,n){this.on("pause-all",()=>{X(this,il).getFile(t)&&n()})}onCancelAll(t,n){this.on("cancel-all",(...r)=>{X(this,il).getFile(t)&&n(...r)})}onResumeAll(t,n){this.on("resume-all",()=>{X(this,il).getFile(t)&&n()})}}il=new WeakMap,Uy=new WeakMap;const{AbortController:BS}=globalThis,RH=(e="Aborted",t)=>{const n=new DOMException(e,"AbortError");return t!=null&&MH(t,"cause")&&Object.defineProperty(n,"cause",{__proto__:null,configurable:!0,writable:!0,value:t.cause}),n};function Xge(e){const t=n=>"error"in n&&!!n.error;return e.filter(n=>!t(n))}function Zge(e){return e.filter(t=>{var n;return!((n=t.progress)!=null&&n.uploadStarted)||!t.isRestored})}function T$(e,t){return e===!0?Object.keys(t):Array.isArray(e)?e:[]}function eye(e){return new Error("Cancelled",{cause:e})}function O$(e){var t;if(e!=null){const n=()=>this.abort(e.reason);e.addEventListener("abort",n,{once:!0});const r=()=>{e.removeEventListener("abort",n)};(t=this.then)==null||t.call(this,r,r)}return this}var Hl,ol,Vl,lf,ll,cf,zu,va,HP,Px,BH,LH,UH,lN,df;class tye{constructor(t){Qe(this,va);Qe(this,Hl,0);Qe(this,ol,[]);Qe(this,Vl,!1);Qe(this,lf);Qe(this,ll,1);Qe(this,cf);Qe(this,zu);Ge(this,"limit");Qe(this,lN,()=>this.resume());Qe(this,df,()=>{if(X(this,Vl)){et(this,zu,setTimeout(X(this,df),0));return}et(this,ll,this.limit),this.limit=Math.ceil((X(this,cf)+X(this,ll))/2);for(let t=X(this,ll);t<=this.limit;t++)ct(this,va,Px).call(this);X(this,cf)-X(this,ll)>3?et(this,zu,setTimeout(X(this,df),2e3)):et(this,ll,Math.floor(X(this,ll)/2))});typeof t!="number"||t===0?this.limit=1/0:this.limit=t}run(t,n){return!X(this,Vl)&&X(this,Hl)<this.limit?ct(this,va,HP).call(this,t):ct(this,va,LH).call(this,t,n)}wrapSyncFunction(t,n){return(...r)=>{const a=this.run(()=>(t(...r),queueMicrotask(()=>a.done()),()=>{}),n);return{abortOn:O$,abort(){a.abort()}}}}wrapPromiseFunction(t,n){return(...r)=>{let a;const i=new Promise((o,l)=>{a=this.run(()=>{let c,d;try{d=Promise.resolve(t(...r))}catch(m){d=Promise.reject(m)}return d.then(m=>{c?l(c):(a.done(),o(m))},m=>{c?l(c):(a.done(),l(m))}),m=>{c=eye(m)}},n)});return i.abort=o=>{a.abort(o)},i.abortOn=O$,i}}resume(){et(this,Vl,!1),clearTimeout(X(this,lf));for(let t=0;t<this.limit;t++)ct(this,va,Px).call(this)}pause(t=null){et(this,Vl,!0),clearTimeout(X(this,lf)),t!=null&&et(this,lf,setTimeout(X(this,lN),t))}rateLimit(t){clearTimeout(X(this,zu)),this.pause(t),this.limit>1&&Number.isFinite(this.limit)&&(et(this,cf,this.limit-1),this.limit=X(this,ll),et(this,zu,setTimeout(X(this,df),t)))}get isPaused(){return X(this,Vl)}}Hl=new WeakMap,ol=new WeakMap,Vl=new WeakMap,lf=new WeakMap,ll=new WeakMap,cf=new WeakMap,zu=new WeakMap,va=new WeakSet,HP=function(t){et(this,Hl,X(this,Hl)+1);let n=!1,r;try{r=t()}catch(a){throw et(this,Hl,X(this,Hl)-1),a}return{abort:a=>{n||(n=!0,et(this,Hl,X(this,Hl)-1),r==null||r(a),ct(this,va,Px).call(this))},done:()=>{n||(n=!0,et(this,Hl,X(this,Hl)-1),ct(this,va,Px).call(this))}}},Px=function(){queueMicrotask(()=>ct(this,va,BH).call(this))},BH=function(){if(X(this,Vl)||X(this,Hl)>=this.limit||X(this,ol).length===0)return;const t=X(this,ol).shift();if(t==null)throw new Error("Invariant violation: next is null");const n=ct(this,va,HP).call(this,t.fn);t.abort=n.abort,t.done=n.done},LH=function(t,n){const r={fn:t,priority:(n==null?void 0:n.priority)||0,abort:()=>{ct(this,va,UH).call(this,r)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},a=X(this,ol).findIndex(i=>r.priority>i.priority);return a===-1?X(this,ol).push(r):X(this,ol).splice(a,0,r),r},UH=function(t){const n=X(this,ol).indexOf(t);n!==-1&&X(this,ol).splice(n,1)},lN=new WeakMap,df=new WeakMap;const sye="4.3.2",nye={version:sye};function rye({method:e="PUT",CanonicalUri:t="/",CanonicalQueryString:n="",SignedHeaders:r,HashedPayload:a}){const i=Object.keys(r).map(o=>o.toLowerCase()).sort();return[e,t,n,...i.map(o=>`${o}:${r[o]}`),"",i.join(";"),a].join(`
656`)}const tO=new TextEncoder,sO={name:"HMAC",hash:"SHA-256"};async function aye(e){const{subtle:t}=globalThis.crypto;return t.digest(sO.hash,tO.encode(e))}async function iye(e){const{subtle:t}=globalThis.crypto;return t.importKey("raw",typeof e=="string"?tO.encode(e):e,sO,!1,["sign"])}function F$(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.length;r++)n+=t[r].toString(16).padStart(2,"0");return n}async function ax(e,t){const{subtle:n}=globalThis.crypto;return n.sign(sO,await iye(e),tO.encode(t))}async function oye({accountKey:e,accountSecret:t,sessionToken:n,bucketN
656ame:r,Key:a,Region:i,expires:o,uploadId:l,partNumber:c}){const d="s3",m=`${d}.${i}.amazonaws.com`,u=`/${r}/${encodeURI(a).replace(/[;?:@&=+$,#!'()*]/g,E=>`%${E.charCodeAt(0).toString(16).toUpperCase()}`)}`,h="UNSIGNED-PAYLOAD",p=new Date().toISOString().replace(/[-:]|\.\d+/g,""),v=p.slice(0,8),y=`${v}/${i}/${d}/aws4_request`,g=new URL(`https://${m}${u}`);g.searchParams.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),g.searchParams.set("X-Amz-Content-Sha256",h),g.searchParams.set("X-Amz-Credential",`${e}/${y}`),g.searchParams.set("X-Amz-Date",p),g.searchParams.set("X-Amz-Expires",o),g.searchParams.set("X-Amz-Security-Token",n),g.searchParams.set("X-Amz-SignedHeaders","host"),c&&g.searchParams.set("partNumber",c),l&&g.searchParams.set("uploadId",l),g.searchParams.set("x-id",c&&l?"UploadPart":"PutObject");const x=rye({CanonicalUri:u,CanonicalQueryString:g.search.slice(1),SignedHeaders:{host:m},HashedPayload:h}),b=F$(await aye(x)),w=["AWS4-HMAC-SHA256",p,y,b].join(`
657`),j=await ax(`AWS4${t}`,v),N=await ax(j,i),C=await ax(N,d),P=await ax(C,"aws4_request"),S=F$(await ax(P,w));return g.searchParams.set("X-Amz-Signature",S),g}const lye=1024*1024,_$={getChunkSize(e){return Math.ceil(e.size/1e4)},onProgress(){},onPartComplete(){},onSuccess(){},onError(e){throw e}};function cye(e){if(typeof e=="string")return parseInt(e,10);if(typeof e=="number")return e;throw new TypeError("Expected a number")}const _b=Symbol("pausing upload, not an actual error");var xo,$i,cl,Kl,Gl,zy,qy,uf,qu,mf,Wy,hf,Hy,Uo,zH,qH,VP,Vy,Ky,WH;class dye{constructor(t,n){Qe(this,Uo);Ge(this,"options");Qe(this,xo,new BS);Qe(this,$i,[]);Qe(this,cl,[]);Qe(this,Kl);Qe(this,Gl);Qe(this,zy,!1);Qe(this,qy);Qe(this,uf);Qe(this,qu);Qe(this,mf);Qe(this,Wy,t=>(t==null?void 0:t.cause)===_b?null:X(this,qy).call(this,t));Qe(this,hf,1e4);Qe(this,Hy,5*lye);Qe(this,Vy,t=>n=>{if(!n.lengthComputable)return;X(this,cl)[t].uploaded=cye(n.loaded);const r=X(this,cl).reduce((a,i)=>a+i.uploaded,0);this.options.onProgress(r,X(this,Kl).size)});Qe(this,Ky,t=>n=>{X(this,$i)[t]=null,X(this,cl)[t].etag=n,X(this,cl)[t].done=!0;const r={PartNumber:t+1,ETag:n};this.options.onPartComplete(r)});var r;this.options={..._$,...n},(r=this.options).getChunkSize??(r.getChunkSize=_$.getChunkSize),et(this,Kl,t),et(this,Gl,n.file),et(this,uf,this.options.onSuccess),et(this,qy,this.options.onError),et(this,qu,this.options.shouldUseMultipart),et(this,mf,n.uploadId&&n.key),ct(this,Uo,zH).call(this)}start(){X(this,zy)?(X(this,xo).signal.aborted||X(this,xo).abort(_b),et(this,xo,new BS),ct(this,Uo,VP).call(this)):X(this,mf)?(this.options.companionComm.restoreUploadFile(X(this,Gl),{uploadId:this.options.uploadId,key:this.options.key}),ct(this,Uo,VP).call(this)):ct(this,Uo,qH).call(this)}pause(){X(this,xo).abort(_b),et(this,xo,new BS)}abort(t){t!=null&&t.really?ct(this,Uo,WH).call(this):this.pause()}[Symbol.for("uppy test: getChunkState")](){return X(this,cl)}}xo=new WeakMap,$i=new WeakMap,cl=new WeakMap,Kl=new WeakMap,Gl=new WeakMap,zy=new WeakMap,qy=new WeakMap,uf=new WeakMap,qu=new WeakMap,mf=new WeakMap,Wy=new WeakMap,hf=new WeakMap,Hy=new WeakMap,Uo=new WeakSet,zH=function(){const t=X(this,Kl).size,n=typeof X(this,qu)=="function"?X(this,qu).call(this,X(this,Gl)):!!X(this,qu);if(n&&t>X(this,Hy)){let r=Math.max(this.options.getChunkSize(X(this,Kl)),X(this,Hy)),a=Math.floor(t/r);a>X(this,hf)&&(a=X(this,hf),r=t/X(this,hf)),et(this,$i,Array(a));for(let i=0,o=0;i<t;i+=r,o++){const l=Math.min(t,i+r),c=()=>{const d=i;return X(this,Kl).slice(d,l)};if(X(this,$i)[o]={getData:c,onProgress:X(this,Vy).call(this,o),onComplete:X(this,Ky).call(this,o),shouldUseMultipart:n},X(this,mf)){const d=i+r>t?t-i:r;X(this,$i)[o].setAsUploaded=()=>{X(this,$i)[o]=null,X(this,cl)[o].uploaded=d}}}}else et(this,$i,[{getData:()=>X(this,Kl),onProgress:X(this,Vy).call(this,0),onComplete:X(this,Ky).call(this,0),shouldUseMultipart:n}]);et(this,cl,X(this,$i).map(()=>({uploaded:0})))},qH=function(){this.options.companionComm.uploadFile(X(this,Gl),X(this,$i),X(this,xo).signal).then(X(this,uf),X(this,Wy)),et(this,zy,!0)},VP=function(){this.options.companionComm.resumeUploadFile(X(this,Gl),X(this,$i),X(this,xo).signal).then(X(this,uf),X(this,Wy))},Vy=new WeakMap,Ky=new WeakMap,WH=function(){X(this,xo).abort(),this.options.companionComm.abortFileUpload(X(this,Gl)).catch(t=>this.options.log(t))};function fa(e){if(e!=null&&e.aborted)throw RH("The operation was aborted",{cause:e.reason})}function uye(e){const t=new URL(e);return t.search="",t.hash="",t.href}var Gy,go,Yy,Qy,Jy,Xy,ff,pf,xf,gf,Wu,yf,yo,Cm,HH,KP;class mye{constructor(t,n,r,a){Qe(this,Cm);Qe(this,Gy);Qe(this,go,new WeakMap);Qe(this,Yy);Qe(this,Qy);Qe(this,Jy);Qe(this,Xy);Qe(this,ff);Qe(this,pf);Qe(this,xf);Qe(this,gf);Qe(this,Wu);Qe(this,yf);Qe(this,yo);et(this,pf,t),et(this,Wu,r),et(this,yo,a),this.setOptions(n)}setOptions(t){const n=X(this,pf);"abortMultipartUpload"in t&&et(this,Gy,n.wrapPromiseFunction(t.abortMultipartUpload,{priority:1})),"createMultipartUpload"in t&&et(this,Yy,n.wrapPromiseFunction(t.createMultipartUpload,{priority:-1})),"signPart"in t&&et(this,Qy,n.wrapPromiseFunction(t.signPart)),"listParts"in t&&et(this,Xy,n.wrapPromiseFunction(t.listParts)),"completeMultipartUpload"in t&&et(this,gf,n.wrapPromiseFunction(t.completeMultipartUpload,{priority:1})),"retryDelays"in t&&et(this,xf,t.retryDelays??[]),"uploadPartBytes"in t&&et(this,yf,n.wrapPromiseFunction(t.uploadPartBytes,{priority:1/0})),"getUploadParameters"in t&&et(this,Jy,n.wrapPromiseFunction(t.getUploadParameters))}async getUploadId(t,n){let r;for(;r=X(this,go).get(t.data),r!=null;)try{return await r}catch{}const a=X(this,Yy).call(this,X(this,yo).call(this,t),n),i=()=>{a.abort(n.reason),X(this,go).delete(t.data)};return n.addEventListener("abort",i,{once:!0}),X(this,go).set(t.data,a),a.then(async o=>
657{n.removeEventListener("abort",i),X(this,Wu).call(this,t,o),X(this,go).set(t.data,o)},()=>{n.removeEventListener("abort",i),X(this,go).delete(t.data)}),a}async abortFileUpload(t){const n=X(this,go).get(t.data);if(n==null)return;X(this,go).delete(t.data),X(this,Wu).call(this,t,Object.create(null));let r;try{r=await n}catch{return}await X(this,Gy).call(this,X(this,yo).call(this,t),r)}async uploadFile(t,n,r){if(fa(r),n.length===1&&!n[0].shouldUseMultipart)return ct(this,Cm,KP).call(this,t,n[0],r);const{uploadId:a,key:i}=await this.getUploadId(t,r);fa(r);try{const o=await Promise.all(n.map((l,c)=>this.uploadChunk(t,c+1,l,r)));return fa(r),await X(this,gf).call(this,X(this,yo).call(this,t),{key:i,uploadId:a,parts:o,signal:r},r).abortOn(r)}catch(o){throw(o==null?void 0:o.cause)!==_b&&(o==null?void 0:o.name)!=="AbortError"&&this.abortFileUpload(t),o}}restoreUploadFile(t,n){X(this,go).set(t.data,n)}async resumeUploadFile(t,n,r){if(fa(r),n.length===1&&n[0]!=null&&!n[0].shouldUseMultipart)return ct(this,Cm,KP).call(this,t,n[0],r);const{uploadId:a,key:i}=await this.getUploadId(t,r);fa(r);const o=await X(this,Xy).call(this,X(this,yo).call(this,t),{uploadId:a,key:i,signal:r},r).abortOn(r);fa(r);const l=await Promise.all(n.map((c,d)=>{var h;const m=d+1,u=o.find(({PartNumber:p})=>p===m);return u==null?this.uploadChunk(t,m,c,r):((h=c==null?void 0:c.setAsUploaded)==null||h.call(c),{PartNumber:m,ETag:u.ETag})}));return fa(r),X(this,gf).call(this,X(this,yo).call(this,t),{key:i,uploadId:a,parts:l,signal:r},r).abortOn(r)}async uploadChunk(t,n,r,a){fa(a);const{uploadId:i,key:o}=await this.getUploadId(t,a),l=X(this,xf).values(),c=X(this,xf).values(),d=()=>{const m=l.next();return m==null||m.done?null:m.value};for(;;){fa(a);const m=r.getData(),{onProgress:u,onComplete:h}=r;let p;try{p=await X(this,Qy).call(this,X(this,yo).call(this,t),{uploadId:i,key:o,partNumber:n,body:m,signal:a}).abortOn(a)}catch(v){const y=d();if(y==null||a.aborted)throw v;await new Promise(g=>setTimeout(g,y));continue}fa(a);try{return{PartNumber:n,...await X(this,yf).call(this,{signature:p,body:m,size:m.size,onProgress:u,onComplete:h,signal:a}).abortOn(a)}}catch(v){if(!await ct(this,Cm,HH).call(this,v,c))throw v}}}}Gy=new WeakMap,go=new WeakMap,Yy=new WeakMap,Qy=new WeakMap,Jy=new WeakMap,Xy=new WeakMap,ff=new WeakMap,pf=new WeakMap,xf=new WeakMap,gf=new WeakMap,Wu=new WeakMap,yf=new WeakMap,yo=new WeakMap,Cm=new WeakSet,HH=async function(t,n){var i;const r=X(this,pf),a=(i=t==null?void 0:t.source)==null?void 0:i.status;if(a==null)return!1;if(a===403&&t.message==="Request has expired"){if(!r.isPaused){if(r.limit===1||X(this,ff)==null){const o=n.next();if(o==null||o.done)return!1;et(this,ff,o.value)}r.rateLimit(0),await new Promise(o=>setTimeout(o,X(this,ff)))}}else if(a===429){if(!r.isPaused){const o=n.next();if(o==null||o.done)return!1;r.rateLimit(o.value)}}else{if(a>400&&a<500&&a!==409)return!1;
657if(typeof navigator<"u"&&navigator.onLine===!1)r.isPaused||(r.pause(),window.addEventListener("online",()=>{r.resume()},{once:!0}));else{const o=n.next();if(o==null||o.done)return!1;await new Promise(l=>setTimeout(l,o.value))}}return!0},KP=async function(t,n,r){const{method:a="POST",url:i,fields:o,headers:l}=await X(this,Jy).call(this,X(this,yo).call(this,t),{signal:r}).abortOn(r);let c;const d=n.getData();if(a.toUpperCase()==="POST"){const v=new FormData;Object.entries(o).forEach(([y,g])=>v.set(y,g)),v.set("file",d),c=v}else c=d;const{onProgress:m,onComplete:u}=n,h=await X(this,yf).call(this,{signature:{url:i,headers:l,method:a},body:c,size:d.size,onProgress:m,onComplete:u,signal:r}).abortOn(r),p=o==null?void 0:o.key;return X(this,Wu).call(this,t,{key:p}),{...h,location:h.location??uye(i),bucket:o==null?void 0:o.bucket,key:p}};function qm(e){if(e!=null&&e.error){const t=new Error(e.message);throw Object.assign(t,e.error),t}return e}function M$(e){const t=e.Expiration;if(t){const n=Math.floor((new Date(t)-Date.now())/1e3);if(n>9)return n}}function $$({meta:e,allowedMetaFields:t,querify:n=!1}){const r=t??Object.keys(e);return e?Object.fromEntries(r.filter(a=>e[a]!=null).map(a=>{const i=n?`metadata[${a}]`:a,o=String(e[a]);return[i,o]})):{}}const hye={allowedMetaFields:!0,limit:6,getTemporarySecurityCredentials:!1,shouldUseMultipart:e=>(e.size||0)>100*1024*1024,retryDelays:[0,1e3,3e3,5e3]};var vf,Aa,Ir,YP,_c,vo,VH,cN,bf,KH,GH,Zy,wf,Hu,ev;const dN=class dN extends CW{constructor(n,r){super(n,{...hye,uploadPartBytes:dN.uploadPartBytes,createMultipartUpload:null,listParts:null,abortMultipartUpload:null,completeMultipartUpload:null,signPart:null,getUploadParameters:null,...r});Qe(this,Ir);Qe(this,vf);Qe(this,Aa);Ge(this,"requests");Ge(this,"uploaderEvents");Ge(this,"uploaders");Qe(this,vo);Qe(this,cN,(n,{key:r,uploadId:a})=>{const i=this.uppy.getFile(n.id);i!=null&&this.uppy.setFileState(n.id,{s3Multipart:{...i.s3Multipart,ke
657y:r,uploadId:a}})});Qe(this,bf,n=>this.uppy.getFile(n.id)||n);Qe(this,Zy,async n=>{if(n.length===0)return;const r=this.uppy.getFilesByIds(n),a=Xge(r),i=Zge(a);this.uppy.emit("upload-start",i);const o=a.map(c=>{if(c.isRemote){const d=()=>this.requests;X(this,Hu).call(this,!1);const m=new AbortController,u=p=>{p.id===c.id&&m.abort()};this.uppy.on("file-removed",u);const h=this.uppy.getRequestClientForFile(c).uploadRemoteFile(c,ct(this,Ir,GH).call(this,c),{signal:m.signal,getQueue:d});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",u)},{priority:-1})(),h}return ct(this,Ir,KH).call(this,c)}),l=await Promise.allSettled(o);return X(this,Hu).call(this,!0),l});Qe(this,wf,()=>{var n;(n=X(this,Aa))==null||n.setCompanionHeaders(this.opts.headers)});Qe(this,Hu,n=>{const{capabilities:r}=this.uppy.getState();this.uppy.setState({capabilities:{...r,resumableUploads:n}})});Qe(this,ev,()=>{X(this,Hu).call(this,!0)});this.type="uploader",this.id=this.opts.id||"AwsS3Multipart",ct(this,Ir,YP).call(this,r);const a={createMultipartUpload:this.createMultipartUpload,listParts:this.listParts,abortMultipartUpload:this.abortMultipartUpload,completeMultipartUpload:this.completeMultipartUpload,signPart:r!=null&&r.getTemporarySecurityCredentials?this.createSignedURL:this.signPart,getUploadParameters:r!=null&&r.getTemporarySecurityCredentials?this.createSignedURL:this.getUploadParameters};for(const i of Object.keys(a))this.opts[i]==null&&(this.opts[i]=a[i].bind(this));this.requests=this.opts.rateLimitedQueue??new tye(this.opts.limit),et(this,vf,new mye(this.requests,this.opts,X(this,cN),X(this,bf))),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null)}[Symbol.for("uppy test: getClient")](){return X(this,Aa)}setOptions(n){X(this,vf).setOptions(n),super.setOptions(n),ct(this,Ir,YP).call(this,n)}resetUploaderReferences(n,r){this.uploaders[n]&&(this.uploaders[n].abort({really:(r==null?void 0:r.abort)||!1}),this.uploaders[n]=null),this.uploaderEvents[n]&&(this.uploaderEvents[n].remove(),this.uploaderEvents[n]=null)}createMultipartUpload(n,r){ct(this,Ir,_c).call(this,"createMultipartUpload"),fa(r);const a=T$(this.opts.allowedMetaFields,n.meta),i=$$({meta:n.meta,allowedMetaFields:a});return X(this,Aa).post("s3/multipart",{filename:n.name,type:n.type,metadata:i},{signal:r}).then(qm)}listParts(n,{key:r,uploadId:a,signal:i},o){i??(i=o),ct(this,Ir,_c).call(this,"listParts"),fa(i);const l=encodeURIComponent(r);return X(this,Aa).get(`s3/multipart/${encodeURIComponent(a)}?key=${l}`,{signal:i}).then(qm)}completeMultipartUpload(n,{key:r,uploadId:a,parts:i,signal:o},l){o??(o=l),ct(this,Ir,_c).call(this,"completeMultipartUpload"),fa(o);const c=encodeURIComponent(r),d=encodeURIComponent(a);return X(this,Aa).post(`s3/multipart/${d}/complete?key=${c}`,{parts:i.map(({ETag:m,PartNumber:u})=>({ETag:m,PartNumber:u}))},{signal:o}).then(qm)}async createSignedURL(n,r){const a=await ct(this,Ir,VH).call(this,r),i=M$(a.credentials)||604800,{uploadId:o,key:l,partNumber:c}=r;return{method:"PUT",expires:i,fields:{},url:`${await oye({accountKey:a.credentials.AccessKeyId,accountSecret:a.credentials.SecretAccessKey,sessionToken:a.credentials.SessionToken,expires:i,bucketName:a.bucket,Region:a.region,Key:l??`${crypto.randomUUID()}-${n.name}`,uploadId:o,partNumber:c})}`,headers:{"Content-Type":n.type}}}signPart(n,{uploadId:r,key:a,partNumber:i,signal:o}){if(ct(this,Ir,_c).call(this,"signPart"),fa(o),r==null||a==null||i==null)throw new Error("Cannot sign without a key, an uploadId, and a partNumber");const l=encodeURIComponent(a);return X(this,Aa).get(`s3/multipart/${encodeURIComponent(r)}/${i}?key=${l}`,{signal:o}).then(qm)}abortMultipartUpload(n,{key:r,uploadId:a,signal:i}){ct(this,Ir,_c).call(this,"abortMultipartUpload");const o=encodeURIComponent(r),l=encodeURIComponent(a);return X(this,Aa).delete(`s3/multipart/${l}?key=${o}`,void 0,{signal:i}).then(qm)}getUploadParameters(n,r){ct(this,Ir,_c).call(this,"getUploadParameters");const{meta:a}=n,{type:i,name:o}=a,l=T$(this.opts.allowedMetaFields,n.meta),c=$$({meta:a,allowedMetaFields:l,querify:!0}),d=new URLSearchParams({filename:o,type:i,...c});return X(this,Aa).get(`s3/params?${d}`,r)}static async uploadPartBytes({signature:{url:n,expires:r,headers:a,method:i="PUT"},body:o,size:l=o.size,onProgress:c,onComplete:d,signal:m}){if(fa(m),n==null)throw new Error("Cannot upload to an undefined URL");return new Promise((u,h)=>{const p=new XMLHttpRequest;
657p.open(i,n,!0),a&&Object.keys(a).forEach(g=>{p.setRequestHeader(g,a[g])}),p.responseType="text",typeof r=="number"&&(p.timeout=r*1e3);function v(){p.abort()}function y(){m==null||m.removeEventListener("abort",v)}m==null||m.addEventListener("abort",v),p.upload.addEventListener("progress",g=>{c(g)}),p.addEventListener("abort",()=>{y(),h(RH())}),p.addEventListener("timeout",()=>{y();const g=new Error("Request has expired");g.source={status:403},h(g)}),p.addEventListener("load",()=>{if(y(),p.status===403&&p.responseText.includes("<Message>Request has expired</Message>")){const j=new Error("Request has expired");j.source=p,h(j);return}if(p.status<200||p.status>=300){const j=new Error("Non 2xx");j.source=p,h(j);return}c==null||c({loaded:l,lengthComputable:!0});const g=p.getAllResponseHeaders().trim().split(/[\r\n]+/),x={__proto__:null};for(const j of g){const N=j.split(": "),C=N.shift(),P=N.join(": ");x[C]=P}const{etag:b,location:w}=x;if(i.toUpperCase()==="POST"&&w==null&&console.error("@uppy/aws-s3: Could not read the Location header. This likely means CORS is not configured correctly on the S3 Bucket. See https://uppy.io/docs/aws-s3/#setting-up-your-s3-bucket"),b==null){console.error("@uppy/aws-s3: Could not read the ETag header. This likely means CORS is not configured correctly on the S3 Bucket. See https://uppy.io/docs/aws-s3/#setting-up-your-s3-bucket");return}d==null||d(b),u({...x,ETag:b})}),p.addEventListener("error",g=>{y();const x=new Error("Unknown error");x.source=g.target,h(x)}),p.send(o)})}install(){X(this,Hu).call(this,!0),this.uppy.addPreProcessor(X(this,wf)),this.uppy.addUploader(X(this,Zy)),this.uppy.on("cancel-all",X(this,ev))}uninstall(){this.uppy.removePreProcessor(X(this,wf)),this.uppy.removeUploader(X(this,Zy)),this.uppy.off("cancel-all",X(this,ev))}};vf=new WeakMap,Aa=new WeakMap,Ir=new WeakSet,YP=function(n){n==null||!("endpoint"in n||"companionUrl"in n||"headers"in n||"companionHeaders"in n||"cookiesRule"in n||"companionCookiesRule"in n)||("companionUrl"in n&&!("endpoint"in n)&&this.uppy.log("`companionUrl` option has been removed in @uppy/aws-s3, use `endpoint` instead.","warning"),"companionHeaders"in n&&!("headers"in n)&&this.uppy.log("`companionHeaders` option has been removed in @uppy/aws-s3, use `headers` instead.","warning"),"companionCookiesRule"in n&&!("cookiesRule"in n)&&this.uppy.log("`companionCookiesRule` option has been removed in @uppy/aws-s3, use `cookiesRule` instead.","warning"),"endpoint"in n?et(this,Aa,new IH(this.uppy,{pluginId:this.id,provider:"AWS",companionUrl:this.opts.endpoint,companionHeaders:this.opts.headers,companionCookiesRule:this.opts.cookiesRule})):("headers"in n&&X(this,wf).call(this),"cookiesRule"in n&&(X(this,Aa).opts.companionCookiesRule=n.cookiesRule)))},_c=function(n){if(!X(this,Aa))throw new Error(`Expected a \`endpoint\` option containing a URL, or if you are not using Companion, a custom \`${n}\` implementation.`)},vo=new WeakMap,VH=async function(n){if(fa(n==null?void 0:n.signal),X(this,vo)==null){const{getTemporarySecurityCredentials:r}=this.opts;r===!0?(ct(this,Ir,_c).call(this,"getTemporarySecurityCredentials"),et(this,vo,X(this,Aa).get("s3/sts",n).then(qm))):et(this,vo,r(n)),et(this,vo,await X(this,vo)),setTimeout(()=>{et(this,vo,null)},(M$(X(this,vo).credentials)||0)*500)}return X(this,vo)},cN=new WeakMap,bf=new WeakMap,KH=function(n){return new Promise((r,a)=>{const i=(m,u)=>{const h=this.uppy.getFile(n.id);this.uppy.emit("upload-progress",h,{uploadStarted:h.progress.uploadStarted??0,bytesUploaded:m,bytesTotal:u})},o=m=>{this.uppy.log(m),this.uppy.emit("upload-error",n,m),this.resetUploaderReferences(n.id),a(m)},l=m=>{const u={body:{...m},status:200,uploadURL:m.location};this.resetUploaderReferences(n.id),this.uppy.emit("upload-success",X(this,bf).call(this,n),u),m.location&&this.uppy.log(`Download ${n.name} from ${m.location}`),r(void 0)},c=new dye(n.data,{companionComm:X(this,vf),log:(...m)=>this.uppy.log(...m),getChunkSize:this.opts.getChunkSize?this.opts.getChunkSize.bind(this):void 0,onProgress:i,onError:o,onSuccess:l,onPartComplete:m=>{this.uppy.emit("s3-multipart:part-uploaded",X(this,bf).call(this,n),m)},file:n,shouldUseMultipart:this.opts.shouldUseMultipart,...n.s3Multipart});this.uploaders[n.id]=c;const d=new Jge(this.uppy);this.uploaderEvents[n.id]=d,d.onFileRemove(n.id,m=>{c.abort(),this.resetUploaderReferences(n.id,{abort:!0}),r(`upload ${m} was removed`)}),d.onCancelAll(n.id,()=>{c.abort(),this.resetUploaderReferences(n.id,{abort:!0}),r(`upload ${n.id} was canceled`)}),d.onFilePause(n.id,m=>{m?c.pause():c.start()}),d.onPauseAll(n.id,()=>{c.pause()}),d.onResumeAll(n.id,()=>{c.start()}),c.start()})},GH=function(n){var r;return{...(r=n.remote)==null?void 0:r.body,protocol:"s3-multipart",size:n.data.size,metadata:n.meta}},Zy=new WeakMap,wf=new WeakMap,Hu=new WeakMap,ev=new WeakMap,Ge(dN,"VERSION",nye.version);let GP=dN;
657function nO({maxNumberOfFiles:e=1,maxFileSize:t=10485760,onGetUploadParameters:n,onComplete:r,buttonClassName:a,buttonVariant:i="default",children:o}){const[l,c]=f.useState(!1),[d]=f.useState(()=>new SP({restrictions:{maxNumberOfFiles:e,maxFileSize:t,allowedFileTypes:["image/*"]},autoProceed:!1}).use(GP,{shouldUseMultipart:!1,getUploadParameters:async m=>{console.log("ObjectUploader: Getting upload parameters for file:",m.name);try{const u=await n(m);console.log("ObjectUploader: Upload params result:",u),console.log("ObjectUploader: URL type:",typeof u.url),console.log("ObjectUploader: URL value:",u.url);const h={method:u.method,url:String(u.url),fields:{}};return console.log("ObjectUploader: Final params:",h),h}catch(u){throw console.error("ObjectUploader: Error getting upload parameters:",u),u}}}).on("complete",m=>{console.log("ObjectUploader: Upload complete:",m),r==null||r(m),c(!1)}).on("error",m=>{console.error("ObjectUploader: Upload error:",m)}).on("upload-error",(m,u,h)=>{console.error("ObjectUploader: Upload error for file:",m==null?void 0:m.name,u,h)}));return s.jsxs("div",{children:[s.jsx(B,{type:"button",onClick:m=>{m.preventDefault(),m.stopPropagation(),c(!0)},variant:i,className:a,children:o}),s.jsx(_H,{uppy:d,open:l,onRequestClose:()=>c(!1),proudlyDisplayPoweredByUppy:!1})]})}function I$({src:e,alt:t,onSave:n,isAdmin:r,className:a,imageClassName:i,fallbackComponent:o,disabled:l=!1}){const[c,d]=f.useState(!1),[m,u]=f.useState(!1),[h,p]=f.useState(""),v=async()=>{if(h.trim()){u(!0);try{await n(h.trim()),d(!1),p("")}catch(g){console.error("Failed to save image URL:",g)}finally{u(!1)}}},y=async g=>{var x;if(g.successful&&g.successful.length>0){const w=g.successful[0].uploadURL;if(!w){console.error("No upload URL in result");return}u(!0);try{const j=JSON.parse(localStorage.getItem("instructorSession")||"{}"),N=JSON.parse(localStorage.getItem("admin_session")||"{}"),C=j.token||((x=N.instructor)==null?void 0:x.token)||localStorage.getItem("auth_token"),P=await fetch("/api/instructor/logo",{method:"PUT",headers:{Authorization:`Bearer ${C}`,"Content-Type":"application/json"},body:JSON.stringify({logoURL:w})});if(!P.ok){const E=await P.text();throw new Error(`Logo update failed: ${P.status} ${E}`)}const S=await P.json();if(S.success)await n(S.logoUrl),d(!1);else throw new Error(S.message||"Logo update failed")}catch(j){throw console.error("Error updating logo:",j),j}finally{u(!1)}}};return r?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:bt("group relative inline-block",a),children:e?s.jsx("img",{src:e,alt:t,className:bt(i,"transition-opacity")}):s.jsxs(s.Fragment,{children:[o||s.jsx("div",{className:bt("bg-slate-100 border-2 border-dashed border-slate-300 rounded flex items-center justify-center",i),children:s.jsx("span",{className:"text-slate-400 text-sm",children:"No image"})}),!l&&s.jsx("button",{onClick:()=>d(!0),className:"absolute inset-0 bg-black/30 hover:bg-black/50 transition-colors flex items-center justify-center rounded cursor-pointer",title:"Click to edit","aria-label":"Edit image",children:s.jsx(Ur,{className:"h-6 w-6 text-white drop-shadow-lg"})})]})}),s.jsx(Ct,{open:c,onOpenChange:d,children:s.jsxs(St,{className:"max-w-md",children:[s.jsx(kt,{children:s.jsxs(Pt,{children:["Edit ",t]})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{children:"Upload Image"}),s.jsx(nO,{maxNumberOfFiles:1,maxFileSize:5*1024*1024,onGetUploadParameters:async g=>{var j;const x=JSON.parse(localStorage.getItem("instructorSession")||"{}").token||((j=JSON.parse(localStorage.getItem("admin_session")||"{}").instructor)==null?void 0:j.token)||localStorage.getItem("auth_token"),b=await fetch("/api/objects/upload",{method:"POST",headers:{Authorization:`Bearer ${x}`,"Content-Type":"application/json"}});if(!b.ok){const N=await b.text();throw new Error(`Upload API failed: ${b.status} ${N}`)}const w=await b.json();if(!w.uploadURL)throw new Error(`No uploadURL in response: ${JSON.stringify(w)}`);return{method:"PUT",url:w.uploadURL}},onComplete:y,buttonClassName:"w-full",children:s.jsxs("div",{className:"flex items-center gap-2 justify-center",children:[s.jsx(Gs,{className:"h-4 w-4"}),e?"Change Image":"Upload Image"]})})]}),s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-0 flex items-center",children:s.jsx("span",{className:"w-full border-t"})}),s.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:s.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or"})})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"manualUrl",children:"Paste Image URL"}),s.jsxs("div",{className:"flex gap-2 mt-1",children:[s.jsx(me,{id:"manualUrl",value:h,onChange:g=>p(g.target.value),placeholder:"https://yoursite.com/image.png",disabled:m}),s.jsx(B,{onClick:v,disabled:!h.trim()||m,size:"sm",children:m?s.jsx(Qr,{className:"h-4 w-4 animate-spin"}):"Save"})]})]}),s.jsx("div",{className:"flex justify-end gap-2 pt-4",children:s.jsx(B,{variant:"outline",onClick:()=>{d(!1),p("")},disabled:m,children:"Cancel"})})]})]})})]}):!e&&o?s.jsx(s.Fragment,{children:o}):e?s.jsx("img",{src:e,alt:t,className:bt(i,a)}):null}function rO(e){const t=e.replace("#","");if(!/^[0-9A-Fa-f]{6}$/.test(t))return null;const n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,a=parseInt(t.slice(4,6),16)/255,i=o=>o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4);return .2126*i(n)+.7152*i(r)+.0722*i(a)}function QP(e){const t=rO(e);return t!=null&&t>.8}function JP(e){const t=rO(e);return t!=null&&t>.5}function Rl(e){const t=rO(e);return t!=null&&t>.5?"218 18% 9%":"355 7% 97%"}const fye="#1C1917",pye="#FAF7F5";function xye(e,t){const n=e==null?void 0:e.trim();if(n)return n;const r=t==null?void 0:t.trim();return r?JP(r)?fye:pye:"#FFFFFF"}function YH(e){e=e.replace("#","");const t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,r=parseInt(e.substr(4,2),16)/255,a=Math.max(t,n,r),i=Math.min(t,n,r);let o=0,l=0;const c=(a+i)/2;if(a!==i){const d=a-i;switch(l=c>.5?d/(2-a-i):d/(a+i),a){case t:o=(n-r)/d+(n<r?6:0);break;case n:o=(r-t)/d+2;break;case r:o=(t-n)/d+4;break}o/=6}return`${Math.round(o*360)} ${Math.round(l*100)}% ${Math.round(c*100)}%`}const R$="#3B82F6";function Cv(e){return e?QP(e)?R$:e:R$}function QH(e,t,n,r){const a=(n==null?void 0:n.trim())||e,i=t,o=r||"to_bottom_right";return o==="solid"?{background:a}:o==="to_right"?{background:`linear-gradient(to right, ${a}, ${i})`}:o==="to_bottom"?{background:`linear-gradient(to bottom, ${a}, ${i})`}:{background:`linear-gradient(to bottom right, ${a}, ${i})`}}const gye=120;function aO({text:e,linkClassName:t="text-sky-600 hover:underline break-all",className:n="",preserveLineBreaks:r=!1}){const[a,i]=f.useState(!1),o=r?e.split(`
658`).length:1,l=e.length>gye||r&&o>2,c=r?e.split(`
659`).flatMap((d,m)=>m===0?[he.createElement(he.Fragment,{key:`line-${m}`},rS(d,t))]:[he.createElement("br",{key:`br-${m}`}),he.createElement(he.Fragment,{key:`line-${m}`},rS(d,t))]):rS(e,t);return s.jsxs("div",{className:n,children:[s.jsx("p",{className:`text-slate-600 text-sm ${a?"":"line-clamp-2"}`,children:c}),l&&s.jsx("button",{type:"button",onClick:()=>i(d=>!d),className:"text-sky-600 hover:underline text-sm mt-0.5 font-medium",children:a?"Less":"More…"})]})}function B$(e){const t=e.match(/^\/cal\/([^/]+)/),n=e.match(/^\/classes\/([^/]+)/),r=e.match(/^\/my-account\/([^/]+)/),a=(t==null?void 0:t[1])||(n==null?void 0:n[1])||(r==null?void 0:r[1]);let i=document.querySelector('link[rel="manifest"]');i||(i=document.createElement("link"),i.rel="manifest",i.id="dynamic-manifest",document.head.appendChild(i));const o=a?`/manifest.json?subdomain=${encodeURIComponent(a)}`:"/manifest.json",l=i.getAttribute("href")||i.href;if(l.split("&v=")[0].split("?v=")[0]!==o){if(console.log("📄 React updating manifest link:",o,"(was:",l,")"),i.setAttribute("href",o),i.href=o,!a){const d=document.querySelector('link[rel="apple-touch-icon"]');d&&(d.href="/apple-touch-icon.png")}if(a){let d=document.querySelector('meta[name="apple-mobile-web-app-title"]');d||(d=document.createElement("meta"),d.setAttribute("name","apple-mobile-web-app-title"),document.head.appendChild(d))}fetch(o).then(d=>{if(d.ok)return console.log("✅ Manifest loaded successfully"),d.json();console.warn("⚠️ Manifest failed to load:",d.status)}).then(d=>{var m,u;if(d){if(console.log("📄 Manifest content:",{name:d.name,start_url:d.start_url,scope:d.scope}
659),d.name){let v=document.querySelector('meta[name="apple-mobile-web-app-title"]');v||(v=document.createElement("meta"),v.setAttribute("name","apple-mobile-web-app-title"),document.head.appendChild(v)),v.setAttribute("content",d.short_name||d.name)}let h=document.querySelector('link[rel="apple-touch-icon"]');const p=(u=(m=d.icons)==null?void 0:m[0])==null?void 0:u.src;p?(h||(h=document.createElement("link"),h.rel="apple-touch-icon",h.sizes="180x180",document.head.appendChild(h)),h.href=p.startsWith("http")?p:`${window.location.origin}${p.startsWith("/")?"":"/"}${p}`):h&&(h.href="/apple-touch-icon.png")}}).catch(d=>{console.error("❌ Error loading manifest:",d)})}}function JH(){const[e]=cn();f.useEffect(()=>{B$(e)},[e]),typeof window<"u"&&B$(window.location.pathname)}function yye(e){try{const t=e.split(".")[1];if(!t)return null;const n=t.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(n).split("").map(a=>"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(r)}catch{return null}}function iO(e){const[t,n]=f.useState({isAdmin:!1,instructorId:null,isOwner:!1,accessLevel:null}),r=f.useRef(null);return f.useEffect(()=>{r.current=null;const a=()=>{var l;try{const c=JSON.parse(localStorage.getItem("instructorSession")||"{}"),d=JSON.parse(localStorage.getItem("admin_session")||"{}"),m=c.token||((l=d.instructor)==null?void 0:l.token)||localStorage.getItem("auth_token");if(!m){const x={isAdmin:!1,instructorId:null,isOwner:!1,accessLevel:null},b=JSON.stringify(x);r.current!==b&&(r.current=b,n(x));return}const u=yye(m),h=(u==null?void 0:u.instructorId)||(u==null?void 0:u.id)||null;if(!h){const x={isAdmin:!1,instructorId:null,isOwner:!1,accessLevel:null},b=JSON.stringify(x);r.current!==b&&(r.current=b,n(x));return}const p=e!==void 0&&h===e,v=u!=null&&u.teamMemberId&&(u!=null&&u.accessLevel)&&["admin","readonly","bookings_only"].includes(u.accessLevel)?u.accessLevel:"admin",y={isAdmin:!0,instructorId:h,isOwner:p||e===void 0,accessLevel:v},g=JSON.stringify(y);r.current!==g&&(r.current=g,n(y))}catch{const d={isAdmin:!1,instructorId:null,isOwner:!1,accessLevel:null},m=JSON.stringify(d);r.current!==m&&(r.current=m,n(d))}};a();const i=()=>{a()};window.addEventListener("storage",i);const o=setInterval(a,1e3);return()=>{window.removeEventListener("storage",i),clearInterval(o)}},[e]),t}function T0(){const{subdomain:e}=sa(),[t]=cn();JH();const[n,r]=f.useState(null),[a,i]=f.useState(null),[o,l]=f.useState(null),[c,d]=f.useState(!1),[m,u]=f.useState(null),[h,p]=f.useState(!1),[v,y]=f.useState(null),[g,x]=f.useState(""),[b,w]=f.useState(new Date),[j,N]=f.useState(!1),[C,P]=f.useState("monthly"),S=f.useRef(!1),[E,T]=f.useState(!1),[z,O]=f.useState(!1),[D,k]=f.useState(!1),[F,W]=f.useState(!1),[q,H]=f.useState(""),[_,L]=f.useState(""),[U,J]=f.useState(""),[I,re]=f.useState(""),[R,Y]=f.useState(""),[M,se]=f.useState({name:"",email:"",subject:"",message:""}),{toast:Q}=Yt(),te=jn(),{data:G,isLoading:Z,error:ie}=Ue({queryKey:[`/api/instructor/by-subdomain/${e}`],enabled:!!e}),{isAdmin:A,isOwner:ge}=iO(G==null?void 0:G.id),je=(ie==null?void 0:ie.message)||"",ke=e?je.toLowerCase().includes("disabled"):!1,Ie=e?!G&&!Z&&je.toLowerCase().includes("not found"):!1,{data:$e=[]}=Ue({queryKey:[`/api/instructors/${G==null?void 0:G.id}/memberships`],enabled:!!(G!=null&&G.id)&&!ke}),{data:qe=[]}=Ue({queryKey:[`/api/coupons/bundles/public/${G==null?void 0:G.id}`],enabled:!!(G!=null&&G.id)&&!ke}),ft=typeof window<"u"&&new URLSearchParams(window.location.search).get("serviceToken")||null,{data:be=[]}=Ue({queryKey:[`/api/services/${G==null?void 0:G.id}`,ft],queryFn:async()=>{const Te=`/api/services/${G==null?void 0:G.id}${ft?`?serviceToken=${encodeURIComponent(ft)}`:""}`;return(await Pe("GET",Te)).json()},enabled:!!(G!=null&&G.id)&&!ke}),Fe=Array.isArray(G==null?void 0:G.featureFlags)&&G.featureFlags.includes("events"),{data:_e=[]}=Ue({queryKey:["/api/events/public",G==null?void 0:G.id],queryFn:async()=>(await Pe("GET",`/api/events/public?instructorId=${G==null?void 0:G.id}`)).json(),enabled:!!(G!=null&&G.id)&&!ke&&Fe}),ze=f.useRef(!1);f.useEffect(()=>{ft&&be.length===1&&!c&&!ze.current&&(ze.current=!0,l(be[0]),d(!0))},[ft,be,c]);const ue=xt({mutationFn:async Te=>(await Pe("POST","/api/instructor-contact",{instructorId:G==null?void 0:G.id,name:Te.name,email:Te.email,subject:Te.subject,message:Te.message})).json(),onSuccess:()=>{Q({title:"Message Sent!",description:"Your message has been sent successfully. The instructor will get back to you soon."}),N(!1),y(null),x(""),se({name:"",email:"",subject:"",message:""})},onError:Te=>{Q({title:"Error",description:Te.message||"Failed to send message. Please try again.",variant:"destructive"})}}),Me=xt({mutationFn:async Te=>{if(!(G!=null&&G.id))throw new Error("Instructor ID not available");const at=await Pe("PATCH",`/api/instructors/${G.id}`,Te);if(!at.ok){const ss=await at.json();throw new Error(ss.message||"Failed to update settings")}return at.json()},onSuccess:()=>
659{te.invalidateQueries({queryKey:[`/api/instructor/by-subdomain/${e}`]}),te.invalidateQueries({queryKey:["/api/instructor"]}),Q({title:"Updated!",description:"Your changes have been saved successfully."})},onError:Te=>{throw Q({title:"Error",description:Te.message||"Failed to save changes. Please try again.",variant:"destructive"}),Te}}),pt=async Te=>{await Me.mutateAsync({businessName:Te})},de=async Te=>{await Me.mutateAsync({description:Te})},fe=async Te=>{await Me.mutateAsync({headline:Te})},le=async Te=>{await Me.mutateAsync({tagline:Te})},Ke=async Te=>{await Me.mutateAsync({logoUrl:Te})},We=async(Te,at,ss,ps,bs)=>{const Ss={primaryColor:Te,secondaryColor:at};ss!==void 0&&(Ss.heroColor=ss||null),ps!==void 0&&(Ss.heroGradientStyle=ps||null),bs!==void 0&&(Ss.heroTextColor=bs||null),await Me.mutateAsync(Ss)};f.useEffect(()=>{z&&G&&(H(G.primaryColor||"#3B82F6"),L(G.secondaryColor||"#10B981"),J(G.heroColor??""),re(G.heroGradientStyle??""),Y(G.heroTextColor??""))},[z,G]);const vt=async Te=>{k(!0);try{if(!Te.trim())throw new Error("Please enter some text to polish");const at=await Pe("POST","/api/polish-text",{text:Te,type:"business_description",context:{businessName:(G==null?void 0:G.businessName)||"",instructorName:(G==null?void 0:G.instructorName)||""}});if(!at.ok){const ps=await at.json();throw new Error(ps.message||"Failed to polish text")}const ss=await at.json();return k(!1),Q({title:"Text Enhanced",description:"Your business description has been polished with AI. Click save to apply."}),ss.polishedText}catch(at){throw k(!1),Q({title:"Enhancement Failed",description:at.message||"Failed to enhance text",variant:"destructive"}),at}},Zt=async Te=>{W(!0);try{if(!Te.trim())throw new Error("Please enter some text to polish");const at=await Pe("POST","/api/polish-text",{text:Te,type:"tagline",context:{businessName:(G==null?void 0:G.businessName)||"",instructorName:(G==null?void 0:G.instructorName)||"",businessDescription:(G==null?void 0:G.description)||""}});if(!at.ok){const ps=await at.json();throw new Error(ps.message||"Failed to polish text")}const ss=await at.json();return W(!1),Q({title:"Text Enhanced",description:"Your tagline has been polished with AI. Click save to apply."}),ss.polishedText}catch(at){throw W(!1),Q({title:"Enhancement Failed",description:at.message||"Failed to enhance text",variant:"destructive"}),at}};f.useEffect(()=>{e&&sessionStorage.setItem("currentInstructorSubdomain",e)},[e]),f.useEffect(()=>{if(G&&(G.primaryColor||G.secondaryColor)){const Te=document.documentElement;if(G.primaryColor){const at=Cv(G.primaryColor);Te.style.setProperty("--primary",Tt(at)),Te.style.setProperty("--primary-foreground",Ot(at))}if(G.secondaryColor){const at=Tt(G.secondaryColor);Te.style.setProperty("--secondary",at);const ss=Ot(G.secondaryColor);Te.style.setProperty("--secondary-foreground",ss)}}return()=>{if(G&&(G.primaryColor||G.secondaryColor)){const Te=document.documentElement;Te.style.removeProperty("--primary"),Te.style.removeProperty("--primary-foreground"),Te.style.removeProperty("--secondary")}}},[G]);function Ht(Te){switch(Te){case"monthly":return"month";case"four_weekly":return"4 weeks";case"quarterly":return"quarter";case"yearly":return"year";default:return"month"}}function Tt(Te){Te=Te.replace("#","");const at=parseInt(Te.substr(0,2),16)/255,ss=parseInt(Te.substr(2,2),16)/255,ps=parseInt(Te.substr(4,2),16)/255,bs=Math.max(at,ss,ps),Ss=Math.min(at,ss,ps);let xs=0,hs=0;const gs=(bs+Ss)/2;if(bs!==Ss){const Os=bs-Ss;switch(hs=gs>.5?Os/(2-bs-Ss):Os/(bs+Ss),bs){case at:xs=(ss-ps)/Os+(ss<ps?6:0);break;case ss:xs=(ps-at)/Os+2;break;case ps:xs=(at-ss)/Os+4;break}xs/=6}return`${Math.round(xs*360)} ${Math.round(hs*100)}% ${Math.round(gs*100)}%`}function Ot(Te){Te=Te.replace("#","");const at=parseInt(Te.substr(0,2),16)/255,ss=parseInt(Te.substr(2,2),16)/255,ps=parseInt(Te.substr(4,2),16)/255,bs=xs=>xs<=.03928?xs/12.92:Math.pow((xs+.055)/1.055,2.4);return .2126*bs(at)+.7152*bs(ss)+.0722*bs(ps)>.5?"218 18% 9%":"355 7% 97%"}const{data:Ft=[],isLoading:is,error:Cs}=Ue({queryKey:e?[`/api/public/classes?subdomain=${e}&v=${(G==null?void 0:G.classesVersion)||1}`]:["/api/classes"],enabled:e?!!G&&!ke:!0,staleTime:0,cacheTime:0,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),{data:Ne=[]}=Ue({queryKey:["/api/instructors"],enabled:!e}),rt=Cs&&Cs.message.toLowerCase().includes("disabled"),ht=rt?[]:Ft;f.useEffect(()=>{const Te=gs=>{switch(gs){case"#events":return"events-section";case"#services":return"services-section";case"#classes":return"classes-section";case"#bundles":return"bundle-section";case"#memberships":return"memberships-section";default:return null}},at=gs=>gs==="memberships-section"||gs==="services-section"||gs==="events-section"||gs==="bundle-section",ss=(gs="smooth")=>{const Os=(window.location.hash||"").toLowerCase(),cs=Te(Os);if(!cs)return;const Tr=document.getElementById(cs);Tr&&Tr.scrollIntoView({behavior:gs,block:"start"})},ps=()=>{ss("smooth")};window.addEventListener("hashchange",ps),requestAnimationFrame(()=>{requestAnimationFrame(()=>ss("smooth"))});let bs=null,Ss=null,xs=null;const hs=document.getElementById("classes-section");return hs&&typeof ResizeObserver<"u"&&(Ss=new ResizeObserver(()=>{const gs=(window.location.hash||"").toLowerCase(),Os=Te(gs);!Os||!at(Os)||(bs&&clearTimeout(bs),bs=setTimeout(()=>
659{bs=null,ss("auto")},120))}),Ss.observe(hs),xs=window.setTimeout(()=>{Ss==null||Ss.disconnect(),Ss=null},8e3)),()=>{window.removeEventListener("hashchange",ps),Ss==null||Ss.disconnect(),bs&&clearTimeout(bs),xs&&clearTimeout(xs)}},[e,G==null?void 0:G.id,ht.length,be.length,_e.length,qe.length,$e.length,C,is]);const Mt=Te=>{if(console.log(`🔍 Analyzing ${Te.length} classes for optimal view mode`),!Te||Te.length===0)return console.log("📊 No classes found, defaulting to monthly view"),"monthly";const at=new Set;Te.forEach(ps=>{if(ps.frequency==="daily"){for(let bs=0;bs<=6;bs++)at.add(bs);console.log(`📅 Daily class "${ps.name}" covers all 7 days`)}else at.add(ps.dayOfWeek),console.log(`📅 Weekly class "${ps.name}" on day ${ps.dayOfWeek}`)});const ss=at.size===7;return console.log(`📅 Days with classes: ${Array.from(at).sort().join(", ")} (${at.size}/7 days)`),ss?(console.log("✅ Classes every day of the week detected. Using weekly view."),"weekly"):(console.log("📅 Not every day has classes. Using monthly view."),"monthly")};f.useEffect(()=>{if(S.current)return;console.log(`🔍 View mode effect triggered. Subdomain: ${e}, Classes count: ${ht.length}`);const Te=(G==null?void 0:G.bookingCalendarView)||"auto";if(e&&(Te==="weekly"||Te==="monthly")){console.log(`🎯 Using instructor calendar default: ${Te}`),P(Te);return}if(e&&ht.length>0){const at=Mt(ht);console.log(`🎯 Setting optimal view mode: ${at}`),P(at)}else e?(console.log("📅 Setting default monthly view for subdomain"),P("monthly")):(console.log("📅 Setting weekly view for root page"),P("weekly"))},[ht,e,G==null?void 0:G.bookingCalendarView]);const Qt=Te=>{const at=new Date,ss=new Date(Te.date);let ps=Te.startTime||"09:00";if(Te.frequency==="daily")try{const gs=JSON.parse(Te.startTime);if(typeof gs=="object"&&gs!==null){const Os=Te.date.getDay();ps=gs[Os.toString()]||Object.values(gs)[0]||"09:00"}}catch{}const[bs,Ss]=ps.split(":").map(Number);if(ss.setHours(bs,Ss,0,0),Te.bookingOpenDays!==null&&Te.bookingOpenDays!==void 0||Te.bookingOpenTime!==null&&Te.bookingOpenTime!==void 0){const gs=Te.bookingOpenDays?Number(Te.bookingOpenDays):0,Os=Te.bookingOpenTime||"00:00",cs=new Date(ss);cs.setDate(cs.getDate()-gs);const[Tr,rr]=Os.split(":").map(Number);if(cs.setHours(Tr||0,rr||0,0,0),at<cs){const He=cs.toLocaleDateString(),tt=cs.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});Q({title:"Bookings Not Yet Open",description:`Bookings for this session open ${gs} day(s) before the session at ${tt} on ${He}. Please try again later.`,variant:"destructive"});return}}let xs=!1,hs="You cannot book a class that has already occurred.";if(Te.bookingCutoffHours!==null&&Te.bookingCutoffHours!==void 0){const gs=Number(Te.bookingCutoffHours),Os=new Date(ss);if(gs>0)Os.setHours(Os.getHours()-gs),xs=at>Os,xs&&(hs=`Bookings are not allowed within ${gs} hour(s) of the class start time. Please book earlier.`);else if(gs<0){const cs=Math.abs(gs);Os.setHours(Os.getHours()+cs),xs=at>Os,xs&&(hs=`Bookings are only allowed up to ${cs} hour(s) after the class start time. The booking window has closed.`)}else xs=at>Os,xs&&(hs="Bookings are not allowed after the class start time.")}else xs=ss<at;if(xs){Q({title:"Cannot Book Class",description:hs,variant:"destructive"});return}if(rW(Te)){i(Te);return}Zs("booking_started","engagement",Te.name,Te.singlePrice||0),r(Te)},ts=Te=>{y(null),x(""),se({name:"",email:"",subject:`Interested in ${Te.name} on ${Te.date.toLocaleDateString()}`,message:`Hi, I'm interested in joining your ${Te.name} class on ${Te.date.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})} at ${Te.startTime}, but it appears to be fully booked. Are there any spots available or could you add me to a waiting list? Thank you!`}),N(!0),Zs("contact_instructor","engagement",Te.name,0)},Js=Te=>{l(Te),d(!0)},xn=f.useMemo(()=>{if(!(G!=null&&G.hidePastClasses))return!0;const Te=new Date,at=new Date(Te),ss=at.getDay(),ps=at.getDate()-ss+(ss===0?-6:1);at.setDate(ps),at.setHours(0,0,0,0);const bs=new Date(b),Ss=bs.getDay(),xs=bs.getDate()-Ss+(Ss===0?-6:1);return bs.setDate(xs),bs.setHours(0,0,0,0),bs.getTime()>at.getTime()},[G==null?void 0:G.hidePastClasses,b]),Xs=Te=>{const at=new Date(b);if(at.setDate(at.getDate()+(Te==="next"?7:-7)),Te==="prev"){const ss=new Date,ps=new Date(ss),bs=ps.getDay(),Ss=ps.getDate()-bs+(bs===0?-6:1);ps.setDate(Ss),ps.setHours(0,0,0,0);const xs=new Date(b),hs=xs.getDay(),gs=xs.getDate()-hs+(hs===0?-6:1);if(xs.setDate(gs),xs.setHours(0,0,0,0),G!=null&&G.hidePastClasses&&xs.getTime()<=ps.getTime())return}w(at)},nn=Te=>{const at=new Date(Te),ss=at.getDay(),ps=at.getDate()-ss+(ss===0?-6:1);at.setDate(ps);const bs=new Date(at);bs.setDate(at.getDate()+6);const Ss={month:"long",day:"numeric",year:"numeric"};return`${at.toLocaleDateString("en-US",{month:"long",day:"numeric"})} - ${bs.toLocaleDateString("en-US",Ss)}`},Vt=()=>{t.startsWith("/admin")?window.location.href="/profile":e&&(t.includes(`/classes/${e}`)||t.includes(`/cal/${e}`))&&(window.location.href=`/my-account/${e}`)};if(e){if(Z)return s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center px-4",children:s.jsxs(Ce,{className:"max-w-md w-full",children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Loading"})}),s.jsx(Ee,{children:s.jsx("p",{className:"text-sm text-slate-600",children:"Loading instructor details…"})})]})});if(ke)return s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center px-4",children:s.jsxs(Ce,{className:"max-w-md w-full",children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Instructor Unavailable"})}),s.jsx(Ee,{className:"space-y-4",children:s.jsx("p",{className:"text-sm text-slate-600",children:"This instructor’s account is currently disabled. Public pages and booking links are unavailable until it is reactivated."})})]})});if(Ie)return s.jsx(jW,{attemptedPath:t});if(ie)return s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center px-4",children:s.jsxs(Ce,{className:"max-w-md w-full",children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Unable to Load Instructor"})}),s.jsx(Ee,{children:s.jsx("p",{className:"text-sm text-slate-600",children:je||"Something went wrong loading this page."})})]})})}return s.jsxs("div",{className:"min-h-screen bg-slate-50",children:[s.jsx("header",{className:"bg-white shadow-sm border-b border-slate-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsx("div",{className:"flex items-center space-x-2 sm:space-x-4",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[G!=null&&G.logoUrl?s.jsx(I$,{src:G.logoUrl,alt:`${G.businessName} logo`,onSave:Ke,isAdmin:A&&ge,className:"h-6 w-6 sm:h-8 sm:w-8",imageClassName:"h-6 w-6 sm:h-8 sm:w-8 object-cover rounded",fallbackComponent:s.jsx(dt,{href:"/",children:s.jsx("a",{children:s.jsx(Ia,{className:"text-primary",size:"md"})})})}):s.jsx(I$,{src:null,alt:"Logo",onSave:Ke,isAdmin:A&&ge,className:"h-6 w-6 sm:h-8 sm:w-8",imageClassName:"h-6 w-6 sm:h-8 sm:w-8 object-cover rounded",fallbackComponent:s.jsx(dt,{href:"/",children:s.jsx("a",{children:s.jsx(Ia,{className:"text-primary",size:"md"})})})}),G!=null&&G.businessName&&(G==null?void 0:G.businessName)!=="Classta"?s.jsx(v0,{value:G.businessName,onSave:pt,isAdmin:A&&ge,className:"flex-1 min-w-0",displayClassName:"text-lg sm:text-xl font-bold text-slate-900 line-clamp-2 max-w-[300px] sm:max-w-none leading-tight sm:leading-normal",placeholder:"Business N
659ame"}):s.jsx(dt,{href:"/",children:s.jsx("span",{className:"text-lg sm:text-xl font-bold text-slate-900",children:"Classta"})})]})}),s.jsxs("div",{className:"flex items-center space-x-2 sm:space-x-4",children:[e&&s.jsx("div",{className:"hidden sm:block",children:s.jsx(yP,{})}),!(G!=null&&G.hideStartTeachingButton)&&s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{size:"sm",className:"bg-primary text-primary-foreground hover:bg-primary/90 text-xs sm:text-sm px-2 sm:px-4",children:[s.jsx("span",{className:"hidden sm:inline",children:"Start Teaching"}),s.jsx("span",{className:"sm:hidden",children:"Teach"})]})}),s.jsx("button",{className:"text-slate-400 hover:text-slate-600 hidden sm:block",children:s.jsx(Af,{className:"h-5 w-5"})}),s.jsx("div",{onClick:Vt,className:"w-8 h-8 bg-primary rounded-full flex items-center justify-center cursor-pointer hover:bg-primary/90 transition-colors",children:s.jsx(Dr,{className:"text-primary-foreground text-sm"})})]})]})})}),(()=>{const Te=G&&(G.heroColor!=null&&G.heroColor!==""||G.heroGradientStyle!=null&&G.heroGradientStyle!==""),at=G&&G.heroTextColor!=null&&G.heroTextColor!=="",ss=(G==null?void 0:G.primaryColor)||"#3B82F6",ps=(G==null?void 0:G.secondaryColor)||"#10B981",bs=G&&!Te,Ss=G?Te?QH(ss,ps,G.heroColor,G.heroGradientStyle):void 0:{background:"linear-gradient(to bottom right, #3B82F6, #10B981)"},xs=xye(at?G.heroTextColor:null,(G==null?void 0:G.heroColor)||(Te?ss:null)),hs="bg-transparent hover:bg-white hover:text-primary border-[color:var(--hero-outline)] text-[color:var(--hero-outline)]",gs={...Ss||{},"--hero-outline":xs},Os="relative "+(bs?"bg-gradient-to-br from-primary to-purple-700 text-white":"");return s.jsxs("section",{className:Os,style:gs,children:[A&&ge&&s.jsx("div",{className:"absolute top-4 left-4 z-10",children:s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>O(!0),className:`backdrop-blur-sm hover:bg-white/20 border-[color:var(--hero-outline)] text-[color:var(--hero-outline)] ${JP(xs)?"bg-white/10":"bg-black/5"}`,children:[s.jsx(Q9,{className:"h-4 w-4 mr-2"}),"Colors"]})}),s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 sm:py-16 lg:py-20",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl sm:text-3xl md:text-4xl lg:text-6xl font-bold mb-4 sm:mb-6 leading-tight "+(at?"":"text-white"),...at?{style:{color:G.heroTextColor}}:{},children:G?`Welcome to ${G.businessName}`:"Discover Amazing Classes"}),s.jsx("div",{className:"text-base sm:text-lg md:text-xl lg:text-2xl mb-6 sm:mb-8 max-w-3xl mx-auto leading-relaxed px-2 "+(at?"":"text-purple-100"),...at?{style:{color:G.heroTextColor}}:{},children:s.jsx(v0,{value:(G==null?void 0:G.description)||"",onSave:de,isAdmin:A&&ge,multiline:!0,maxLength:300,placeholder:"Book premium classes with certified instructors. Flexible packages, expert guidance, amazing results.",className:at?"":"text-purple-100",displayClassName:at?"":"text-purple-100",inputClassName:"text-slate-900",showCharacterCount:!0,onPolish:vt,isPolishing:D,editButtonClassName:at?"opacity-90 hover:opacity-100":"text-purple-100 hover:text-white"})}),s.jsxs("div",{className:"hidden md:flex flex-col sm:flex-row gap-4 items-center justify-center",children:[s.jsx(B,{size:"lg",className:"bg-white text-primary hover:bg-slate-50 text-base sm:text-lg px-6 sm:px-8 py-3 sm:py-4",onClick:()=>{var cs;(cs=document.getElementById("classes-section"))==null||cs.scrollIntoView({behavior:"smooth"}),window.history.replaceState(void 0,"",`${window.location.pathname}${window.location.search}#classes`)},children:(G==null?void 0:G.terminologyPlural)||"Classes"}),be.length>0&&s.jsx(B,{size:"lg",variant:"outline",className:`${hs} text-base sm:text-lg px-6 sm:px-8 py-3 sm:py-4`,onClick:()=>{var cs;(cs=document.getElementById("services-section"))==null||cs.scrollIntoView({behavior:"smooth"}),window.history.replaceState(void 0,"",`${window.location.pathname}${window.location.search}#services`)},children:"Services"}),_e.length>0&&s.jsx(B,{size:"lg",variant:"outline",className:`${hs} text-base sm:text-lg px-6 sm:px-8 py-3 sm:py-4`,onClick:()=>{var cs;(cs=document.getElementById("events-section"))==null||cs.scrollIntoView({behavior:"smooth"}),window.history.replaceState(void 0,"",`${window.location.pathname}${window.location.search}#events`)},children:"Events"}),$e.length>0&&s.jsx(B,{size:"lg",variant:"outline",className:`${hs} text-base sm:text-lg px-6 sm:px-8 py-3 sm:py-4`,onClick:()=>{var cs;(cs=document.getElementById("memberships-section"))==null||cs.scrollIntoView({behavior:"smooth"}),window.history.replaceState(void 0,"",`${window.location.pathname}${window.location.search}#memberships`)},children:"Memberships"}),e&&s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-center",children:[s.jsx(dt,{href:`/my-account/${e}`,children:s.jsx(B,{size:"lg",variant:"outline",className:`${hs}
659 text-base sm:text-lg px-6 sm:px-8 py-3 sm:py-4`,children:"My Account"})}),(G==null?void 0:G.showContactLink)!==!1&&s.jsx(B,{size:"lg",variant:"outline",className:`${hs} text-base sm:text-lg px-6 sm:px-8 py-3 sm:py-4`,onClick:()=>{y(null),x(""),N(!0)},children:"Contact"})]})]}),s.jsxs("div",{className:"md:hidden w-full",children:[s.jsx(B,{size:"lg",variant:"outline",className:`${hs} w-full mb-4`,onClick:()=>T(!E),children:E?s.jsxs(s.Fragment,{children:[s.jsx(ja,{className:"h-5 w-5 mr-2"}),"Close Menu"]}):s.jsxs(s.Fragment,{children:[s.jsx(MN,{className:"h-5 w-5 mr-2"}),"Menu"]})}),E&&s.jsxs("div",{className:`${JP(xs)?"bg-white/10":"bg-black/5"} backdrop-blur-sm rounded-lg p-4 space-y-3`,children:[s.jsx(B,{size:"lg",className:"bg-white text-primary hover:bg-slate-50 w-full",onClick:()=>{var cs;(cs=document.getElementById("classes-section"))==null||cs.scrollIntoView({behavior:"smooth"}),window.history.replaceState(void 0,"",`${window.location.pathname}${window.location.search}#classes`),T(!1)},children:(G==null?void 0:G.terminologyPlural)||"Classes"}),be.length>0&&s.jsx(B,{size:"lg",variant:"outline",className:`${hs} w-full`,onClick:()=>{var cs;(cs=document.getElementById("services-section"))==null||cs.scrollIntoView({behavior:"smooth"}),window.history.replaceState(void 0,"",`${window.location.pathname}${window.location.search}#services`),T(!1)},children:"Services"}),_e.length>0&&s.jsx(B,{size:"lg",variant:"outline",className:`${hs} w-full`,onClick:()=>{var cs;(cs=document.getElementById("events-section"))==null||cs.scrollIntoView({behavior:"smooth"}),window.history.replaceState(void 0,"",`${window.location.pathname}${window.location.search}#events`),T(!1)},children:"Events"}),$e.length>0&&s.jsx(B,{size:"lg",variant:"outline",className:`${hs} w-full`,onClick:()=>{var cs;(cs=document.getElementById("memberships-section"))==null||cs.scrollIntoView({behavior:"smooth"}),window.history.replaceState(void 0,"",`${window.location.pathname}${window.location.search}#memberships`),T(!1)},children:"Memberships"}),e&&s.jsxs(s.Fragment,{children:[s.jsx(dt,{href:`/my-account/${e}`,className:"block",children:s.jsx(B,{size:"lg",variant:"outline",className:`${hs} w-full`,onClick:()=>T(!1),children:"My Account"})}),(G==null?void 0:G.showContactLink)!==!1&&s.jsx(B,{size:"lg",variant:"outline",className:`${hs} w-full`,onClick:()=>{y(null),x(""),N(!0),T(!1)},children:"Contact"})]})]})]})]})})]})})(),s.jsx("section",{id:"classes-section",className:"py-16 bg-white",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[s.jsxs("div",{className:`${ht.length>0?"text-center mb-12":"text-center mb-0"}`,children:[ht.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-4",children:s.jsx(v0,{value:(G==null?void 0:G.headline)||"",onSave:fe,isAdmin:A&&ge,maxLength:60,placeholder:"Available Classes",className:"text-3xl font-bold text-slate-900",displayClassName:"text-3xl font-bold text-slate-900",inputClassName:"text-slate-900",showCharacterCount:!0})}),s.jsx("div",{className:"text-lg text-slate-600 max-w-2xl mx-auto",children:s.jsx(v0,{value:(G==null?void 0:G.tagline)||"",onSave:le,isAdmin:A&&ge,maxLength:120,placeholder:"Choose from our variety of classes. Book individual sessions or save with class packages.",className:"text-lg text-slate-600",displayClassName:"text-lg text-slate-600",inputClassName:"text-slate-900",showCharacterCount:!0,onPolish:Zt,isPol
659ishing:F})})]}),e&&qe&&qe.length>0&&s.jsx("div",{className:`${ht.length>0?"mt-6":"mt-0"} flex flex-wrap gap-3 justify-center`,children:qe&&qe.length>0&&s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>{const Te=document.getElementById("bundle-section");Te==null||Te.scrollIntoView({behavior:"smooth"})},className:"text-primary border-primary hover:bg-primary hover:text-primary-foreground transition-colors",children:[s.jsx(jg,{className:"h-4 w-4 mr-2"}),"View Bundle Offers"]})})]}),rt&&s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-slate-600",children:"Classes are currently unavailable for this instructor."})}),ht.length>0&&s.jsxs(s.Fragment,{children:[e&&s.jsx("div",{className:"flex justify-center mb-6",children:s.jsxs("div",{className:"inline-flex bg-slate-100 rounded-lg p-1","data-testid":"view-toggle",children:[s.jsxs(B,{variant:C==="monthly"?"default":"ghost",size:"sm",onClick:()=>{S.current=!0,P("monthly")},className:`px-4 py-2 text-sm font-medium transition-all ${C==="monthly"?"bg-white shadow-sm text-slate-900":"text-slate-600 hover:text-slate-900"}`,"data-testid":"monthly-view-button",children:[s.jsx(_N,{className:"h-4 w-4 mr-2"}),"Monthly List"]}),s.jsxs(B,{variant:C==="weekly"?"default":"ghost",size:"sm",onClick:()=>{S.current=!0,P("weekly")},className:`px-4 py-2 text-sm font-medium transition-all ${C==="weekly"?"bg-white shadow-sm text-slate-900":"text-slate-600 hover:text-slate-900"}`,"data-testid":"weekly-view-button",children:[s.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Weekly Calendar"]})]})}),C==="weekly"&&s.jsx("div",{className:"mb-6 sm:mb-8",children:s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between bg-slate-50 p-3 sm:p-4 rounded-lg space-y-3 sm:space-y-0",children:[s.jsxs(B,{variant:"ghost",onClick:()=>Xs("prev"),disabled:!xn,className:`flex items-center space-x-2 text-slate-600 hover:text-primary w-full sm:w-auto justify-center sm:justify-start ${xn?"":"opacity-50 cursor-not-allowed"}`,"data-testid":"previous-week-button",children:[s.jsx(lm,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Previous Week"}),s.jsx("span",{className:"sm:hidden",children:"Previous"})]}),s.jsx("h3",{className:"text-base sm:text-lg font-semibold text-slate-900 text-center px-2",children:nn(b)}),s.jsxs(B,{variant:"ghost",onClick:()=>Xs("next"),className:"flex items-center space-x-2 text-slate-600 hover:text-primary w-full sm:w-auto justify-center sm:justify-start","data-testid":"next-week-button",children:[s.jsx("span",{className:"hidden sm:inline",children:"Next Week"}),s.jsx("span",{className:"sm:hidden",children:"Next"}),s.jsx(Ji,{className:"h-4 w-4"})]})]})}),is?s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),s.jsx("p",{className:"mt-2 text-slate-600",children:"Loading classes..."})]}):C==="monthly"?s.jsx(xq,{classes:ht,onClassSelect:Qt,onContactInstructor:e?ts:void 0,isRootPage:!e,instructorCurrency:(G==null?void 0:G.currency)||void 0,instructor:G}):s.jsx(pq,{classes:ht,currentWeek:b,onClassSelect:Qt,onContactInstructor:e?ts:void 0,isRootPage:!e,instructorCurrency:(G==null?void 0:G.currency)||void 0,instructor:G})]}),e&&be.length>0&&s.jsxs("div",{id:"services-section",className:`${ht.length>0?"mt-16":"mt-0"}`,children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-4",children:"Services"}),s.jsx("p",{className:"text-lg text-slate-600 max-w-2xl mx-auto",children:"Book one-on-one sessions and personalized services tailored to your needs."})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:be.map(Te=>s.jsxs(Ce,{className:"hover:shadow-lg transition-shadow cursor-pointer",onClick:()=>Js(Te),children:[s.jsx(gt,{children:s.jsx("div",{className:"flex items-start justify-between",children:s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:Te.name}),Te.description&&s.jsx("p",{className:"text-slate-600 text-sm mb-3",children:Te.description})]})})}),s.jsx(Ee,{children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center text-sm text-slate-600",children:[s.jsx(Ls,{className:"h-4 w-4 mr-2"}),Te.duration," minutes"]}),s.jsxs("div",{className:"text-lg font-bold text-slate-900",children:[mt((G==null?void 0:G.currency)||"GBP"),Te.price]})]}),Te.location&&s.jsxs("div",{className:"flex items-center text-sm text-slate-600",children:[s.jsx(si,{className:"h-4 w-4 mr-2"}),Te.location]}),s.jsx(B,{className:"w-full mt-4",children:"Book Service"})]})})]},Te.id))})]}),e&&_e.length>0&&s.jsxs("div",{id:"events-section",className:`${ht.length>0||be.length>0?"mt-16":"mt-0"}`,children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-4",children:"Events"}),s.jsx("p",{className:"text-lg text-slate-600 max-w-2xl mx-auto",children:"Get tickets for upcoming events and workshops."})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:_e.map(Te=>s.jsxs(Ce,{className:"hover:shadow-lg transition-shadow flex flex-col overflow-hidden",children:[Te.imageUrl&&s.jsx("div",{className:"aspect-video w-full bg-slate-100 shrink-0",children:s.jsx("img",{src:Te.imageUrl.startsWith("http")?Te.imageUrl:`${window.location.origin}${Te.imageUrl}`,alt:Te.title,className:"h-full w-full object-cover"})}),s.jsx(gt,{children:s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:Te.title}),Te.description&&s.jsx(aO,{text:Te.description,linkClassName:"text-sky-600 hover:underline break-all",preserveLineBreaks:!0})]}),s.jsx(um,{className:"h-5 w-5 text-slate-400 shrink-0"})]})}),s.jsxs(Ee,{className:"flex-1 flex flex-col",children:[s.jsxs("div",{className:"space-y-2 text-sm text-slate-600 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ls,{className:"h-4 w-4 shrink-0"}),Ud(Te.startsAt)]}),Te.location&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(si,{className:"h-4 w-4 shrink-0"}),Te.location]})]}),s.jsxs("div",{className:"mt-auto space-y-1",children:[Te.startsAt&&Te.ticketTypes.map(at=>s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{children:at.name}),s.jsxs("span",{children:[at.price_minor===0?"Free":`${mt(Te.currency||(G==null?void 0:G.currency)||"GBP")}${(at.price_minor/100).toFixed(2)}`,at.remaining<10&&s.jsxs("span",{className:"text-amber-600 ml-1",children:["(",at.remaining," left)"]})]})]},at.id)),s.jsx(B,{className:"w-full mt-4",onClick:()=>{Te.startsAt?(u(Te),p(!0)):(y(Te),x(""),se(at=>({...at,subject:`Interest in: ${Te.title} (date TBC)`})),N(!0))},children:Te.startsAt?"Buy tickets":"Register interest"})]})]})]},Te.id))})]}),e&&(G==null?void 0:G.id)&&s.jsx("div",{id:"bundle-section",children:s.jsx(Pw,{instructorId:G.id,instructorCurrency:(G==null?void 0:G.currency)||"GBP",className:"mt-8"})})]})}),e&&$e.length>0&&s.jsx("section",{id:"memberships-section",className:"py-12 sm:py-16 lg:py-20 bg-white",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h2",{className:"text-3xl sm:text-4xl font-bold text-slate-900 mb-4",children:"Membership Options"}),s.jsx("p",{className:"text-lg text-slate-600 max-w-2xl mx-auto",children:"Join our community and get exclusive access to special classes, member pricing, and premium content."})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:$e.map(Te=>s.jsxs(Ce,{className:"relative hover:shadow-lg transition-shadow",children:[s.jsxs(gt,{children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h3",{className:"text-xl font-semibold",children:Te.name}),s.jsxs(Je,{variant:"secondary",className:"text-lg font-bold",children:[mt((G==null?void 0:G.currency)||"GBP"),Te.price,"/",Ht(Te.billingFrequency)]})]}),Te.description&&s.jsx("p",{className:"text-slate-600 mt-2 whitespace-pre-line break-words",children:Te.description})]}),s.jsx(Ee,{children:s.jsxs("div",{className:"space-y-3",children:[Te.usageLimit??Te.memberOnlyClassLim
659it?s.jsxs("div",{className:"flex items-center text-sm text-slate-600",children:[s.jsx("span",{className:"font-medium",children:"Includes:"}),s.jsxs("span",{className:"ml-2",children:[Te.usageLimit??Te.memberOnlyClassLimit," class booking",((Te.usageLimit??Te.memberOnlyClassLimit)||0)!==1?"s":""," per ",Te.usageLimitPeriod||Te.memberOnlyClassLimitPeriod||"month"]})]}):s.jsxs("div",{className:"flex items-center text-sm text-slate-600",children:[s.jsx("span",{className:"font-medium",children:"Unlimited"}),s.jsx("span",{className:"ml-2",children:"access to all member classes"})]}),s.jsx("div",{className:"pt-4",children:s.jsx(dt,{href:`/classes/${e}/memberships`,children:s.jsx(B,{className:"w-full",children:"Join Membership"})})})]})})]},Te.id))}),s.jsxs("div",{className:"text-center mt-8",children:[s.jsx("p",{className:"text-slate-600 mb-4",children:"Already a member? Access your account to manage your subscription."}),s.jsx(dt,{href:`/my-account/${e}`,children:s.jsx(B,{variant:"outline",children:"Access My Account"})})]})]})}),n&&s.jsx($T,{classData:n,onClose:()=>r(null),instructor:G||Ne.find(Te=>Te.id===n.instructorId)}),s.jsx(aW,{open:!!a,classId:(a==null?void 0:a.id)??null,className:a==null?void 0:a.name,onClose:()=>i(null),onVerified:()=>{if(!a)return;const Te=a;i(null),Zs("booking_started","engagement",Te.name,Te.singlePrice||0),r(Te)}}),s.jsx(Ct,{open:j,onOpenChange:Te=>{N(Te),Te||(y(null),x(""))},children:s.jsxs(St,{className:"max-w-md max-h-[85vh] overflow-y-auto",children:[s.jsx(kt,{children:s.jsxs(Pt,{className:"flex items-center gap-2",children:[s.jsx(_n,{className:"h-5 w-5"}),"Contact ",G==null?void 0:G.businessName]})}),s.jsxs("form",{onSubmit:Te=>{Te.preventDefault(),M.name&&M.email&&M.subject&&M.message&&ue.mutate({...M,message:LT(M.message,{enabled:v==null?void 0:v.bookingInfoFieldEnabled,label:v==null?void 0:v.bookingInfoFieldLabel},g)})},className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"name",children:"Your Name *"}),s.jsx(me,{id:"name",value:M.name,onChange:Te=>se({...M,name:Te.target.value}),required:!0,placeholder:"Enter your full name"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",children:"Your Email *"}),s.jsx(me,{id:"email",type:"email",value:M.email,onChange:Te=>se({...M,email:Te.target.value}),required:!0,placeholder:"[email protected]"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"subject",children:"Subject *"}),s.jsx(me,{id:"subject",value:M.subject,onChange:Te=>se({...M,subject:Te.target.value}),required:!0,placeholder:"What's this about?"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"message",children:"Message *"}),s.jsx(Is,{id:"message",value:M.message,onChange:Te=>se({...M,message:Te.target.value}),required:!0,rows:4,placeholder:"Your message..."})]}),s.jsx(UT,{id:"interest-booking-info",enabled:!!(v!=null&&v.bookingInfoFieldEnabled),label:v==null?void 0:v.bookingInfoFieldLabel,value:g,onChange:x}),s.jsxs("div",{className:"flex gap-3 pt-4",children:[s.jsx(B,{type:"button",variant:"outline",onClick:()=>N(!1),className:"flex-1",children:"Cancel"}),s.jsx(B,{type:"submit",disabled:ue.isPending||!M.name||!M.email||!M.subject||!M.message,className:"flex-1",children:ue.isPending?"Sending...":"Send Message"})]})]})]})}),s.jsx(iW,{service:o,isOpen:c,onClose:()=>{d(!1),l(null)},instructorCurrency:(G==null?void 0:G.currency)||"GBP"}),m&&h&&s.jsx(BT,{event:m,instructor:G?{id:G.id,stripePublicKey:G.stripePublicKey,stripeConnectAccountId:G.stripeConnectAccountId,currency:G.currency}:null,onClose:()=>{p(!1),u(null)}}),e&&s.jsx("div",{className:"fixed bottom-4 right-4 z-50 sm:hidden",children:s.jsx(yP,{})}),s.jsx(Ct,{open:z,onOpenChange:O,children:s.jsxs(St,{className:"max-w-md",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Customize Colors"}),s.jsx(yn,{children:"Choose your primary and secondary brand colors. Changes will update the hero banner and buttons."})]}),s.jsxs("div",{className:"space-y-6 py-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"primaryColor",children:"Primary Color"}),s.jsxs("div",{className:"flex items-center space-x-3 mt-2",children:[s.jsx(me,{type:"color",id:"primaryColor",value:q,onChange:Te=>{const at=Te.target.value;H(at),We(at,_,U||null,I||null,R||null)},className:"w-16 h-10 p-1 border rounded cursor-pointer"}),s.jsx(me,{type:"text",value:q,onChange:Te=>{const at=Te.target.value;H(at),/^#[0-9A-F]{6}$/i.test(at)&&We(at,_,U||null,I||null,R||null)},placeholder:"#3B82F6",className:"flex-1 font-mono text-sm"})]}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Main brand color for buttons and highlights"}),s.jsx("p",{className:"text-xs text-amber-700 mt-1 bg-amber-50 border border-amber-200 rounded px-2 py-1.5",children:"Very light colours (e.g. #fafafa) that would make text and buttons invisible will be overridden for readability."})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"secondaryColor",children:"Secondary Color"}),s.jsxs("div",{className:"flex items-center space-x-3 mt-2",children:[s.jsx(me,{type:"color",id:"secondaryColor",value:_,onCh
659ange:Te=>{const at=Te.target.value;L(at),We(q,at,U||null,I||null,R||null)},className:"w-16 h-10 p-1 border rounded cursor-pointer"}),s.jsx(me,{type:"text",value:_,onChange:Te=>{const at=Te.target.value;L(at),/^#[0-9A-F]{6}$/i.test(at)&&We(q,at,U||null,I||null,R||null)},placeholder:"#10B981",className:"flex-1 font-mono text-sm"})]}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Accent color for success states and icons"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"heroColor",children:"Hero section colour"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1 mb-2",children:"Banner behind the welcome text. Leave empty to use primary → secondary gradient."}),s.jsxs("div",{className:"flex items-center space-x-3 mt-2",children:[s.jsx(me,{type:"color",id:"heroColor",value:U||q||"#3B82F6",onChange:Te=>J(Te.target.value),className:"w-16 h-10 p-1 border rounded cursor-pointer"}),s.jsx(me,{type:"text",value:U,onChange:Te=>J(Te.target.value),placeholder:"Empty = gradient",className:"flex-1 font-mono text-sm"})]})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Hero gradient style"}),s.jsxs(Bt,{value:I||"to_bottom_right",onValueChange:re,children:[s.jsx($t,{className:"mt-2",children:s.jsx(Lt,{placeholder:"Diagonal"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"to_bottom_right",children:"Diagonal (bottom right)"}),s.jsx(ce,{value:"solid",children:"Solid colour only"}),s.jsx(ce,{value:"to_right",children:"Horizontal"}),s.jsx(ce,{value:"to_bottom",children:"Vertical"})]})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"heroTextColor",children:"Hero text colour"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1 mb-2",children:"Title, description, and outline buttons (My Account, Contact). Leave empty for white title text; outline buttons then contrast automatically against the banner."}),s.jsxs("div",{className:"flex items-center space-x-3 mt-2",children:[s.jsx(me,{type:"color",id:"heroTextColor",value:R||"#ffffff",onChange:Te=>Y(Te.target.value),className:"w-16 h-10 p-1 border rounded cursor-pointer"}),s.jsx(me,{type:"text",value:R,onChange:Te=>Y(Te.target.value),placeholder:"Empty = white",className:"flex-1 font-mono text-sm"})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(B,{variant:"outline",onClick:()=>{O(!1),G&&(H(G.primaryColor||"#3B82F6"),L(G.secondaryColor||"#10B981"),J(G.heroColor??""),re(G.heroGradientStyle??""),Y(G.heroTextColor??""))},children:"Cancel"}),s.jsx(B,{onClick:async()=>{await We(q,_,U||null,I||null,R||null),O(!1)},children:"Save Colors"})]})]})})]})}const LS="classta_app_version",vye="classta_version_check_disabled";function bye(e){if(localStorage.getItem(vye)==="true"||!(e!=null&&e.appVersion))return;const t=e.appVersion,n=localStorage.getItem(LS);if(n&&n!==t){console.log("🔄 App version changed, forcing refresh...",{old:n,new:t}),"caches"in window&&caches.keys().then(a=>{a.forEach(i=>{caches.delete(i)})});const r={};for(let a=0;a<localStorage.length;a++){const i=localStorage.key(a);i&&(i.startsWith("pending_")||i.startsWith("booking_"))&&(r[i]=localStorage.getItem(i)||"")}localStorage.clear(),Object.entries(r).forEach(([a,i])=>{localStorage.setItem(a,i)}),localStorage.setItem(LS,t),window.location.reload();return}n||localStorage.setItem(LS,t)}function d1(e){f.useEffect(()=>{bye(e)},[e==null?void 0:e.appVersion])}function wye(){const{subdomain:e}=sa();cn();const[t,n]=f.useState(null),[r,a]=f.useState(null),[i,o]=f.useState(null),[l,c]=f.useState(!1),[d,m]=f.useState(null),[u,h]=f.useState(!1),[p,v]=f.useState(()=>{const fe=new Date,le=fe.getDay(),Ke=fe.getDate()-le+(le===0?-6:1),We=new Date(fe);return We.setDate(Ke),We.setHours(0,0,0,0),We}),[y,g]=f.useState(!1),[x,b]=f.useState(null),[w,j]=f.useState(""),[N,C]=f.useState(e?"monthly":"weekly"),P=f.useRef(!1),[S,E]=f.useState({name:"",email:"",subject:"",message:""}),{toast:T}=Yt(),z=new URLSearchParams(window.location.search),O=z.get("show"),D=z.get("serviceToken")||null,k=O?O.split(",").map(fe=>fe.trim().toLowerCase()).filter(fe=>fe.length>0):[],F=k.length===0||k.includes("all"),W=F||k.includes("bundles"),q=F||k.includes("classes"),H=F||k.includes("services"),_=F||k.includes("events"),L=F||k.includes("memberships"),{data:U}=Ue({queryKey:[`/api/instructor/by-subdomain/${e}`],enabled:!!e});d1(U);const{data:J=[]}=Ue({queryKey:[`/api/instructors/${U==null?void 0:U.id}/memberships`],enabled:!!(U!=null&&U.id)}),{data:I=[],isLoading:re}=Ue({queryKey:[`/api/coupons/bundles/public/${U==null?void 0:U.id}`],enabled:!!(U!=null&&U.id)}),{data:R=[],isLoading:Y}=Ue({queryKey:[`/api/services/${U==null?void 0:U.id}`,D],queryFn:async()=>{const fe=`/api/services/${U==null?void 0:U.id}${D?`?serviceToken=${encodeURIComponent(D)}`:""}`;return(await Pe("GET",fe)).json()},enabled:!!(U!=null&&U.id)}),{data:M=[],isLoading:se}=Ue({queryKey:["/api/events/public",U==null?void 0:U.id],queryFn:async()=>(await Pe("GET",`/api/events/public?instructorId=${U==null?void 0:U.id}`)).json(),enabled:!!(U!=null&&U.id)}),Q=f.useRef(!1);f.useEffect(()=>{D&&R.length===1&&!l&&!Q.current&&(Q.current=!0,o(R[0]),c(!0))},[D,R,l]),f.useEffect(()=>{if(P.current)return;const fe=U==null?void 0:U.bookingCalendarView;(fe==="weekly"||fe==="monthly")&&C(fe)},[U==null?void 0:U.bookingCalendarView]);const te=(U==null?void 0:U.embedBundlePosition)||"top",G=(W&&I.length>0?1:0)+(q?1:0)+(H&&R.length>0?1:0)+(_&&M.length>0?1:0)+(L&&J.length>0?1:0),Z=e&&!re&&!Y&&!se&&G>1,ie=xt({mutationFn:async fe=>(await Pe("POST","/api/instructor-contact",{instructorId:U==null?void 0:U.id,name:fe.name,email:fe.email,subject:fe.subject,message:fe.message})).json(),onSuccess:()=>{T({title:"Message Sent!",description:"Your message has been sent successfully. The instructor will get back to you soon."}),g(!1),b(null),j(""),E({name:"",email:"",subject:"",message:""})},onError:fe=>{T({title:"Error",description:fe.message||"Failed to send message. Please try again.",variant:"destructive"})}});f.useEffect(()=>{e&&sessionStorage.setItem("currentInstructorSubdomain",e)},[e]),f.useEffect(()=>{if(U&&(U.primaryColor||U.secondaryColor)){const fe=document.documentElement;if(U.primaryColor){const le=Cv(U.primaryColor);fe.style.setProperty("--primary",A(le)),fe.style.setProperty("--primary-foreground",ge(le))}if(U.secondaryColor){const le=A(U.secondaryColor);fe.style.setProperty("--secondary",le);const Ke=ge(U.secondaryColor);fe.style.setProperty("--secondary-foreground",Ke)}}return()=>{if(U&&(U.primaryColor||U.secondaryColor)){const fe=document.documentElement;fe.style.removeProperty("--primary"),fe.style.removeProperty("--primary-foreground"),fe.style.removeProperty("--secondary")}}},[U]);function A(fe){fe=fe.replace("#","");const le=parseInt(fe.substr(0,2),16)/255,Ke=parseInt(fe.substr(2,2),16)/255,We=parseInt(fe.substr(4,2),16)/255,vt=Math.max(le,Ke,We),Zt=Math.min(le,Ke,We);let Ht=0,Tt=0;const Ot=(vt+Zt)/2;if(vt!==Zt){const Ft=vt-Zt;switch(Tt=Ot>.5?Ft/(2-vt-Zt):Ft/(vt+Zt),vt){case le:Ht=(Ke-We)/Ft+(Ke<We?6:0);break;case Ke:Ht=(We-le)/Ft+2;break;case We:Ht=(le-Ke)/Ft+4;break}Ht/=6}return`${Math.round(Ht*360)} ${Math.round(Tt*100)}% ${Math.round(Ot*100)}%`}function ge(fe){fe=fe.replace("#","");const le=parseInt(fe.substr(0,2),16)/255,Ke=parseInt(fe.substr(2,2),16)/255,We=parseInt(fe.substr(4,2),16)/255,vt=Ht=>Ht<=.03928?Ht/12.92:Math.pow((Ht+.055)/1.055,2.4);return .2126*vt(le)+.7152*vt(Ke)+.0722*vt(We)>.5?"218 18% 9%":"355 7% 97%"}const{data:je=[],isLoading:ke}=Ue({queryKey:e?[`/api/public/classes?subdomain=${e}&v=${(U==null?void 0:U.classesVersion)||1}`]:["/api/classes"],enabled:e?!!U:!0,staleTime:0,cacheTime:0,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),{data:Ie=[]}=Ue({queryKey:["/api/instructors"],enabled:!e}),$e=je;Cl(!!t||y);const be=fe=>{const le=new Date,Ke=new Date(fe.date);let We=fe.startTime||"09:00";if(fe.frequency==="daily")try{const Ot=JSON.parse(fe.startTime);if(typeof Ot=="object"&&Ot!==null){const Ft=fe.date.getDay();We=Ot[Ft.toString()]||Object.values(Ot)[0]||"09:00"}}catch{}const[vt,Zt]=We.split(":").map(Number);
659if(Ke.setHours(vt,Zt,0,0),fe.bookingOpenDays!==null&&fe.bookingOpenDays!==void 0||fe.bookingOpenTime!==null&&fe.bookingOpenTime!==void 0){const Ot=fe.bookingOpenDays?Number(fe.bookingOpenDays):0,Ft=fe.bookingOpenTime||"00:00",is=new Date(Ke);is.setDate(is.getDate()-Ot);const[Cs,Ne]=Ft.split(":").map(Number);if(is.setHours(Cs||0,Ne||0,0,0),le<is){const ht=is.toLocaleDateString(),Mt=is.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});T({title:"Bookings Not Yet Open",description:`Bookings for this session open ${Ot} day(s) before the session at ${Mt} on ${ht}. Please try again later.`,variant:"destructive"});return}}let Ht=!1,Tt="You cannot book a class that has already occurred.";if(fe.bookingCutoffHours!==null&&fe.bookingCutoffHours!==void 0){const Ot=Number(fe.bookingCutoffHours),Ft=new Date(Ke);if(Ot>0)Ft.setHours(Ft.getHours()-Ot),Ht=le>Ft,Ht&&(Tt=`Bookings are not allowed within ${Ot} hour(s) of the class start time. Please book earlier.`);else if(Ot<0){const is=Math.abs(Ot);Ft.setHours(Ft.getHours()+is),Ht=le>Ft,Ht&&(Tt=`Bookings are only allowed up to ${is} hour(s) after the class start time. The booking window has closed.`)}else Ht=le>Ft,Ht&&(Tt="Bookings are not allowed after the class start time.")}else Ht=Ke<le;if(Ht){T({title:"Cannot Book Class",description:Tt,variant:"destructive"});return}if(rW(fe)){a(fe);return}Zs("booking_started","engagement",fe.name,fe.singlePrice||0),n(fe)},Fe=fe=>{b(null),j(""),E({name:"",email:"",subject:`Interested in ${fe.name} on ${fe.date.toLocaleDateString()}`,message:`Hi, I'm interested in joining your ${fe.name} class on ${fe.date.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})} at ${fe.time}, but it appears to be fully booked. Are there any spots available or could you add me to a waiting list? Thank you!`}),g(!0),Zs("contact_instructor","engagement",fe.name,0)},_e=fe=>{o(fe),c(!0)},ze=fe=>{const le=new Date(p);if(le.setDate(le.getDate()+(fe==="next"?7:-7)),fe==="prev"){const Ke=new Date,We=new Date(Ke),vt=We.getDay(),Zt=We.getDate()-vt+(vt===0?-6:1);We.setDate(Zt),We.setHours(0,0,0,0);const Ht=new Date(p),Tt=Ht.getDay(),Ot=Ht.getDate()-Tt+(Tt===0?-6:1);if(Ht.setDate(Ot),Ht.setHours(0,0,0,0),U!=null&&U.hidePastClasses&&Ht.getTime()<=We.getTime())return;const Ft=new Date(le),is=Ft.getDay(),Cs=Ft.getDate()-is+(is===0?-6:1);Ft.setDate(Cs),Ft.setHours(0,0,0,0),Ft>=We&&v(le)}else v(le)},ue=f.useMemo(()=>{if(!(U!=null&&U.hidePastClasses))return!0;const fe=new Date,le=new Date(fe),Ke=le.getDay(),We=le.getDate()-Ke+(Ke===0?-6:1);le.setDate(We),le.setHours(0,0,0,0);const vt=new Date(p),Zt=vt.getDay(),Ht=vt.getDate()-Zt+(Zt===0?-6:1);return vt.setDate(Ht),vt.setHours(0,0,0,0),vt.getTime()>le.getTime()},[U==null?void 0:U.hidePastClasses,p]),Me=fe=>{const le=new Date(fe),Ke=le.getDay(),We=le.getDate()-Ke+(Ke===0?-6:1);le.setDate(We);const vt=new Date(le);vt.setDate(le.getDate()+6);const Zt={month:"long",day:"numeric",year:"numeric"};return`${le.toLocaleDateString("en-US",{month:"long",day:"numeric"})} - ${vt.toLocaleDateString("en-US",Zt)}`};function pt(fe){switch(fe){case"monthly":return"month";case"four_weekly":return"4 weeks";case"quarterly":return"quarter";case"yearly":return"year";default:return"month"}}const de=fe=>{const le=document.getElementById(fe);if(!le)return;const Ke=le.getBoundingClientRect(),We=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,Ht=Ke.top+We-10;window.scrollTo({top:Math.max(0,Ht),behavior:"smooth"})};return s.jsxs("div",{className:"min-h-screen bg-slate-50",children:[s.jsx("section",{id:"classes-section",className:"py-4 bg-white",children:s.jsxs("div",{className:"w-full px-1 sm:px-2",children:[Z&&(()=>{const fe=[];return W&&I.length>0&&fe.push({label:"Bundles",onClick:()=>de("bundle-section")}),q&&fe.push({label:"Calendar",onClick:()=>{const le=document.querySelector('[data-testid="view-toggle"]');if(le){const Ke=le.getBoundingClientRect(),We=window.pageYOffset||document.documentElement.scrollTop||0,vt=Ke.top+We-10;window.scrollTo({top:Math.max(0,vt),behavior:"smooth"})}else de("classes-section")}}),H&&R.length>0&&fe.push({label:"Services",onClick:()=>de("services-section")}),_&&M.length>0&&fe.push({label:"Events",onClick:()=>de("events-section")}),L&&J.length>0&&fe.push({label:"Memberships",onClick:()=>de("memberships-section")}),s.jsx("div",{className:"flex justify-center mb-6",children:s.jsxs("nav",{className:"flex items-center gap-2 text-sm","aria-label":"Breadcrumb",children:[fe.map((le,Ke)=>s.jsxs(f.Fragment,{children:[le.isLink?s.jsx(dt,{href:le.href||"#",className:"text-primary hover:text-primary/80 font-medium transition-colors px-2 py-1 rounded hover:bg-primary/10",children:le.label}):s.jsx("button",{onClick:We=>{We.preventDefault(),We.stopPropagation(),le.onClick()},className:"text-primary hover:text-primary/80 font-medium transition-colors px-2 py-1 rounded hover:bg-primary/10",children:le.label}),Ke<fe.length-1&&s.jsx("span",{className:"text-slate-400",children:"|"})]},le.label)),fe.length>0&&s.jsx("span",{className:"text-slate-400",children:"|"}),s.jsx(dt,{href:`/my-account/${e}`,className:"text-primary hover:text-primary/80 font-medium transition-colors px-2 py-1 rounded hover:bg-primary/10",children:"My A
659ccount"})]})})})(),W&&e&&(U==null?void 0:U.id)&&te==="top"&&I.length>0&&s.jsx("div",{id:"bundle-section",className:"mb-8",children:s.jsx(Pw,{instructorId:U.id,instructorCurrency:(U==null?void 0:U.currency)||"GBP",className:""})}),q&&e&&s.jsx("div",{className:"flex justify-center mb-4",children:s.jsxs("div",{className:"inline-flex bg-slate-100 rounded-lg p-1","data-testid":"view-toggle",children:[s.jsxs(B,{variant:N==="monthly"?"default":"ghost",size:"sm",onClick:()=>{P.current=!0,C("monthly")},className:`px-4 py-2 text-sm font-medium transition-all ${N==="monthly"?"bg-white shadow-sm text-slate-900":"text-slate-600 hover:text-slate-900"}`,"data-testid":"monthly-view-button",children:[s.jsx(_N,{className:"h-4 w-4 mr-2"}),"Monthly List"]}),s.jsxs(B,{variant:N==="weekly"?"default":"ghost",size:"sm",onClick:()=>{P.current=!0,C("weekly")},className:`px-4 py-2 text-sm font-medium transition-all ${N==="weekly"?"bg-white shadow-sm text-slate-900":"text-slate-600 hover:text-slate-900"}`,"data-testid":"weekly-view-button",children:[s.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Weekly Calendar"]})]})}),q&&N==="weekly"&&s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between bg-slate-50 p-3 sm:p-4 rounded-lg space-y-3 sm:space-y-0",children:[s.jsxs(B,{variant:"ghost",onClick:()=>ze("prev"),disabled:!ue,className:`flex items-center space-x-2 text-slate-600 hover:text-primary w-full sm:w-auto justify-center sm:justify-start ${ue?"":"opacity-50 cursor-not-allowed"}`,"data-testid":"previous-week-button",children:[s.jsx(lm,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Previous Week"}),s.jsx("span",{className:"sm:hidden",children:"Previous"})]}),s.jsx("h3",{className:"text-base sm:text-lg font-semibold text-slate-900 text-center px-2",children:Me(p)}),s.jsxs(B,{variant:"ghost",onClick:()=>ze("next"),className:"flex items-center space-x-2 text-slate-600 hover:text-primary w-full sm:w-auto justify-center sm:justify-start","data-testid":"next-week-button",children:[s.jsx("span",{className:"hidden sm:inline",children:"Next Week"}),s.jsx("span",{className:"sm:hidden",children:"Next"}),s.jsx(Ji,{className:"h-4 w-4"})]})]})}),q&&(ke?s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),s.jsx("p",{className:"mt-2 text-slate-600",children:"Loading classes..."})]}):N==="monthly"?s.jsx("div",{className:"gap-4",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(260px, 1fr))"},children:s.jsx(xq,{classes:$e,onClassSelect:be,onContactInstructor:e?Fe:void 0,isRootPage:!e,instructorCurrency:(U==null?void 0:U.currency)||void 0,instructor:U})}):s.jsx(pq,{classes:$e,currentWeek:p,onClassSelect:be,onContactInstructor:e?Fe:void 0,isRootPage:!e,instructorCurrency:(U==null?void 0:U.currency)||void 0,instructor:U})),H&&e&&(U==null?void 0:U.id)&&R.length>0&&s.jsxs("div",{id:"services-section",className:`${q&&$e.length>0?"mt-16":"mt-8"}`,children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-4",children:"Services"}),s.jsx("p",{className:"text-slate-600 max-w-2xl mx-auto",children:"Book one-on-one sessions and personalized services tailored to your needs."})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:R.map(fe=>s.jsxs(Ce,{className:"hover:shadow-lg transition-shadow cursor-pointer",onClick:()=>_e(fe),children:[s.jsx(gt,{children:s.jsx("div",{className:"flex items-start justify-between",children:s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:fe.name}),fe.description&&s.jsx("p",{className:"text-slate-600 text-sm mb-3",children:fe.description})]})})}),s.jsx(Ee,{children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center text-sm text-slate-600",children:[s.jsx(Ls,{className:"h-4 w-4 mr-2"}),fe.duration," minutes"]}),s.jsxs("div",{className:"text-lg font-bold text-slate-900",children:[mt((U==null?void 0:U.currency)||"GBP"),fe.price]})]}),fe.location&&s.jsxs("div",{className:"flex items-center text-sm text-slate-600",children:[s.jsx(si,{className:"h-4 w-4 mr-2"}),fe.location]}),s.jsx(B,{className:"w-full mt-4",children:"Book Service"})]})})]},fe.id))})]}),_&&e&&(U==null?void 0:U.id)&&M.length>0&&s.jsxs("div",{id:"events-section",className:`${q&&$e.length>0||H&&R.length>0?"mt-16":"mt-8"}`,children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-4",children:"Events"}),s.jsx("p",{className:"text-slate-600 max-w-2xl mx-auto",children:"Get tickets for upcoming events and workshops."})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:M.map(fe=>s.jsxs(Ce,{className:"hover:shadow-lg transition-shadow flex flex-col",children:[s.jsx(gt,{children:s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:fe.title}),fe.description&&s.jsx(aO,{text:fe.description,linkClassName:"text-sky-600 hover:underline break-all",preserveLineBreaks:!0})]}),s.jsx(um,{className:"h-5 w-5 text-slate-400 shrink-0"})]})}),s.jsxs(Ee,{className:"flex-1 flex flex-col",children:[s.jsxs("div",{className:"space-y-2 text-sm text-slate-600 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ls,{className:"h-4 w-4 shrink-0"}),Ud(fe.startsAt)]}),fe.location&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(si,{className:"h-4 w-4 shrink-0"}),fe.location]})]}),s.jsxs("div",{className:"mt-auto space-y-1",children:[fe.startsAt&&fe.ticketTypes.map(le=>s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{children:le.name}),s.jsxs("span",{children:[le.price_minor===0?"Free":`${mt(fe.currency||(U==null?void 0:U.currency)||"GBP")}${(le.price_minor/100).toFixed(2)}`,le.remaining<10&&s.jsxs("span",{className:"text-amber-600 ml-1",children:["(",le.remaining," left)"]})]})]},le.id)),s.jsx(B,{className:"w-full mt-4",onClick:()=>{fe.startsAt?(m(fe),h(!0)):(b(fe),j(""),E(le=>({...le,subject:`Interest in: ${fe.title} (date TBC)`})),g(!0))},children:fe.startsAt?"Buy tickets":"Register interest"})]})]})]},fe.id))})]}),W&&e&&(U==null?void 0:U.id)&&te==="bottom"&&I.length>0&&s.jsx("div",{id:"bundle-section",className:"mt-8",children:s.jsx(Pw,{instructorId:U.id,instructorCurrency:(U==null?void 0:U.currency)||"GBP",className:""})}),L&&e&&(U==null?void 0:U.id)&&J.length>0&&s.jsxs("div",{id:"memberships-section",className:`${q&&$e.length>0||H&&R.length>0||_&&M.length>0||W&&I.length>0?"mt-16":"mt-8"}`,children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-4",children:"Membership Options"}),s.jsx("p",{className:"text-slate-600 max-w-2xl mx-auto",children:"Join our community and get exclusive access to special classes, member pricing, and premium content."})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:J.map(fe=>s.jsxs(Ce,{className:"hover:shadow-lg transition-shadow",children:[s.jsxs(gt,{children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h3",{className:"text-xl font-semibold text-slate-900",children:fe.name}),s.jsxs(Je,{variant:"secondary",className:"text-lg font-bold",children:[mt((U==null?void 0:U.currency)||"GBP"),fe.price,fe.billingType==="one_time"?" one-time":`/${pt(fe.billingFrequency)}`]})]}
659),fe.description&&s.jsx("p",{className:"text-slate-600 mt-2 text-sm whitespace-pre-line break-words",children:fe.description})]}),s.jsx(Ee,{children:s.jsxs("div",{className:"space-y-3",children:[fe.usageLimit&&s.jsxs("div",{className:"flex items-center text-sm text-slate-600",children:[s.jsx("span",{className:"font-medium",children:"Includes:"}),s.jsxs("span",{className:"ml-2",children:[fe.usageLimit," classes per"," ",fe.billingType==="one_time"?"period":pt(fe.billingFrequency)]})]}),!fe.usageLimit&&s.jsxs("div",{className:"flex items-center text-sm text-slate-600",children:[s.jsx("span",{className:"font-medium",children:"Unlimited"}),s.jsx("span",{className:"ml-2",children:"access to all member classes"})]}),s.jsx(dt,{href:`/classes/${e}/memberships`,children:s.jsx(B,{className:"w-full mt-4",children:"Join Membership"})})]})})]},fe.id))})]})]})}),e&&s.jsx("footer",{className:"bg-slate-50 border-t border-slate-200 mt-auto py-4",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsx("div",{className:"flex flex-col items-center justify-center text-sm text-slate-600",children:s.jsx(dt,{href:`/my-account/${e}`,className:"text-primary hover:text-primary/80 font-medium transition-colors underline",children:"Manage My Bookings"})})})}),t&&s.jsx($T,{classData:t,onClose:()=>n(null),instructor:U||Ie.find(fe=>fe.id===t.instructorId)}),s.jsx(aW,{open:!!r,classId:(r==null?void 0:r.id)??null,className:r==null?void 0:r.name,onClose:()=>a(null),onVerified:()=>{if(!r)return;const fe=r;a(null),Zs("booking_started","engagement",fe.name,fe.singlePrice||0),n(fe)}}),s.jsx(iW,{service:i,isOpen:l,onClose:()=>{c(!1),o(null)},instructorCurrency:(U==null?void 0:U.currency)||"GBP"}),d&&u&&s.jsx(BT,{event:d,instructor:U?{id:U.id,stripePublicKey:U.stripePublicKey,stripeConnectAccountId:U.stripeConnectAccountId,currency:U.currency}:null,onClose:()=>{h(!1),m(null)}}),s.jsx(Ct,{open:y,onOpenChange:fe=>{g(fe),fe||(b(null),j(""))},children:s.jsxs(St,{className:"max-w-md max-h-[85vh] overflow-y-auto",children:[s.jsx(kt,{children:s.jsxs(Pt,{className:"flex items-center gap-2",children:[s.jsx(_n,{className:"h-5 w-5"}),"Contact ",U==null?void 0:U.businessName]})}),s.jsxs("form",{onSubmit:fe=>{fe.preventDefault(),S.name&&S.email&&S.subject&&S.message&&ie.mutate({...S,message:LT(S.message,{enabled:x==null?void 0:x.bookingInfoFieldEnabled,label:x==null?void 0:x.bookingInfoFieldLabel},w)})},className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"embed-contact-name",children:"Your Name *"}),s.jsx(me,{id:"embed-contact-name",value:S.name,onChange:fe=>E({...S,name:fe.target.value}),required:!0,placeholder:"Enter your full name"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"embed-contact-email",children:"Your Email *"}),s.jsx(me,{id:"embed-contact-email",type:"email",value:S.email,onChange:fe=>E({...S,email:fe.target.value}),required:!0,placeholder:"[email protected]"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"embed-contact-subject",children:"Subject *"}),s.jsx(me,{id:"embed-contact-subject",value:S.subject,onChange:fe=>E({...S,subject:fe.target.value}),required:!0,placeholder:"What's this about?"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"embed-contact-message",children:"Message *"}),s.jsx(Is,{id:"embed-contact-message",value:S.message,onChange:fe=>E({...S,message:fe.target.value}),required:!0,rows:4,placeholder:"Your message..."})]}),s.jsx(UT,{id:"embed-interest-booking-info",enabled:!!(x!=null&&x.bookingInfoFieldEnabled),label:x==null?void 0:x.bookingInfoFieldLabel,value:w,onChange:j}),s.jsxs("div",{className:"flex gap-3 pt-4",children:[s.jsx(B,{type:"button",variant:"outline",onClick:()=>g(!1),className:"flex-1",children:"Cancel"}),s.jsx(B,{type:"submit",disabled:ie.isPending||!S.name||!S.email||!S.subject||!S.message,className:"flex-1",children:ie.isPending?"Sending...":"Send Message"})]})]})]})})]})}const L$="/assets/bookings-LGt03iMH.png",U$="/assets/booking-BL4X_Xcp.png",z$="/assets/mobile_booking-CDNwzUTP.png";function jye(){return s.jsxs("div",{className:"relative w-full max-w-7xl mx-auto py-8 md:py-16",children:[s.jsx("div",{className:"hidden md:block",children:s.jsxs("div",{className:"relative flex justify-center items-center min-h-[600px]",children:[s.jsxs("div",{className:"relative z-10 transform -translate-x-16 -translate-y-8",children:[s.jsxs("div",{className:"bg-gray-800 rounded-t-2xl p-1 shadow-2xl",children:[s.jsx("div",{className:"bg-black rounded-t-xl p-3",children:s.jsx("div",{className:"bg-white rounded-lg overflow-hidden w-[420px] h-64",children:s.jsx("img",{src:L$,alt:"Admin dashboard interface",className:"w-full h-full object-cover object-top"})})}),s.jsx("div",{className:"bg-gray-700 h-4 rounded-b-2xl"})]}),s.jsxs("div",{className:"text-center mt-6",children:[s.jsx("h3",{className:"font-semibold text-gray-900",children:"Admin Dashboard"}),s.jsx("p",{className:"text-sm text-gray-600",children:"Powerful management tools"})]})]}),s.jsxs("div",{className:"relative z-10 transform translate-x-16 translate-y-8",children:[s.jsx("div",{className:"bg-gray-900 rounded-2xl p-2 shadow-2xl",children:s.jsx("div",{className:"bg-black rounded-xl p-1",children:s.jsx("div",{className:"bg-white rounded-lg overflow-hidden w-[350px] h-64",children:s.jsx("img",{src:U$,alt:"Client booking interface",className:"w-full h-full object-cover object-top"})})})}),s.jsxs("div",{className:"text-center mt-6",children:[s.jsx("h3",{className:"font-semibold text-gray-900",children:"Client Experience"}),s.jsx("p",{className:"text-sm text-gray-600",children:"Beautiful class booking"})]})]}),s.jsxs("div",{className:"absolute z-30 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2",children:[s.jsx("div",{className:"bg-gray-900 rounded-[3rem] p-2 shadow-2xl",children:s.jsx("div",{className:"bg-black rounded-[2.5rem] p-1",children:s.jsxs("div",{className:"bg-white rounded-[2rem] overflow-hidden w-56 h-[480px] relative",children:[s.jsx("div",{className:"absolute top-2 left-1/2 transform -translate-x-1/2 w-24 h-5 bg-black rounded-full z-10"}),s.jsx("img",{src:z$,alt:"Mobile booking interface",className:"w-full h-full object-cover"})]})})}),s.jsxs("div",{className:"text-center mt-6",children:[s.jsx("h3",{className:"font-semibold text-gray-900",children:"Mobile Ready"}),s.jsx("p",{className:"text-sm text-gray-600",children:"Book anywhere, anytime"})]})]}),s.jsx("div",{className:"absolute top-20 left-20 w-6 h-6 bg-purple-400 rounded-full animate-pulse opacity-60"}),s.jsx("div",{className:"absolute top-40 right-16 w-4 h-4 bg-blue-400 rounded-full animate-bounce opacity-60"}),s.jsx("div",{className:"absolute bottom-32 left-12 w-5 h-5 bg-green-400 rounded-full animate-pulse opacity-60"}),s.jsx("div",{className:"absolute bottom-20 right-24 w-3 h-3 bg-yellow-400 rounded-full animate-bounce opacity-60"})]})}),s.jsxs("div",{className:"block md:hidden space-y-12",children:[s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"bg-gray-900 rounded-[2.5rem] p-2 shadow-2xl",children:s.jsx("div",{className:"bg-black rounded-[2rem] p-1",children:s.jsxs("div",{className:"bg-white rounded-[1.5rem] overflow-hidden w-48 h-96 relative",children:[s.jsx("div",{className:"absolute top-2 left-1/2 transform -translate-x-1/2 w-20 h-4 bg-black rounded-full z-10"}),s.jsx("img",{src:z$,alt:"Mobile booking interface",className:"w-full h-full object-cover"})]})})}),s.jsxs("div",{className:"text-center mt-4",children:[s.jsx("h3",{className:"font-semibold text-gray-900",children:"Mobile Ready"}),s.jsx("p",{className:"text-sm text-gray-600",children:"Book anywhere, anytime"})]})]}),s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"bg-gray-900 rounded-2xl p-2 shadow-2xl",children:s.jsx("div",{className:"bg-black rounded-xl p-1",children:s.jsx("div",{className:"bg-white rounded-lg overflow-hidden w-80 h-56",children:s.jsx("img",{src:U$,alt:"Client booking interface",className:"w-full h-full object-cover object-top"})})})}),s.jsxs("div",{className:"text-center mt-4",children:[s.jsx("h3",{className:"font-semibold text-gray-900",children:"Client Experience"}),s.jsx("p",{className:"text-sm text-gray-600",children:"Beautiful class booking"})]})]}),s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsxs("div",{className:"bg-gray-800 rounded-t-2xl p-1 shadow-2xl",children:[s.jsx("div",{className:"bg-black rounded-t-xl p-2",children:s.jsx("div",{className:"bg-white rounded-lg overflow-hidden w-80 h-48",children:s.jsx("img",{src:L$,alt:"Admin dashboard interface",className:"w-full h-full object-cover object-top"})})}),s.jsx("div",{className:"bg-gray-700 h-3 rounded-b-2xl"})]}),s.jsxs("div",{className:"text-center mt-4",children:[s.jsx("h3",{className:"font-semibold text-gray-900",children:"Admin Dashboard"}),s.jsx("p",{className:"text-sm text-gray-600",children:"Powerful management tools"})]})]})]})]})}let O0=!1;function XH({toast:e,setLocation:t,onSuccess:n,onError:r,timezone:a,currency:i,referredBy:o}){const[l,c]=f.useState(!1),[d,m]=f.useState(!1),u=f.useRef(!1),h=f.useRef(!1);f.useEffect(()=>{var j;let v=null;const y=()=>{var N;if(window.AppleID&&!window.AppleID._initialized){let C="https://classta.co/auth/apple/callback";(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.endsWith(".ngrok.io"))&&(C="https://untied3.eu.ngrok.io/auth/apple/callback"),window.AppleID.auth.init({clientId:"com.classta.login",scope:"name email",redirectURI:C,usePopup:!0}),window.AppleID._initialized=!0}(N=window.AppleID)!=null&&N.auth&&c(!0)};if((j=window.AppleID)!=null&&j.auth)y();else{const N=document.querySelector('script[src*="appleid.auth.js"]');N?N.addEventListener("load",y):(v=document.createElement("script"),v.src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",v.async=!0,v.onload=y,document.body.appendChild(v))}const g=()=>{m(!1)},x=N=>
659{if(u.current){console.log("[AppleSignIn] Signup already processed, skipping duplicate call");return}u.current=!0,O0=!1,e({title:"Welcome to Classta!",description:"Your account has been created successfully with Apple. You have 30 days of free access!"}),localStorage.removeItem("admin_session"),localStorage.removeItem("auth_token"),N.token&&localStorage.setItem("auth_token",N.token);const C=Date.now()+24*60*60*1e3,P={instructor:N,expires:C};localStorage.setItem("admin_session",JSON.stringify(P)),Zs("instructor_signup","engagement","signup",1),typeof window<"u"&&window.clicky&&window.clicky.goal(1550),typeof window<"u"&&window.fbq&&window.fbq("track","CompleteRegistration"),typeof window<"u"&&window.gtag&&window.gtag("event","conversion",{send_to:"AW-17123389975/7yj6CKS7y5MbEJfkiOU_"}),window.uetq&&(window.uetq=window.uetq||[],window.uetq.push("event","verified_signup",{})),t("/admin"),n&&n(N)},b=async N=>{var C,P;if(h.current){console.log("[AppleSignIn] Already processing signup in this instance, ignoring duplicate event");return}if(O0){console.log("[AppleSignIn] Another instance is already processing signup, ignoring duplicate event"),g();return}O0=!0,h.current=!0,g();try{const S=(P=(C=N.detail)==null?void 0:C.authorization)==null?void 0:P.id_token;if(!S)throw new Error("No ID token received from Apple");const E={id_token:S};a&&(E.timezone=a),i&&(E.currency=i),o&&(E.referredBy=o),console.log("[AppleSignIn] Making API call to /api/instructor/apple-signup");const T=await fetch("/api/instructor/apple-signup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)});if(!T.ok){const O=await T.json().catch(()=>({message:"Apple signup failed"})),D=O.message||"";throw D.includes("duplicate key")&&D.includes("instructors_apple_id_key")&&console.log("[AppleSignIn] Duplicate key error detected, but this might be a race condition"),new Error(O.message||`Apple signup failed: ${T.status} ${T.statusText}`)}const z=await T.json();console.log("[AppleSignIn] Signup successful, received data:",z),x(z)}catch(S){O0=!1,h.current=!1,e({title:"Apple Sign-In Error",description:(S==null?void 0:S.message)||"Failed to load Apple Sign-In. Please try the manual signup form below.",variant:"destructive"}),r&&r(S)}},w=N=>{var T;g();const C=(N==null?void 0:N.error)||((T=N==null?void 0:N.detail)==null?void 0:T.error)||(N==null?void 0:N.detail),P=C==null?void 0:C.code,S=(C==null?void 0:C.message)||(C==null?void 0:C.error)||"";P===1001||P==="1001"||String(P)==="1001"||S!=null&&S.toLowerCase().includes("cancel")||S!=null&&S.toLowerCase().includes("cancelled")||S!=null&&S.toLowerCase().includes("user cancelled")||!C&&!P&&!S||C&&typeof C=="object"&&!Object.keys(C).length||r&&r(C)};return document.addEventListener("AppleIDSignInOnSuccess",b),document.addEventListener("AppleIDSignInOnFailure",w),()=>{g(),u.current=!1,h.current=!1,document.removeEventListener("AppleIDSignInOnSuccess",b),document.removeEventListener("AppleIDSignInOnFailure",w),v&&(v.onload=null)}},[e,t,n,r,a,i]);const p=f.useCallback(()=>{var v;if(!l||!((v=window.AppleID)!=null&&v.auth)){e({title:"Apple Sign-In Not Ready",description:"Apple Sign-In is still loading. Please try again in a moment.",variant:"destructive"});return}m(!0),setTimeout(()=>{try{const y=window.AppleID.auth.signIn();y&&typeof y.catch=="function"&&y.catch(g=>{m(!1),(g==null?void 0:g.code)!==1001&&(g==null?void 0:g.code)!=="1001"&&e({title:"Apple Sign-In Error",description:"Failed to start Apple sign-in. Please try again.",variant:"destructive"}),r&&r(g)})}catch(y){m(!1),e({title:"Apple Sign-In Error",description:"Failed to start Apple sign-in. Please try again.",variant:"destructive"}),r&&r(y)}},100)},[l,e,r]);return l?s.jsx("div",{className:"w-full flex justify-center",children:s.jsx("button",{type:"button",onClick:p,disabled:d,className:`flex items-center justify-center gap-2 border border-slate-200 rounded-lg py-3 px-4 font-medium text-base mb-2 h-[44px] w-[280px] transition-colors ${d?"bg-slate-100 text-slate-500 cursor-not-allowed":"bg-white hover:bg-slate-50 text-slate-800"}`,"aria-label":d?"Loading...":"Sign up with Apple",children:d?s.jsxs(s.Fragment,{children:[s.jsx(Qr,{className:"w-4 h-4 animate-spin"}),s.jsx("span",{children:"Loading..."})]}):s.jsxs(s.Fragment,{children:[s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"currentColor",className:"mr-2",children:s.jsx("path",{d:"M16.365 10.88c-.02-2.06 1.68-3.04 1.76-3.09-0.96-1.4-2.45-1.6-2.98-1.62-1.27-.13-2.48.74-3.13.74-.65 0-1.65-.72-2.72-.7-1.4.02-2.7.82-3.42 2.08-1.46 2.54-.37 6.3 1.04 8.36.7 1.01 1.53 2.14 2.62 2.1 1.06-.04 1.46-.68 2.74-.68 1.28 0 1.64.68 2.74.66 1.13-.02 1.84-1.03 2.53-2.04.8-1.17 1.13-2.3 1.15-2.36-.03-.01-2.2-.84-2.22-3.33zm-2.6-6.1c.58-.7.97-1.68.86-2.66-.83.03-1.83.55-2.42 1.25-.53.62-.99 1.61-.82 2.56.97.08 1.8-.39 2.38-1.15z"})}),"Sign up with Apple"]})})}):s.jsx("div",{className:"w-full flex justify-center",children:s.jsxs("div",{className:"flex items-center justify-center gap-2 border border-slate-200 rounded-lg py-3 px-4 bg-slate-50 text-slate-400 font-medium text-base mb-2 h-[44px] w-[280px] opacity-50 cursor-not-allowed",children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-slate-300 border-t-transparent roun
659ded-full mr-2"}),"Loading Apple Sign In..."]})})}const Nye="413164365675-6do464sralq4qrf2jji2gljroack88s5.apps.googleusercontent.com";function oO({onSuccess:e,onError:t,text:n="signup_with",size:r="large",theme:a="outline",className:i="",apiEndpoint:o="/api/instructor/google-signup",referredBy:l}){const c=f.useRef(null),d=async u=>{try{console.log("🔐 GOOGLE SIGNIN - Making API call to:",o);const p=await(await Pe("POST",o,{credential:u.credential,...o.includes("signup")&&{timezone:"Europe/London",currency:"GBP",referredBy:l}})).json();console.log("✅ GOOGLE SIGNIN - API response received:",p),console.log("✅ GOOGLE SIGNIN - Instructor data type:",typeof p),console.log("✅ GOOGLE SIGNIN - Instructor data keys:",Object.keys(p||{})),e(p)}catch(h){console.error("❌ GOOGLE SIGNIN - API error:",h),t==null||t(h)}};f.useEffect(()=>{const u=()=>{window.google&&c.current&&(window.google.accounts.id.initialize({client_id:Nye,callback:d,auto_select:!1}),window.google.accounts.id.renderButton(c.current,{text:n,size:r,theme:a,width:"280"}))};if(window.google)u();else{const h=document.createElement("script");h.src="https://accounts.google.com/gsi/client",h.onload=u,h.onerror=()=>{console.error("Failed to load Google Sign-In script"),t==null||t()},document.head.appendChild(h)}return()=>{window.google&&window.google.accounts.id.cancel()}},[e,t,n,r,a,o]);const m=()=>{switch(r){case"small":return"h-[32px]";case"medium":return"h-[40px]";case"large":default:return"h-[44px]"}};return s.jsx("div",{className:`${i} w-[280px] ${m()} flex items-center justify-center`,onClick:()=>{typeof window.gtag<"u"&&window.gtag("event","signup_intent",{event_category:"engagement",event_label:"google_signin_landing",value:1})},children:s.jsx("div",{ref:c,className:"w-full h-full"})})}function lO({onSuccess:e,onError:t,className:n="",apiEndpoint:r="/api/instructor/facebook-signup",referredBy:a}){const[i,o]=f.useState(!1),[l,c]=f.useState(""),[d,m]=f.useState(!1);f.useEffect(()=>{(async()=>{try{const v="",y=await fetch("/api/public/config");if(y.ok){const g=await y.json();g.facebookAppId?(c(g.facebookAppId),m(!0),console.error("✅ Facebook App ID loaded from server")):(console.error("❌ Facebook App ID not found in server config"),t==null||t("Facebook App ID is not configured. Please contact support."))}else console.error("❌ Failed to fetch config from server:",y.status),t==null||t("Failed to load configuration. Please refresh the page.")}catch(v){console.error("❌ Error fetching Facebook config:",v),t==null||t("Failed to load Facebook configuration. Please refresh the page.")}})()},[t]);const u=async p=>{if(console.error("🔵 Facebook response received:",{status:p.status,hasAuthResponse:!!p.authResponse,error:p.error}),p.error){console.error("❌ Facebook login error:",p.error);const v=p.error.message||"Facebook login failed";if(p.error.code===1349197){console.error("ℹ️ Facebook login was cancelled by user");return}p.error.code===190||p.error.code===200?t==null||t("Facebook authentication failed. Please check if your domain is configured in Facebook App settings."):t==null||t(v);return}if(p.status==="connected"&&p.authResponse){try{const v=p.authResponse.accessToken;console.error("🔵 Sending Facebook credential to backend...");const y=await Pe("POST",r,{credential:v,...r.includes("signup")&&{timezone:"Europe/London",currency:"GBP",referredBy:a}});if(!y.ok){const x=await y.json().catch(()=>({message:"Unknown error"}));console.error("❌ Backend error:",x),t==null||t(x.message||"Authentication failed");return}const g=await y.json();console.error("✅ Facebook authentication successful"),e(g)}catch(v){console.error("❌ Error processing Facebook response:",v),t==null||t((v==null?void 0:v.message)||"Failed to complete authentication")}return}if(p.status==="unknown"||!p.error&&!p.authResponse){console.error("ℹ️ Facebook login cancelled - user closed popup or did not authorize");return}console.error("⚠️ Facebook login not connected:",p.status)};f.useEffect(()=>{if(!d||!l)return;if(window.FB){o(!0);return}if(document.querySelector('script[src="https://connect.facebook.net/en_US/sdk.js"]')){const g=()=>{window.FB?(o(!0),console.error("✅ Facebook SDK already loaded")):setTimeout(g,100)};g();return}window.fbAsyncInit||(window.fbAsyncInit=function(){if(!l){console.error("❌ Facebook App ID is missing. Cannot initialize SDK."),t==null||t("Facebook App ID is not configured.");return}try{window.FB.init({appId:l,cookie:!0,xfbml:!0,version:"v19.0"}),console.error("✅ Facebook SDK loaded and initialized. Domain:",window.location.hostname),window.dispatchEvent(new CustomEvent("fbSDKReady"))}catch(g){console.error("❌ Error initializing Facebook SDK:",g),t==null||t("Failed to initialize Facebook SDK: "+((g==null?void 0:g.message)||"Unknown error"))}});const v=()=>o(!0);window.addEventListener("fbSDKReady",v);const y=document.createElement("script");return y.src="https://connect.facebook.net/en_US/sdk.js",y.async=!0,y.defer=!0,y.onload=()=>{window.FB&&console.error("✅ Facebook SDK script loaded")},y.onerror=()=>{console.error("❌ Failed to load Facebook SDK script"),t==null||t("Failed to load Facebook SDK script")},document.body.appendChild(y),()=>{window.removeEventListener("fbSDKReady",v)}},[d,l,t]);const h=()=>
659{if(console.error("🔵 Facebook sign-in button clicked"),typeof window.gtag<"u"&&window.gtag("event","signup_intent",{event_category:"engagement",event_label:"facebook_signin",value:1}),!l){console.error("❌ Facebook App ID is not configured"),t==null||t("Facebook App ID is not configured. Please contact support.");return}if(!i||!window.FB){console.error("❌ Facebook SDK not loaded when button clicked",{sdkReady:i,hasFB:!!window.FB,configLoaded:d}),t==null||t("Facebook SDK not loaded. Please refresh the page and try again.");return}console.error("🔵 Attempting Facebook login. Domain:",window.location.hostname);try{window.FB.login(p=>{console.error("🔵 Facebook login response:",p),u(p)},{scope:"public_profile,email"})}catch(p){console.error("❌ Error calling FB.login():",p),t==null||t((p==null?void 0:p.message)||"Failed to open Facebook login. Please check if popups are blocked.")}};return s.jsxs("button",{type:"button",className:`w-[280px] h-[44px] flex items-center justify-center bg-blue-600 hover:bg-blue-700 text-white rounded-md font-medium text-base shadow-sm ${n}`,onClick:h,style:{minHeight:44},disabled:!i||!d,children:[s.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"mr-2",children:s.jsx("path",{d:"M22.675 0h-21.35C.595 0 0 .592 0 1.326v21.348C0 23.408.595 24 1.325 24h11.495v-9.294H9.692v-3.622h3.128V8.413c0-3.1 1.893-4.788 4.659-4.788 1.325 0 2.463.099 2.797.143v3.24l-1.918.001c-1.504 0-1.797.715-1.797 1.763v2.313h3.587l-.467 3.622h-3.12V24h6.116C23.406 24 24 23.408 24 22.674V1.326C24 .592 23.406 0 22.675 0",fill:"#fff"})}),d?i?"Continue with Facebook":"Loading Facebook...":"Loading..."]})}function ZH({open:e,onOpenChange:t}){return s.jsx(Ct,{open:e,onOpenChange:t,children:s.jsxs(St,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Terms & Conditions"}),s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mt-1",children:"Last updated: 13 February 2026"})]}),s.jsxs("div",{className:"prose prose-gray dark:prose-invert max-w-none space-y-6 text-sm",children:[s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"1. Acceptance of Terms"}),s.jsx("p",{children:'By accessing or using Classta ("the Platform", "we", "us", "our"), you agree to be bound by these Terms & Conditions. If you do not agree, you must not use the Platform.'}),s.jsx("p",{children:"These Terms apply to all users, including instructors, organisers and clients."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"2. Description of Service"}),s.jsx("p",{children:'Classta is an online booking and payments platform that enables instructors, organisers and service providers ("Instructors") to create and manage classes, sessions, events and related activities, and allows clients ("Clients") to discover and book those services.'}),s.jsx("p",{children:"Features may include:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Class and event creation and scheduling"}),s.jsx("li",{children:"Ticket and booking management"}),s.jsx("li",{children:"Online payment processing"}),s.jsx("li",{children:"Automated emails and reminders"}),s.jsx("li",{children:"Public booking pages"})]}),s.jsx("p",{children:"Classta provides technology services only. We are not the organiser, operator, or provider of any class, event or activity listed on the Platform."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"3. Accounts and Registration"}),s.jsx("p",{children:"To use certain features, you must create an account."}),s.jsx("p",{children:"You agree to:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Provide accurate and complete information"}),s.jsx("li",{children:"Maintain the security of your login details"}),s.jsx("li",{children:"Accept responsibility for activity under your account"}),s.jsx("li",{children:"Notify us immediately of any unauthorised use"})]}),s.jsx("p",{children:"We may suspend or terminate accounts that provide false information or misuse the Platform."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"4. Bookings and Payments"}),s.jsx("h3",{className:"text-sm font-medium",children:"4.1 Bookings"}),s.jsxs("ul",{children:[s.jsx("li",{children:"All bookings and ticket purchases are subject to availability as determined by the Instructor."}),s.jsx("li",{children:"A booking is confirmed once payment has been successfully processed and a confirmation email has been issued."})]}),s.jsx("h3",{className:"text-sm font-medium",children:"4.2 Payments"}),s.jsx("p",{children:"Payments are processed through third-party payment providers (such as Stripe or PayPal). Classta does not store full payment card details."}),s.jsx("p",{children:"By making a payment, you also agree to the terms of the relevant payment provider."}),s.jsx("h3",{className:"text-sm font-medium",children:"4.3 Cancellations and Refunds"}),s.jsx("p",{children:"Cancellation and refund policies are set by individual Instructors."}),s.jsx("p",{children:"Classta is not responsible for refund decisions, service delivery, or cancellations made by Instructors."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"5. Instructor Responsibilities"}),s.jsx("p",{children:"Instructors agree to:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Provide accurate descriptions, pricing and scheduling information"}),s.jsx("li",{children:"Maintain appropriate qualifications, licences and insurance"}),s.jsx("li",{children:"Deliver services safely and professionally"}),s.jsx("li",{children:"Comply with all applicable laws and regulations"}),s.jsx("li",{children:"Pay applicable subscription or service fees"})]}),s.jsx("p",{children:"Instructors are solely responsible for the services they offer."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"6. Content and External Links"}),s.jsx("p",{children:"Instructors may upload content including descriptions, images, and external links."}),s.jsx("p",{children:"Classta does not verify or endorse third-party websites or external 
659content."}),s.jsx("p",{children:"We reserve the right, at our sole discretion and without prior notice, to remove or disable:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Events or classes"}),s.jsx("li",{children:"External links"}),s.jsx("li",{children:"Images or other uploaded content"}),s.jsx("li",{children:"User accounts"})]}),s.jsx("p",{children:"where we consider content to be inappropriate, misleading, unlawful, harmful, in breach of these Terms, or in conflict with the interests of the Platform."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"7. Acceptable Use"}),s.jsx("p",{children:"You must not:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Use the Platform for illegal or fraudulent purposes"}),s.jsx("li",{children:"Upload harmful, misleading, defamatory or inappropriate content"}),s.jsx("li",{children:"Interfere with the Platform's operation, security or infrastructure"}),s.jsx("li",{children:"Attempt to copy, reverse engineer or exploit the Platform"}),s.jsx("li",{children:"Violate the rights of other users"})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"8. Health, Safety and Participation Risk"}),s.jsx("p",{children:"Participation in classes, sessions or events may involve risk."}),s.jsx("p",{children:"Clients acknowledge that:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"They participate at their own risk"}),s.jsx("li",{children:"Classta does not supervise or control activities"}),s.jsx("li",{children:"Classta is not responsible for injuries or losses arising from participation"}),s.jsx("li",{children:"Participants should seek appropriate professional advice where necessary."})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"9. Limitation of Liability"}),s.jsx("p",{children:"Classta acts solely as a technology platform connecting Instructors and Clients."}),s.jsx("p",{children:"To the fullest extent permitted by law, Classta is not liable for:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"The quality, safety, legality or delivery of services"}),s.jsx("li",{children:"Injuries, losses or damages arising from participation"}),s.jsx("li",{children:"Disputes between Instructors and Clients"}),s.jsx("li",{children:"Content or external links provided by users"})]}),s.jsx("p",{children:"Nothing in these Terms excludes liability where it cannot legally be excluded."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"10. Fees and Subscriptions"}),s.jsx("p",{children:"Instructors may be required to pay subscription or service fees to use the Platform."}),s.jsx("p",{children:"Fees are charged as described at the time of purchase."}),s.jsx("p",{children:"We reserve the right to update pricing with reasonable notice."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"11. Fair Use"}),s.jsx("p",{children:"Classta operates on a simple, flat monthly subscription model intended for typical use by individual instructors and small-to-medium organisations."}),s.jsx("p",{children:"While we do not charge per booking or per user, we reserve the right to review accounts whose usage is materially excessive, automated, or outside normal expected use of the Platform."}),s.jsx("p",{children:"Where usage significantly impacts platform performance, infrastructure costs, or other users, we may:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Contact the account holder to discuss usage"}),s.jsx("li",{children:"Require migration to a custom or enterprise arrangement"}),s.jsx("li",{children:"Impose reasonable usage limits"}),s.jsx("li",{children:"Suspend or terminate the account if necessary"})]}),s.jsx("p",{children:"We will aim to act reasonably and transparently."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"12. Suspension and Termination"}),s.jsx("p",{children:"We may suspend or terminate accounts at our discretion, including where:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"These Terms are breached"}),s.jsx("li",{children:"Content is inappropriate or unlawful"}),s.jsx("li",{children:"Continued use presents risk to the Platform"})]}),s.jsx("p",{children:"Users may delete their accounts at any time."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"13. Changes to the Platform or Terms"}),s.jsx("p",{children:"We may update or modify the Platform or these Terms at any time."}),s.jsx("p",{children:"Where changes are significant, we will notify users via email or platform notification."}),s.jsx("p",{children:"Continued use of the Platform constitutes acceptance of the updated Terms."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"14. Governing Law"}),s.jsx("p",{children:"These Terms are governed by the laws of England and Wales."}),s.jsx("p",{children:"Any disputes shall be subject to the exclusive jurisdiction of the courts of England and Wales."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"15. Contact"}),s.jsx("p",{children:"If you have questions regarding these Terms, please contact:"}),s.jsx("p",{children:s.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 dar
659k:text-blue-400 hover:underline",children:"[email protected]"})})]})]})]})})}function eV({open:e,onOpenChange:t}){return s.jsx(Ct,{open:e,onOpenChange:t,children:s.jsxs(St,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Privacy Policy"}),s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mt-1",children:"Last updated: 13 February 2026"})]}),s.jsxs("div",{className:"prose prose-gray dark:prose-invert max-w-none space-y-6 text-sm",children:[s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"1. Introduction"}),s.jsx("p",{children:'Classta ("we", "us", "our") operates an online booking and payments platform that enables instructors and organisers to manage classes, sessions and events.'}),s.jsx("p",{children:"We are committed to protecting your personal data and complying with applicable data protection laws, including the UK GDPR and Data Protection Act 2018."}),s.jsx("p",{children:"This Privacy Policy explains how we collect, use and protect your information."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"2. Who We Are"}),s.jsx("p",{children:"For most personal data processed in connection with the operation of the Classta platform, MJT Net Ltd is the data controller."}),s.jsx("p",{children:"However:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Instructors are independent data controllers in relation to client information collected for their classes or events."}),s.jsx("li",{children:"Classta acts as a data processor when processing client data on behalf of instructors."})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"3. Information We Collect"}),s.jsx("h3",{className:"text-sm font-medium",children:"3.1 Information You Provide"}),s.jsx("p",{children:"This may include:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Name, email address, phone number"}),s.jsx("li",{children:"Account login credentials"}),s.jsx("li",{children:"Profile photos and business information (for instructors)"}),s.jsx("li",{children:"Booking details"}),s.jsx("li",{children:"Emergency contact information"}),s.jsx("li",{children:"Health or participation information (if collected via instructor forms)"}),s.jsx("li",{children:"Payment details (processed securely via third-party providers such as Stripe or PayPal)"})]}),s.jsx("p",{children:"Classta does not store full payment card details."}),s.jsx("h3",{className:"text-sm font-medium",children:"3.2 Automatically Collected Information"}),s.jsx("p",{children:"We may collect:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"IP address"}),s.jsx("li",{children:"Device and browser information"}),s.jsx("li",{children:"Usage data (pages visited, time spent, interactions)"}),s.jsx("li",{children:"Referring URLs"})]}),s.jsx("p",{children:"We use tools such as Google Analytics to analyse usage trends."}),s.jsx("h3",{className:"text-sm font-medium",children:"3.3 Cookies"}),s.jsx("p",{children:"We use cookies and similar technologies to:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Maintain sessions"}),s.jsx("li",{children:"Improve performance"}),s.jsx("li",{children:"Analyse platform usage"}),s.jsx("li",{children:"Support marketing (where consent is provided)"})]}),s.jsx("p",{children:"You may control cookies through your browser settings."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"4. Lawful Basis for Processing (UK GDPR)"}),s.jsx("p",{children:"We process personal data on the following lawful bases:"}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Contract"})," – to provide booking and payment services"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Legitimate Interests"})," – to improve and secure the platform"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Legal Obligation"})," – to comply with tax and accounting laws"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Consent"})," – for marketing communications"]})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"5. How We Use Your Information"}),s.jsx("p",{children:"We use personal data to:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Provide and operate the platform"}),s.jsx("li",{children:"Process bookings and payments"}),s.jsx("li",{children:"Send confirmations and reminders"}),s.jsx("li",{children:"Provide customer support"}),s.jsx("li",{children:"Improve platform performance"}),s.jsx("li",{children:"Prevent fraud and ensure security"}),s.jsx("li",{children:"Comply with legal obligations"}),s.jsx("li",{children:"Send marketing communications (where permitted)"})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"6. Information Sharing"}),s.jsx("h3",{className:"text-sm font-medium",children:"6.1 With Instru
659ctors"}),s.jsx("p",{children:"When a client books a class or event, relevant personal data is shared with the instructor responsible for that service."}),s.jsx("p",{children:"Instructors are responsible for how they use client information."}),s.jsx("h3",{className:"text-sm font-medium",children:"6.2 Service Providers"}),s.jsx("p",{children:"We use trusted third-party providers including:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Stripe and PayPal (payment processing)"}),s.jsx("li",{children:"Postmark (email delivery)"}),s.jsx("li",{children:"Twilio (SMS notifications)"}),s.jsx("li",{children:"Google Analytics (analytics)"}),s.jsx("li",{children:"Cloud hosting providers (data storage)"})]}),s.jsx("p",{children:"These providers process data under contractual safeguards."}),s.jsx("h3",{className:"text-sm font-medium",children:"6.3 Legal Disclosure"}),s.jsx("p",{children:"We may disclose information if required to do so by law or to protect our legal rights."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"7. Data Security"}),s.jsx("p",{children:"We implement appropriate technical and organisational measures, including:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Encryption in transit (HTTPS)"}),s.jsx("li",{children:"Secure hosting infrastructure"}),s.jsx("li",{children:"Access controls and authentication"}),s.jsx("li",{children:"Regular software updates"})]}),s.jsx("p",{children:"No system can guarantee absolute security."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"8. Data Retention"}),s.jsx("p",{children:"We retain personal data only as long as necessary."}),s.jsx("p",{children:"Typical retention periods:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Account information: Until account deletion"}),s.jsx("li",{children:"Financial and booking records: Up to 7 years (for legal and tax purposes)"}),s.jsx("li",{children:"Marketing data: Until consent is withdrawn"}),s.jsx("li",{children:"Analytics data: In accordance with provider retention policies"})]}),s.jsx("p",{children:"If you delete your account, we will remove or anonymise personal data except where retention is legally required."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"9. Your Rights"}),s.jsx("p",{children:"Under UK GDPR, you have the right to:"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Access your data"}),s.jsx("li",{children:"Correct inaccurate data"}
659),s.jsx("li",{children:"Request deletion (subject to legal obligations)"}),s.jsx("li",{children:"Restrict processing"}),s.jsx("li",{children:"Object to processing"}),s.jsx("li",{children:"Withdraw consent"}),s.jsx("li",{children:"Lodge a complaint with the Information Commissioner's Office (ICO)"})]}),s.jsxs("p",{children:["To exercise your rights, contact ",s.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 dark:text-blue-400 hover:underline",children:"[email protected]"})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"10. Children's Data"}),s.jsx("p",{children:"Classta is not intended for children under 16."}),s.jsx("p",{children:"Instructors are responsible for obtaining appropriate parental consent where required for minors attending classes or events."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"11. International Transfers"}),s.jsx("p",{children:"Some of our service providers may process data outside the UK."}),s.jsx("p",{children:"Where this occurs, we ensure appropriate safeguards such as standard contractual clauses are in place."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"12. External Links"}),s.jsx("p",{children:"Our platform may contain links to third-party websites. We are not responsible for the privacy practices of those websites."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"13. Changes to This Policy"}),s.jsx("p",{children:"We may update this Privacy Policy periodically."}),s.jsx("p",{children:"Where changes are significant, we will notify users via email or platform notification."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-base font-semibold",children:"14. Contact Information"}),s.jsx("p",{children:"If you have questions about this Privacy Policy or wish to exercise your rights, contact:"}),s.jsxs("div",{className:"mt-3 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Email:"})," ",s.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 dark:text-blue-400 hover:underline",children:"[email protected]"})]}),s.jsxs("p",{className:"mt-2",children:[s.jsx("strong",{children:"For data protection matters:"})," ",s.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 dark:text-blue-400 hover:underline",children:"[email protected]"})]})]})]})]})]})})}function q$(){function e(){return/twa/.test(navigator.userAgent.toLowerCase())||window.navigator.standalone&&/android/i.test(navigator.userAgent)?!0:window.matchMedia("(display-mode: standalone)").matches&&/android/i.test(navigator.userAgent)}return!e()}const Cye=f.memo(({onSuccess:e,onError:t,referredBy:n})=>s.jsx(oO,{onSuccess:e,onError:t,text:"continue_with",size:"large",theme:"outline",apiEndpoint:"/api/instructor/google-signup",referredBy:n})),Sye=f.memo(({onSuccess:e,onError:t,referredBy:n})=>s.jsx(lO,{onSuccess:e,onError:t,apiEndpoint:"/api/instructor/facebook-signup",referredBy:n}));function kye(){const[e,t]=f.useState(!1),[n,r]=f.useState(!1),[a,i]=f.useState(!1),[o,l]=f.useState(!1),[c,d]=f.useState(!1),[m,u]=f.useState(!1),{toast:h}=Yt(),[,p]=cn(),{formatPrice:v,currentPrice:y,isLoading:g}=ZN(),[x,b]=f.useState({instructorName:"",businessName:"",email:"",password:"",confirmPassword:"",timezone:"Europe/London",currency:"GBP",referredBy:""}),[w,j]=f.useState({});f.useEffect(()=>{Ez();const _=Dz();_&&b(L=>L.referredBy?L:{...L,referredBy:_})},[]),f.useEffect(()=>{const _=document.createElement("script");_.id="helpscout-beacon-bootstrap",_.type="text/javascript",_.async=!0,_.innerHTML='!function(e,t,n){function a(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,a){e.Beacon.readyQueue.push({method:t,options:n,data:a})},n.readyQueue=[],"complete"===t.readyState)return a();e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}(window,document,window.Beacon||function(){});';const L=document.createElement("script");return L.id="helpscout-beacon-init",L.type="text/javascript",L.innerHTML="window.Beacon('init', '4c0a64a0-dadd-4aa9-a084-27ca6e6cb029');",document.body.appendChild(_),document.body.appendChild(L),()=>{document.body.contains(_)&&document.body.removeChild(_),document.body.contains(L)&&document.body.removeChild(L);const U=window.Beacon;if(U)try{U("destroy")}catch{}}},[]),f.useEffect(()=>{if(document.getElementById("famewall-script"))return;const _=document.createElement("script");return _.id="famewall-script",_.type="text/javascript",_.src="https://embed.famewall.io/newFrame.js",_.defer=!0,document.body.appendChild(_),()=>{const L=document.getElementById("famewall-script");L&&document.body.contains(L)&&document.body.removeChild(L)}},[]);const N=_=>_.split(" ").map((U,J)=>{const I=U.replace(/[^a-zA-Z0-9]/g,"");return I.length===0?"":J===0?I.charAt(0).toLowerCase()+I.slice(1):I.charAt(0).toUpperCase()+I.slice(1)}).join("").substring(0,30);function C(_){let L=_.split("@")[0];return L.includes("+")&&(L=L.split("+")[0]),L.includes(".")?L.split(".").map(U=>U.length>0?U.charAt(0).toUpperCase()+U.slice(1).toLowerCase():"").join(" "):L.includes("_")?L.split("_").map(U=>U.length>0?U.charAt(0).toUpperCase()+U.slice(1).toLowerCase():"").join(" "):/([a-z])([A-Z])/g.test(L)?L.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,U=>
659U.toUpperCase()):L.charAt(0).toUpperCase()+L.slice(1).toLowerCase()}const P=["admin","administrator","root","system","login","logout","signup","register","user","users","account","accounts","settings","profile","profiles","dashboard","api","auth","authentication","session","sessions","config","configuration","manage","management","superuser","support","help","contact","terms","privacy","legal","about","faq","blog","news","status","billing","payment","payments","invoice","invoices","subscription","subscriptions","webhook","webhooks","stripe","paypal","oauth","callback","token","tokens","password","reset","verify","verification","confirm","confirmation","email","emails","notifications","message","messages","error","errors","404","500","maintenance","static","assets","css","js","images","img","fonts","public","private","uploads","files","file","download","downloads","reports","report","analytics","tracking","track","metrics","media","content","class","classes","package","packages","booking","bookings","schedule","calendar","member","members","membership","memberships","instructor","instructors","teacher","teachers","student","students"],S=()=>{const _={};return x.email.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(x.email)||(_.email="Please enter a valid email address"):_.email="Email is required",x.password.trim()?x.password.length<6?_.password="Password must be at least 6 characters":x.password.length>128?_.password="Password must be no more than 128 characters":/(?=.*[a-zA-Z])(?=.*\d)/.test(x.password)||(_.password="Password must contain both letters and numbers"):_.password="Password is required",j(_),Object.keys(_).length===0},E=xt({mutationFn:async()=>{const L=x.email.split("@")[0].replace(/[^a-zA-Z0-9]/g,""),U=C(x.email);let J=N(L);if(P.includes(J.toLowerCase())){let re=1,R=J+re;for(;P.includes(R.toLowerCase());)re++,R=J+re;J=R}return(await Pe("POST","/api/instructor/signup",{...x,instructorName:U,businessName:U,subdomain:J,description:"Professional instructor providing quality training sessions.",tagline:"Transform your learning journey with us!",primaryColor:"#a13ac9",secondaryColor:"#62a164",logoUrl:null,requiresSubscription:!0,trialEndsAt:new Date(Date.now()+30*24*60*60*1e3),stripeCustomerId:null,stripeSubscriptionId:null,subscriptionStatus:"trialing"})).json()},onSuccess:_=>{if(_.requiresVerification){h({title:"Account Created!",description:"Please check your email to verify your account."}),Zs("instructor_signup_pending_verification","engagement","signup",1),typeof window<"u"&&window.clicky&&window.clicky.goal(1549),typeof window<"u"&&window.fbq&&window.fbq("track","Lead",{content_name:"Signup Pending Verification",status:"pending_verification"}),typeof window<"u"&&window.gtag&&window.gtag("event","conversion",{send_to:"AW-17123389975/nv1RCNCXrpYbEJfkiOU_"}),p(`/verify/sent?email=${encodeURIComponent(_.email)}`);return}const L=_.instructor||_;h({title:"Welcome to Classta!",description:"Your account has been created successfully. You have 30 days of free access!"}),localStorage.removeItem("admin_session"),localStorage.removeItem("auth_token");const U=Date.now()+24*60*60*1e3,J={instructor:L,expires:U};localStorage.setItem("admin_session",JSON.stringify(J)),typeof window<"u"&&window.fbq&&window.fbq("track","CompleteRegistration"),Zs("instructor_signup","engagement","signup",1),typeof window<"u"&&window.clicky&&window.clicky.goal(1550),typeof window<"u"&&window.gtag&&window.gtag("event","conversion",{send_to:"AW-17123389975/7yj6CKS7y5MbEJfkiOU_"}),window.uetq&&(window.uetq=window.uetq||[],window.uetq.push("event","verified_signup",{})),p("/admin")},onError:_=>{h({title:"Signup Failed",description:_.message||"Something went wrong. Please try again.",variant:"destructive"})}}),T=f.useCallback(_=>{h({title:"Welcome to Classta!",description:"Your account has been created successfully with Google. You have 30 days of free access!"}),localStorage.removeItem("admin_session"),localStorage.removeItem("auth_token"),_.token&&(localStorage.setItem("auth_token",_.token),console.log("💾 GOOGLE SIGNUP - JWT token stored for immediate login"));const L=Date.now()+24*60*60*1e3,U={instructor:_,expires:L};localStorage.setItem("admin_session",JSON.stringify(U)),Zs("instructor_signup","engagement","signup",1),typeof window<"u"&&window.clicky&&window.clicky.goal(1550),typeof window<"u"&&window.fbq&&window.fbq("track","CompleteRegistration"),typeof window<"u"&&window.gtag&&window.gtag("event","conversion",{send_to:"AW-17123389975/7yj6CKS7y5MbEJfkiOU_"}),window.uetq&&(window.uetq=window.uetq||[],window.uetq.push("event","verified_signup",{})),p("/admin")},[p,h]),z=f.useCallback(()=>{h({title:"Google Sign-In Error",description:"Failed to load Google Sign-In. Please try the manual signup form below.",variant:"destructive"})}
659,[h]),O=f.useCallback(()=>{h({title:"Facebook Sign-In Error",description:"Failed to load Facebook Sign-In. Please try the manual signup form below.",variant:"destructive"})},[h]);f.useCallback(()=>h({title:"Apple Sign-In Error",description:"Failed to load Apple Sign-In. Please try the manual signup form below.",variant:"destructive"}),[h]);const D=_=>{_.preventDefault(),S()&&E.mutate()},k=(_,L)=>{b(U=>({...U,[_]:L})),w[_]&&j(U=>({...U,[_]:""}))},{data:F=[]}=Ue({queryKey:["/api/classes/featured"]}),{data:W={}}=Ue({queryKey:["/api/classes/booking-counts",F.map(_=>_.id).join(",")],enabled:F.length>0,queryFn:async()=>{const _=F.map(U=>U.id).join(",");return(await fetch(`/api/classes/booking-counts?ids=${_}`)).json()}}),H=[...F].sort((_,L)=>{const U=(W[L.id]||0)-(W[_.id]||0);if(U!==0)return U;const J=new Date(_.createdAt||0);return new Date(L.createdAt||0).getTime()-J.getTime()}).slice(0,3);return s.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-blue-50",children:[s.jsxs(zo,{children:[s.jsx("title",{children:"Class Booking for Instructors | AI-Powered Setup – Classta"}),s.jsx("meta",{name:"description",content:"Create your first class in minutes with AI. Take payments, track attendance, manage packages & bundles, and offer individual sessions on your branded page. 30-day free trial."}),s.jsx("meta",{name:"keywords",content:"class booking, online booking, instructor platform, class scheduling, yoga booking system, pilates booking software, individual sessions booking, AI class creator, AI-powered booking, secure payments, attendance tracking"}),s.jsx("meta",{name:"author",content:"Classta"}),s.jsx("meta",{property:"og:type",content:"website"}),s.jsx("meta",{property:"og:url",content:"https://classta.co/"}),s.jsx("meta",{property:"og:title",content:"Class Booking for Instructors | AI-Powered Setup – Classta"}),s.jsx("meta",{property:"og:description",content:"Create your first class in minutes with AI. Take payments, track attendance, manage packages & bundles, and offer individual sessions on your branded page. 30-day free trial."}),s.jsx("meta",{property:"og:image",content:"https://classta.co/new-og-image.png"}),s.jsx("meta",{property:"og:image:width",content:"1200"}),s.jsx("meta",{property:"og:image:height",content:"630"}),s.jsx("meta",{property:"og:site_name",content:"Classta"}),s.jsx("meta",{property:"twitter:card",content:"summary_large_image"}),s.jsx("meta",{property:"twitter:url",content:"https://classta.co/"}),s.jsx("meta",{property:"twitter:title",content:"Book and manage your classes online | Classta"}),s.jsx("meta",{property:"twitter:description",content:"Classta is a professional booking platform for all types of instructors—whether you teach fitness, crafts, cooking, first aid, or any other class."}),s.jsx("meta",{property:"twitter:image",content:"https://classta.co/new-og-image.png"}),s.jsx("link",{rel:"canonical",href:"https://classta.co/"}),s.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"Product",name:"Classta",description:"Class booking software for independent instructors with AI-assisted setup.",image:"https://classta.co/new-og-image.png",offers:[{"@type":"Offer",price:"15.00",priceCurrency:"GBP",availability:"https://schema.org/InStock",url:"https://classta.co/pricing",hasMerchantReturnPolicy:{"@type":"MerchantReturnPolicy",applicableCountry:"GB",returnPolicyCategory:"https://schema.org/MerchantReturnFiniteReturnWindow",merchantReturnDays:30,returnMethod:"https://schema.org/ReturnByMail",returnFees:"https://schema.org/FreeReturn"},shippingDetails:{"@type":"OfferShippingDetails",shippingRate:{"@type":"MonetaryAmount",value:0,currency:"GBP"},deliveryTime:{"@type":"ShippingDeliveryTime",handlingTime:{"@type":"QuantitativeValue",minValue:0,maxValue:0,unitCode:"DAY"},transitTime:{"@type":"QuantitativeValue",minValue:0,maxValue:0,unitCode:"DAY"}}}},{"@type":"Offer",price:"15.00",priceCurrency:"EUR",availability:"https://schema.org/InStock",url:"https://classta.co/pricing",hasMerchantReturnPolicy:{"@type":"MerchantReturnPolicy",applicableCountry:"DE",returnPolicyCategory:"https://schema.org/MerchantReturnFiniteReturnWindow",merchantReturnDays:30,returnMethod:"https://schema.org/ReturnByMail",returnFees:"https://schema.org/FreeReturn"},shippingDetails:{"@type":"OfferShippingDetails",shippingRate:{"@type":"MonetaryAmount",value:0,currency:"EUR"},deliveryTime:{"@type":"ShippingDeliveryTime",handlingTime:{"@type":"QuantitativeValue",minValue:0,maxValue:0,unitCode:"DAY"},transitTime:{"@type":"QuantitativeValue",minValue:0,maxValue:0,unitCode:"DAY"}}}},{"@type":"Offer",price:"20.00",priceCurrency:"USD",availability:"https://schema.org/InStock",url:"https://classta.co/pricing",hasMerchantReturnPolicy:{"@type":"MerchantReturnPolicy",applicableCountry:"US",returnPolicyCategory:"https://schema.org/MerchantReturnFiniteReturnWindow",merchantReturnDays:30,returnMethod:"https://schema.org/ReturnByMail",returnFees:"https://schema.org/FreeReturn"},shippingDetails:{"@type":"OfferShippingDetails",shippingRate:{"@type":"MonetaryAmount",value:0,currency:"USD"},deliveryTime:{"@type":"ShippingDeliveryTime",handlingTime:{"@type":"QuantitativeValue",minValue:0,maxValue:0,unitCode:"DAY"},transitTime:{"@type":"QuantitativeValue",minValue:0,maxValue:0,unitCode:"DAY"}}}}]})}),s.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"Organization","@id":"https://classta.co/#organization",name:"Classta",url:"https://classta.co",logo:"https://classta.co/classta-logo-smaller.png",description:"Class booking software for instructors and small studios — bookings, memberships, event ticketing and payments in one flat-priced plan.",sameAs:["https://www.facebook.com/classtaco","https://www.instagram.com/classta.co","https://apps.apple.com/us/app/classta/id6752913096","https://play.google.com/store/apps/details?id=co.classta.tw
659a","https://www.capterra.co.uk/software/1079139/Classta","https://marketplace.zoom.us/apps/uMNzy4dpTz6fCaNHVzcbpQ"]})}),s.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"WebSite","@id":"https://classta.co/#website",name:"Classta",url:"https://classta.co",publisher:{"@id":"https://classta.co/#organization"}})})]}),s.jsx("header",{className:"bg-white/80 backdrop-blur-sm border-b border-slate-200 sticky top-0 z-50",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsxs("div",{className:"flex items-center space-x-3",onClick:()=>{const _=document.getElementById("ai-demo");if(window.scrollY>0)return window.scrollTo({top:0,behavior:"smooth"});_&&_.scrollIntoView({behavior:"smooth"})},children:[s.jsx(Ia,{className:"text-primary",size:"md"}),s.jsx("span",{className:"text-xl font-bold text-slate-900",children:"Classta"})]}),s.jsxs("div",{className:"hidden md:flex items-center space-x-4",children:[s.jsxs("div",{className:"relative",children:[s.jsxs(B,{variant:"ghost",size:"sm",onClick:()=>t(!e),className:"flex items-center space-x-1",children:[s.jsx("span",{children:"Solutions"}),s.jsx(vi,{className:"w-4 h-4"})]}),e&&s.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-slate-200 rounded-lg shadow-lg z-50 min-w-52",children:[s.jsx("a",{href:"/class-booking-system.html",className:"block px-4 py-2 text-sm text-slate-700 hover:bg-slate-50 first:rounded-t-lg",children:"Class Booking System"}),s.jsx("a",{href:"/yoga-booking-system.html",className:"block px-4 py-2 text-sm text-slate-700 hover:bg-slate-50",children:"Yoga Booking System"}),s.jsx("a",{href:"/pilates-booking-software.html",className:"block px-4 py-2 text-sm text-slate-700 hover:bg-slate-50 last:rounded-b-lg",children:"Pilates Booking Software"}),s.jsx("a",{href:"/for",className:"block px-4 py-2 text-sm text-slate-700 hover:bg-slate-50 last:rounded-b-lg",children:"Other use cases"})]})]}),s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>{var _;return(_=document.getElementById("pricing"))==null?void 0:_.scrollIntoView({behavior:"smooth"})},children:"Pricing"}),s.jsx(dt,{href:"/instructor-signup",children:s.jsx(B,{variant:"outline",size:"sm",children:"Start Free Trial"})}),a?s.jsx(dt,{href:"/admin",children:s.jsxs(B,{variant:"ghost",size:"sm",children:[s.jsx(Dd,{className:"w-4 h-4 mr-2"}),"Admin"]})}):s.jsx(dt,{href:"/admin",children:s.jsxs(B,{variant:"ghost",size:"sm",children:[s.jsx(Nd,{className:"w-4 h-4 mr-2"}),"Log In"]})}),s.jsx("a",{href:"https://help.classta.co/",children:s.jsx(B,{variant:"ghost",size:"sm",children:"Help"})})]}),s.jsx("div",{className:"md:hidden",children:s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>r(!n),className:"p-2",children:n?s.jsx(ja,{className:"w-5 h-5"}):s.jsx(MN,{className:"w-5 h-5"})})})]}),n&&s.jsx("div",{className:"md:hidden border-t border-slate-200 bg-white/95 backdrop-blur-sm",children:s.jsxs("div",{className:"px-2 pt-2 pb-3 space-y-1",children:[s.jsxs("div",{className:"px-3 py-2",children:[s.jsx("div",{className:"text-sm font-medium text-slate-900 mb-2",children:"Solutions"}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("a",{href:"/class-booking-system.html",className:"block px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 rounded-md",children:"Class Booking System"}),s.jsx("a",{href:"/yoga-booking-system.html",className:"block px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 rounded-md",children:"Yoga Booking System"}),s.jsx("a",{href:"/pilates-booking-software.html",className:"block px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 rounded-md",children:"Pilates Booking Software"}),s.jsx("a",{href:"/for",className:"block px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 rounded-md",children:"Other use cases"})]})]}),s.jsxs("div",{className:"border-t border-slate-200 pt-2",children:[s.jsx("button",{className:"w-full text-left flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",onClick:()=>{r(!1),setTimeout(()=>{var _;(_=document.getElementById("pricing"))==null||_.scrollIntoView({behavior:"smooth"})},50)},children:"Pricing"}
659),s.jsx(dt,{href:"/instructor-signup",children:s.jsx("div",{className:"flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",onClick:()=>r(!1),children:"Start Teaching"})}),a?s.jsx(dt,{href:"/admin",children:s.jsxs("div",{className:"flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",children:[s.jsx(Dd,{className:"w-4 h-4 mr-3"}),"Admin"]})}):s.jsx(dt,{href:"/admin",children:s.jsxs("div",{className:"flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",children:[s.jsx(Nd,{className:"w-4 h-4 mr-3"}),"Log In"]})}),s.jsx("a",{href:"https://help.classta.co/",children:s.jsx("div",{className:"flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",children:"Help"})})]})]})})]})}),s.jsxs("section",{className:"relative py-20 px-4 sm:px-6 lg:px-12",children:[s.jsxs("div",{className:"max-w-7xl mx-auto",children:[s.jsxs("div",{className:"lg:grid lg:grid-cols-2 lg:gap-12 lg:items-start",children:[s.jsxs("div",{className:"order-1 lg:order-none text-center lg:text-left mb-8 lg:mb-0",children:[s.jsxs("h1",{className:"text-4xl sm:text-6xl font-bold text-slate-900 mb-6",children:["Your booking page",s.jsx("span",{className:"text-primary block",children:"ready in minutes"})]}),s.jsx("div",{className:"mb-6 cursor-pointer",onClick:()=>{typeof window.gtag<"u"&&window.gtag("event","click",{event_category:"engagement",event_label:"create_class_ai_badge",value:1});const _=document.getElementById("ai-demo");_&&_.scrollIntoView({behavior:"smooth"})},children:s.jsxs("span",{className:"inline-flex items-center px-3 py-1.5 rounded-full text-sm font-medium bg-gradient-to-r from-green-100 to-blue-100 text-slate-800 border border-green-200",children:[s.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full mr-2 animate-pulse"}),"New: Create a class with AI"]})}),s.jsx("p",{className:"text-xl text-slate-600 mb-8 max-w-2xl mx-auto",children:"Describe your class, session, or service and instantly get a ready-to-use booking page with reminders and QR check-in. Perfect for fitness, wellness, tutoring, workshops, 1-to-1 sessions & more."}),s.jsx("p",{className:"text-xl text-slate-600 mb-8 max-w-2xl mx-auto lg:block hidden",children:s.jsxs("ul",{className:"list-disc list-outside text-base ml-6 space-y-1",children:[s.jsx("li",{className:"pl-2",children:"Describe your class, service, or event - yoga, Pilates, workshops, personal training, anything."}),s.jsx("li",{className:"pl-2",children:"Your booking page is generated instantly (with reminders + QR check-in)."}),s.jsx("li",{className:"pl-2",children:"Connect Stripe/PayPal & share your link"})]})}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center mb-4",children:[s.jsx(dt,{href:"/instructor-signup",className:"w-full sm:w-auto",children:s.jsx(B,{size:"lg",className:"w-full sm:w-auto bg-primary hover:bg-primary/90 text-white px-8 py-3 text-lg",children:"Create your booking page →"})}),s.jsx(B,{variant:"link",size:"lg",className:"px-8 py-3 text-lg text-primary",onClick:()=>{typeof window.gtag<"u"&&window.gtag("event","click",{event_category:"engagement",event_label:"watch_video_button",value:1});const _=document.getElementById("ai-demo");_&&_.scrollIntoView({behavior:"smooth"})},children:"Watch how it works"})]}),s.jsx("div",{className:"text-center text-sm text-slate-600 mb-8",children:"Free • No card required • 5 minutes"}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 max-w-3xl mx-auto text-sm text-slate-700",children:[s.jsxs("div",{className:"flex items-center justify-center gap-2 bg-white/80 border border-slate-200 rounded-lg px-3 py-2 shadow-sm",children:[s.jsx(bn,{className:"w-4 h-4 text-green-600"}),s.jsx("span",{children:"Live in ~5 minutes"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2 bg-white/80 border border-slate-200 rounded-lg px-3 py-2 shadow-sm",children:[s.jsx(bn,{className:"w-4 h-4 text-green-600"}),s.jsx("span",{children:g?"...":`${v(y)}/mo — everything included`})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2 bg-white/80 border border-slate-200 rounded-lg px-3 py-2 shadow-sm",children:[s.jsx(bn,{className:"w-4 h-4 text-green-600"}),s.jsx("span",{children:"Used by instructors worldwide"})]})]}),s.jsxs("div",{className:"flex flex-wrap justify-center lg:justify-start gap-3 text-sm text-slate-600 mt-4",children:[s.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 rounded-full bg-white/80 border border-slate-200 shadow-sm",children:[s.jsx(bn,{className:"w-4 h-4 text-green-600"}),"No contracts"]}),s.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 rounded-full bg-white/80 border border-slate-200 shadow-sm",children:[s.jsx(bn,{className:"w-4 h-4 text-green-600"}),"Cancel anytime"]}),s.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 rounded-full bg-white/80 border border-slate-200 shadow-sm",children:[s.jsx(bn,{className:"w-4 h-4 text-green-600"}),"UK support"]})]})]}),s.jsx("div",{className:"order-2 lg:order-none w-full content-end flex justify-center mt-8 lg:mt-0",children:s.jsx("div",{className:"bg-slate-900/90 border border-slate-700 rounded-[32px] p-3 shadow-2xl max-w-[280px] sm:max-w-[320px] w-full lg:translate-x-4",children:s.jsx("div",{className:"bg-black rounded-[24px] overflow-hidden shadow-xl",children:s.jsx("img",{src:"/attached_assets/mobile-booking-view.png",alt:"Mobile booking view showing available classes",className:"w-full h-auto block",loading:"lazy"})})})})]}),s.jsx("div",{className:"mt-12 mb-12",children:s.jsxs("div",{className:"grid lg:grid-cols-2 gap-10 items-center",children:[s.jsxs("div",{className:"space-y-4 text-left lg:text-left",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900",children:"A beautiful booking experience for your clients"}),s.jsx("p",{className:"text-xl text-slate-600",children:"Let clients browse, book, and pay on any device. Use your branded booking page or embed the calendar directly on your site."}),s.jsxs("div",{className:"space-y-2 text-slate-700",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600"}),s.jsx("span",{children:"Optimized for mobile — most clients book on their phone"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600"}),s.jsx("span",{children:"Works standalone or embedded on your website"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[s.jsxs("a",{href:"https://classta.co/cal/classta",className:"inline-flex items-center justify-center gap-2 text-primary font-semibold border border-primary/30 bg-primary/10 px-4 py-2 rounded-lg hover:border-primary/50 hover:bg-primary/20 transition-colors",target:"_blank",rel:"noreferrer",children:["View a live booking page",s.jsx(qn,{
659className:"w-4 h-4"})]}),s.jsx(dt,{href:"/instructor-signup",children:s.jsx(B,{variant:"outline",size:"sm",children:"Start free – publish your page"})})]})]}),s.jsx("div",{className:"rounded-2xl border border-slate-200 shadow-xl overflow-hidden bg-white w-full",children:s.jsx("img",{src:"/attached_assets/desktop-booking-page.png",alt:"Desktop calendar booking page",className:"w-full h-auto block",loading:"lazy"})})]})}),s.jsxs("div",{className:"mt-16 mb-16",children:[s.jsxs("div",{className:"text-center mb-10",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Trusted by independent instructors"}),s.jsx("p",{className:"text-slate-600 text-sm",children:"Real feedback from independent instructors using Classta."})]}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-6 max-w-5xl mx-auto",children:[s.jsxs("div",{className:"bg-white border border-slate-200 rounded-lg p-6 shadow-sm",children:[s.jsx("p",{className:"text-slate-700 mb-4 leading-relaxed",children:'"I’ve had a really good experience with Classta so far. Everything feels simple and easy to follow, and every question I’ve had has always been answered"'}),s.jsx("p",{className:"text-sm text-slate-500",children:"— Valentina, Pilates instructor"})]}),s.jsxs("div",{className:"bg-white border border-slate-200 rounded-lg p-6 shadow-sm",children:[s.jsx("p",{className:"text-slate-700 mb-4 leading-relaxed",children:`"I've just made the switch to Classta and am loving the simplicity of the system. Moreover the support from the Classta team has been second to none. They went over and above with my queries and in record speed time. I highly recommend 😁"`}),s.jsx("p",{className:"text-sm text-slate-500",children:"— Zarina, Dance fitness instructor"})]}),s.jsxs("div",{className:"bg-white border border-slate-200 rounded-lg p-6 shadow-sm",children:[s.jsx("p",{className:"text-slate-700 mb-4 leading-relaxed",children:'"Really intuitive to use and brilliant customer service "'}),s.jsx("p",{className:"text-sm text-slate-500",children:"— Francesca, Pilates instructor"})]})]}),s.jsx("div",{className:"text-center mt-8",children:s.jsx(B,{asChild:!0,variant:"outline",size:"lg",children:s.jsx("a",{href:"https://wall.famewall.io/classta",target:"_blank",rel:"noopener noreferrer",children:"See more testimonials"})})})]}),s.jsx("div",{className:"text-center mb-12 text-slate-600",children:s.jsxs("div",{className:"flex flex-wrap justify-center gap-4 text-[15px] opacity-90",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 opacity-70",fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{d:"M7 8a3 3 0 100-6 3 3 0 000 6zM14.5 9a2.5 2.5 0 100-5 2.5 2.5 0 000 5zM1.615 16.428a1.224 1.224 0 01-.569-1.175 6.002 6.002 0 0111.908 0c.058.467-.172.92-.57 1.174A9.953 9.953 0 017 18a9.953 9.953 0 01-5.385-1.572zM14.5 16h-.106c.07-.297.088-.611.048-.933a7.47 7.47 0 00-1.588-3.755 4.502 4.502 0 015.874 2.636.818.818 0 01-.36.98A7.465 7.465 0 0114.5 16z"})}),"Built for instructors of all kinds"]}),s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 opacity-70",fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M8 1a2.5 2.5 0 00-2.5 2.5v13a2.5 2.5 0 002.5 2.5h4a2.5 2.5 0 002.5-2.5v-13A2.5 2.5 0 0012 1H8zM9 15a1 1 0 011-1h.01a1 1 0 110 2H10a1 1 0 01-1-1z",clipRule:"evenodd"})}),"Mobile-friendly"]}),s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 opacity-70",fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{d:"M4 4a2 2 0 00-2 2v1h16V6a2 2 0 00-2-2H4zM18 9H2v5a2 2 0 002 2h12a2 2 0 002-2V9zM4 13a1 1 0 011-1h1a1 1 0 110 2H5a1 1 0 01-1-1zm5-1a1 1 0 100 2h1a1 1 0 100-2H9z"})}),"Secure payments via Stripe"]}),s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 opacity-70",fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{d:"M2 11a1 1 0 011-1h2a1 1 0 011 1v5a1 1 0 01-1 1H3a1 1 0 01-1-1v-5zM8 7a1 1 0 011-1h2a1 1 0 011 1v9a1 1 0 01-1 1H9a1 1 0 01-1-1V7zM14 4a1 1 0 011-1h2a1 1 0 011 1v12a1 1 0 01-1 1h-2a1 1 0 01-1-1V4z"})}),"Real-time Analytics"]}),s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("svg",{className:"w-4 h-4 opacity-70",fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M2.166 4.999A11.954 11.954 0 0010 1.944 11.954 11.954 0 0017.834 5c.11.65.166 1.32.166 2.001 0 5.225-3.34 9.67-8 11.317C5.34 16.67 2 12.225 2 7c0-.682.057-1.35.166-2.001zm11.541 3.708a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),"GDPR compliant"]})]})}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-8 max-w-2xl mx-auto mb-8",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-primary",children:"5 min"}),s.jsx("div",{className:"text-slate-600",children:"Setup Time"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-primary",children:"24/7"}),s.jsx("div",{className:"text-slate-600",children:"Automated Bookings"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-primary",children:g?"...":v(y)}),s.jsx("div",{className:"text-slate-600",children:"Per Month"})]})]})]}),s.jsx(ZH,{open:c,onOpenChange:d}),s.jsx(eV,{open:m,onOpenChange:u})]}),s.jsx("section",{className:"py-16 bg-white",children:s.jsx("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsx("div",{className:"mb-8 text-center",children:s.jsx(jye,{})})})}),s.jsx("section",{className:"py-16 bg-slate-50",id:"signup-section",children:s.jsxs("div",{className:"max-w-xl mx-auto px-4 sm:px-6 lg:px-8",children:[s.jsx("div",{id:"mobile-signup",className:"hidden","aria-hidden":"true"}),s.jsx("div",{id:"desktop-signup",children:s.jsxs(Ce,{className:"md:shadow-lg lg:shadow-lg shadow-xl border-2 border-primary/20 md:border lg:border bg-white md:bg-card lg:bg-card ring-2 ring-primary/10 md:ring-0 lg:ring-0",children:[s.jsxs(gt,{className:"text-center",children:[s.jsx(Nt,{className:"text-xl",children:"Start Your Free Trial"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Create your first class in 2 minutes"})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsx("p",{className:"text-xs text-slate-500 text-center",children:"Fastest setup: Continue with Google (auto-verifies your email)"}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx(Cye,{onSuccess:T,onError:z,referredBy:x.referredBy}),q$()&&s.jsx(XH,{toast:h,setLocation:p,timezone:x.timezone,currency:x.currency,referredBy:x.referredBy}),q$()&&s.jsx(Sye,{onSuccess:T,onError:O,referredBy:x.referredBy})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"flex-1 h-px bg-slate-200"}),s.jsx("span",{className:"text-sm text-slate-500 bg-white px-3",children:"Or continue with email"}),s.jsx("div",{className:"flex-1 h-px bg-slate-200"})]})]}),s.jsxs("form",{onSubmit:D,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"signup-email",className:"text-sm",children:"Email Address *"}),s.jsx(me,{id:"signup-email",type:"email",value:x.email,onChange:_=>k("email",_.target.value),onFocus:()=>{typeof window.gtag<"u"&&window.gtag("event","signup_intent",{event_category:"engagement",event_label:"input_email_signup",value:1})},placeholder:"[email protected]",className:w.email?"border-red-500":"","data-testid":"input-email"}),w.email&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:w.email})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"signup-password",className:"text-sm",children:"Password *"}),s.jsx("div",{className:"text-xs text-slate-600 mb-1",children:"At least 6 characters with letters and numbers"}),s.jsxs("div",{className:"relative",children:[s.jsx(me,{id:"signup-password",type:o?"text":"password",value:x.password,onChange:_=>k("password",_.target.value),placeholder:"Enter your password",className:w.password?"border-red-500 pr-12":"pr-12","data-testid":"input-password",maxLength:128}),s.jsx("button",{type:"button","aria-label":o?"Hide password":"Show password",onClick:()=>l(_=>!_),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-primary focus:outline-none",tabIndex:0,children:o?s.jsx(uc,{className:"w-4 h-4"}):s.jsx(wa,{className:"w-4 h-4"})})]}),w.password&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:w.password})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"landing-referred-by",className:"text-sm",children:"Did another instructor recommend Classta?"}),s.jsx(me,{id:"landing-referred-by",value:x.referredBy,onChange:_=>k("referredBy",_.target.value),placeholder:"e.g. Sarah from Yoga with Sarah"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Enter their name here (optional)"})]}
659),s.jsx(B,{type:"submit",className:"w-full bg-primary hover:bg-primary/90 py-3",disabled:E.isPending,"data-testid":"button-submit",children:E.isPending?"Creating Account...":"Start Free – No Card Needed"}),s.jsx("p",{className:"text-center text-xs text-slate-500",children:"We’ll email a verification link—open it to activate your account."}),s.jsxs("p",{className:"text-center text-xs text-slate-500",children:["By signing up you agree to our"," ",s.jsx("button",{type:"button",className:"text-primary hover:text-primary/80 underline focus:outline-none",onClick:()=>d(!0),children:"Terms"})," ","and"," ",s.jsx("button",{type:"button",className:"text-primary hover:text-primary/80 underline focus:outline-none",onClick:()=>u(!0),children:"Privacy Policy"})]})]})]})]})})]})}),s.jsx("section",{id:"ai-demo",className:"py-16 bg-gradient-to-b from-white to-slate-50",children:s.jsx("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-6",children:"Describe your class. Your full booking setup in seconds."}),s.jsx("div",{className:"mb-12",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 max-w-5xl mx-auto",children:[s.jsxs("div",{className:"relative text-center md:text-left",children:[s.jsx("div",{className:"bg-white rounded-xl p-6 shadow-sm border border-slate-100 h-full",children:s.jsxs("div",{className:"flex items-start gap-4 md:block",children:[s.jsx("div",{className:"w-12 h-12 bg-primary text-white rounded-full flex items-center justify-center text-lg font-bold flex-shrink-0 md:mx-auto md:mb-4",children:"1"}),s.jsxs("div",{className:"flex-1 md:text-center",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-2",children:"Describe it"}),s.jsx("p",{className:"text-slate-600 text-sm leading-relaxed",children:'"Vinyasa Flow, Tuesdays 6pm, £8.50, 60 mins"'})]})]})}),s.jsx("div",{className:"hidden md:block absolute top-1/2 -right-3 transform -translate-y-1/2 z-10",children:s.jsx(qn,{className:"w-6 h-6 text-primary"})})]}),s.jsxs("div",{className:"relative text-center md:text-left",children:[s.jsx("div",{className:"bg-white rounded-xl p-6 shadow-sm border border-slate-100 h-full",children:s.jsxs("div",{className:"flex items-start gap-4 md:block",children:[s.jsx("div",{className:"w-12 h-12 bg-primary text-white rounded-full flex items-center justify-center text-lg font-bold flex-shrink-0 md:mx-auto md:mb-4",children:"2"}),s.jsxs("div",{className:"flex-1 md:text-center",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-2",children:"We build it"}),s.jsx("p",{className:"text-slate-600 text-sm leading-relaxed",children:"Booking page, payments, reminders, attendance"})]})]})}),s.jsx("div",{className:"hidden md:block absolute top-1/2 -right-3 transform -translate-y-1/2 z-10",children:s.jsx(qn,{className:"w-6 h-6 text-primary"})})]}),s.jsx("div",{className:"text-center md:text-left",children:s.jsx("div",{className:"bg-white rounded-xl p-6 shadow-sm border border-slate-100 h-full",children:s.jsxs("div",{className:"flex items-start gap-4 md:block",children:[s.jsx("div",{className:"w-12 h-12 bg-primary text-white rounded-full flex items-center justify-center text-lg font-bold flex-shrink-0 md:mx-auto md:mb-4",children:"3"}),s.jsxs("div",{className:"flex-1 md:text-center",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-2",children:"Share & get paid"}),s.jsx("p",{className:"text-slate-600 text-sm leading-relaxed",children:"Publish in one click"})]})]})})})]})}),s.jsxs("div",{className:"mb-8 space-y-3",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 text-center",children:"Watch a booking page built in under 30 seconds"}),s.jsx("div",{style:{position:"relative",paddingTop:"67.734375%",maxWidth:"960px",margin:"0 auto"},children:s.jsx("iframe",{src:"https://customer-c6vjbr0z26dtd56n.cloudflarestream.com/8b6d6aaec503066d30f8a4baba8a91aa/iframe?poster=https%3A%2F%2Fcustomer-c6vjbr0z26dtd56n.cloudflarestream.com%2F8b6d6aaec503066d30f8a4baba8a91aa%2Fthumbnails%2Fthumbnail.jpg%3Ftime%3D%26height%3D600&title=Create+Your+First+Class+with+AI",loading:"lazy",style:{border:"none",position:"absolute",top:0,left:0,height:"100%",width:"100%",borderRadius:"16px"},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;",allowFullScreen:!0,title:"Create Your First Class with AI (39s)"})}),s.jsx("div",{className:"text-center mt-3 mb-6",children:s.jsx("span",{className:"text-xs text-slate-500",children:"0:39 demo"})})]}),s.jsxs("div",{className:"text-center space-y-2",children:[s.jsx(dt,{href:"/instru
659ctor-signup",children:s.jsxs(B,{size:"lg",className:"bg-primary hover:bg-primary/90 text-white px-8 py-3 text-lg",children:[s.jsx(dl,{className:"w-5 h-5 mr-2"}),"Create my first class (free)"]})}),s.jsx("p",{className:"text-sm text-slate-500",children:g?"... • No contracts • No setup fees":`${v(y)}/month • No contracts • No setup fees`})]})]})})}),s.jsx("section",{className:"py-8 md:py-12 bg-slate-50",children:s.jsx("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-4",children:"Everything You Need in One Platform"}),s.jsx("p",{className:"text-xs text-slate-500 mb-8",children:'AI-powered features are marked "AI"'}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Client self-booking"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Online payments"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Yoga class scheduling"})]}),s.jsxs("div",{className:"relative flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm cursor-pointer hover:shadow-md transition-shadow",onClick:()=>{const _=document.getElementById("ai-demo");_&&_.scrollIntoView({behavior:"smooth"})},children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Create class with AI"}),s.jsxs("div",{className:"absolute -top-1 -right-1 flex gap-1",children:[s.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 bg-opacity-70 text-purple-800 border border-white shadow-sm",children:[s.jsx(lr,{className:"w-2.5 h-2.5 mr-1"}),"AI"]}),s.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-green-100 bg-opacity-70 text-green-800 border border-white shadow-sm",children:"NEW"})]})]}),s.jsxs("div",{className:"relative flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Auto enrolment forms"}),s.jsx("div",{className:"absolute -top-1 -right-1",children:s.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 bg-opacity-70 text-purple-800 border border-white shadow-sm",children:[s.jsx(lr,{className:"w-2.5 h-2.5 mr-1"}),"AI"]})})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Calendar view"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Membership sales"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Email & SMS reminders"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Custom branding"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Private booking links"})]}),s.jsxs("div",{className:"relative flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"AI content enhancement"}),s.jsx("div",{className:"absolute -top-1 -right-1",children:s.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 bg-opacity-70 text-purple-800 border border-white shadow-sm",children:[s.jsx(lr,{className:"w-2.5 h-2.5 mr-1"}),"AI"]})})]}),s.jsxs("div",{className:"relative flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"AI social media posts"}),s.jsx("div",{className:"absolute -top-1 -right-1",children:s.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 bg-opacity-70 text-purple-800 border border-white shadow-sm",children:[s.jsx(lr,{className:"w-2.5 h-2.5 mr-1"}),"AI"]})})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Real-time analytics"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Mobile responsive"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Multi-currency supp
659ort"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Discount coupons"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Pilates studio management"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Attendance tracking"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"QR Check-in"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Class Packages"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Individual Sessions"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Session Bundles"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Multi-instructor support"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Flexible Scheduling"})]})]}),s.jsx("div",{className:"text-center mt-8",children:s.jsx(dt,{to:"/features",children:s.jsxs(B,{variant:"outline",size:"lg",className:"text-blue-600 border-blue-600 hover:bg-blue-50",children:["More Features",s.jsx(qn,{className:"ml-2 h-4 w-4"})]})})})]})})}),s.jsx("section",{className:"py-20 bg-white",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-4",children:"The Complete Class Booking System for Instructors"}),s.jsx("p",{className:"text-xl text-slate-600 max-w-2xl mx-auto",children:"Manage class bookings, take online payments, sell memberships, automate reminders and streamline check-ins - everything you need to run and grow your classes."})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 mb-8",children:[s.jsx(Ce,{className:"border-0 shadow-lg hover:shadow-xl transition-shadow duration-300",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-6",children:s.jsx(Ls,{className:"w-8 h-8 text-blue-600"})}),s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-4",children:"Automated Bookings"}),s.jsx("p",{className:"text-slate-600",children:"Your own branded class booking page with calendar integration. Clients book instantly, payments processed automatically."})]})}),s.jsx(Ce,{className:"border-0 shadow-lg hover:shadow-xl transition-shadow duration-300",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6",children:s.jsx(ti,{className:"w-8 h-8 text-green-600"})}),s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-4",children:"Recurring Revenue"}),s.jsx("p",{className:"text-slate-600",children:"Sell monthly memberships with exclusive content, special pricing, and automatic billing through Stripe."})]})}),s.jsx(Ce,{className:"border-0 shadow-lg hover:shadow-xl transition-shadow duration-300",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-6",children:s.jsx(sr,{className:"w-8 h-8 text-purple-600"})}),s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-4",children:"Client Management"}),s.jsx("p",{className:"text-slate-600",children:"Track bookings, manage member subscriptions, and communicate with your community all in one place."})]})}),s.jsx(Ce,{className:"border-0 shadow-lg hover:shadow-xl transition-shadow duration-300",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-yellow-100 rounded-full flex items-center justify-center mx-auto mb-6",children:s.jsx(Af,{className:"w-8 h-8 text-yellow-600"})}),s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-4",children:"Smart Notifications"}),s.jsx("p",{className:"text-slate-600",children:"Automated email & SMS reminders for clients, instant booking notifications, and membership renewal alerts."})]})}),s.jsx(Ce,{className:"border-0 shadow-lg hover:shadow-xl transition-shadow duration-300",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-6",children:s.jsx(oT,{className:"w-8 h-8 text-red-600"})}),s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-4",children:"Secure Payments"}),s.jsx("p",{className:"text-slate-600",children:"PCI-compliant payment processing with Stripe & PayPal. Your clients' data is safe, your payments are guaranteed."})]})}),s.jsx(Ce,{className:"border-0 shadow-lg hover:shadow-xl transition-shadow duration-300",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-6",children:s.jsx(lT,{className:"w-8 h-8 text-blue-600"})}),s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-4",children:"Zoom Integration"}),s.jsx("p",{className:"text-slate-600",children:"Automatically create Zoom meeting links for online classes. Choose between shared session links or unique booking links."})]})}),s.jsx(Ce,{className:"border-0 shadow-lg hover:shadow-xl transition-shadow duration-300",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-6",children:s.jsx(Z9,{className:"w-8 h-8 text-indigo-600"})}),s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-4",children:"Launch Instantly"}),s.jsx("p",{className:"text-slate-600",children:"Set up your entire class booking system in minutes. No technical skills required, no monthly fees to start."})]})}),s.jsx(Ce,{className:"border-0 shadow-lg hover:shadow-xl transition-shadow duration-300",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-orange-100 rounded-full flex items-center justify-center mx-auto mb-6",children:s.jsx(lr,{className:"w-8 h-8 text-orange-600"})}),s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-4",children:"AI-Powered Tools"}),s.jsxs("p",{className:"text-slate-600 leading-relaxed",children:[s.jsx("strong",{children:"Create entire classes from simple descriptions"})," ",'- just say "Yoga on Mondays at 6pm, £15 per session" and watch the AI handle scheduling, pricing, and setup. Plus generate health forms, enhance content, and create social media posts.']})]})}),s.jsx(Ce,{className:"border-0 shadow-lg hover:shadow-xl transition-shadow duration-300",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-emerald-100 rounded-full flex items-center justify-center mx-auto mb-6",children:s.jsx(pw,{className:"w-8 h-8 text-emerald-600"})}),s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-4",children:"QR Attendance"}),s.jsx("p",{className:"text-slate-600",children:"Streamline check-ins with QR codes in booking emails. Scan to instantly mark attendance - no more manual searches."})]})})]}),s.jsx("div",{className:"text-center mt-12",children:s.jsx(dt,{href:"/instru
659ctor-signup",children:s.jsxs(B,{size:"lg",className:"bg-primary hover:bg-primary/90 text-white px-8 py-3 text-lg",children:[s.jsx(dl,{className:"w-5 h-5 mr-2"}),"Create my first class (free)"]})})})]})}),s.jsx("section",{className:"py-16 bg-white",children:s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 text-center",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-6",children:"How Classta compares to other booking platforms"}),s.jsx("p",{className:"text-lg text-slate-600 mb-12 max-w-2xl mx-auto",children:"While other platforms charge extra for essential features or limit your growth, Classta includes everything you need at one transparent price."}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[s.jsxs("div",{className:"bg-slate-50 p-6 rounded-lg",children:[s.jsx("h3",{className:"font-semibold text-slate-700 mb-4",children:"Other Platforms"}),s.jsxs("ul",{className:"text-sm text-slate-600 space-y-2",children:[s.jsxs("li",{children:["• ",s.jsx("strong",{children:"Class creation:"})," Manual setup"]}),s.jsxs("li",{children:["• ",s.jsx("strong",{children:"Launch time:"})," Hours+"]}),s.jsxs("li",{children:["• ",s.jsx("strong",{children:"All features:"})," Bolt-ons & tiers"]}),s.jsx("li",{children:"• Complex multi-step setup"})]})]}),s.jsxs("div",{className:"bg-primary text-white p-6 rounded-lg shadow-lg transform scale-105",children:[s.jsx("h3",{className:"font-semibold mb-4",children:"Classta"}),s.jsxs("ul",{className:"text-sm space-y-2",children:[s.jsxs("li",{children:["• ",s.jsx("strong",{children:"AI class creator:"})," Yes ✨"]}),s.jsxs("li",{children:["• ",s.jsx("strong",{children:"Launch time:"})," Minutes"]}),s.jsxs("li",{children:["• ",s.jsx("strong",{children:"All features:"})," From day one"]}),s.jsx("li",{children:"• One-click setup"})]}),s.jsxs("div",{className:"mt-4 pt-4 border-t border-purple-300",children:[s.jsx("div",{className:"text-2xl font-bold",children:g?"...":v(y)}),s.jsx("div",{className:"text-sm opacity-90",children:"per month, everything included"})]})]}),s.jsxs("div",{className:"bg-slate-50 p-6 rounded-lg",children:[s.jsx("h3",{className:"font-semibold text-slate-700 mb-4",children:"Typical Competitor"}),s.jsxs("ul",{className:"text-sm text-slate-600 space-y-2",children:[s.jsxs("li",{children:["• ",s.jsx("strong",{children:"Class creation:"})," Manual setup"]}),s.jsxs("li",{children:["• ",s.jsx("strong",{children:"Launch time:"})," Hours+"]}),s.jsxs("li",{children:["• ",s.jsx("strong",{children:"All features:"})," Bolt-ons & tiers"]}),s.jsx("li",{children:"• App dependency"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-8 max-w-3xl mx-auto",children:[s.jsxs("div",{className:"flex items-center space-x-3 bg-green-50 p-4 rounded-lg",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"No hidden costs or surprise fees"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-green-50 p-4 rounded-lg",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"All features included from day one"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-green-50 p-4 rounded-lg",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"No booking volume restrictions"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-green-50 p-4 rounded-lg",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Works on any device, no app required"})]})]}),s.jsx("div",{className:"mb-8",children:s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{size:"lg",className:"bg-primary hover:bg-primary/90 text-white px-8 py-3 text-lg mb-4",children:[s.jsx(dl,{className:"w-5 h-5 mr-2"}),"Create my first class (free)"]})})}),s.jsx("a",{href:"/classta-vs-bookwhen-vs-gymcatch.html",onClick:()=>{typeof window.gtag<"u"&&window.gtag("event","click",{event_category:"engagement",event_label:"comparison_details_button",value:1})},children:s.jsxs(B,{variant:"outline",size:"lg",className:"group",children:["See detailed feature comparison",s.jsx(qn,{
659className:"w-4 h-4 ml-2 group-hover:translate-x-1 transition-transform"})]})})]})}),s.jsx("section",{id:"pricing",className:"py-20 bg-white",children:s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 text-center",children:[s.jsx("h2",{className:"text-3xl sm:text-4xl font-bold text-slate-900 mb-3",children:"One simple price. Everything included."}),s.jsx("p",{className:"text-lg text-slate-600 max-w-2xl mx-auto mb-10",children:"No tiers, no bolt-ons, no per-booking fees — every feature for one flat monthly price."}),s.jsxs("div",{className:"max-w-lg mx-auto",children:[s.jsx("div",{className:"border-2 border-primary/20 shadow-lg rounded-2xl overflow-hidden bg-white text-left",children:s.jsxs("div",{className:"p-8",children:[s.jsxs("div",{className:"flex items-baseline gap-1 mb-1",children:[s.jsx("span",{className:"text-5xl font-bold text-primary",children:g?"…":v(y)}),s.jsx("span",{className:"text-slate-600",children:"per month"})]}),s.jsx("p",{className:"text-slate-600 mb-6",children:"All features included. Nothing locked behind a higher tier."}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-3 mb-8",children:["Unlimited classes & bookings","Memberships, packages & bundles","Event ticket sales","Online payments (Stripe & PayPal)","SMS & email reminders","No feature gating"].map(_=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0 mt-0.5"}),s.jsx("span",{className:"text-slate-700 text-sm",children:_})]},_))}),s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{size:"lg",className:"w-full bg-primary hover:bg-primary/90 text-lg py-6",children:["Start Free Trial",s.jsx(qn,{className:"w-5 h-5 ml-2"})]})}),s.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-5 gap-y-2 mt-6 text-sm text-slate-600",children:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(qt,{className:"w-4 h-4 text-green-600"})," 30-day free trial"]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(qt,{className:"w-4 h-4 text-green-600"})," No card required"]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(qt,{className:"w-4 h-4 text-green-600"})," Cancel anytime"]})]})]})}),s.jsx("p",{className:"text-slate-600 mt-6",children:s.jsx(dt,{href:"/pricing",className:"text-primary font-medium underline hover:text-primary/80",children:"See everything that's included & FAQs"})})]})]})}),s.jsx("section",{className:"py-16 bg-slate-50",children:s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 text-center",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-8",children:"Perfect for..."}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-8",children:[s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-6 h-6 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Independent instructors"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-6 h-6 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Hall & studio-based classes"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-6 h-6 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Online sessions via Zoom etc"})]}),s.jsxs("div",{className:"flex items-center space-x-3 bg-white p-4 rounded-lg shadow-sm",children:[s.jsx(qt,{className:"w-6 h-6 text-green-600 flex-shrink-0"}),s.jsx("span",{className:"text-slate-700 font-medium",children:"Small group training"})]})]}),s.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-sm",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Great for instructors teaching:"}),s.jsxs("div",{className:"flex flex-wrap justify-center gap-3 text-sm",children:[s.jsx("a",{href:"/yoga-booking-system.html",className:"hover:opacity-80 transition-opacity",children:s.jsx(Je,{variant:"secondary",className:"px-3 py-1 cursor-pointer",children:"Yoga Classes"})}),s.jsx("a",{href:"/pilates-booking-software.html",className:"hover:opacity-80 transition-opacity",children:s.jsx(Je,{variant:"secondary",className:"px-3 py-1 cursor-pointer",children:"Pilates Studios"})}),s.jsx(Je,{variant:"secondary",className:"px-3 py-1",children:"Cooking Classes"}),s.jsx(Je,{variant:"secondary",className:"px-3 py-1",children:"Art & Crafts"}),s.jsx(Je,{variant:"secondary",className:"px-3 py-1",children:"First Aid Training"}),s.jsx(Je,{variant:"secondary",className:"px-3 py-1",children:"Language Learning"}),s.jsx(Je,{variant:"secondary",className:"px-3 py-1",children:"Music Lessons"}),s.jsx(Je,{variant:"secondary",className:"px-3 py-1",children:"Dance Classes"}),s.jsx(Je,{variant:"secondary",className:"px-3 py-1",children:"Photography"}),s.jsx(Je,{variant:"secondary",className:"px-3 py-1",children:"Martial Arts"}),s.jsx(Je,{variant:"secondary",className:"px-3 py-1",children:"Personal Training"}),s.jsx(Je,{variant:"secondary",className:"px-3 py-1",children:"Business Skills"}),s.jsx(Je,{variant:"secondary",className:"px-3 py-1",children:"Mindfulness"})]})]})]})}),s.jsx("section",{className:"py-20 bg-gradient-to-r from-primary/5 to-primary/10",children:s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 text-center",children:[s.jsx("div",{className:"famewall-embed","data-src":"classta","data-format":"carousel",style:{width:"100%"}}),s.jsx("div",{className:"text-center mt-8",children:s.jsx(dt,{href:"/instru
659ctor-signup",children:s.jsxs(B,{size:"lg",className:"bg-primary hover:bg-primary/90 text-white px-8 py-3 text-lg",children:[s.jsx(dl,{className:"w-5 h-5 mr-2"}),"Create my first class (free)"]})})})]})}),H.length>0&&s.jsx("section",{className:"py-20 bg-slate-50",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-4",children:"Featured Classes"}),s.jsx("p",{className:"text-xl text-slate-600",children:"Discover popular classes from our amazing instructors"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:H.map(_=>s.jsx(Ce,{className:"border-0 shadow-lg hover:shadow-xl transition-shadow duration-300 overflow-hidden",children:s.jsxs(Ee,{className:"p-0",children:[s.jsx("div",{className:"bg-gradient-to-r from-primary to-primary/80 h-48 flex items-center justify-center",children:s.jsxs("div",{className:"text-center text-white",children:[s.jsx("h3",{className:"text-2xl font-bold mb-2",children:_.name}),s.jsx(Je,{variant:"secondary",className:"bg-white/20 text-white",children:_.classType})]})}),s.jsxs("div",{className:"p-6",children:[s.jsx("p",{className:"text-slate-600 mb-4 line-clamp-2",children:_.description}),s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{className:"text-sm text-slate-500",children:[s.jsxs("div",{children:["📍 ",_.location]}),s.jsxs("div",{children:["⏱ ",_.duration," mins"]})]}),s.jsxs("div",{className:"text-right",children:[s.jsxs("div",{className:"text-2xl font-bold text-primary",children:["£",_.singlePrice]}),s.jsx("div",{className:"text-sm text-slate-500",children:"per class"})]})]}),s.jsx(dt,{href:_.instructorSubdomain?`/cal/${_.instructorSubdomain}`:"#",children:s.jsxs(B,{className:"w-full",variant:"outline",children:["View Classes",s.jsx(qn,{className:"w-4 h-4 ml-2"})]})})]})]})},_.id))}),s.jsx("div",{className:"text-center mt-12",children:s.jsx(dt,{href:"/classes",children:s.jsxs(B,{size:"lg",variant:"outline",children:["Browse All Classes",s.jsx(qn,{className:"w-5 h-5 ml-2"})]})})})]})}),s.jsx("section",{className:"py-20 bg-primary text-white",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center",children:[s.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Turn Your Expertise Into Recurring Revenue"}),s.jsx("p",{className:"text-xl text-purple-100 mb-8 max-w-2xl mx-auto",children:"Launch your class-based business in minutes. Sell memberships, automate bookings, and build a community of dedicated clients who pay you monthly."}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 mb-12 max-w-4xl mx-auto",children:[s.jsxs("div",{className:"text-center",children:[s.jsx(qt,{className:"w-8 h-8 mx-auto mb-4 text-purple-200"}),s.jsx("div",{className:"font-semibold mb-2",children:"Launch in Minutes"}),s.jsx("div",{className:"text-purple-100 text-sm",children:"No coding, no complexity"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx(qt,{className:"w-8 h-8 mx-auto mb-4 text-purple-200"}),s.jsx("div",{className:"font-semibold mb-2",children:"Monthly Memberships"}),s.jsx("div",{className:"text-purple-100 text-sm",children:"Predictable recurring income"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx(qt,{className:"w-8 h-8 mx-auto mb-4 text-purple-200"}),s.jsx("div",{className:"font-semibold mb-2",children:"Zero Setup Costs"}),s.jsx("div",{className:"text-purple-100 text-sm",children:"Start free, pay only on revenue"})]})]}),s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{size:"lg",variant:"secondary",className:"bg-white text-primary hover:bg-purple-50 px-8 py-3 text-lg",children:["Streamline Your Classes",s.jsx(qn,{className:"w-5 h-5 ml-2"})]})}),s.jsx("div",{className:"mt-4",children:s.jsx(dt,{href:"/free-tools?utm_source=site&utm_medium=home_lower_cta&utm_campaign=free_tools_launch",className:"text-purple-200 hover:text-white text-sm underline transition-colors",children:"or try the Free Tools — no login needed"})})]})}),s.jsx("section",{className:"py-16 bg-slate-50",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-4",children:"Looking for Classes?"}),s.jsx("p",{className:"text-lg text-slate-600 max-w-xl mx-auto mb-8",children:"Discover amazing instructors and book classes easily. Join memberships for exclusive content and special pricing."}
659),s.jsx(dt,{href:"/classes",children:s.jsxs(B,{size:"lg",variant:"outline",className:"px-8 py-3",children:[s.jsx(Ls,{className:"w-5 h-5 mr-2"}),"Browse Classes"]})})]})})}),s.jsx("section",{className:"py-16 bg-gradient-to-r from-primary to-primary/90 text-white",children:s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 text-center",children:[s.jsx("h2",{className:"text-2xl font-bold mb-4",children:"Turn a class idea into a live booking page today."}),s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{size:"lg",className:"bg-white hover:bg-gray-50 text-primary px-8 py-3 text-lg",children:[s.jsx(dl,{className:"w-5 h-5 mr-2"}),"Create my first class (free)"]})})]})}),s.jsx("div",{className:"fixed bottom-0 left-0 right-0 bg-primary text-white p-4 shadow-lg z-50 md:hidden",children:s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{className:"w-full bg-white hover:bg-gray-50 text-primary font-bold py-3",children:[s.jsx(dl,{className:"w-5 h-5 mr-2"}),"Create my first class (free)"]})})}),s.jsx("div",{className:"bg-slate-50 py-4",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsx("p",{className:"mt-6 text-center text-xs leading-snug text-neutral-500",children:g?"Prices loading...":`Price: ${v(y)} per month`})})}),s.jsx("footer",{className:"bg-slate-900 text-white py-12",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-8",children:[s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[s.jsx(Ia,{className:"text-primary",size:"sm"}),s.jsx("span",{className:"text-lg font-bold",children:"Classta"})]}),s.jsx("p",{className:"text-slate-400 text-sm",children:"The modern platform for class bookings and instructor memberships."}),s.jsx("a",{href:"https://startupfa.me/s/classta.co?utm_source=classta.co",target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-block",style:{maxWidth:224},children:s.jsx("img",{src:"https://startupfa.me/badges/featured/default-small.webp",alt:"Featured on Startup Fame",width:224,height:36,style:{boxShadow:"0 2px 8px rgba(0,0,0,0.08)",borderRadius:8,background:"#fff",width:"100%",height:"auto"}})})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-4",children:"For Students"}),s.jsxs("ul",{className:"space-y-2 text-sm text-slate-400",children:[s.jsx("li",{children:s.jsx(dt,{href:"/classes",className:"hover:text-white",children:"Browse Classes"})}),s.jsx("li",{children:s.jsx(dt,{href:"/classes",className:"hover:text-white",children:"Find Instructors"})}),s.jsx("li",{children:s.jsx(dt,{href:"/classes",className:"hover:text-white",children:"Memberships"})})]})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-4",children:"For Instructors"}),s.jsxs("ul",{className:"space-y-2 text-sm text-slate-400",children:[s.jsx("li",{children:s.jsx(dt,{href:"/instructor-signup",className:"hover:text-white",children:"Sign Up Now"})}),s.jsx("li",{children:s.jsx(dt,{href:"/pricing",className:"hover:text-white",children:"Pricing"})}),s.jsx("li",{children:s.jsx(dt,{href:"/features",className:"hover:text-white",children:"Features"})}),s.jsx("li",{children:s.jsx("a",{href:"https://help.classta.co/",className:"hover:text-white",children:"Help Center"})}),s.jsx("li",{children:s.jsx("a",{href:"/class-booking-system.html",className:"hover:text-white",children:"Class Booking System"})}),s.jsx("li",{children:s.jsx("a",{href:"/yoga-booking-system.html",className:"hover:text-white",children:"Yoga Booking System"})}),s.jsx("li",{children:s.jsx("a",{href:"/pilates-booking-software.html",className:"hover:text-white",children:"Pilates Booking Software"})})]})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-4",children:"Compare"}),s.jsxs("ul",{className:"space-y-2 text-sm text-slate-400",children:[s.jsx("li",{children:s.jsx("a",{href:"/classta-vs-bookwhen-vs-gymcatch.html",className:"hover:text-white",children:"Classta vs Gymcatch"})}),s.jsx("li",{children:s.jsx("a",{href:"/classta-vs-bookwhen-vs-gymcatch.html",className:"hover:text-white",children:"Classta vs Bookwhen"})}),s.jsx("li",{children:s.jsx(dt,{href:"/moving-from-bookwhen",className:"hover:text-white",children:"Moving from Bookwhen"})}),s.jsx("li",{children:s.jsx("a",{href:"/classta-vs-mindbody.html",className:"hover:text-white",children:"Classta vs Mindbody"})}),s.jsx("li",{children:s.jsx("a",{href:"/classta-vs-teamup.html",className:"hover:text-white",children:"Classta vs Teamup"})}),s.jsx("li",{children:s.jsx("a",{href:"/classta-vs-acuity-scheduling.html",className:"hover:text-white",children:"Classta vs Acuity Scheduling"})})]})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-4",children:"Support"}),s.jsxs("ul",{className:"space-y-2 text-sm text-slate-400",children:[s.jsx("li",{children:s.jsx("a",{href:"https://help.classta.co/",className:"hover:text-white",children:"FAQ"})}),s.jsx("li",{children:s.jsx(dt,{href:"/blog",className:"hover:text-white",children:"Blog"})}),s.jsx("li",{children:s.jsx(dt,{href:"/terms",className:"hover:text-white",children:"Terms"})}),s.jsx("li",{children:s.jsx(dt,{href:"/privacy",className:"hover:text-white",children:"Privacy"})})]})]})]})})})]})}var u1="Tabs",[Pye]=ua(u1,[Np]),tV=Np(),[Eye,cO]=Pye(u1),sV=f.forwardRef((e,t)=>
vendor: 5,377 bytes, line 659
659{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...d}=e,m=xv(l),[u,h]=yi({prop:r,onChange:a,defaultProp:i??"",caller:u1});return s.jsx(Eye,{scope:n,baseId:pi(),value:u,onValueChange:h,orientation:o,dir:m,activationMode:c,children:s.jsx(ms.div,{dir:m,"data-orientation":o,...d,ref:t})})});sV.displayName=u1;var nV="TabsList",rV=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...a}=e,i=cO(nV,n),o=tV(n);return s.jsx(AT,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(ms.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:t})})});rV.displayName=nV;var aV="TabsTrigger",iV=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=e,o=cO(aV,n),l=tV(n),c=cV(o.baseId,r),d=dV(o.baseId,r),m=r===o.value;return s.jsx(TT,{asChild:!0,...l,focusable:!a,active:m,children:s.jsx(ms.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":d,"data-state":m?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...i,ref:t,onMouseDown:At(e.onMouseDown,u=>{!a&&u.button===0&&u.ctrlKey===!1?o.onValueChange(r):u.preventDefault()}),onKeyDown:At(e.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&o.onValueChange(r)}),onFocus:At(e.onFocus,()=>{const u=o.activationMode!=="manual";!m&&!a&&u&&o.onValueChange(r)})})})});iV.displayName=aV;var oV="TabsContent",lV=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=e,l=cO(oV,n),c=cV(l.baseId,r),d=dV(l.baseId,r),m=r===l.value,u=f.useRef(m);return f.useEffect(()=>{const h=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(h)},[]),s.jsx(Na,{present:a||m,children:({present:h})=>s.jsx(ms.div,{"data-state":m?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:d,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:h&&i})})});lV.displayName=oV;function cV(e,t){return`${e}-trigger-${t}`}function dV(e,t){return`${e}-content-${t}`}var Dye=sV,uV=rV,mV=iV,hV=lV;const sc=Dye,Hi=f.forwardRef(({className:e,...t},n)=>s.jsx(uV,{ref:n,className:bt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Hi.displayName=uV.displayName;const Ts=f.forwardRef(({className:e,...t},n)=>s.jsx(mV,{ref:n,className:bt("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Ts.displayName=mV.displayName;const on=f.forwardRef(({className:e,...t},n)=>s.jsx(hV,{ref:n,className:bt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));on.displayName=hV.displayName;var m1="Switch",[Aye]=ua(m1),[Tye,Oye]=Aye(m1),fV=f.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:d,form:m,...u}=e,[h,p]=f.useState(null),v=Us(t,w=>p(w)),y=f.useRef(!1),g=h?m||!!h.closest("form"):!0,[x,b]=yi({prop:a,defaultProp:i??!1,onChange:d,caller:m1});return s.jsxs(Tye,{scope:n,checked:x,disabled:l,children:[s.jsx(ms.button,{type:"button",role:"switch","aria-checked":x,"aria-required":o,"data-state":yV(x),"data-disabled":l?"":void 0,disabled:l,value:c,...u,ref:v,onClick:At(e.onClick,w=>{b(j=>!j),g&&(y.current=w.isPropagationStopped(),y.current||w.stopPropagation())})}),g&&s.jsx(gV,{control:h,bubbles:!y.current,name:r,value:c,checked:x,required:o,disabled:l,form:m,style:{transform:"translateX(-100%)"}})]})});fV.displayName=m1;var pV="SwitchThumb",xV=f.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=Oye(pV,n);return s.jsx(ms.span,{"data-state":yV(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});xV.displayName=pV;var Fye="SwitchBubbleInput",gV=f.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...a},i)=>{const o=f.useRef(null),l=Us(o,i),c=e1(n),d=LN(t);return f.useEffect(()=>{const m=o.current;if(!m)return;const u=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(u,"checked").set;if(c!==n&&p){const v=new Event("click",{bubbles:r});p.call(m,n),m.dispatchEvent(v)}},[c,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});gV.displayName=Fye;function yV(e){return e?"checked":"unchecked"}var vV=fV,_ye=xV;const Rs=f.forwardRef(({className:e,...t},n)=>s.jsx(vV,{className:bt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:s.jsx(_ye,{className:bt("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}
659));Rs.displayName=vV.displayName;function bV(){const{toast:e}=Yt(),t=f.useRef(!1),{data:n,refetch:r,error:a}=Ue({queryKey:["/api/zoom/status"],retry:!1});f.useEffect(()=>{var d;const l=JSON.parse(localStorage.getItem("instructorSession")||"{}"),c=JSON.parse(localStorage.getItem("admin_session")||"{}");l.token||(d=c.instructor)!=null&&d.token||localStorage.getItem("auth_token")},[a,n]),JSON.parse(localStorage.getItem("admin_session")||"{}");const i=xt({mutationFn:async()=>(await Pe("GET","/api/zoom/connect")).json(),onSuccess:l=>{window.location.href=l.authUrl},onError:l=>{e({title:"Connection Failed",description:l.message,variant:"destructive"})}}),o=xt({mutationFn:async()=>(await Pe("POST","/api/zoom/disconnect")).json(),onSuccess:()=>{r(),e({title:"Disconnected",description:"Your Zoom account has been disconnected."})},onError:l=>{e({title:"Disconnection Failed",description:l.message,variant:"destructive"})}});return f.useEffect(()=>{const l=new URLSearchParams(window.location.search),c=l.get("zoom_connected"),d=l.get("zoom_error");if(c==="true")e({title:"Connected!",description:"Your Zoom account has been connected successfully."}),r(),window.history.replaceState({},document.title,window.location.pathname);else if(d){let m="Failed to connect to Zoom.";d==="access_denied"?m="Access was denied. Please try again and authorize the connection.":d==="connection_failed"&&(m="Connection failed. Please try again."),e({title:"Connection Failed",description:m,variant:"destructive"}),window.history.replaceState({},document.title,window.location.pathname)}},[e,r]),f.useEffect(()=>{n!=null&&n.connected&&(t.current=!1)},[n==null?void 0:n.connected]),f.useEffect(()=>{!(n!=null&&n.reconnectRequired)||t.current||(t.current=!0,e({title:"Zoom session expired",description:"Your Zoom connection was cleared because the link expired or was revoked (Zoom refresh tokens can expire after long inactivity). Connect again to create meeting links for bookings.",variant:"destructive"}))},[n==null?void 0:n.reconnectRequired,e]),s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(lT,{className:"h-5 w-5"}),"Zoom Integration"]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"",children:[s.jsxs("div",{className:"mb-2 text-sm text-muted-foreground",children:[s.jsx("p",{className:"text-sm font-medium mb-1",children:n!=null&&n.connected?"Connected":"Not Connected"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:n!=null&&n.connected?"You can create Zoom meetings for your classes":"Connect your Zoom account to automatically create meeting links"}),(n==null?void 0:n.connected)&&n.connectedAt&&s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Connected on ",new Date(n.connectedAt).toLocaleDateString()]}),n!=null&&n.refreshFailedTransiently&&(n!=null&&n.connected)?s.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-500 mt-2",children:"Could not verify Zoom with Zoom's servers just now. If new bookings miss meeting links, try disconnecting and connecting again."}):null]}),s.jsx("div",{className:"flex items-center gap-2",children:n!=null&&n.connected?s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Je,{variant:"outline",className:"text-green-600 border-green-200",children:"Connected"}),s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>o.mutate(),disabled:o.isPending,children:[s.jsx(Lre,{className:"h-4 w-4 mr-1"}),o.isPending?"Disconnecting...":"Disconnect"]})]}):s.jsxs(B,{onClick:()=>i.mutate(),disabled:i.isPending,children:[s.jsx(Lr,{className:"h-4 w-4 mr-2"}),i.isPending?"Connecting...":"Connect to Zoom"]})})]}),s.jsx("div",{className:"text-sm text-muted-foreground",children:s.jsx("p",{children:"Once connected, you can enable automatic Zoom meeting creation for specific classes in the class settings."})})]})]})}const qd=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:bt("w-full caption-bottom text-sm",e),...t})}));qd.displayName="Table";const Wd=f.forwardRef(({className:e,...t},n)=>s.jsx("thead",{ref:n,className:bt("[&_tr]:border-b",e),...t}));Wd.displayName="TableHeader";const Hd=f.forwardRef(({className:e,...t},n)=>s.jsx("tbody",{ref:n,className:bt("[&_tr:last-child]:border-0",e),...t}));Hd.displayName="TableBody";const Mye=f.forwardRef(({className:e,...t},n)=>s.jsx("tfoot",{ref:n,className:bt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));Mye.displayName="TableFooter";const Ra=f.forwardRef(({className:e,...t},n)=>s.jsx("tr",{ref:n,className:bt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Ra.displayName="TableRow";const Es=f.forwardRef(({className:e,...t},n)=>s.jsx("th",{ref:n,className:bt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));Es.displayName="TableHead";const Ds=f.forwardRef(({className:e,...t},n)=>s.jsx("td",{ref:n,className:bt("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Ds.displayName="TableCell";const $ye=f.forwardRef(({className:e,...t},n)=>s.jsx("caption",{ref:n,className:bt("mt-4 text-sm text-muted-foreground",e),...t}));
659$ye.displayName="TableCaption";function wV({value:e,onChange:t,placeholder:n="Type tags separated by commas...",className:r}){const[a,i]=f.useState(""),[o,l]=f.useState(!1),c=f.useRef(null),d=f.useRef(null),m=f.useRef(!1),u=e?e.split(",").map(j=>j.trim()).filter(j=>j.length>0):[],{data:h=[]}=Ue({queryKey:["/api/clients/tags"],queryFn:async()=>{const j=await Pe("GET","/api/clients/tags");if(!j.ok)throw new Error("Failed to fetch tags");return j.json()},enabled:!0}),p=h.filter(j=>{const N=a.trim().toLowerCase();return N.length>0&&j.toLowerCase().includes(N)&&!u.includes(j)});f.useEffect(()=>{const j=N=>{d.current&&!d.current.contains(N.target)&&l(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[]);const v=j=>j.trim().toLowerCase(),y=j=>{const N=v(j);if(N&&!u.includes(N)){const C=[...u,N];t(C.join(","))}i(""),l(!1)},g=j=>{const N=u.filter(C=>C!==j);t(N.length>0?N.join(","):"")},x=j=>{const N=j.target.value;i(N),l(N.trim().length>0)},b=j=>{var N;if(j.key==="Enter"||j.key===","){j.preventDefault();const C=a.trim();C&&y(C)}else j.key==="Backspace"&&a===""&&u.length>0?g(u[u.length-1]):j.key==="Escape"&&(l(!1),(N=c.current)==null||N.blur())},w=(j,N)=>{j.preventDefault(),m.current=!0,y(N),setTimeout(()=>{m.current=!1},100)};return s.jsxs("div",{ref:d,className:bt("relative",r),children:[s.jsxs("div",{className:"flex flex-wrap gap-2 p-2 min-h-[42px] border border-input rounded-md bg-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:[u.map((j,N)=>s.jsxs(Je,{variant:"secondary",className:"flex items-center gap-1 px-2 py-1",children:[j,s.jsx("button",{type:"button",onClick:()=>g(j),className:"ml-1 rounded-full hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring","aria-label":`Remove ${j} tag`,children:s.jsx(ja,{className:"h-3 w-3"})})]},N)),s.jsx(me,{ref:c,type:"text",value:a,onChange:x,onKeyDown:b,onFocus:()=>l(a.trim().length>0),onBlur:()=>{if(m.current)return;const j=a.trim();j&&y(j),l(!1)},placeholder:u.length===0?n:"",className:"flex-1 min-w-[120px] border-0 focus-visible:ring-0 focus-visible:ring-offset-0 p-0 h-auto"})]}),o&&p.length>0&&s.jsx("div",{className:"absolute z-50 w-full mt-1 bg-popover border border-border rounded-md shadow-lg max-h-48 overflow-y-auto",children:p.map((j,N)=>s.jsx("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm hover:bg-accent focus:bg-accent focus:outline-none",onMouseDown:C=>w(C,j),children:j},N))})]})}var Iye=Symbol("radix.slottable");function Rye(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Iye,t}var jV="AlertDialog",[Bye]=ua(jV,[iz]),Nc=iz(),NV=e=>{const{__scopeAlertDialog:t,...n}=e,r=Nc(t);return s.jsx(kT,{...r,...n,modal:!0})};NV.displayName=jV;var Lye="AlertDialogTrigger",CV=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Nc(n);return s.jsx(jz,{...a,...r,ref:t})});CV.displayName=Lye;var Uye="AlertDialogPortal",SV=e=>{const{__scopeAlertDialog:t,...n}=e,r=Nc(t);return s.jsx(PT,{...r,...n})};SV.displayName=Uye;var zye="AlertDialogOverlay",kV=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Nc(n);return s.jsx(mv,{...a,...r,ref:t})});kV.displayName=zye;var Mh="AlertDialogContent",[qye,Wye]=Bye(Mh),Hye=Rye("AlertDialogContent"),PV=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...a}=e,i=Nc(n),o=f.useRef(null),l=Us(t,o),c=f.useRef(null);return s.jsx(tce,{contentName:Mh,titleName:EV,docsSlug:"alert-dialog",children:s.jsx(qye,{scope:n,cancelRef:c,children:s.jsxs(hv,{role:"alertdialog",...i,...a,ref:l,onOpenAutoFocus:At(a.onOpenAutoFocus,d=>{var m;d.preventDefault(),(m=c.current)==null||m.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[s.jsx(Hye,{children:r}),s.jsx(Kye,{contentRef:o})]})})})});PV.displayName=Mh;var EV="AlertDialogTitle",DV=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Nc(n);return s.jsx(fv,{...a,...r,ref:t})});DV.displayName=EV;var AV="AlertDialogDescription",TV=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Nc(n);return s.jsx(pv,{...a,...r,ref:t})});TV.displayName=AV;var Vye="AlertDialogAction",OV=f.forwardRef((e,t)=>
659{const{__scopeAlertDialog:n,...r}=e,a=Nc(n);return s.jsx(XN,{...a,...r,ref:t})});OV.displayName=Vye;var FV="AlertDialogCancel",_V=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=Wye(FV,n),i=Nc(n),o=Us(t,a);return s.jsx(XN,{...i,...r,ref:o})});_V.displayName=FV;var Kye=({contentRef:e})=>{const t=`\`${Mh}\` requires a description for the component to be accessible for screen reader users.
660
661You can add a description to the \`${Mh}\` by passing a \`${AV}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
662
663Alternatively, 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 \`${Mh}\`. 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.
664
665For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return f.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Gye=NV,Yye=CV,Qye=SV,MV=kV,$V=PV,IV=OV,RV=_V,BV=DV,LV=TV;const Zi=Gye,dO=Yye,Jye=Qye,UV=f.forwardRef(({className:e,...t},n)=>s.jsx(MV,{className:bt("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));UV.displayName=MV.displayName;const bi=f.forwardRef(({className:e,...t},n)=>s.jsxs(Jye,{children:[s.jsx(UV,{}),s.jsx($V,{ref:n,className:bt("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})]}));bi.displayName=$V.displayName;const wi=({className:e,...t})=>s.jsx("div",{className:bt("flex flex-col space-y-2 text-center sm:text-left",e),...t});wi.displayName="AlertDialogHeader";const ji=({className:e,...t})=>s.jsx("div",{className:bt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ji.displayName="AlertDialogFooter";const Ni=f.forwardRef(({className:e,...t},n)=>s.jsx(BV,{ref:n,className:bt("text-lg font-semibold",e),...t}));Ni.displayName=BV.displayName;const Ci=f.forwardRef(({className:e,...t},n)=>s.jsx(LV,{ref:n,className:bt("text-sm text-muted-foreground",e),...t}));Ci.displayName=LV.displayName;const eo=f.forwardRef(({className:e,...t},n)=>s.jsx(IV,{ref:n,className:bt(jT(),e),...t}));eo.displayName=IV.displayName;const to=f.forwardRef(({className:e,...t},n)=>s.jsx(RV,{ref:n,className:bt(jT({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));to.displayName=RV.displayName;var Xye=Object.defineProperty,Zye=(e,t,n)=>t in e?Xye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,er=(e,t,n)=>Zye(e,typeof t!="symbol"?t+"":t,n);const Tw={x:0,y:0,width:0,height:0,unit:"px"},Wm=(e,t,n)=>Math.min(Math.max(e,t),n),eve=(...e)=>e.filter(t=>t&&typeof t=="string").join(" "),W$=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function tve(e,t,n,r){const a=el(e,n,r);return e.width&&(a.height=a.width/t),e.height&&(a.width=a.height*t),a.y+a.height>r&&(a.height=r-a.y,a.width=a.height*t),a.x+a.width>n&&(a.width=n-a.x,a.height=a.width/t),e.unit==="%"?Rc(a,n,r):a}function sve(e,t,n){const r=el(e,t,n);return r.x=(t-r.width)/2,r.y=(n-r.height)/2,e.unit==="%"?Rc(r,t,n):r}function Rc(e,t,n){return e.unit==="%"?{...Tw,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function el(e,t,n){return e.unit?e.unit==="px"?{...Tw,...e,unit:"px"}:{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...Tw,...e,unit:"px"}}function H$(e,t,n,r,a,i=0,o=0,l=r,c=a){const d={...e};let m=Math.min(i,r),u=Math.min(o,a),h=Math.min(l,r),p=Math.min(c,a);t&&(t>1?(m=o?o*t:m,u=m/t,h=l*t):(u=i?i/t:u,m=u*t,p=c/t)),d.y<0&&(d.height=Math.max(d.height+d.y,u),d.y=0),d.x<0&&(d.width=Math.max(d.width+d.x,m),d.x=0);const v=r-(d.x+d.width);v<0&&(d.x=Math.min(d.x,r-m),d.width+=v);const y=a-(d.y+d.height);if(y<0&&(d.y=Math.min(d.y,a-u),d.height+=y),d.width<m&&((n==="sw"||n=="nw")&&(d.x-=m-d.width),d.width=m),d.height<u&&((n==="nw"||n=="ne")&&(d.y-=u-d.height),d.height=u),d.width>h&&((n==="sw"||n=="nw")&&(d.x-=h-d.width),d.width=h),d.height>p&&((n==="nw"||n=="ne")&&(d.y-=p-d.height),d.height=p),t){const g=d.width/d.height;if(g<t){const x=Math.max(d.width/t,u);(n==="nw"||n=="ne")&&(d.y-=x-d.height),d.height=x}else if(g>t){const x=Math.max(d.height*t,m);(n==="sw"||n=="nw")&&(d.x-=x-d.width),d.width=x}}return d}function nve(e,t,n,r){const a={...e};return t==="ArrowLeft"?r==="nw"?(a.x-=n,a.y-=n,a.width+=n,a.height+=n):r==="w"?(a.x-=n,a.width+=n):r==="sw"?(a.x-=n,a.width+=n,a.height+=n):r==="ne"?(a.y+=n,a.width-=n,a.height-=n):r==="e"?a.width-=n:r==="se"&&(a.width-=n,a.height-=n):t==="ArrowRight"&&(r==="nw"?(a.x+=n,a.y+=n,a.width-=n,a.height-=n):r==="w"?(a.x+=n,a.width-=n):r==="sw"?(a.x+=n,a.width-=n,a.height-=n):r==="ne"?(a.y-=n,a.width+=n,a.height+=n):r==="e"?a.width+=n:r==="se"&&(a.width+=n,a.height+=n)),t==="ArrowUp"?r==="nw"?(a.x-=n,a.y-=n,a.width+=n,a.height+=n):r==="n"?(a.y-=n,a.height+=n):r==="ne"?(a.y-=n,a.width+=n,a.height+=n):r==="sw"?(a.x+=n,a.width-=n,a.height-=n):r==="s"?a.height-=n:r==="se"&&(a.width-=n,a.height-=n):t==="ArrowDown"&&(r==="nw"?(a.x+=n,a.y+=n,a.width-=n,a.height-=n):r==="n"?(a.y+=n,a.height-=n):r==="ne"?(a.y+=n,a.width-=n,a.height-=n):r==="sw"?(a.x-=n,a.width+=n,a.height+=n):r==="s"?a.height+=n:r==="se"&&(a.width+=n,a.height+=n)),a}const Hm={capture:!0,passive:!1};let rve=0;const Mc=class oo extends f.PureComponent{constructor(){super(...arguments),er(this,"docMoveBound",!1),er(this,"mouseDownOnCrop",!1),er(this,"dragStarted",!1),er(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),er(this,"componentRef",f.createRef()),er(this,"mediaRef",f.createRef()),er(this,"resizeObserver"),er(this,"initChangeCalled",!1),er(this,"instanceId",`rc-${rve++}`),er(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),er(this,"onCropPointerDown",t=>{const{crop:n,disabled:r}=this.props,a=this.getBox();if(!n)return;const i=el(n,a.width,a.height);if(r)return;t.cancelable&&t.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const o=t.target.dataset.ord,l=!!o;let c=t.clientX,d=t.clientY,m=i.x,u=i.y;if(o){const h=t.clientX-a.x,p=t.clientY-a.y;let v=0,y=0;o==="ne"||o=="e"?(v=h-(i.x+i.width),y=p-i.y,m=i.x,u=i.y+i.height):o==="se"||o==="s"?(v=h-(i.x+i.width),y=p-(i.y+i.height),m=i.x,u=i.y):o==="sw"||o=="w"?(v=h-i.x,y=p-(i.y+i.height),m=i.x+i.width,u=i.y):(o==="nw"||o=="n")&&(v=h-i.x,y=p-i.y,m=i.x+i.width,u=i.y+i.height),c=m+a.x+v,d=u+a.y+y}this.evData={startClientX:c,startClientY:d,startCropX:m,startCropY:u,clientX:t.clientX,clientY:t.clientY,isResize:l,ord:o},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})}),er(this,"onComponentPointerDown",t=>{const{crop:n,disabled:r,locked:a,keepSelection:i,onChange:o}=this.props,l=this.getBox();if(r||a||i&&n)return;t.cancelable&&t.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const c=t.clientX-l.x,d=t.clientY-l.y,m={unit:"px",x:c,y:d,width:0,height:0};this.evData={startClientX:t.clientX,startClientY:t.clientY,startCropX:c,startCropY:d,clientX:t.clientX,clientY:t.clientY,isResize:!0},this.mouseDownOnCrop=!0,o(el(m,l.width,l.height),Rc(m,l.width,l.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),er(this,"onDocPointerMove",t=>{const{crop:n,disabled:r,onChange:a,onDragStart:i}=this.props,o=this.getBox();if(r||!n||!this.mouseDownOnCrop)return;t.cancelable&&t.preventDefault(),this.dragStarted||(this.dragStarted=!0,i&&i(t));const{evData:l}=this;l.clientX=t.clientX,l.clientY=t.clientY;let c;l.isResize?c=this.resizeCrop():c=this.dragCrop(),W$(n,c)||a(el(c,o.width,o.height),Rc(c,o.width,o.height))}),er(this,"onComponentKeyDown",t=>{const{crop:n,disabled:r,onChange:a,onComplete:i}=this.props;if(r)return;const o=t.key;let l=!1;if(!n)return;const c=this.getBox(),d=this.makePixelCrop(c),m=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?oo.nudgeStepLarge:t.shiftKey?oo.nudgeStepMedium:oo.nudgeStep;if(o==="ArrowLeft"?(d.x-=m,l=!0):o==="ArrowRight"?(d.x+=m,l=!0):o==="ArrowUp"?(d.y-=m,l=!0):o==="ArrowDown"&&(d.y+=m,l=!0),l){t.cancelable&&t.preventDefault(),d.x=Wm(d.x,0,c.width-d.width),d.y=Wm(d.y,0,c.height-d.height);const u=el(d,c.width,c.height),h=Rc(d,c.width,c.height);a(u,h),i&&i(u,h)}}),er(this,"onHandlerKeyDown",(t,n)=>{const{aspect:r=0,crop:a,disabled:i,minWidth:o=0,minHeight:l=0,maxWidth:c,maxHeight:d,onChange:m,onComplete:u}=this.props,h=this.getBox();if(i||!a)return;if(t.key==="ArrowUp"||t.key==="ArrowDown"||t.key==="ArrowLeft"||t.key==="ArrowRight")t.stopPropagation(),t.preventDefault();else return;const p=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?oo.nudgeStepLarge:t.shiftKey?oo.nudgeStepMedium:oo.nudgeStep,v=el(a,h.width,h.height),y=nve(v,t.ke
665y,p,n),g=H$(y,r,n,h.width,h.height,o,l,c,d);if(!W$(a,g)){const x=Rc(g,h.width,h.height);m(g,x),u&&u(g,x)}}),er(this,"onDocPointerDone",t=>{const{crop:n,disabled:r,onComplete:a,onDragEnd:i}=this.props,o=this.getBox();this.unbindDocMove(),!(r||!n)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,i&&i(t),a&&a(el(n,o.width,o.height),Rc(n,o.width,o.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),er(this,"onDragFocus",()=>{var t;(t=this.componentRef.current)==null||t.scrollTo(0,0)})}get document(){return document}getBox(){const t=this.mediaRef.current;if(!t)return{x:0,y:0,width:0,height:0};const{x:n,y:r,width:a,height:i}=t.getBoundingClientRect();return{x:n,y:r,width:a,height:i}}componentDidUpdate(t){const{crop:n,onComplete:r}=this.props;if(r&&!t.crop&&n){const{width:a,height:i}=this.getBox();a&&i&&r(el(n,a,i),Rc(n,a,i))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,Hm),this.document.addEventListener("pointerup",this.onDocPointerDone,Hm),this.document.addEventListener("pointercancel",this.onDocPointerDone,Hm),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,Hm),this.document.removeEventListener("pointerup",this.onDocPointerDone,Hm),this.document.removeEventListener("pointercancel",this.onDocPointerDone,Hm),this.docMoveBound=!1)}getCropStyle(){const{crop:t}=this.props;if(t)return{top:`${t.y}${t.unit}`,left:`${t.x}${t.unit}`,width:`${t.width}${t.unit}`,height:`${t.height}${t.unit}`}}dragCrop(){const{evData:t}=this,n=this.getBox(),r=this.makePixelCrop(n),a=t.clientX-t.startClientX,i=t.clientY-t.startClientY;return r.x=Wm(t.startCropX+a,0,n.width-r.width),r.y=Wm(t.startCropY+i,0,n.height-r.height),r}getPointRegion(t,n,r,a){const{evData:i}=this,o=i.clientX-t.x,l=i.clientY-t.y;let c;a&&n?c=n==="nw"||n==="n"||n==="ne":c=l<i.startCropY;let d;return r&&n?d=n==="nw"||n==="w"||n==="sw":d=o<i.startCropX,d?c?"nw":"sw":c?"ne":"se"}resolveMinDimensions(t,n,r=0,a=0){const i=Math.min(r,t.width),o=Math.min(a,t.height);return!n||!i&&!o?[i,o]:n>1?i?[i,i/n]:[o*n,o]:o?[o*n,o]:[i,i/n]}resizeCrop(){const{evData:t}=this,{aspect:n=0,maxWidth:r,maxHeight:a}=this.props,i=this.getBox(),[o,l]=this.resolveMinDimensions(i,n,this.props.minWidth,this.props.minHeight);let c=this.makePixelCrop(i);const d=this.getPointRegion(i,t.ord,o,l),m=t.ord||d;let u=t.clientX-t.startClientX,h=t.clientY-t.startClientY;(o&&m==="nw"||m==="w"||m==="sw")&&(u=Math.min(u,-o)),(l&&m==="nw"||m==="n"||m==="ne")&&(h=Math.min(h,-l));const p={unit:"px",x:0,y:0,width:0,height:0};d==="ne"?(p.x=t.startCropX,p.width=u,n?(p.height=p.width/n,p.y=t.startCropY-p.height):(p.height=Math.abs(h),p.y=t.startCropY-p.height)):d==="se"?(p.x=t.startCropX,p.y=t.startCropY,p.width=u,n?p.height=p.width/n:p.height=h):d==="sw"?(p.x=t.startCropX+u,p.y=t.startCropY,p.width=Math.abs(u),n?p.height=p.width/n:p.height=h):d==="nw"&&(p.x=t.startCropX+u,p.width=Math.abs(u),n?(p.height=p.width/n,p.y=t.startCropY-p.height):(p.height=Math.abs(h),p.y=t.startCropY+h));const v=H$(p,n,d,i.width,i.height,o,l,r,a);return n||oo.xyOrds.indexOf(m)>-1?c=v:oo.xOrds.indexOf(m)>-1?(c.x=v.x,c.width=v.width):oo.yOrds.indexOf(m)>-1&&(c.y=v.y,c.height=v.height),c.x=Wm(c.x,0,i.width-c.width),c.y=Wm(c.y,0,i.height-c.height),c}renderCropSelection(){const{ariaLabels:t=oo.defaultProps.ariaLabels,disabled:n,locked:r,renderSelectionAddon:a,ruleOfThirds:i,crop:o}=this.props,l=this.getCropStyle();if(o)return he.createElement("div",{style:l,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":t.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!r&&he.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},he.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),he.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),he.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),he.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),he.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":t.nwDragHandle,onKeyDown:c=>this.onHandlerKeyDown(c,"nw"),role:"button"}),he.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":t.nDragHandle,onKeyDown:c=>this.onHandlerKeyDown(c,"n"),role:"button"}),he.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":t.neDragHandle,onKeyDown:c=>this.onHandlerKeyDown(c,"ne"),role:"button"}),he.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":t.eDragHandle,onKeyDown:c=>this.onHandlerKeyDown(c,"e"),role:"button"}),he.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":t.seDragHandle,onKeyDown:c=>this.onHandlerKeyDown(c,"se"),role:"button"}),he.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":t.sDragHandle,onKeyDown:c=>this.onHandlerKeyDown(c,"s"),role:"button"}),he.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":t.swDragHandle,onKeyDown:c=>this.onHandlerKeyDown(c,"sw"),role:"button"}),he.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":t.wDragHandle,onKeyDown:c=>this.onHandlerKeyDown(c,"w"),role:"button"})),a&&he.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:c=>c.stopPropagation()},a(this.state)),i&&he.createElement(he.Fragment,null,he.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),he.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(t){const n={...Tw,...this.props.crop||{}};return el(n,t.width,t.height)}render(){const{aspect:t,children:n,circularCrop:r,className:a,crop:i,disabled:o,locked:l,style:c,ruleOfThirds:d}=this.props,{cropIsActive:m,newCropIsBeingDrawn:u}=this.state,h=i?this.renderCropSelection():null,p=eve("ReactCrop",a,m&&"ReactCrop--active",o&&"ReactCrop--disabled",l&&"ReactCrop--locked",u&&"ReactCrop--new-crop",i&&t&&"ReactCrop--fixed-aspect",i&&r&&"ReactCrop--circular-crop",i&&d&&"ReactCrop--rule-of-thirds",!this.dragStarted&&i&&!i.width&&!i.height&&"ReactCrop--invisible-crop",r&&"ReactCrop--no-animate");return he.createElement("div",{ref:this.componentRef,className:p,style:c},he.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),i?he.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},he.createElement("defs",null,he.createElement("mask",{id:`hole-${this.instanceId}`},he.createElement("rect",{width:"100%",height:"100%",fill:"white"}),r?he.createElement("ellipse",{cx:`${i.x+i.width/2}${i.unit}`,cy:`${i.y+i.height/2}${i.unit}`,rx:`${i.width/2}${i.unit}`,ry:`${i.height/2}${i.unit}`,fill:"black"}):he.createElement("rect",{x:`${i.x}${i.unit}`,y:`${i.y}${i.unit}`,width:`${i.width}${i.unit}`,height:`${i.height}${i.unit}`,fill:"black"}))),he.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,h)}};er(Mc,"xOrds",["e","w"]),er(Mc,"yOrds",["n","s"]),er(Mc,"xyOrds",["nw","ne","se","sw"]),er(Mc,"nudgeStep",1),er(Mc,"nudgeStepMedium",10),er(Mc,"nudgeStepLarge",100),er(Mc,"defaultProps",{ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}});let ave=Mc;function ive({imageFile:e,aspectRatio:t=2/3,onCropComplete:n,onCancel:r}){const a=t>0?t:.6666666666666666,[i,o]=f.useState(""),[l,c]=f.useState(),[d,m]=f.useState(null),[u,h]=f.useState(!0),p=f.useRef(null);f.useEffect(()=>{const g=new FileReader;g.onload=x=>{var w;const b=(w=x.target)==null?void 0:w.result;o(b),h(!1)}
665,g.readAsDataURL(e)},[e]);const v=f.useCallback(g=>{const x=g.currentTarget,{width:b,height:w}=x,j=tve({unit:"%",width:90},a,b,w),N=sve(j,b,w);c(N)},[a]),y=f.useCallback(async()=>{if(!p.current||!d)return;const g=p.current,x=document.createElement("canvas"),b=g.naturalWidth/g.width,w=g.naturalHeight/g.height,j=Math.round(d.width*b),N=Math.round(d.height*w);x.width=j,x.height=N;const C=x.getContext("2d");C&&(C.imageSmoothingQuality="high",C.imageSmoothingEnabled=!0,C.drawImage(g,Math.round(d.x*b),Math.round(d.y*w),j,N,0,0,j,N),x.toBlob(P=>{if(!P)return;const S=new File([P],e.name,{type:e.type,lastModified:Date.now()});n(S)},e.type,.95))},[d,e,n]);return s.jsx(Ct,{open:!0,onOpenChange:()=>r(),children:s.jsxs(St,{className:"max-w-3xl max-h-[90vh] overflow-hidden flex flex-col",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Crop Profile Picture"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Adjust to the passport photo format (2:3 portrait). Drag or resize the box."})]}),s.jsx("div",{className:"flex-1 min-h-0",children:u?s.jsx("div",{className:"flex items-center justify-center h-[60vh]",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"})}):s.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-lg p-3 h-[60vh] flex items-center justify-center",children:s.jsx("div",{className:"max-h-full max-w-full",children:s.jsx(ave,{crop:l,onChange:g=>c(g),onComplete:g=>{m(g)},aspect:a,keepSelection:!0,minHeight:100,minWidth:100,className:"max-h-[60vh]",children:s.jsx("img",{ref:p,alt:"Crop preview",src:i,onLoad:v,className:"max-h-[60vh] object-contain"})})})})}),s.jsxs(Er,{className:"flex-shrink-0",children:[s.jsx(B,{variant:"outline",onClick:r,children:"Cancel"}),s.jsx(B,{onClick:y,disabled:!d||u,children:"Crop & Upload"})]})]})})}function zV({onUpload:e,buttonClassName:t,children:n}){const[r,a]=f.useState(null),[i,o]=f.useState(!1),l=f.useRef(null),c=u=>{var p;const h=(p=u.target.files)==null?void 0:p[0];if(h){if(!["image/jpeg","image/jpg","image/png","image/webp"].includes(h.type)){alert("Invalid file type. Please upload a JPEG, PNG, or WebP image.");return}if(h.size>5*1024*1024){alert("File size exceeds 5MB limit.");return}a(h)}},d=async u=>{o(!0);try{await e(u),a(null),l.current&&(l.current.value="")}catch(h){console.error("Upload error:",h)}finally{o(!1)}},m=()=>{a(null),l.current&&(l.current.value="")};return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:l,type:"file",accept:"image/jpeg,image/jpg,image/png,image/webp",onChange:c,className:"hidden",disabled:i}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>{var u;return(u=l.current)==null?void 0:u.click()},className:t,disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Uploading..."]}):n}),r&&s.jsx(ive,{imageFile:r,aspectRatio:2/3,onCropComplete:d,onCancel:m},`${r.name}-${r.size}-${r.lastModified}`)]})}function h1(e){const t=e||"";return t.startsWith("sub_")||t.startsWith("gocardless_")}function ove(e){if(e==null||e==="")return null;const t=typeof e=="string"?parseFloat(e):Number(e);if(isNaN(t)||t<=0)return null;const n=Math.round(t*24);return n<=0?null:{days:Math.floor(n/24),hours:n%24}}function lve(e,t){return e<=0&&t<=0?null:e+t/24}function V$(e){const t=ove(e);return t?{days:t.days,hours:t.hours}:{days:"",hours:""}}function K$({id:e,checked:t,onCheckedChange:n,helperText:r,terminologySingular:a}){return s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:e,checked:t,onCheckedChange:i=>n(i===!0)}),s.jsxs(V,{htmlFor:e,className:"text-sm text-slate-600",children:["Offer a free trial ",a.toLowerCase()," to new customers"]})]}),t&&s.jsx("p",{className:"text-xs text-slate-500 ml-6 mt-1",children:r})]})}function qV({onClose:e,editingClass:t}){var zs,De,we,ot,_t,zt;const n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],r=()=>{var K;try{const $=localStorage.getItem("admin_session");if($)return(K=JSON.parse($).instructor)==null?void 0:K.id}catch($){console.error("Error reading session:",$)}return null},a=()=>{var K;try{const $=localStorage.getItem("admin_session");if($)return(K=JSON.parse($).instructor)==null?void 0:K.email}catch($){console.error("Error reading session:",$)}return null},i=r();a();const{data:o}=Ue({queryKey:[`/api/instructors/${i}`],enabled:!!i}),l=K=>{if(!K)return"";try{const $=JSON.parse(K);if(typeof $=="object"&&$!==null)return Object.values($)[0]||""}catch{}return K},c=()=>
665{if(!(t!=null&&t.startTime)||(t==null?void 0:t.frequency)!=="daily")return!1;try{const K=JSON.parse(t.startTime);return typeof K=="object"&&K!==null}catch{return!1}},d=K=>{if(!K)return!1;const $=K.disableQrCheckin??K.disable_qr_checkin;return typeof $=="boolean"?$:typeof $=="string"?["true","t","1"].includes($.toLowerCase()):typeof $=="number"?$===1:!1},m=K=>({name:(K==null?void 0:K.name)||"",description:(K==null?void 0:K.description)||"",classType:(K==null?void 0:K.classType)||"",location:(K==null?void 0:K.location)||"",dayOfWeek:(K==null?void 0:K.dayOfWeek)??1,frequency:(K==null?void 0:K.frequency)||"weekly",enabledDays:K!=null&&K.enabledDays?JSON.parse(K.enabledDays):[1,2,3,4,5],startTime:l((K==null?void 0:K.startTime)||""),duration:(K==null?void 0:K.duration)||60,maxCapacity:(K==null?void 0:K.maxCapacity)||10,instructorName:(K==null?void 0:K.instructorName)||"",singlePrice:(K==null?void 0:K.singlePrice)||"",allowSingleBooking:(K==null?void 0:K.allowSingleBooking)??!0,allowMultiDateSingleBooking:(K==null?void 0:K.allowMultiDateSingleBooking)??!1,onePerCustomer:(K==null?void 0:K.onePerCustomer)||!1,offerFreeTrial:(K==null?void 0:K.offerFreeTrial)||!1,offerFirstUsePrice:(K==null?void 0:K.offerFirstUsePrice)||!1,firstUsePrice:(K==null?void 0:K.firstUsePrice)||"",testMode:(K==null?void 0:K.testMode)||!1,onboardingFormId:(K==null?void 0:K.onboardingFormId)||null,requireOnboardingForm:(K==null?void 0:K.requireOnboardingForm)||!1,requireEmergencyContact:(K==null?void 0:K.requireEmergencyContact)??!0,requirePhoneForBooking:(K==null?void 0:K.requirePhoneForBooking)??!1,customInfo:(K==null?void 0:K.customInfo)||"",startDate:(K==null?void 0:K.startDate)||new Date().toISOString().split("T")[0],endDate:(K==null?void 0:K.endDate)||"",excludeDates:(K==null?void 0:K.excludeDates)||"",termsAndConditionsUrl:(K==null?void 0:K.termsAndConditionsUrl)||"",termsAndConditionsText:(K==null?void 0:K.termsAndConditionsText)||"",showOnInstructorPage:(K==null?void 0:K.showOnInstructorPage)??!0,allowCashPayments:(K==null?void 0:K.allowCashPayments)||!1,isActive:(K==null?void 0:K.isActive)??!0,createZoomMeetingOnBooking:(K==null?void 0:K.createZoomMeetingOnBooking)||!1,allowReschedule:(K==null?void 0:K.allowReschedule)||!1,rescheduleDayRange:(K==null?void 0:K.rescheduleDayRange)||7,rescheduleHoursBefore:(K==null?void 0:K.rescheduleHoursBefore)??null,allowRescheduleToDifferentClasses:(K==null?void 0:K.allowRescheduleToDifferentClasses)||!1,allowClientCancellation:(K==null?void 0:K.allowClientCancellation)||!1,cancellationDaysBefore:(K==null?void 0:K.cancellationDaysBefore)??null,autoRefundStripe:(K==null?void 0:K.autoRefundStripe)||!1,bookingConfirmationRedirectUrl:(K==null?void 0:K.bookingConfirmationRedirectUrl)||"",bookingCutoffHours:(K==null?void 0:K.bookingCutoffHours)??null,bookingOpenDays:(K==null?void 0:K.bookingOpenDays)??null,bookingOpenTime:(K==null?void 0:K.bookingOpenTime)??null,bookingLocked:(K==null?void 0:K.bookingLocked)??!1,bookingAccessCode:(K==null?void 0:K.bookingAccessCode)||"",disableQrCheckin:d(K),waitlistEnabled:(K==null?void 0:K.waitlistEnabled)??!1,waitlistNotificationDelayMinutes:(K==null?void 0:K.waitlistNotificationDelayMinutes)??0,photoUrl:(K==null?void 0:K.photoUrl)||""}),[u,h]=f.useState(()=>m(t)),[p,v]=f.useState("class-info"),[y,g]=f.useState(null),x=f.useRef(null),b=f.useRef(null),w=V$((t==null?void 0:t.cancellationDaysBefore)??null),[j,N]=f.useState(w.days),[C,P]=f.useState(w.hours),S=(K,$)=>{N(K),P($);const pe=K===""?0:K,ye=$===""?0:$;h(Be=>({...Be,cancellationDaysBefore:lve(pe,ye)}))};f.useEffect(()=>{const K=setTimeout(()=>{const $=x.current;if(!$)return;const pe=$.querySelector('[role="tablist"]');if(!pe)return;const ye=pe.querySelector('button[data-state="active"]');ye&&ye.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},150);return()=>clearTimeout(K)},[p]);const[E,T]=f.useState(c()),[z,O]=f.useState(()=>{if(t!=null&&t.startTime&&(t==null?void 0:t.frequency)==="daily")try{const K=JSON.parse(t.startTime);if(typeof K=="object"&&K!==null){const $={};
665return Object.entries(K).forEach(([pe,ye])=>{$[parseInt(pe)]=ye}),$}}catch{}return{}}),[D,k]=f.useState([]),[F,W]=f.useState(!1),[q,H]=f.useState(!!(t!=null&&t.bookingConfirmationRedirectUrl)),[_,L]=f.useState((t==null?void 0:t.bookingCutoffHours)!==null&&(t==null?void 0:t.bookingCutoffHours)!==void 0),[U,J]=f.useState((t==null?void 0:t.bookingOpenDays)!==null&&(t==null?void 0:t.bookingOpenDays)!==void 0||(t==null?void 0:t.bookingOpenTime)!==null&&(t==null?void 0:t.bookingOpenTime)!==void 0),[I,re]=f.useState(null),[R,Y]=f.useState(!1),[M,se]=f.useState(null),[Q,te]=f.useState(!1),[G,Z]=f.useState(null),[ie,A]=f.useState({name:"",numberOfWeeks:4,price:"",bookingWindowWeeks:"",fixedPackageStartDate:""}),[ge,je]=f.useState(!1),ke=f.useRef(!1),[Ie,$e]=f.useState([]),[qe,ft]=f.useState({hoursBeforeClass:24,sendEmail:!0,sendSms:!1}),[be,Fe]=f.useState([]),[_e,ze]=f.useState([]),[ue,Me]=f.useState(!1),{data:pt=[]}=Ue({queryKey:["/api/memberships"],enabled:!!i}),{data:de}=Ue({queryKey:[`/api/classes/${t==null?void 0:t.id}/memberships`],enabled:!!(t!=null&&t.id)}),{data:fe=[],refetch:le}=Ue({queryKey:[`/api/classes/${t==null?void 0:t.id}/schedules`],enabled:!!(t!=null&&t.id)&&!(t!=null&&t.parentClassId),queryFn:async()=>{const K=await Pe("GET",`/api/classes/${t.id}/schedules`);return K.ok?K.json():[]}}),[Ke,We]=f.useState(1),[vt,Zt]=f.useState("09:00"),[Ht,Tt]=f.useState(""),[Ot,Ft]=f.useState(null),{data:is}=Ue({queryKey:["instructor-names",i],queryFn:async()=>(await Pe("GET","/api/services/instructor-names")).json(),enabled:!!i}),Cs=Array.isArray(is==null?void 0:is.names)?is.names.filter(K=>typeof K=="string"&&K.trim()):[],Ne=async(K,$)=>{if(t!=null&&t.id){Ft(K.id);try{const pe=await Pe("PUT",`/api/classes/${t.id}/schedules/${K.id}`,{dayOfWeek:K.dayOfWeek,frequency:K.frequency||"weekly",enabledDays:K.enabledDays,startTime:K.startTime,startDate:K.startDate,endDate:K.endDate,excludeDates:K.excludeDates,exceptionalDates:K.exceptionalDates,instructorName:K.instructorName??null,...$});if(!pe.ok){const ye=await pe.json();throw new Error(ye.message||"Failed to update schedule")}await le(),Te.invalidateQueries({queryKey:["/api/admin/classes"]})}catch(pe){Vt({title:"Could not update schedule",description:pe.message,variant:"destructive"})}finally{Ft(null)}}},rt=async K=>{if(t!=null&&t.id&&confirm("Remove this schedule? Bookings on it must be removed first.")){Ft(K);try{const $=await Pe("DELETE",`/api/classes/${t.id}/schedules/${K}`);if(!$.ok){const pe=await $.json();throw new Error(pe.message||"Failed to remove schedule")}await le(),Te.invalidateQueries({queryKey:["/api/admin/classes"]})}catch($){Vt({title:"Could not remove schedule",description:$.message,variant:"destructive"})}finally{Ft(null)}}},ht=async()=>{if(t!=null&&t.id){Ft("new");try{const K=await Pe("POST",`/api/classes/${t.id}/schedules`,{dayOfWeek:Ke,frequency:"weekly",enabledDays:null,startTime:vt,startDate:u.startDate||null,endDate:u.endDate||null,excludeDates:u.excludeDates||null,exceptionalDates:null,instructorName:Ht.trim()||u.instructorName||null});if(!K.ok){const $=await K.json();throw new Error($.message||"Failed to add schedule")}await le(),Te.invalidateQueries({queryKey:["/api/admin/classes"]}),Vt({title:"Schedule added",description:"Clients can now book this extra time."})}catch(K){Vt({title:"Could not add schedule",description:K.message,variant:"destructive"})}finally{Ft(null)}}};f.useEffect(()=>{if(de!==void 0)if(Array.isArray(de)&&de.length>0){const K=de.map($=>({id:$.membershipId,memberPrice:$.memberPrice||""}));Fe(K)}else Fe([])},[de]),f.useEffect(()=>{if(u.excludeDates){const K=u.excludeDates.split(`
666`).filter($=>$.trim());ze(K)}},[]);const Mt=()=>{const K=[],$=u.startDate?new Date(u.startDate):new Date,pe=u.endDate?new Date(u.endDate):null,ye=new Date($),Be=new Date;Be.setHours(0,0,0,0),Be.setFullYear(Be.getFullYear()+1);const Ze=pe||Be;if(u.frequency==="daily"){const es=Array.isArray(u.enabledDays)?u.enabledDays:u.enabledDays?JSON.parse(u.enabledDays):[1,2,3,4,5];for(;ye<=Ze;){const Ns=ye.getDay();es.includes(Ns)&&K.push(new Date(ye)),ye.setDate(ye.getDate()+1)}}else{const es=u.dayOfWeek===0?7:u.dayOfWeek;for(;ye.getDay()!==(es===7?0:es);)ye.setDate(ye.getDate()+1);for(;ye<=Ze;)K.push(new Date(ye)),ye.setDate(ye.getDate()+7)}return K},Qt=()=>{var $;if(u.frequency==="daily"&&E&&Object.keys(z).length>0){const pe=Object.values(z).filter(ye=>ye!=null&&String(ye).trim()!=="");return pe.length===0?!1:pe.some(ye=>/^\d{1,2}:\d{2}/.test(String(ye).trim()))}const K=(($=u.startTime)==null?void 0:$.trim())??"";return K.length>0&&/^\d{1,2}:\d{2}/.test(K)},ts=(K,$,pe,ye,Be)=>{const Ze=new Date(K),es=new Date($);if(Ze.setHours(0,0,0,0),es.setHours(23,59,59,999),Ze.getTime()>es.getTime())return!1;const Ns=new Date(Ze);if(Ns.setHours(0,0,0,0),pe==="daily"){const ls=Array.isArray(Be)?Be:typeof Be=="string"?(()=>{try{return JSON.parse(Be)}catch{return[]}})():[];if(ls.length===0)return!1;for(;Ns.getTime()<=es.getTime();){if(ls.includes(Ns.getDay()))return!0;Ns.setDate(Ns.getDate()+1)}return!1}
666else{const ls=ye===7?0:ye;for(;Ns.getTime()<=es.getTime();){if(Ns.getDay()===ls)return!0;Ns.setDate(Ns.getDate()+1)}return!1}},Js=K=>{if(!_e.includes(K)){const $=[..._e,K].sort();ze($),h(pe=>({...pe,excludeDates:$.join(`
667`)}))}},xn=K=>{const $=_e.filter(pe=>pe!==K);ze($),h(pe=>({...pe,excludeDates:$.join(`
668`)}))},Xs=K=>{const $=K.getFullYear(),pe=String(K.getMonth()+1).padStart(2,"0"),ye=String(K.getDate()).padStart(2,"0");return`${$}-${pe}-${ye}`},nn=K=>{const[$,pe,ye]=K.split("-").map(Number);return new Date($,pe-1,ye)},{toast:Vt}=Yt(),Te=jn(),{data:at=[]}=Ue({queryKey:["/api/onboarding-forms"]}),{data:ss,isLoading:ps,error:bs}=Ue({queryKey:["/api/zoom/status"],retry:!1});f.useEffect(()=>{if(t!=null&&t.id){fetch(`/api/classes/${t.id}/packages`).then($=>$.json()).then($=>k($)).catch(console.error);const K=localStorage.getItem("auth_token");K&&fetch(`/api/classes/${t.id}/reminders`,{headers:{Authorization:`Bearer ${K}`,"Content-Type":"application/json"}}).then($=>$.ok?$.json():(console.error("Failed to fetch reminders:",$.status,$.statusText),[])).then($=>$e($)).catch($=>{console.error("Error fetching reminders:",$),$e([])})}},[t==null?void 0:t.id]),f.useEffect(()=>{t&&(h(m(t)),L(t.bookingCutoffHours!==null&&t.bookingCutoffHours!==void 0),H(!!t.bookingConfirmationRedirectUrl),h(K=>({...K,waitlistEnabled:t.waitlistEnabled??!1,waitlistNotificationDelayMinutes:t.waitlistNotificationDelayMinutes??0})))},[t==null?void 0:t.id]),f.useEffect(()=>{if(!(t!=null&&t.id))return;let K=!1;return(async()=>{try{const ye=await(await Pe("GET",`/api/classes/${t.id}`)).json();if(K||!ye)return;const Be=d(ye);h(Ze=>{const es=m(ye);return es.disableQrCheckin=Be,es})}catch(pe){console.error("Failed to fetch latest class data",pe)}})(),()=>{K=!0}},[t==null?void 0:t.id]);const Ss=xt({mutationFn:async K=>{const $=t&&t.id&&t.id!==void 0,pe=$?`/api/classes/${t.id}`:"/api/classes";return Pe($?"PUT":"POST",pe,K)},onSuccess:async K=>{const $=await K.json(),pe=t&&t.id&&t.id!==void 0,ye=pe?t.id:$.id;for(const Ze of D)typeof Ze.id=="number"&&Ze.id>1e12?await Pe("POST","/api/packages",{name:Ze.name,numberOfWeeks:Ze.numberOfWeeks,price:Ze.price,bookingWindowWeeks:Ze.bookingWindowWeeks,fixedPackageStartDate:Ze.fixedPackageStartDate??null,classId:ye,instructorId:2}):Ze.id&&await Pe("PUT",`/api/packages/${Ze.id}`,{name:Ze.name,numberOfWeeks:Ze.numberOfWeeks,price:Ze.price,bookingWindowWeeks:Ze.bookingWindowWeeks,fixedPackageStartDate:Ze.fixedPackageStartDate??null,classId:ye,instructorId:2});let Be=!0;try{const Ze=await Pe("PUT",`/api/classes/${ye}/memberships`,{memberships:be});if(!Ze.ok){const es=await Ze.json();throw new Error(es.message||"Failed to update memberships")}}catch(Ze){Be=!1,console.error("Error updating memberships:",Ze)}Te.invalidateQueries({queryKey:["/api/admin/classes"]}),Te.invalidateQueries({queryKey:["/api/classes"]}),Te.invalidateQueries({queryKey:[`/api/classes/${ye}`]}),Te.invalidateQueries({queryKey:[`/api/classes/${ye}/memberships`]}),Te.invalidateQueries({queryKey:[`/api/classes/${ye}/memberships/public`]}),Te.invalidateQueries({queryKey:[`/api/classes/${ye}/packages`]}),Te.invalidateQueries({queryKey:Ze=>{if(Array.isArray(Ze)&&Ze.length>0){const es=String(Ze[0]);return es.includes(`/api/classes/${ye}/packages`)||es.includes("/api/classes")&&es.includes("packages")}return typeof Ze=="string"?Ze.includes(`/api/classes/${ye}/packages`)||Ze.includes("/api/classes")&&Ze.includes("packages"):!1}}),Te.invalidateQueries({queryKey:Ze=>typeof Ze=="string"&&Ze.includes("/api/public/classes")}),Vt(Be?{title:"Success",description:`Class ${pe?"updated":"created"} successfully!`}:{title:"Class updated, but membership update failed",description:"The class was saved but membership access may not have updated. Please try editing again.",variant:"destructive"}),e()},onError:K=>{Vt({title:"Error",description:K.message,variant:"destructive"})}}),xs=K=>{var ye,Be;if(K.preventDefault(),!u.name.trim()){Vt({title:"Validation Error",description:"Class name is required",variant:"destructive"});return}if(!u.classType.trim()){Vt({title:"Validation Error",description:"Class type is required",variant:"destructive"});return}if(u.allowSingleBooking||(!u.singlePrice||u.singlePrice==="")&&(u.singlePrice="0"),u.allowSingleBooking&&(!u.singlePrice||u.singlePrice==="")&&(u.singlePrice="0"),u.offerFirstUsePrice){const Ze=parseFloat(String(u.firstUsePrice??""));if(u.firstUsePrice===""||Number.isNaN(Ze)||Ze<0){Vt({title:"Validation Error",description:"Enter a first-session special price of 0 or more, or turn the option off.",variant:"destructive"});return}const es=parseFloat(String(u.singlePrice||"0"));if(!Number.isNaN(es)&&es>0&&Ze>=es){Vt({title:"Validation Error",description:"First-session special price should be lower than the single class price.",variant:"destructive"});return}}if(u.bookingLocked&&!String(u.bookingAccessCode||"").trim()){Vt({title:"Validation Error",description:"Enter an access code when booking is locked, or turn off the lock.",variant:"destructive"});return}if(!Qt()){v("schedule"),Vt({title:"Validation Error",description:"Please set a start time in the Schedule tab.",variant:"destructive"}),setTimeout(()=>{var Ze;return(Ze=b.current)==null?void 0:Ze.focus()},150);return}let $=u.startTime;u.frequency==="daily"&&E&&Object.keys(z).length>0&&($=JSON.stringify(z));const pe={instructorId:i||2,name:u.name,description:u.description,classType:u.classType,location:u.location,dayOfWeek:u.dayOfWeek,frequency:u.frequency,enabledDays:JSON.stringify(u.enabledDays),startTime:$,duration:u.duration,maxCapacity:u.maxCapacity,instructorName:u.instructorName,singlePrice:u.singlePrice,allowSingleBooking:u.allowSingleBooking,allowMultiDateSingleBooking:u.allowMultiDateSingleBooking,onePerCustomer:u.onePerCustomer,offerFreeTrial:u.offerFreeTrial,offerFirstUsePrice:u.offerFirstUsePrice,firstUsePrice:u.offerFirstUsePrice&&u.firstUsePrice||null,testMode:u.testMode,onboardingFormId:u.onboardingFormId,requireOnboardingForm:u.requireOnboardingForm,requireEmergencyContact:u.requireEmergencyContact,requirePhoneForBooking:u.requirePhoneForBooking,termsAndConditionsUrl:u.termsAndConditionsUrl,termsAndConditionsText:u.termsAndConditionsText,customInfo:u.customInfo,startDate:u.startDate||"",endDate:u.endDate||"",excludeDates:u.excludeDates||"",showOnInstructorPage:u.showOnInstructorPage,allowCashPayments:u.allowCashPayments,isActive:u.isActive,createZoomMeetingOnBooking:u.createZoomMeetingOnBooking,allowReschedule:u.allowReschedule,rescheduleDayRange:u.rescheduleDayRange,rescheduleHoursBefore:u.rescheduleHoursBefore!==null&&u.rescheduleHoursBefore!==void 0?u.rescheduleHoursBefore:null,allowRescheduleToDifferentClasses:u.allowRescheduleToDifferentClasses,allowClientCancellation:u.allowClientCancellation,cancellationDaysBefore:u.cancellationDaysBefore!==null&&u.cancellationDaysBefore!==void 0?u.cancellationDaysBefore:null,autoRefundStripe:u.autoRefundStripe,bookingConfirmationRedirectUrl:u.bookingConfirmationRedirectUrl||null,bookingCutoffHours:u.bookingCutoffHours!==null&&u.bookingCutoffHours!==void 0?Number(u.bookingCutoffHours):null,bookingOpenDays:u.bookingOpenDays!==null&&u.bookingOpenDays!==void 0?Number(u.bookingOpenDays):null,bookingOpenTime:u.bookingOpenTime||null,bookingLocked:u.bookingLocked===!0,bookingAccessCode:String(u.bookingAccessCode||"").trim()||null,disableQrCheckin:u.disableQrCheckin,waitlistEnabled:u.waitlistEnabled,waitlistNotificationDelayMinutes:u.waitlistNotificationDelayMinutes,photoUrl:u.photoUrl||null};if(console.log("Form submission - formData.startDate:",u.startDate),console.log("Form submission - full classData:",pe),(ye=u.startDate)!=null&&ye.trim()&&((Be=u.endDate)!=null&&Be.trim())&&!ts(u.startDate,u.endDate,u.frequency,u.dayOfWeek,u.enabledDays)){g(pe);return}Ss.mutate(pe)},hs=()=>{var pe;if(!ie.name||!ie.price){Vt({title:"Error",description:"Package name and price are required",variant:"destructive"});return}if(ie.bookingWindowWeeks&&parseInt(ie.bookingWindowWeeks)<ie.numberOfWeeks){const ye=u.frequency==="daily"?"days":"weeks";Vt({title:"Invalid Booking Window",description:`Booking window cannot be smaller than the package length. Please set it to at least ${ie.numberOfWeeks} ${ye}.`,variant:"destructive"});return}if(ie.numberOfWeeks===1&&!ke.current){je(!0);return}ke.current=!1;const K=(pe=ie.fixedPackageStartDate)==null?void 0:pe.trim(),$={id:Date.now(),classId:(t==null?void 0:t.id)||0,instructorId:2,name:ie.name,numberOfWeeks:ie.numberOfWeeks,price:ie.price,bookingWindowWeeks:ie.bookingWindowWeeks?parseInt(ie.bookingWindowWeeks):null,fixedPackageStartDate:K||null,isActive:!0,createdAt:new Date};k(I?ye=>ye.map(Be=>Be.id===I.id?{...$,id:I.id}:Be):ye=>[...ye,$]),A({name:"",numberOfWeeks:4,price:"",bookingWindowWeeks:"",fixedPackageStartDate:""}),W(!1),re(null)},gs=K=>{var $;re(K),A({name:K.name,numberOfWeeks:K.numberOfWeeks,price:K.price.toString(),bookingWindowWeeks:(($=K.bookingWindowWeeks)==null?void 0:$.toString())||"",fixedPackageStartDate:K.fixedPackageStartDate??""}),W(!0)},Os=async K=>{const $=K>1e12,pe=D;if(k(ye=>
668ye.filter(Be=>Be.id!==K)),!$)try{await Pe("DELETE",`/api/packages/${K}`),t!=null&&t.id&&Te.invalidateQueries({queryKey:[`/api/classes/${t.id}/packages`]})}catch(ye){k(pe),Vt({variant:"destructive",title:"Couldn't delete package",description:(ye==null?void 0:ye.message)||"This package couldn't be deleted. It may have existing bookings."})}},cs=async()=>{if(t!=null&&t.id)try{const K=await Pe("POST",`/api/classes/${t.id}/reminders`,qe);if(!K.ok)throw new Error(`HTTP error! status: ${K.status}`);const $=await K.json();$e([...Ie,$]),Vt({title:"Reminder Added",description:"Class reminder has been successfully added."})}catch(K){console.error("Error adding reminder:",K),Vt({title:"Error",description:"Failed to add reminder. Please try again.",variant:"destructive"})}else{const K={id:Date.now(),classId:0,hoursBeforeClass:qe.hoursBeforeClass,sendEmail:qe.sendEmail,sendSms:qe.sendSms,createdAt:new Date};$e([...Ie,K])}ft({hoursBeforeClass:24,sendEmail:!0,sendSms:!1})},Tr=async(K,$,pe)=>{if(console.log("Updating reminder setting",{id:K,field:$,value:pe,editingClassId:t==null?void 0:t.id}),!(t!=null&&t.id)||K>1e12)$e(Ie.map(ye=>ye.id===K?{...ye,[$]:pe}:ye));else try{const ye=localStorage.getItem("auth_token"),Be=Ie.find(Ns=>Ns.id===K);if(!Be)return;const Ze=await fetch(`/api/reminders/${K}`,{method:"PUT",headers:{Authorization:`Bearer ${ye}`,"Content-Type":"application/json"},body:JSON.stringify({hoursBeforeClass:Be.hoursBeforeClass,sendEmail:$==="sendEmail"?pe:Be.sendEmail,sendSms:$==="sendSms"?pe:Be.sendSms})});if(!Ze.ok)throw new Error(`HTTP error! status: ${Ze.status}`);const es=await Ze.json();$e(Ie.map(Ns=>Ns.id===K?es:Ns)),Vt({title:"Reminder Updated",description:`${$==="sendEmail"?"Email":"SMS"} setting has been ${pe?"enabled":"disabled"}.`})}catch(ye){console.error("Error updating reminder:",ye),Vt({title:"Error",description:"Failed to update reminder. Please try again.",variant:"destructive"})}},rr=async K=>{if(!(t!=null&&t.id)||K>1e12)$e(Ie.filter($=>$.id!==K));else try{const $=localStorage.getItem("auth_token"),pe=await fetch(`/api/reminders/${K}`,{method:"DELETE",headers:{Authorization:`Bearer ${$}`,"Content-Type":"application/json"}});if(!pe.ok)throw new Error(`HTTP error! status: ${pe.status}`);$e(Ie.filter(ye=>ye.id!==K)),Vt({title:"Reminder Deleted",description:"Class reminder has been successfully deleted."})}catch($){console.error("Error deleting reminder:",$),Vt({title:"Error",description:"Failed to delete reminder. Please try again.",variant:"destructive"})}},xe=K=>{if(K<24)return`${K} hour${K===1?"":"s"} before`;{const $=Math.floor(K/24),pe=K%24;return pe===0?`${$} day${$===1?"":"s"} before`:`${$} day${$===1?"":"s"} ${pe} hour${pe===1?"":"s"} before`}},He=async()=>{if(!u.description.trim()){Vt({title:"Nothing to polish",description:"Please enter a description first",variant:"destructive"});return}se(u.description),Y(!0);try{const $=await(await Pe("POST","/api/polish-text",{text:u.description,type:"class_description"})).json();h(pe=>({...pe,description:$.polishedText})),Vt({title:"Text polished successfully",description:"Your class description has been improved with AI"})}catch{Vt({title:"Polish failed",description:"Unable to polish text at this time",variant:"destructive"})}finally{Y(!1)}},tt=()=>{M&&(h(K=>({...K,description:M})),se(null),Vt({title:"Description restored",description:"Original text has been restored"}))},Jt=async()=>{if(!u.termsAndConditionsText.trim()){Vt({title:"Nothing to polish",description:"Please enter some terms and conditions first",variant:"destructive"});return}Z(u.termsAndConditionsText),te(!0);try{const $=await(await Pe("POST","/api/polish-text",{text:u.termsAndConditionsText,type:"terms_conditions"})).json();h(pe=>({...pe,termsAndConditionsText:$.polishedText})),Vt({title:"Terms & conditions polished successfully",description:"Your terms have been enhanced with AI for better clarity and professionalism"})}catch{Vt({title:"Polish failed",description:"Unable to polish terms at this time",variant:"destructive"})}finally{te(!1)}},ds=()=>{G&&(h(K=>({...K,termsAndConditionsText:G})),Z(null),Vt({title:"Terms & conditions restored",description:"Original text has been restored"}))};return f.useEffect(()=>{if(t){h({name:t.name||"",description:t.description||"",classType:t.classType||"",location:t.location||"",dayOfWeek:t.dayOfWeek??
6681,frequency:t.frequency||"weekly",enabledDays:t.enabledDays?JSON.parse(t.enabledDays):[1,2,3,4,5],startTime:l(t.startTime||""),duration:t.duration||60,maxCapacity:t.maxCapacity||10,instructorName:t.instructorName||"",singlePrice:t.singlePrice||"",allowSingleBooking:t.allowSingleBooking??!0,allowMultiDateSingleBooking:t.allowMultiDateSingleBooking??!1,onePerCustomer:t.onePerCustomer||!1,offerFreeTrial:t.offerFreeTrial||!1,offerFirstUsePrice:t.offerFirstUsePrice||!1,firstUsePrice:t.firstUsePrice||"",testMode:t.testMode||!1,onboardingFormId:t.onboardingFormId||null,requireOnboardingForm:t.requireOnboardingForm||!1,requireEmergencyContact:t.requireEmergencyContact??!0,requirePhoneForBooking:t.requirePhoneForBooking??!1,customInfo:t.customInfo||"",startDate:t.startDate||new Date().toISOString().split("T")[0],endDate:t.endDate||"",excludeDates:t.excludeDates||"",termsAndConditionsUrl:t.termsAndConditionsUrl||"",termsAndConditionsText:t.termsAndConditionsText||"",showOnInstructorPage:t.showOnInstructorPage??!0,allowCashPayments:t.allowCashPayments||!1,isActive:t.isActive??!0,createZoomMeetingOnBooking:t.createZoomMeetingOnBooking||!1,allowReschedule:t.allowReschedule||!1,rescheduleDayRange:t.rescheduleDayRange||7,rescheduleHoursBefore:t.rescheduleHoursBefore??null,allowRescheduleToDifferentClasses:t.allowRescheduleToDifferentClasses||!1,allowClientCancellation:t.allowClientCancellation||!1,cancellationDaysBefore:t.cancellationDaysBefore??null,autoRefundStripe:t.autoRefundStripe||!1,bookingConfirmationRedirectUrl:t.bookingConfirmationRedirectUrl||"",bookingCutoffHours:t.bookingCutoffHours??null,bookingOpenDays:t.bookingOpenDays??null,bookingOpenTime:t.bookingOpenTime??null,bookingLocked:t.bookingLocked??!1,bookingAccessCode:t.bookingAccessCode||"",disableQrCheckin:d(t),waitlistEnabled:t.waitlistEnabled??!1,waitlistNotificationDelayMinutes:t.waitlistNotificationDelayMinutes??0,photoUrl:t.photoUrl||""});const K=V$(t.cancellationDaysBefore??null);N(K.days),P(K.hours),H(!!t.bookingConfirmationRedirectUrl),L(t.bookingCutoffHours!==null&&t.bookingCutoffHours!==void 0)}},[t]),s.jsxs(s.Fragment,{children:[s.jsx(Ct,{open:!0,onOpenChange:e,children:s.jsxs(St,{className:"max-w-5xl flex flex-col p-0 left-2 right-2 sm:left-[50%] sm:right-auto",style:{height:"85vh",maxHeight:"85vh"},children:[s.jsx(kt,{className:"px-4 sm:px-8 pt-6 pb-2 sm:pb-4",children:s.jsx(Pt,{className:"text-base sm:text-lg",children:t?"Edit "+(o==null?void 0:o.terminologySingular)||"Class":"Create New "+(o==null?void 0:o.terminologySingular)||"Class"})}),s.jsxs("form",{onSubmit:xs,className:"flex flex-col flex-1 overflow-hidden",children:[s.jsxs(sc,{value:p,onValueChange:v,className:"flex flex-col flex-1 overflow-hidden px-4 sm:px-8",children:[s.jsx("div",{ref:x,className:"mb-4",children:s.jsxs(Hi,{className:"flex max-w-full overflow-x-auto sm:overflow-visible sm:grid sm:grid-cols-5 gap-2 scrollbar-thin [-ms-overflow-style:none] [scrollbar-width:none] sm:[-ms-overflow-style:auto] sm:[scrollbar-width:auto] [&::-webkit-scrollbar]:hidden sm:[&::-webkit-scrollbar]:block justify-start sm:justify-center",children:[s.jsx(Ts,{value:"class-info",className:"flex-shrink-0 sm:flex-shrink whitespace-nowrap",children:"Details"}),s.jsx(Ts,{value:"schedule",className:"flex-shrink-0 sm:flex-shrink whitespace-nowrap",children:"Schedule"}),s.jsx(Ts,{value:"pricing",className:"flex-shrink-0 sm:flex-shrink whitespace-nowrap",children:"Pricing"}),s.jsxs(Ts,{value:"reminders",className:"flex-shrink-0 sm:flex-shrink whitespace-nowrap",children:["Reminders",Ie.length>0&&s.jsxs("span",{className:"ml-1.5 text-xs font-normal text-slate-500",children:["(",Ie.length,")"]})]}),s.jsx(Ts,{value:"options",className:"flex-shrink-0 sm:flex-shrink whitespace-nowrap",children:"Options"})]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto space-y-6 pb-4 sm:pb-12 px-2 sm:px-1",style:{minHeight:"400px"},children:[s.jsxs(on,{value:"class-info",className:"space-y-6 mt-0",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsxs(V,{htmlFor:"name",children:[(o==null?void 0:o.terminologySingular)||"Class"," Name"]}),s.jsx(me,{id:"name",value:u.name,onChange:K=>h($=>({...$,name:K.target.value})),placeholder:"Yoga Basics",required:!0})]}),s.jsxs("div",{children:[s.jsxs(V,{htmlFor:"classType",children:[(o==null?void 0:o.terminologySingular)||"Class"," Type"]}
668),s.jsx(me,{id:"classType",value:u.classType,onChange:K=>h($=>({...$,classType:K.target.value})),placeholder:"Yoga",required:!0})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"location",children:"Location"}),s.jsx(me,{id:"location",value:u.location,onChange:K=>h($=>({...$,location:K.target.value})),placeholder:"e.g., Studio A, Main Gym, Village Hall, 123 High Street"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"description",children:"Description"}),s.jsx(Is,{id:"description",maxLength:500,value:u.description,onChange:K=>h($=>({...$,description:K.target.value})),placeholder:"A beginner-friendly yoga class..."}),s.jsxs("div",{className:"text-xs text-slate-500 mt-1",children:[u.description.length,"/500 characters"]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 mt-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(B,{type:"button",variant:"outline",size:"sm",onClick:He,disabled:R||!u.description.trim(),className:"text-xs",children:[s.jsx(lr,{className:"w-3 h-3 mr-1"}),R?"Polishing...":"Polish this with AI"]}),M&&s.jsxs(B,{type:"button",variant:"ghost",size:"sm",onClick:tt,className:"text-xs text-muted-foreground",children:[s.jsx(dm,{className:"w-3 h-3 mr-1"}),"Undo"]})]}),s.jsx("div",{className:"flex items-center gap-2",children:u.photoUrl?s.jsxs(s.Fragment,{children:[s.jsx("img",{src:u.photoUrl,alt:"Class photo",className:"h-10 w-10 object-cover rounded border"}),s.jsx(B,{type:"button",variant:"ghost",size:"sm",onClick:()=>h(K=>({...K,photoUrl:""})),className:"text-xs text-muted-foreground h-8 w-8 p-0",title:"Remove photo",children:s.jsx(ja,{className:"h-4 w-4"})})]}):s.jsx(nO,{maxNumberOfFiles:1,maxFileSize:5*1024*1024,onGetUploadParameters:async K=>{const $=localStorage.getItem("auth_token"),pe=await fetch("/api/objects/upload",{method:"POST",headers:{Authorization:`Bearer ${$}`,"Content-Type":"application/json"}});if(!pe.ok){const Be=await pe.text();throw new Error(`Upload API failed: ${pe.status} ${Be}`)}const ye=await pe.json();if(!ye.uploadURL)throw new Error(`No uploadURL in response: ${JSON.stringify(ye)}`);return{method:"PUT",url:ye.uploadURL}},onComplete:async K=>{if(K.successful&&K.successful.length>0){const pe=K.successful[0].uploadURL;pe&&(h(ye=>({...ye,photoUrl:pe})),Vt({title:"Photo uploaded",description:"Class photo has been uploaded successfully."}))}},buttonVariant:"link",buttonClassName:"text-xs text-blue-600 hover:text-blue-800 h-auto p-0 font-normal",children:"Add photo (optional)"})})]})]}),s.jsxs("div",{className:"space-y-4 p-4 border border-slate-200 rounded-lg",children:[s.jsxs("h3",{className:"font-medium",children:[(o==null?void 0:o.terminologySingular)||"Class"," Visibility"]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"isActive",checked:u.isActive,onCheckedChange:K=>h($=>({...$,isActive:K}))}),s.jsxs(V,{htmlFor:"isActive",className:"text-sm",children:["Show on public page"," ",s.jsx("span",{className:"text-slate-500",children:"(shows on classta.co/classes)"})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"showOnInstructorPage",checked:u.showOnInstructorPage,onCheckedChange:K=>h($=>({...$,showOnInstructorPage:K}))}),s.jsxs(V,{htmlFor:"showOnInstructorPage",className:"text-sm",children:["Show on my client page"," ",s.jsxs("span",{className:"text-slate-500",children:["(classta.co/cal/",(o==null?void 0:o.subdomain)||"yoursubdomain",")"]})]})]})]}),s.jsxs("div",{className:"space-y-4 p-4 border border-slate-200 rounded-lg",children:[s.jsx("h3",{className:"font-medium",children:"Onboarding Form"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"requireOnboardingForm",checked:u.requireOnboardingForm,onCheckedChange:K=>h($=>({...$,requireOnboardingForm:K}))}),s.jsx(V,{htmlFor:"requireOnboardingForm",className:"text-sm",children:"Require onboarding form"})]}),u.requireOnboardingForm&&s.jsxs("div",{children:[s.jsx(V,{htmlFor:"onboardingFormId",children:"Onboarding Form"}),s.jsxs(Bt,{value:((zs=u.onboardingFormId)==null?void 0:zs.toString())||"",onValueChange:K=>h($=>({...$,onboardingFormId:K?parseInt(K):null})),children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"Select a form"})}),s.jsx(It,{children:at.map(K=>s.jsx(ce,{value:K.id.toString(),children:K.name},K.id))})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"requireEmergencyContact",checked:u.requireEmergencyContact,onCheckedChange:K=>h($=>({...$,requireEmergencyContact:K}))}),s.jsx(V,{htmlFor:"requireEmergencyContact",className:"text-sm",children:"Require emergency contact"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"requirePhoneForBooking",checked:u.requirePhoneForBooking,onCheckedChange:K=>h($=>({...$,requirePhoneForBooking:K}))}),s.jsx(V,{htmlFor:"requirePhoneForBooking",className:"text-sm",children:"Phone number required at booking"})]}),s.jsx("p",{className:"text-xs text-slate-500 italic",children:"Form will be included in booking flow and presented to new customers"})]})]}),s.jsxs("div",{className:"space-y-4 p-4 border border-slate-200 rounded-lg",children:[s.jsx("h3",{className:"font-medium",children:"Terms & Conditions/Instructions"}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"termsAndConditionsUrl",children:"Terms & Conditions URL (optional)"}),s.jsx(me,{id:"termsAndConditionsUrl",value:u.termsAndConditionsUrl,onChange:K=>h($=>({...$,termsAndConditionsUrl:K.target.value})),placeholder:"https://your-website.com/terms"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Link to your terms and conditions page"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"termsAndConditionsText",children:"Custom Terms & Conditions (optional)"}),s.jsx(Is,{id:"termsAndConditionsText",value:u.termsAndConditionsText,onChange:K=>h($=>({...$,termsAndConditionsText:K.target.value})),placeholder:"Enter your custom terms and conditions text...",className:"h-24"}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsxs(B,{type:"button",variant:"outline",size:"sm",onClick:Jt,disabled:Q||!u.termsAndConditionsText.trim(),className:"text-xs",children:[s.jsx(lr,{className:"w-3 h-3 mr-1"}),Q?"Polishing...":"Polish this with AI"]}),G&&s.jsxs(B,{type:"button",variant:"ghost",size:"sm",onClick:ds,className:"text-xs text-muted-foreground",children:[s.jsx(dm,{className:"w-3 h-3 mr-1"}),"Undo"]})]}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Alternative to URL - displays as popup when clicked"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"customInfo",children:"Custom Instructions"}),s.jsx(Is,{id:"customInfo",value:u.customInfo,onChange:K=>h($=>({...$,customInfo:K.target.value})),placeholder:"Optional instructions for booking confirmations (e.g., directions, parking info, Zoom links, what to bring, etc.)",className:"h-24"}),s.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:["This information will be included in booking confirmation and reminder emails. You can use tokens like ",s.jsx("code",{children:"{{booking_id}}"}),","," ",s.jsx("code",{children:"{{booking_date}}"}),","," ",s.jsx("code",{children:"{{amount}}"}),","," ",s.jsx("code",{children:"{{class_name}}"}),","," ",s.jsx("code",{children:"{{client_name}}"}),","," ",s.jsx("code",{children:"{{client_firstname}}"}),","," ",s.jsx("code",{children:"{{client_email}}"})," in your message."]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"createZoomMeetingOnBooking",checked:u.createZoomMeetingOnBooking,onCheckedChange:K=>h($=>({...$,createZoomMeetingOnBooking:K})),disabled:!(ss!=null&&ss.connected)}),s.jsxs(V,{htmlFor:"createZoomMeetingOnBooking",className:"text-sm",children:["Create Zoom meeting link when this"," ",((De=o==null?void 0:o.terminologySingular)==null?void 0:De.toLowerCase())||"class"," ","is booked"]})]}),!(ss!=null&&ss.connected)&&s.jsx("p",{className:"text-sm text-muted-foreground ml-6",children:"Connect your Zoom account in settings to enable this option"})]})]}),s.jsxs(on,{value:"schedule",className:"space-y-6 mt-0",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"dayOfWeek",children:"Day of Week"}),s.jsxs(Bt,{value:u.dayOfWeek.toString(),onValueChange:K=>h($=>({...$,dayOfWeek:parseInt(K)})),children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsx(It,{children:n.map((K,$)=>s.jsx(ce,{value:$.toString(),children:K},$))})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"frequency",children:"Frequency *"}),s.jsxs(Bt,{value:u.frequency,onValueChange:K=>h($=>({...$,frequency:K})),children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"weekly",children:"Repeat Weekly"}),s.jsx(ce,{value:"daily",children:"Repeat Daily"})]})]})]})]}),u.frequency==="daily"&&s.jsxs("div",{className:"mb-4",children:[s.jsx(V,{children:"Enabled Days *"}),s.jsxs("div",{className:"grid grid-cols-4 sm:grid-cols-7 gap-2 mt-2",children:[" ",n.map((K,$)=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:`day-${$}`,checked:u.enabledDays.includes($),onCheckedChange:pe=>{if(h(ye=>({...ye,enabledDays:pe?[...ye.enabledDays,$]:ye.enabledDays.filter(
668Be=>Be!==$)})),!pe&&z[$]){const ye={...z};delete ye[$],O(ye)}}}),s.jsx(V,{htmlFor:`day-${$}`,className:"text-sm",children:K.slice(0,3)})]},$))]})]}),u.frequency==="daily"&&s.jsxs("div",{className:"mb-4",children:[s.jsxs("div",{className:"flex items-center space-x-2 mb-3",children:[s.jsx(Xt,{id:"useDifferentTimes",checked:E,onCheckedChange:K=>{if(T(K),!K)O({});else{const $={};u.enabledDays.forEach(pe=>{$[pe]=u.startTime||"09:00"}),O($)}}}),s.jsx(V,{htmlFor:"useDifferentTimes",className:"text-sm font-medium",children:"Set different times for different days"})]}),E&&s.jsxs("div",{className:"space-y-3 p-4 border border-slate-200 rounded-lg bg-slate-50",children:[s.jsx(V,{className:"text-sm font-medium",children:"Set time for each day:"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:u.enabledDays.map(K=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsxs(V,{className:"text-sm w-20",children:[n[K],":"]}),s.jsx(me,{type:"time",value:z[K]||"",onChange:$=>{O(pe=>({...pe,[K]:$.target.value}))},className:"flex-1"})]},K))}),s.jsx("p",{className:"text-xs text-slate-600",children:"Each enabled day can have its own start time. This allows for flexible scheduling across the week."})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsxs(V,{htmlFor:"startTime",children:["Start Time",u.frequency==="daily"&&E&&s.jsx("span",{className:"text-xs text-slate-500 ml-1",children:"(default for new days)"})]}),s.jsx(me,{ref:b,id:"startTime",type:"time",value:u.startTime,onChange:K=>{if(h($=>({...$,startTime:K.target.value})),u.frequency==="daily"&&E){const $={};u.enabledDays.forEach(pe=>{$[pe]=K.target.value}),O($)}},required:!(u.frequency==="daily"&&E),disabled:u.frequency==="daily"&&E}),u.frequency==="daily"&&E&&s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Individual times are set above. This field is used as default for new days."})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"duration",children:"Duration (minutes)"}),s.jsx(me,{id:"duration",type:"number",value:u.duration,onChange:K=>h($=>({...$,duration:parseInt(K.target.value)})),min:"15",max:"720",required:!0})]})]}),!(t!=null&&t.id)&&s.jsx("p",{className:"text-sm text-slate-600",children:"Additional schedules can be added after the class has been saved."}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"maxCapacity",children:"Max Capacity"}),s.jsx(me,{id:"maxCapacity",type:"number",value:u.maxCapacity,onChange:K=>h($=>({...$,maxCapacity:parseInt(K.target.value)})),min:"1",max:"50",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"instructorName",children:"Instructor Name"}),s.jsx(me,{id:"instructorName",value:u.instructorName,onChange:K=>h($=>({...$,instructorName:K.target.value})),placeholder:"John Doe"})]})]}),s.jsxs("div",{className:"space-y-4 p-4 border border-slate-200 rounded-lg",children:[s.jsx("h3",{className:"font-medium",children:"Schedule Restrictions"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"startDate",children:"Start Date (optional)"}),s.jsx(me,{id:"startDate",type:"date",value:u.startDate,onChange:K=>h($=>({...$,startDate:K.target.value}))}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Classes won't appear on calendar before this date"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"endDate",children:"End Date (optional)"}),s.jsx(me,{id:"endDate",type:"date",value:u.endDate,onChange:K=>h($=>({...$,endDate:K.target.value}))})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"excludeDates",children:"Exclude Dates"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"flex gap-2",children:s.jsxs(Bt,{onValueChange:K=>Js(K),children:[s.jsx($t,{className:"flex-1",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ls,{className:"h-4 w-4"}),s.jsx(Lt,{placeholder:"Select dates to exclude..."})]})}),s.jsx(It,{children:Mt().map(K=>{const $=Xs(K),pe=_e.includes($);return s.jsxs(ce,{value:$,disabled:pe,children:[K.toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short",year:"numeric"})," ",pe?"(excluded)":""]},$)}
668)})]})}),_e.length>0&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs text-slate-600",children:"Excluded dates:"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:_e.map(K=>{const $=nn(K);return s.jsxs("div",{className:"flex items-center gap-1 bg-red-50 text-red-700 px-2 py-1 rounded text-xs",children:[s.jsx("span",{children:$.toLocaleDateString("en-GB",{day:"numeric",month:"short"})}),s.jsx("button",{type:"button",onClick:()=>xn(K),className:"ml-1 hover:bg-red-100 rounded",children:s.jsx(ja,{className:"h-3 w-3"})})]},K)})})]}),s.jsxs("p",{className:"text-xs text-slate-500",children:["Select dates when your"," ",((we=o==null?void 0:o.terminologySingular)==null?void 0:we.toLowerCase())||"class"," ","won't run (holidays, breaks, etc.).",u.frequency==="daily"?" Dates matching all selected days are shown.":" Only dates matching your selected day of the week are shown."]})]})]})]})]}),s.jsxs("div",{className:"space-y-3 p-4 border border-slate-200 rounded-lg",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"allowReschedule",checked:u.allowReschedule,onCheckedChange:K=>h($=>({...$,allowReschedule:K}))}),s.jsxs(V,{htmlFor:"allowReschedule",className:"text-sm",children:["Allow clients to reschedule bookings themselves"," ",s.jsx("span",{className:"text-slate-500",children:"(Instead of having to request a change)"})]})]}),u.allowReschedule&&s.jsxs("div",{className:"ml-6 space-y-2",children:[s.jsxs("div",{className:"grid grid-cols-[60px_80px_1fr] items-center gap-x-2",children:[s.jsx(V,{htmlFor:"rescheduleDayRange",className:"text-sm",children:"within"}),s.jsx(me,{id:"rescheduleDayRange",type:"number",value:u.rescheduleDayRange,onChange:K=>h($=>({...$,rescheduleDayRange:parseInt(K.target.value)||7})),min:"1",max:"365",className:"w-20"}),s.jsx(V,{htmlFor:"rescheduleDayRange",className:"text-sm",children:"days of booked date"})]}),s.jsxs("div",{className:"grid grid-cols-[60px_80px_1fr] items-center gap-x-2",children:[s.jsx(V,{htmlFor:"rescheduleHoursBefore",className:"text-sm",children:"until"}),s.jsx(me,{id:"rescheduleHoursBefore",type:"number",value:u.rescheduleHoursBefore??"",onChange:K=>h($=>({...$,rescheduleHoursBefore:K.target.value?parseInt(K.target.value):null})),min:"1",max:"168",className:"w-20",placeholder:"Optional"}),s.jsx(V,{htmlFor:"rescheduleHoursBefore",className:"text-sm",children:"hours before booked class"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"allowRescheduleToDifferentClasses",checked:u.allowRescheduleToDifferentClasses,onCheckedChange:K=>h($=>({...$,allowRescheduleToDifferentClasses:K}))}),s.jsx(V,{htmlFor:"allowRescheduleToDifferentClasses",className:"text-sm",children:"Allow rescheduling onto different classes of the same value"})]})]})]}),s.jsxs("div",{className:"space-y-3 p-4 border border-slate-200 rounded-lg",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"allowClientCancellation",checked:u.allowClientCancellation,onCheckedChange:K=>h($=>({...$,allowClientCancellation:K}))}),s.jsxs(V,{htmlFor:"allowClientCancellation",className:"text-sm",children:["Allow clients to cancel bookings themselves"," ",s.jsx("span",{className:"text-slate-500",children:"(Instead of having to request cancellation)"})]})]}),u.allowClientCancellation&&s.jsxs("div",{className:"ml-6 space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-2",children:[s.jsx(V,{className:"text-sm",children:"up to"}),s.jsx(me,{id:"cancellationPeriodDays",type:"number",value:j,onChange:K=>{const $=K.target.value;if($===""){S("",C);return}const pe=parseInt($,10);!isNaN(pe)&&pe>=0&&S(Math.min(365,pe),C)},min:"0",max:"365",className:"w-20",placeholder:"0"}),s.jsx(V,{htmlFor:"cancellationPeriodDays",className:"text-sm",children:"days"}),s.jsx(me,{id:"cancellationPeriodHours",type:"number",value:C,onChange:K=>{const $=K.target.value;if($===""){S(j,"");return}const pe=parseInt($,10);!isNaN(pe)&&pe>=0&&S(j,Math.min(23,pe))},min:"0",max:"23",className:"w-20",placeholder:"0"}),s.jsx(V,{htmlFor:"cancellationPeriodHours",className:"text-sm",children:"hours before class"})]}),s.jsx("p",{className:"text-xs text-slate-500 ml-0",children:"Leave both at 0 for no time restriction. If set, clients can only cancel when more than this time remains before the class."}),s.jsxs("div",{className:"flex items-center space-x-2 mt-3",children:[s.jsx(Xt,{id:"autoRefundStripe",checked:u.autoRefundStripe,onCheckedChange:K=>h($=>({...$,autoRefundStripe:K}))}),s.jsxs(V,{htmlFor:"autoRefundStripe",className:"text-sm",children:["Automatically refund Stripe payments"," ",s.jsx("span",{className:"text-slate-500",children:"(single class bookings only; packages are not refunded. PayPal refunds must be done manually by admin)"})]})]})]})]}),s.jsxs("div",{className:"space-y-3 p-4 border border-slate-200 rounded-lg",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"useBookingCutoff",checked:_,onCheckedChange:K=>{const $=!!K;L($),h(pe=>({...pe,bookingCutoffHours:$?pe.bookingCutoffHours:null}))}}),s.jsx(V,{htmlFor:"useBookingCutoff",className:"text-sm",children:"Add a booking cutoff time"})]}),_&&s.jsxs("div",{className:"ml-6",children:[s.jsx(V,{htmlFor:"bookingCutoffHours",className:"text-sm",children:"Booking cutoff time (hours)"}),s.jsx(me,{id:"bookingCutoffHours",type:"number",step:"0.5",value:u.bookingCutoffHours??"",onChange:K=>h($=>({...$,bookingCutoffHours:K.target.value?parseFloat(K.target.value):null})),placeholder:"e.g. 1 or -0.5",className:"mt-1"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Positive values (e.g., 1) prevent bookings within this many hours before class start. Negative values (e.g., -0.5) allow bookings up to this many hours after class start. Set to 0 to close bookings exactly at the start."})]}),s.jsxs("div",{className:"flex items-center space-x-2 mt-4",children:[s.jsx(Xt,{id:"useBookingOpen",checked:U,onCheckedChange:K=>{const $=!!K;J($),h(pe=>({...pe,bookingOpenDays:$?pe.bookingOpenDays:null,bookingOpenTime:$?pe.bookingOpenTime:null}))}}),s.jsx(V,{htmlFor:"useBookingOpen",className:"text-sm",children:"Schedule when bookings open"})]}),U&&s.jsxs("div",{className:"ml-6 space-y-3",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"bookingOpenDays",className:"text-sm",children:"Days before session"}),s.jsx(me,{id:"bookingOpenDays",type:"number",min:"1",value:u.bookingOpenDays??"",onChange:K=>h($=>({...$,bookingOpenDays:K.target.value?parseInt(K.target.value):null})),placeholder:"e.g. 3",className:"mt-1"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Number of days before the session when bookings will open (e.g., 3 = bookings open 3 days before)."})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"bookingOpenTime",className:"text-sm",children:"Time of day"}),s.jsx(me,{id:"bookingOpenTime",type:"time",value:u.bookingOpenTime??"",onChange:K=>h($=>({...$,bookingOpenTime:K.target.value||null})),className:"mt-1"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Time of day when bookings open (e.g., 09:00). Bookings will open at this time, N days before each session."})]})]}),s.jsxs("div",{className:"mt-6 space-y-3 rounded-md border border-slate-200 p-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"bookingLocked",checked:u.bookingLocked===!0,onCheckedChange:K=>h($=>({...$,bookingLocked:K}))}),s.jsxs(V,{htmlFor:"bookingLocked",className:"text-sm flex items-center gap-1.5",children:[s.jsx(jd,{className:"h-3.5 w-3.5"}),"Lock booking with an access code"]})]}),s.jsx("p",{className:"text-xs text-slate-500 ml-6",children:"Class stays visible on your booking page, but clients need the access code to book. Turn this off when you are ready to open to everyone — the code is kept so you can reuse it next block."}),(u.bookingLocked||u.bookingAccessCode)&&s.jsxs("div",{className:"ml-6 space-y-2",children:[s.jsx(V,{htmlFor:"bookingAccessCode",className:"text-sm",children:"Access code"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(me,{id:"bookingAccessCode",type:"text",autoComplete:"off",value:u.bookingAccessCode||"",onChange:K=>h($=>({...$,bookingAccessCode:K.target.value})),placeholder:"e.g. autumn2026",className:"flex-1"}
668),s.jsx(B,{type:"button",variant:"outline",size:"icon",title:"Copy access code",disabled:!String(u.bookingAccessCode||"").trim(),onClick:async()=>{const K=String(u.bookingAccessCode||"").trim();if(K)try{await navigator.clipboard.writeText(K),Vt({title:"Copied",description:"Access code copied to clipboard."})}catch{Vt({title:"Copy failed",description:"Could not copy the access code.",variant:"destructive"})}},children:s.jsx(pr,{className:"h-4 w-4"})})]})]})]})]}),(t==null?void 0:t.id)&&!t.parentClassId&&s.jsxs("div",{className:"space-y-3 p-4 border border-slate-200 rounded-lg bg-slate-50",children:[s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Additional schedules (beta)"}),s.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Add another day or time for this class. Each time can have its own instructor. Rescheduling between these times is new, so please tell us if anything looks wrong."})]}),fe.map(K=>s.jsxs("div",{className:"flex flex-wrap items-end gap-2 bg-white p-3 rounded-md border",children:[s.jsxs("div",{children:[s.jsx(V,{className:"text-xs",children:"Day"}),s.jsxs(Bt,{value:String(K.dayOfWeek),onValueChange:$=>Ne(K,{dayOfWeek:parseInt($,10)}),children:[s.jsx($t,{className:"w-36",children:s.jsx(Lt,{})}),s.jsx(It,{children:n.map(($,pe)=>s.jsx(ce,{value:String(pe),children:$},$))})]})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-xs",children:"Start time"}),s.jsx(me,{type:"time",value:K.startTime||"",onChange:$=>{$.target.value&&$.target.value!==K.startTime&&Ne(K,{startTime:$.target.value})},className:"w-36"})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-xs",children:"Instructor"}),s.jsx(me,{list:"schedule-instructor-names",defaultValue:K.instructorName||"",placeholder:u.instructorName||"Optional",onBlur:$=>{const pe=$.target.value.trim()||null;pe!==(K.instructorName||null)&&Ne(K,{instructorName:pe})},className:"w-40"})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-xs",children:"Starts"}),s.jsx(me,{type:"date",defaultValue:K.startDate||"",onBlur:$=>{const pe=$.target.value||null;pe!==(K.startDate||null)&&Ne(K,{startDate:pe})},className:"w-36"})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-xs",children:"Ends"}),s.jsx(me,{type:"date",defaultValue:K.endDate||"",onBlur:$=>{const pe=$.target.value||null;pe!==(K.endDate||null)&&Ne(K,{endDate:pe})},className:"w-36"})]}),s.jsxs("div",{className:"min-w-[12rem] flex-1",children:[s.jsx(V,{className:"text-xs",children:"Dates to skip"}),s.jsx(me,{defaultValue:K.excludeDates||"",placeholder:"YYYY-MM-DD, ...",onBlur:$=>{const pe=$.target.value.trim()||null;pe!==(K.excludeDates||null)&&Ne(K,{excludeDates:pe})},className:"w-full"})]}),s.jsx(B,{type:"button",variant:"ghost",size:"icon",disabled:Ot===K.id,title:"Remove this schedule",onClick:()=>rt(K.id),children:s.jsx(ln,{className:"h-4 w-4"})})]},K.id)),s.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[s.jsxs("div",{children:[s.jsx(V,{className:"text-xs",children:"Day"}),s.jsxs(Bt,{value:String(Ke),onValueChange:K=>We(parseInt(K,10)),children:[s.jsx($t,{className:"w-36",children:s.jsx(Lt,{})}),s.jsx(It,{children:n.map((K,$)=>s.jsx(ce,{value:String($),children:K},`new-${K}`))})]})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-xs",children:"Start time"}),s.jsx(me,{type:"time",value:vt,onChange:K=>Zt(K.target.value),className:"w-36"})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-xs",children:"Instructor"}),s.jsx(me,{list:"schedule-instructor-names",value:Ht,onChange:K=>Tt(K.target.value),placeholder:u.instructorName||"Optional",className:"w-40"})]}),s.jsxs(B,{type:"button",variant:"outline",disabled:Ot==="new",onClick:ht,children:[s.jsx(Gs,{className:"h-4 w-4 mr-1"}),"Add schedule"]})]}),s.jsx("datalist",{id:"schedule-instructor-names",children:Cs.map(K=>s.jsx("option",{value:K},K))})]})]}),s.jsx(on,{value:"pricing",className:"space-y-6 mt-0",children:s.jsxs("div",{className:"space-y-4 p-4 border border-slate-200 rounded-lg",children:[s.jsx("h3",{className:"font-medium",children:"Pricing Options"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"allowSingleBooking",checked:u.allowSingleBooking,onCheckedChange:K=>{h($=>!K&&be.length>0?{...$,allowSingleBooking:!1,allowMultiDateSingleBooking:!1,singlePrice:"0"}:K?{...$,allowSingleBooking:K}:{...$,allowSingleBooking:!1,allowMultiDateSingleBooking:!1})}}),s.jsxs(V,{htmlFor:"allowSingleBooking",className:"text-sm",children:["Allow single"," ",((ot=o==null?void 0:o.terminologySingular)==null?void 0:ot.toLowerCase())||"class"," ","bookings"]})]}),!u.allowSingleBooking&&be.length>0&&s.jsxs("div",{className:"ml-6 mt-2 p-3 bg-purple-50 border border-purple-200 rounded-md",children:[s.jsxs("p",{className:"text-sm text-purple-800",children:[s.jsx("strong",{children:"Members-only class:"})," This class will only be available to members with the selected memberships. Single bookings are disabled."]}),s.jsx("p",{className:"text-xs text-purple-700 mt-2",children:"You can still offer new customers one free trial under Membership Access below."})]}),u.allowSingleBooking&&s.jsxs("div",{className:"space-y-3 ml-6",children:[s.jsxs("div",{children:[s.jsxs(V,{htmlFor:"singlePrice",children:["Single Class Price (",o!=null&&o.currency?mt(o.currency):"£",")"]}),s.jsx(me,{id:"singlePrice",type:"number",step:"0.01",value:u.singlePrice,onChange:K=>h($=>({...$,singlePrice:K.target.value})),placeholder:"15.00 (enter 0 for free classes)",min:"0"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Enter 0 for free classes that anyone can book"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"allowMultiDateSingleBooking",checked:u.allowMultiDateSingleBooking,onCheckedChange:K=>h($=>({...$,allowMultiDateSingleBooking:K}))}),s.jsx(V,{htmlFor:"allowMultiDateSingleBooking",className:"text-sm text-slate-600",children:"Allow customer to book multiple dates at once"})]}),u.allowMultiDateSingleBooking&&s.jsx("p",{className:"text-xs text-slate-500 ml-6 mt-1",children:"Customers can add any number of dates in one checkout when using single class pricing."}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"onePerCustomer",checked:u.onePerCustomer,onCheckedChange:K=>h($=>({...$,onePerCustomer:K}))}),s.jsxs(V,{htmlFor:"onePerCustomer",className:"text-sm text-slate-600",children:["Limit to one single"," ",((_t=o==null?void 0:o.terminologySingular)==null?void 0:_t.toLowerCase())||"class"," ","booking per customer (packages not restricted)"]})]}),s.jsx(K$,{id:"offerFreeTrial",checked:u.offerFreeTrial,onCheckedChange:K=>h($=>({...$,offerFreeTrial:K})),terminologySingular:(o==null?void 0:o.terminologySingular)||"class",helperText:"New customers who haven't booked this class before will see a free trial option"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"offerFirstUsePrice",checked:u.offerFirstUsePrice,onCheckedChange:K=>h($=>({...$,offerFirstUsePrice:K}))}),s.jsx(V,{htmlFor:"offerFirstUsePrice",className:"text-sm text-slate-600",children:"Offer a first-session special price"})]}),u.offerFirstUsePrice&&s.jsxs("div",{className:"ml-6 space-y-2",children:[s.jsx("p",{className:"text-xs text-slate-500",children:"Customers who haven't booked this class before pay this price for their first session. After that they pay the normal single class price. Packages, bundles, and memberships are unchanged."}),s.jsxs("div",{children:[s.jsxs(V,{htmlFor:"firstUsePrice",children:["First-session price (",o!=null&&o.currency?mt(o.currency):"£",")"]}),s.jsx(me,{id:"firstUsePrice",type:"number",step:"0.01",min:"0",value:u.firstUsePrice,onChange:K=>h($=>({...$,firstUsePrice:K.target.value})),placeholder:"5.00"})]})]})]}),s.jsxs("div",{className:"space-y-4 pt-4 border-t border-slate-200",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(V,{className:"text-sm font-medium",children:"Package Options"}),s.jsxs(B,{type:"button",variant:"outline",size:"sm",onClick:()=>{re(null),A({name:"",numberOfWeeks:4,price:"",bookingWindowWeeks:"",fixedPackageStartDate:""}),W(!0)},className:"text-xs",children:[s.jsx(Gs,{className:"w-3 h-3 mr-1"}),"Add Package"]})]}),D.length===0?s.jsxs("div",{className:"text-center py-8 text-slate-500 border-2 border-dashed border-slate-200 rounded-lg",children:[s.jsx("p",{className:"text-sm",children:"No packages created yet"}),s.jsx("p",{className:"text-xs",children:'Click "Add Package" to create custom package deals'})]}):s.jsx("div",{className:"space-y-2",children:D.map(K=>s.jsxs("div",{className:"flex items-center justify-between p-3 border border-slate-200 rounded-lg",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-sm",children:K.name}),s.jsxs("p",{className:"text-xs text-slate-600",children:[K.numberOfWeeks," ",u.frequency==="daily"?"days":"weeks"," ","•"," ",o!=null&&o.currency?mt(o.currency):"£",K.price,K.bookingWindowWeeks&&` • ${K.bookingWindowWeeks} ${u.frequency==="daily"?"day":"week"} booking window`,K.fixedPackageStartDate&&` • Fixed start: ${K.fixedPackageStartDate}`]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(B,{t
668ype:"button",variant:"outline",size:"sm",onClick:()=>gs(K),className:"text-xs px-2 py-1",children:"Edit"}),s.jsx(B,{type:"button",variant:"outline",size:"sm",onClick:()=>Os(K.id),className:"text-xs px-2 py-1 text-red-600 hover:text-red-700",children:"Delete"})]})]},K.id))})]}),s.jsxs("div",{className:"flex items-center space-x-2 pt-4 border-t border-slate-200",children:[s.jsx(Xt,{id:"allowCashPayments",checked:u.allowCashPayments,onCheckedChange:K=>h($=>({...$,allowCashPayments:K}))}),s.jsx(V,{htmlFor:"allowCashPayments",className:"text-sm",children:"Allow cash payments on arrival"})]}),s.jsxs("div",{className:"space-y-4 pt-4 border-t border-slate-200",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsx(V,{className:"text-sm font-medium",children:"Membership Access"})}),s.jsx("div",{className:"space-y-3",children:pt&&pt.length>0?s.jsxs("div",{className:"space-y-3",children:[s.jsxs(V,{className:"text-sm text-slate-600",children:["Select which memberships can access this"," ",((zt=o==null?void 0:o.terminologySingular)==null?void 0:zt.toLowerCase())||"class"," ","and set special pricing:"]}),pt.map(K=>{const $=be.find(ye=>ye.id===K.id),pe=!!$;return s.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:`membership-${K.id}`,checked:pe,onCheckedChange:ye=>{Fe(ye?Be=>[...Be,{id:K.id,memberPrice:""}]:Be=>Be.filter(Ze=>Ze.id!==K.id))}}),s.jsx(V,{htmlFor:`membership-${K.id}`,className:"text-sm font-medium",children:K.name}),s.jsxs("span",{className:"text-xs text-slate-500",children:["(",mt((o==null?void 0:o.currency)||"GBP"),K.price,"/",K.billingFrequency,")"]})]}),pe&&s.jsxs("div",{className:"ml-6 flex items-center space-x-2",children:[s.jsx(V,{htmlFor:`price-${K.id}`,className:"text-xs text-slate-600",children:"Member price (optional):"}),s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx("span",{className:"text-sm",children:mt((o==null?void 0:o.currency)||"GBP")}),s.jsx(me,{id:`price-${K.id}`,type:"number",step:"0.01",min:"0",placeholder:"Free access",value:($==null?void 0:$.memberPrice)||"",onChange:ye=>{Fe(Be=>Be.map(Ze=>Ze.id===K.id?{...Ze,memberPrice:ye.target.value}:Ze))},className:"w-24 h-8"})]}),s.jsx("span",{className:"text-xs text-slate-500",children:"(Leave empty for free access)"})]})]},K.id)}),be.length>0&&s.jsxs("div",{className:"mt-2 p-2 bg-blue-50 rounded text-sm text-blue-700",children:[be.length," membership",be.length>1?"s":""," ","selected"]}),!u.allowSingleBooking&&be.length>0&&s.jsx("div",{className:"mt-3 p-3 bg-green-50 border border-green-200 rounded-md",children:s.jsx(K$,{id:"offerFreeTrialMemberships",checked:u.offerFreeTrial,onCheckedChange:K=>h($=>({...$,offerFreeTrial:K})),terminologySingular:(o==null?void 0:o.terminologySingular)||"class",helperText:"New customers can book one class for free. After that, this class is members-only. No drop-in price is shown."})})]}):s.jsx("div",{className:"text-sm text-slate-500",children:"No memberships available. Create memberships first to associate them with classes."})})]}),s.jsxs("div",{className:"flex items-center space-x-2 pt-4 border-t border-slate-200",children:[s.jsx(Xt,{id:"testMode",checked:u.testMode,onCheckedChange:K=>h($=>({...$,testMode:K}))}),s.jsxs(V,{htmlFor:"testMode",className:"text-sm",children:["Test Mode"," ",s.jsx("span",{className:"text-slate-500",children:"(bypasses payments)"})]})]})]})}),s.jsx(on,{value:"reminders",className:"space-y-6 mt-0",children:s.jsxs("div",{className:"space-y-4 p-4 border border-slate-200 rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Af,{className:"h-5 w-5 text-blue-600"}),s.jsx("h3",{className:"font-medium",children:"Reminders"})]}),s.jsxs("p",{className:"text-sm text-slate-600",children:["Set up automatic reminders to be sent to clients before their scheduled"," ",(o==null?void 0:o.terminologyPlural.toLowerCase())||"class",". You can create multiple reminders with different timing and delivery methods."]}),Ie.length===0&&s.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-800",children:[s.jsx("strong",{children:"No reminders are set for this class."})," ",'Clients will not receive reminder emails or SMS until you add at least one below. The form below is not active until you choose Email and/or SMS and click "Add Reminder".']}),Ie.length>0&&s.jsxs("div",{className:"mb-6",children:[s.jsx("h4",{className:"text-sm font-medium text-slate-700 mb-3",children:"Active Reminders"}),s.jsx("div",{className:"space-y-3",children:Ie.map(K=>s.jsxs("div",{className:"flex items-center justify-between p-3 bg-white border rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Af,{className:"h-4 w-4 text-blue-500"}),s.jsx("span",{className:"font-medium text-slate-900",children:xe(K.hoursBeforeClass)})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Xt,{id:`email-${K.id}`,checked:K.sendEmail,onCheckedChange:$=>Tr(K.id,"sendEmail",!!$)}),s.jsxs("label",{htmlFor:`email-${K.id}`,className:"text-sm cursor-pointer",children:[s.jsx(_n,{className:"h-3 w-3 inline mr-1"}),"Email"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Xt,{id:`sms-${K.id}`,checked:K.sendSms,onCheckedChange:$=>Tr(K.id,"sendSms",!!$)}),s.jsxs("label",{htmlFor:`sms-${K.id}`,className:"text-sm cursor-pointer",children:[s.jsx(fw,{className:"h-3 w-3 inline mr-1"}),"SMS"]})]})]})]}
668),s.jsx(B,{type:"button",variant:"ghost",size:"sm",onClick:()=>rr(K.id),className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:s.jsx(ln,{className:"h-4 w-4"})})]},K.id))})]}),s.jsxs("div",{className:`border-t pt-4 ${Ie.length===0?"rounded-lg border-2 border-dashed border-slate-300 bg-slate-50/50 p-4 -mx-1":""}`,children:[s.jsx("h4",{className:"text-sm font-medium text-slate-700 mb-3",children:Ie.length===0?"Add your first reminder":"Add another reminder"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"reminderHours",children:"Send Reminder"}),s.jsxs(Bt,{value:qe.hoursBeforeClass.toString(),onValueChange:K=>ft($=>({...$,hoursBeforeClass:parseInt(K)})),children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"1",children:"1 hour before"}),s.jsx(ce,{value:"2",children:"2 hours before"}),s.jsx(ce,{value:"4",children:"4 hours before"}),s.jsx(ce,{value:"6",children:"6 hours before"}),s.jsx(ce,{value:"12",children:"12 hours before"}),s.jsx(ce,{value:"24",children:"1 day before"}),s.jsx(ce,{value:"48",children:"2 days before"}),s.jsx(ce,{value:"72",children:"3 days before"}),s.jsx(ce,{value:"168",children:"1 week before"})]})]})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Delivery Method"}),s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"reminderEmail",checked:qe.sendEmail,onCheckedChange:K=>ft($=>({...$,sendEmail:K}))}),s.jsxs(V,{htmlFor:"reminderEmail",className:"text-sm flex items-center gap-1",children:[s.jsx(_n,{className:"h-3 w-3"}),"Email"]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"reminderSms",checked:qe.sendSms,onCheckedChange:K=>ft($=>({...$,sendSms:K}))}),s.jsxs(V,{htmlFor:"reminderSms",className:"text-sm flex items-center gap-1",children:[s.jsx(fw,{className:"h-3 w-3"}),"SMS"]})]})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(B,{type:"button",onClick:cs,disabled:!qe.sendEmail&&!qe.sendSms,className:"w-full",children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Add Reminder"]})})]})]})]})}),s.jsxs(on,{value:"options",className:"space-y-6 mt-0",children:[s.jsxs("div",{className:"space-y-3 p-4 border border-slate-200 rounded-lg",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"useCustomRedirect",checked:q,onCheckedChange:K=>{H(K),K||h($=>({...$,bookingConfirmationRedirectUrl:""}))}}),s.jsxs(V,{htmlFor:"useCustomRedirect",className:"text-sm",children:["Use custom booking confirmation redirect URL"," ",s.jsx("span",{className:"text-slate-500",children:"(for tracking pixels like Meta Pixel, Google Analytics, etc.)"})]})]}),q&&s.jsxs("div",{className:"ml-6",children:[s.jsx(V,{htmlFor:"bookingConfirmationRedirectUrl",className:"text-sm",children:"Redirect URL"}),s.jsx(me,{id:"bookingConfirmationRedirectUrl",type:"url",value:u.bookingConfirmationRedirectUrl,onChange:K=>h($=>({...$,bookingConfirmationRedirectUrl:K.target.value})),placeholder:"https://example.com/booking-confirmed",className:"mt-1"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Users will be redirected to this URL after booking confirmation. When the calendar is embedded in an iframe, the redirect opens the full browser window. Add your tracking code to that page."})]})]}),s.jsxs("div",{className:"space-y-3 p-4 border border-slate-200 rounded-lg",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"disableQrCheckin",checked:u.disableQrCheckin,onCheckedChange:K=>h($=>({...$,disableQrCheckin:K}))}),s.jsx(V,{htmlFor:"disableQrCheckin",className:"text-sm",children:"Disable QR Code Check-in Links"})]}),s.jsx("p",{className:"text-xs text-slate-500 ml-6",children:"When enabled, QR code check-in links will not be included in booking confirmation emails and reminders."})]}),s.jsxs("div",{className:"space-y-3 p-4 border border-slate-200 rounded-lg",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"waitlistEnabled",checked:u.waitlistEnabled,onCheckedChange:K=>h($=>({...$,waitlistEnabled:K}))}),s.jsx(V,{htmlFor:"waitlistEnabled",className:"text-sm",children:"Enable Waitlist"})]}),s.jsx("p",{className:"text-xs text-slate-500 ml-6",children:"Allow clients to join a waitlist when this class is full. They'll be notified when spots become available."}),u.waitlistEnabled&&s.jsxs("div",{className:"ml-6",children:[s.jsx(V,{htmlFor:"waitlistNotificationDelayMinutes",className:"text-sm",children:"Waitlist Notification Delay (minutes)"}),s.jsx(me,{id:"waitlistNotificationDelayMinutes",type:"number",min:"0",value:u.waitlistNotificationDelayMinutes,onChange:K=>h($=>({...$,waitlistNotificationDelayMinutes:parseInt(K.target.value)||0})),placeholder:"0",className:"mt-1"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Time between notifying each person on the waitlist. Set to 0 to notify everyone at once."})]})]})]})]})]}),s.jsxs(Er,{className:"px-4 sm:px-8 pt-4 pb-4 sm:pb-6 border-t bg-background sticky bottom-0 z-10",children:[s.jsx(B,{t
668ype:"button",variant:"outline",onClick:e,children:"Cancel"}),s.jsx(B,{type:"submit",disabled:Ss.isPending,children:Ss.isPending?"Saving...":t?"Update "+((o==null?void 0:o.terminologySingular)||"Class"):"Create "+((o==null?void 0:o.terminologySingular)||"Class")})]})]})]})}),s.jsx(Zi,{open:y!==null,onOpenChange:K=>{K||g(null)},children:s.jsxs(bi,{children:[s.jsxs(wi,{children:[s.jsx(Ni,{children:"Date range doesn't match schedule"}),s.jsx(Ci,{children:"The start and end dates you set don't include any of the days this class runs on (for example, a Monday class with dates that are only Saturday–Sunday). The class won't appear on your booking calendar until the dates are fixed. Save anyway?"})]}),s.jsxs(ji,{children:[s.jsx(to,{children:"Cancel"}),s.jsx(eo,{onClick:()=>{y&&(Ss.mutate(y),g(null))},children:"Save anyway"})]})]})}),s.jsx(Zi,{open:ge,onOpenChange:K=>{K||je(!1)},children:s.jsxs(bi,{children:[s.jsxs(wi,{children:[s.jsx(Ni,{children:"Only 1 class in this package?"}),s.jsxs(Ci,{children:["A package with just one ",u.frequency==="daily"?"day":"week"," is unusual—clients will only get a single booking. For one-off classes, use single bookings instead. Did you mean to set a higher number (e.g. 4)?"]})]}),s.jsxs(ji,{children:[s.jsx(to,{children:"Cancel"}),s.jsx(eo,{onClick:()=>{ke.current=!0,je(!1),hs()},children:"Save anyway"})]})]})}),s.jsx(Ct,{open:F,onOpenChange:W,children:s.jsxs(St,{children:[s.jsx(kt,{children:s.jsx(Pt,{children:I?"Edit Package":"Create Package"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"packageName",children:"Package Name"}),s.jsx(me,{id:"packageName",value:ie.name,onChange:K=>A($=>({...$,name:K.target.value})),placeholder:"4-Week Beginner Package",required:!0})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsxs(V,{htmlFor:"numberOfWeeks",children:["Number of ",u.frequency==="daily"?"Days":"Weeks"]}),s.jsx(me,{id:"numberOfWeeks",type:"number",value:ie.numberOfWeeks,onChange:K=>A($=>({...$,numberOfWeeks:parseInt(K.target.value)})),min:"1",max:u.frequency==="daily"?"365":"52",required:!0})]}),s.jsxs("div",{children:[s.jsxs(V,{htmlFor:"packagePrice",children:["Price (",o!=null&&o.currency?mt(o.currency):"£",")"]}),s.jsx(me,{id:"packagePrice",type:"number",step:"0.01",value:ie.price,onChange:K=>A($=>({...$,price:K.target.value})),placeholder:"50.00",min:"0",required:!0})]})]}),s.jsxs("div",{children:[s.jsxs(V,{htmlFor:"bookingWindow",children:["Booking Window (",u.frequency==="daily"?"days":"weeks",", optional)"]}),s.jsx(me,{id:"bookingWindow",type:"number",value:ie.bookingWindowWeeks,onChange:K=>A($=>({...$,bookingWindowWeeks:K.target.value})),placeholder:u.frequency==="daily"?"30":"6",min:"1",max:u.frequency==="daily"?"365":"24"}),s.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:["Let clients pick any ",ie.numberOfWeeks," sessions within this many"," ",u.frequency==="daily"?"days":"weeks","."]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"fixedPackageStartDate",children:"Fixed package start date (optional)"}),s.jsx(me,{id:"fixedPackageStartDate",type:"date",value:ie.fixedPackageStartDate,onChange:K=>A($=>({...$,fixedPackageStartDate:K.target.value}))}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"When set, the package always uses this date as the first session (same full block for everyone), regardless of which calendar date the client clicked."})]}),s.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[s.jsx(B,{type:"button",variant:"outline",onClick:()=>{W(!1),re(null),A({name:"",numberOfWeeks:4,price:"",bookingWindowWeeks:"",fixedPackageStartDate:""})},children:"Cancel"}),s.jsx(B,{type:"button",onClick:hs,children:I?"Update Package":"Add Package"})]})]})]})})]})}var WV={exports:{}};/* @license
669Papa Parse
670v5.5.3
671https://github.com/mholt/PapaParse
672License: MIT
673*/(function(e,t){((n,r)=>{e.exports=r()})(xx,function n(){var r=typeof self<"u"?self:typeof window<"u"?window:r!==void 0?r:{},a,i=!r.document&&!!r.postMessage,o=r.IS_PAPA_WORKER||!1,l={},c=0,d={};function m(S){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(E){var T=N(E);T.chunkSize=parseInt(T.chunkSize),E.step||E.chunk||(T.chunkSize=null),this._handle=new y(T),(this._handle.streamer=this)._config=T}).call(this,S),this.parseChunk=function(E,T){var z=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<z){let D=this._config.newline;D||(O=this._config.quoteChar||'"',D=this._handle.guessLineEndings(E,O)),E=[...E.split(D).slice(z)].join(D)}this.isFirstChunk&&P(this._config.beforeFirstChunk)&&(O=this._config.beforeFirstChunk(E))!==void 0&&(E=O),this.isFirstChunk=!1,this._halted=!1;var z=this._partialLine+E,O=(this._partialLine="",this._handle.parse(z,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(E=O.meta.cursor,z=(this._finished||(this._partialLine=z.substring(E-this._baseIndex),this._baseIndex=E),O&&O.data&&(this._rowCount+=O.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)r.postMessage({results:O,workerId:d.WORKER_ID,finished:z});else if(P(this._config.chunk)&&!T){if(this._config.chunk(O,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=O=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(O.data),this._completeResults.errors=this._completeResults.errors.concat(O.errors),this._completeResults.meta=O.meta),this._completed||!z||!P(this._config.complete)||O&&O.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),z||O&&O.meta.paused||this._nextChunk(),O}this._halted=!0},this._sendError=function(E){P(this._config.error)?this._config.error(E):o&&this._config.error&&r.postMessage({workerId:d.WORKER_ID,error:E,finished:!1})}}function u(S){var E;(S=S||{}).chunkSize||(S.chunkSize=d.RemoteChunkSize),m.call(this,S),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(T){this._input=T,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(E=new XMLHttpRequest,this._config.withCredentials&&(E.withCredentials=this._config.withCredentials),i||(E.onload=C(this._chunkLoaded,this),E.onerror=C(this._chunkError,this)),E.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var T,z=this._config.downloadRequestHeaders;for(T in z)E.setRequestHeader(T,z[T])}var O;this._config.chunkSize&&(O=this._start+this._config.chunkSize-1,E.setRequestHeader("Range","bytes="+this._start+"-"+O));try{E.send(this._config.downloadRequestBody)}catch(D){this._chunkError(D.message)}i&&E.status===0&&this._chunkError()}},this._chunkLoaded=function(){E.readyState===4&&(E.status<200||400<=E.status?this._chunkError():(this._start+=this._config.chunkSize||E.responseText.length,this._finished=!this._config.chunkSize||this._start>=(T=>(T=T.getResponseHeader("Content-Range"))!==null?parseInt(T.substring(T.lastIndexOf("/")+1)):-1)(E),this.parseChunk(E.responseText)))},this._chunkError=function(T){T=E.statusText||T,this._sendError(new Error(T))}}function h(S){(S=S||{}).chunkSize||(S.chunkSize=d.LocalChunkSize),m.call(this,S);var E,T,z=typeof FileReader<"u";this.stream=function(O){this._input=O,T=O.slice||O.webkitSlice||O.mozSlice,z?((E=new FileReader).onload=C(this._chunkLoaded,this),E.onerror=C(this._chunkError,this)):E=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var O=this._input,D=(this._config.chunkSize&&(D=Math.min(this._start+this._config.chunkSize,this._input.size),O=T.call(O,this._start,D)),E.readAsText(O,this._config.encoding));z||this._chunkLoaded({target:{result:D}})},this._chunkLoaded=function(O){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(O.target.result)},this._chunkError=function(){this._sendError(E.error)}}function p(S){var E;m.call(this,S=S||{}),this.stream=function(T){return E=T,this._nextChunk()},this._nextChunk=function(){var T,z;if(!this._finished)return T=this._config.chunkSize,E=T?(z=E.substring(0,T),E.substring(T)):(z=E,""),this._finished=!E,this.parseChunk(z)}}function v(S){m.call(this,S=S||{});var E=[],T=!0,z=!1;this.pause=function(){m.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){m.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(O){this._input=O,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){z&&E.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),E.length?this.parseChunk(E.shift()):T=!0},this._streamData=C(function(O){try{E.push(typeof O=="string"?O:O.toString(this._config.encoding)),T&&(T=!1,this._checkIsFinished(),this.parseChunk(E.shift()))}catch(D){this._streamError(D)}},this),this._streamError=C(function(O){this._streamCleanUp(),this._sendError(O)},this),this._streamEnd=C(function(){this._streamCleanUp(),z=!0,this._streamData("")},this),this._streamCleanUp=C(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function y(S){var E,T,z,O,D=Math.pow(2,53),k=-D,F=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,W=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,q=this,H=0,_=0,L=!1,U=!1,J=[],I={data:[],errors:[],meta:{}};function re(se){return S.skipEmptyLines==="greedy"?se.join("").trim()==="":se.length===1&&se[0].length===0}function R(){if(I&&z&&(M("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+d.DefaultDelimiter+"'"),z=!1),S.skipEmptyLines&&(I.data=I.data.filter(function(Z){return!re(Z)})),Y()){let Z=function(ie,A){P(S.transformHeader)&&(ie=S.transformHeader(ie,A)),J.push(ie)};var G=Z;
vendor: 9,397 bytes, lines 673-681
673if(I)if(Array.isArray(I.data[0])){for(var se=0;Y()&&se<I.data.length;se++)I.data[se].forEach(Z);I.data.splice(0,1)}else I.data.forEach(Z)}function Q(Z,ie){for(var A=S.header?{}:[],ge=0;ge<Z.length;ge++){var je=ge,ke=Z[ge],ke=((Ie,$e)=>(qe=>(S.dynamicTypingFunction&&S.dynamicTyping[qe]===void 0&&(S.dynamicTyping[qe]=S.dynamicTypingFunction(qe)),(S.dynamicTyping[qe]||S.dynamicTyping)===!0))(Ie)?$e==="true"||$e==="TRUE"||$e!=="false"&&$e!=="FALSE"&&((qe=>{if(F.test(qe)&&(qe=parseFloat(qe),k<qe&&qe<D))return 1})($e)?parseFloat($e):W.test($e)?new Date($e):$e===""?null:$e):$e)(je=S.header?ge>=J.length?"__parsed_extra":J[ge]:je,ke=S.transform?S.transform(ke,je):ke);je==="__parsed_extra"?(A[je]=A[je]||[],A[je].push(ke)):A[je]=ke}return S.header&&(ge>J.length?M("FieldMismatch","TooManyFields","Too many fields: expected "+J.length+" fields but parsed "+ge,_+ie):ge<J.length&&M("FieldMismatch","TooFewFields","Too few fields: expected "+J.length+" fields but parsed "+ge,_+ie)),A}var te;I&&(S.header||S.dynamicTyping||S.transform)&&(te=1,!I.data.length||Array.isArray(I.data[0])?(I.data=I.data.map(Q),te=I.data.length):I.data=Q(I.data,0),S.header&&I.meta&&(I.meta.fields=J),_+=te)}function Y(){return S.header&&J.length===0}function M(se,Q,te,G){se={type:se,code:Q,message:te},G!==void 0&&(se.row=G),I.errors.push(se)}P(S.step)&&(O=S.step,S.step=function(se){I=se,Y()?R():(R(),I.data.length!==0&&(H+=se.data.length,S.preview&&H>S.preview?T.abort():(I.data=I.data[0],O(I,q))))}),this.parse=function(se,Q,te){var G=S.quoteChar||'"',G=(S.newline||(S.newline=this.guessLineEndings(se,G)),z=!1,S.delimiter?P(S.delimiter)&&(S.delimiter=S.delimiter(se),I.meta.delimiter=S.delimiter):((G=((Z,ie,A,ge,je)=>{var ke,Ie,$e,qe;je=je||[",","	","|",";",d.RECORD_SEP,d.UNIT_SEP];for(var ft=0;ft<je.length;ft++){for(var be,Fe=je[ft],_e=0,ze=0,ue=0,Me=($e=void 0,new x({comments:ge,delimiter:Fe,newline:ie,preview:10}).parse(Z)),pt=0;pt<Me.data.length;pt++)A&&re(Me.data[pt])?ue++:(be=Me.data[pt].length,ze+=be,$e===void 0?$e=be:0<be&&(_e+=Math.abs(be-$e),$e=be));0<Me.data.length&&(ze/=Me.data.length-ue),(Ie===void 0||_e<=Ie)&&(qe===void 0||qe<ze)&&1.99<ze&&(Ie=_e,ke=Fe,qe=ze)}return{successful:!!(S.delimiter=ke),bestDelimiter:ke}})(se,S.newline,S.skipEmptyLines,S.comments,S.delimitersToGuess)).successful?S.delimiter=G.bestDelimiter:(z=!0,S.delimiter=d.DefaultDelimiter),I.meta.delimiter=S.delimiter),N(S));return S.preview&&S.header&&G.preview++,E=se,T=new x(G),I=T.parse(E,Q,te),R(),L?{meta:{paused:!0}}:I||{meta:{paused:!1}}},this.paused=function(){return L},this.pause=function(){L=!0,T.abort(),E=P(S.chunk)?"":E.substring(T.getCharIndex())},this.resume=function(){q.streamer._halted?(L=!1,q.streamer.parseChunk(E,!0)):setTimeout(q.resume,3)},this.aborted=function(){return U},this.abort=function(){U=!0,T.abort(),I.meta.aborted=!0,P(S.complete)&&S.complete(I),E=""},this.guessLineEndings=function(Z,G){Z=Z.substring(0,1048576);var G=new RegExp(g(G)+"([^]*?)"+g(G),"gm"),te=(Z=Z.replace(G,"")).split("\r"),G=Z.split(`
674`),Z=1<G.length&&G[0].length<te[0].length;if(te.length===1||Z)return`
675`;for(var ie=0,A=0;A<te.length;A++)te[A][0]===`
676`&&ie++;return ie>=te.length/2?`\r
677`:"\r"}}function g(S){return S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x(S){var E=(S=S||{}).delimiter,T=S.newline,z=S.comments,O=S.step,D=S.preview,k=S.fastMode,F=null,W=!1,q=S.quoteChar==null?'"':S.quoteChar,H=q;if(S.escapeChar!==void 0&&(H=S.escapeChar),(typeof E!="string"||-1<d.BAD_DELIMITERS.indexOf(E))&&(E=","),z===E)throw new Error("Comment character same as delimiter");z===!0?z="#":(typeof z!="string"||-1<d.BAD_DELIMITERS.indexOf(z))&&(z=!1),T!==`
678`&&T!=="\r"&&T!==`\r
679`&&(T=`
680`);var _=0,L=!1;this.parse=function(U,J,I){if(typeof U!="string")throw new Error("Input must be a string");var re=U.length,R=E.length,Y=T.length,M=z.length,se=P(O),Q=[],te=[],G=[],Z=_=0;if(!U)return _e();if(k||k!==!1&&U.indexOf(q)===-1){for(var ie=U.split(T),A=0;A<ie.length;A++){if(G=ie[A],_+=G.length,A!==ie.length-1)_+=T.length;else if(I)return _e();if(!z||G.substring(0,M)!==z){if(se){if(Q=[],qe(G.split(E)),ze(),L)return _e()}else qe(G.split(E));if(D&&D<=A)return Q=Q.slice(0,D),_e(!0)}}return _e()}for(var ge=U.indexOf(E,_),je=U.indexOf(T,_),ke=new RegExp(g(H)+g(q),"g"),Ie=U.indexOf(q,_);;)if(U[_]===q)for(Ie=_,_++;;){if((Ie=U.indexOf(q,Ie+1))===-1)return I||te.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Q.length,index:_}),be();if(Ie===re-1)return be(U.substring(_,Ie).replace(ke,q));if(q===H&&U[Ie+1]===H)Ie++;else if(q===H||Ie===0||U[Ie-1]!==H){ge!==-1&&ge<Ie+1&&(ge=U.indexOf(E,Ie+1));var $e=ft((je=je!==-1&&je<Ie+1?U.indexOf(T,Ie+1):je)===-1?ge:Math.min(ge,je));if(U.substr(Ie+1+$e,R)===E){G.push(U.substring(_,Ie).replace(ke,q)),U[_=Ie+1+$e+R]!==q&&(Ie=U.indexOf(q,_)),ge=U.indexOf(E,_),je=U.indexOf(T,_);break}if($e=ft(je),U.substring(Ie+1+$e,Ie+1+$e+Y)===T){if(G.push(U.substring(_,Ie).replace(ke,q)),Fe(Ie+1+$e+Y),ge=U.indexOf(E,_),Ie=U.indexOf(q,_),se&&(ze(),L))return _e();if(D&&Q.length>=D)return _e(!0);break}te.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Q.length,index:_}),Ie++}}else if(z&&G.length===0&&U.substring(_,_+M)===z){if(je===-1)return _e();_=je+Y,je=U.indexOf(T,_),ge=U.indexOf(E,_)}else if(ge!==-1&&(ge<je||je===-1))G.push(U.substring(_,ge)),_=ge+R,ge=U.indexOf(E,_);else{if(je===-1)break;if(G.push(U.substring(_,je)),Fe(je+Y),se&&(ze(),L))return _e();if(D&&Q.length>=D)return _e(!0)}return be();function qe(ue){Q.push(ue),Z=_}function ft(ue){var Me=0;return Me=ue!==-1&&(ue=U.substring(Ie+1,ue))&&ue.trim()===""?ue.length:Me}function be(ue){return I||(ue===void 0&&(ue=U.substring(_)),G.push(ue),_=re,qe(G),se&&ze()),_e()}function Fe(ue){_=ue,qe(G),G=[],je=U.indexOf(T,_)}function _e(ue){if(S.header&&!J&&Q.length&&!W){var Me=Q[0],pt=Object.create(null),de=new Set(Me);let fe=!1;for(let le=0;le<Me.length;le++){let Ke=Me[le];if(pt[Ke=P(S.transformHeader)?S.transformHeader(Ke,le):Ke]){let We,vt=pt[Ke];for(;We=Ke+"_"+vt,vt++,de.has(We););de.add(We),Me[le]=We,pt[Ke]++,fe=!0,(F=F===null?{}:F)[We]=Ke}else pt[Ke]=1,Me[le]=Ke;de.add(Ke)}fe&&console.warn("Duplicate headers found and renamed."),W=!0}return{data:Q,errors:te,meta:{delimiter:E,linebreak:T,aborted:L,truncated:!!ue,cursor:Z+(J||0),renamedHeaders:F}}}function ze(){O(_e()),Q=[],te=[]}},this.abort=function(){L=!0},this.getCharIndex=function(){return _}}function b(S){var E=S.data,T=l[E.workerId],z=!1;if(E.error)T.userError(E.error,E.file);else if(E.results&&E.results.data){var O={abort:function(){z=!0,w(E.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:j,resume:j};if(P(T.userStep)){for(var D=0;D<E.results.data.length&&(T.userStep({data:E.results.data[D],errors:E.results.errors,meta:E.results.meta},O),!z);D++);delete E.results}else P(T.userChunk)&&(T.userChunk(E.results,O,E.file),delete E.results)}E.finished&&!z&&w(E.workerId,E.results)}function w(S,E){var T=l[S];P(T.userComplete)&&T.userComplete(E),T.terminate(),delete l[S]}function j(){throw new Error("Not implemented.")}function N(S){if(typeof S!="object"||S===null)return S;var E,T=Array.isArray(S)?[]:{};for(E in S)T[E]=N(S[E]);return T}function C(S,E){return function(){S.apply(E,arguments)}}function P(S){return typeof S=="function"}return d.parse=function(S,E){var T=(E=E||{}).dynamicTyping||!1;if(P(T)&&(E.dynamicTypingFunction=T,T={}),E.dynamicTyping=T,E.transform=!!P(E.transform)&&E.transform,!E.worker||!d.WORKERS_SUPPORTED)return T=null,d.NODE_STREAM_INPUT,typeof S=="string"?(S=(z=>z.charCodeAt(0)!==65279?z:z.slice(1))(S),T=new(E.download?u:p)(E)):S.readable===!0&&P(S.read)&&P(S.on)?T=new v(E):(r.File&&S instanceof File||S instanceof Object)&&(T=new h(E)),T.stream(S);(T=(()=>{var z;return!!d.WORKERS_SUPPORTED&&(z=(()=>{var O=r.URL||r.webkitURL||null,D=n.toString();return d.BLOB_URL||(d.BLOB_URL=O.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",D,")();"],{type:"text/javascript"})))})(),(z=new r.Worker(z)).onmessage=b,z.id=c++,l[z.id]=z)})()).userStep=E.step,T.userChunk=E.chunk,T.userComplete=E.complete,T.userError=E.error,E.step=P(E.step),E.chunk=P(E.chunk),E.complete=P(E.complete),E.error=P(E.error),delete E.worker,T.postMessage({input:S,config:E,workerId:T.id})},d.unparse=function(S,E){var T=!1,z=!0,O=",",D=`\r
681`,k='"',F=k+k,W=!1,q=null,H=!1,_=((()=>{if(typeof E=="object"){if(typeof E.delimiter!="string"||d.BAD_DELIMITERS.filter(function(J){return E.delimiter.indexOf(J)!==-1}).length||(O=E.delimiter),typeof E.quotes!="boolean"&&typeof E.quotes!="function"&&!Array.isArray(E.quotes)||(T=E.quotes),typeof E.skipEmptyLines!="boolean"&&typeof E.skipEmptyLines!="string"||(W=E.skipEmptyLines),typeof E.newline=="string"&&(D=E.newline),typeof E.quoteChar=="string"&&(k=E.quoteChar),typeof E.header=="boolean"&&(z=E.header),Array.isArray(E.columns)){if(E.columns.length===0)throw new Error("Option columns is empty");q=E.columns}E.escapeChar!==void 0&&(F=E.escapeChar+k),E.escapeFormulae instanceof RegExp?H=E.escapeFormulae:typeof E.escapeFormulae=="boolean"&&E.escapeFormulae&&(H=/^[=+\-@\t\r].*$/)}})(),new RegExp(g(k),"g"));if(typeof S=="string"&&(S=JSON.parse(S)),Array.isArray(S)){if(!S.length||Array.isArray(S[0]))return L(null,S,W);
681if(typeof S[0]=="object")return L(q||Object.keys(S[0]),S,W)}else if(typeof S=="object")return typeof S.data=="string"&&(S.data=JSON.parse(S.data)),Array.isArray(S.data)&&(S.fields||(S.fields=S.meta&&S.meta.fields||q),S.fields||(S.fields=Array.isArray(S.data[0])?S.fields:typeof S.data[0]=="object"?Object.keys(S.data[0]):[]),Array.isArray(S.data[0])||typeof S.data[0]=="object"||(S.data=[S.data])),L(S.fields||[],S.data||[],W);throw new Error("Unable to serialize unrecognized input");function L(J,I,re){var R="",Y=(typeof J=="string"&&(J=JSON.parse(J)),typeof I=="string"&&(I=JSON.parse(I)),Array.isArray(J)&&0<J.length),M=!Array.isArray(I[0]);if(Y&&z){for(var se=0;se<J.length;se++)0<se&&(R+=O),R+=U(J[se],se);0<I.length&&(R+=D)}for(var Q=0;Q<I.length;Q++){var te=(Y?J:I[Q]).length,G=!1,Z=Y?Object.keys(I[Q]).length===0:I[Q].length===0;if(re&&!Y&&(G=re==="greedy"?I[Q].join("").trim()==="":I[Q].length===1&&I[Q][0].length===0),re==="greedy"&&Y){for(var ie=[],A=0;A<te;A++){var ge=M?J[A]:A;ie.push(I[Q][ge])}G=ie.join("").trim()===""}if(!G){for(var je=0;je<te;je++){0<je&&!Z&&(R+=O);var ke=Y&&M?J[je]:je;R+=U(I[Q][ke],je)}Q<I.length-1&&(!re||0<te&&!Z)&&(R+=D)}}return R}function U(J,I){var re,R;return J==null?"":J.constructor===Date?JSON.stringify(J).slice(1,25):(R=!1,H&&typeof J=="string"&&H.test(J)&&(J="'"+J,R=!0),re=J.toString().replace(_,F),(R=R||T===!0||typeof T=="function"&&T(J,I)||Array.isArray(T)&&T[I]||((Y,M)=>{for(var se=0;se<M.length;se++)if(-1<Y.indexOf(M[se]))return!0;return!1})(re,d.BAD_DELIMITERS)||-1<re.indexOf(O)||re.charAt(0)===" "||re.charAt(re.length-1)===" ")?k+re+k:re)}},d.RECORD_SEP="�",d.UNIT_SEP="�",d.BYTE_ORDER_MARK="\uFEFF",d.BAD_DELIMITERS=["\r",`
682`,'"',d.BYTE_ORDER_MARK],d.WORKERS_SUPPORTED=!i&&!!r.Worker,d.NODE_STREAM_INPUT=1,d.LocalChunkSize=10485760,d.RemoteChunkSize=5242880,d.DefaultDelimiter=",",d.Parser=x,d.ParserHandle=y,d.NetworkStreamer=u,d.FileStreamer=h,d.StringStreamer=p,d.ReadableStreamStreamer=v,r.jQuery&&((a=r.jQuery).fn.parse=function(S){var E=S.config||{},T=[];return this.each(function(D){if(!(a(this).prop("tagName").toUpperCase()==="INPUT"&&a(this).attr("type").toLowerCase()==="file"&&r.FileReader)||!this.files||this.files.length===0)return!0;for(var k=0;k<this.files.length;k++)T.push({file:this.files[k],inputElem:this,instanceConfig:a.extend({},E)})}),z(),this;function z(){if(T.length===0)P(S.complete)&&S.complete();else{var D,k,F,W,q=T[0];if(P(S.before)){var H=S.before(q.file,q.inputElem);if(typeof H=="object"){if(H.action==="abort")return D="AbortError",k=q.file,F=q.inputElem,W=H.reason,void(P(S.error)&&S.error({name:D},k,F,W));if(H.action==="skip")return void O();typeof H.config=="object"&&(q.instanceConfig=a.extend(q.instanceConfig,H.config))}else if(H==="skip")return void O()}var _=q.instanceConfig.complete;q.instanceConfig.complete=function(L){P(_)&&_(L,q.file,q.inputElem),O()},d.parse(q.file,q.instanceConfig)}}function O(){T.splice(0,1),z()}}),o&&(r.onmessage=function(S){S=S.data,d.WORKER_ID===void 0&&S&&(d.WORKER_ID=S.workerId),typeof S.input=="string"?r.postMessage({workerId:d.WORKER_ID,results:d.parse(S.input,S.config),finished:!0}):(r.File&&S.input instanceof File||S.input instanceof Object)&&(S=d.parse(S.input,S.config))&&r.postMessage({workerId:d.WORKER_ID,results:S,finished:!0})}),(u.prototype=Object.create(m.prototype)).constructor=u,(h.prototype=Object.create(m.prototype)).constructor=h,(p.prototype=Object.create(p.prototype)).constructor=p,(v.prototype=Object.create(m.prototype)).constructor=v,d})})(WV);var cve=WV.exports;const HV=Qs(cve),XP=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function VV(e){const t=new Date(e);if(isNaN(t.getTime()))return"?";const n=t.getDay(),r=t.getHours(),a=t.getMinutes(),i=`${String(r).padStart(2,"0")}:${String(a).padStart(2,"0")}`;return`${XP[n]??n} ${i}`}function US(e){var a,i;const t=((a=e["Event title"])==null?void 0:a.trim())??"",n=(i=e["Event starts"])==null?void 0:i.trim(),r=n?VV(n):"?";return`${t}|${r}`}function dve(e){const t=e.startTime??"09:00";let n={};try{const i=JSON.parse(t);typeof i=="object"&&i!==null&&!Array.isArray(i)?n=i:n={[e.dayOfWeek]:t}}catch{n={[e.dayOfWeek]:t}}if(e.frequency==="weekly"){const i=e.dayOfWeek,o=n[String(i)]??Object.values(n)[0]??t;return`${XP[i]??i} ${o}`}let r=[];try{r=e.enabledDays?JSON.parse(e.enabledDays):[1,2,3,4,5]}catch{r=[1,2,3,4,5]}const a=[];for(const i of r.sort((o,l)=>o-l)){const o=n[String(i)]??Object.values(n)[0]??t;a.push(`${XP[i]??i} ${o}`)}return a.join(", ")}function uve({isOpen:e,onClose:t}){const[n,r]=f.useState(1),[a,i]=f.useState(null),[o,l]=f.useState(""),[c,d]=f.useState([]),[m,u]=f.useState([]),[h,p]=f.useState({}),[v,y]=f.useState([]),[g,x]=f.useState(null),{toast:b}=Yt(),w=jn(),{data:j=[]}=Ue({queryKey:["/api/admin/classes"]}
682),{data:N=[]}=Ue({queryKey:["/api/admin/services"]}),C=xt({mutationFn:async k=>{const F=await Pe("POST","/api/admin/import/bookwhen",k);if(!F.ok){const W=await F.json();throw new Error(W.message||"Import failed")}return F.json()},onSuccess:k=>{x(k.stats),r(4),w.invalidateQueries({queryKey:["/api/admin/bookings"]}),w.invalidateQueries({queryKey:["/api/clients"]}),b({title:"Import Successful",description:k.message})},onError:k=>{b({title:"Import Failed",description:k.message||"Failed to import CSV data",variant:"destructive"})}}),P=k=>{var q;const F=(q=k.target.files)==null?void 0:q[0];if(!F)return;if(!F.name.endsWith(".csv")){b({title:"Invalid File",description:"Please upload a CSV file",variant:"destructive"});return}i(F);const W=new FileReader;W.onload=H=>{var re;const _=(re=H.target)==null?void 0:re.result;l(_);const L=HV.parse(_,{header:!0,skipEmptyLines:!0,transformHeader:R=>R.trim()});if(L.errors.length>0){y(L.errors.map(R=>R.message)),b({title:"CSV Parse Errors",description:`Found ${L.errors.length} parsing errors`,variant:"destructive"});return}if(d(L.data),y([]),L.data.length>0){const R=Object.keys(L.data[0]),M=["Event title","EventID","Attended?","Event starts","Event ends"].filter(Q=>!R.includes(Q));if(M.length>0){y([`This doesn't appear to be a Bookwhen attendance export. Missing required columns: ${M.join(", ")}`]),b({title:"Invalid CSV Format",description:`Missing required columns: ${M.join(", ")}. Please make sure you've exported the 'Attendance' report from Bookwhen.`,variant:"destructive"});return}if(!(R.includes("Attendee email")||R.includes("Contact email"))){y(["This CSV is missing email columns. Expected 'Attendee email' or 'Contact email'."]),b({title:"Invalid CSV Format",description:"Missing email columns. Please make sure you've exported the full attendance report from Bookwhen.",variant:"destructive"});return}}const U={};L.data.forEach(R=>{var te,G,Z,ie;const Y=(te=R.EventID)==null?void 0:te.trim(),M=(G=R["Event title"])==null?void 0:G.trim(),se=(Z=R["Event starts"])==null?void 0:Z.trim();if(((ie=R["Event cancelled"])==null?void 0:ie.toLowerCase())==="true"||!Y||!M||!se)return;const Q=US(R);U[Q]||(U[Q]={title:M,dayTimeLabel:VV(se),count:0}),U[Q].count+=1});const J=Object.entries(U).map(([R,Y])=>({slotKey:R,title:Y.title,dayTimeLabel:Y.dayTimeLabel,count:Y.count}));J.sort((R,Y)=>{const M=R.title.localeCompare(Y.title);return M!==0?M:R.dayTimeLabel.localeCompare(Y.dayTimeLabel)}),u(J);const I={};J.forEach(R=>{I[R.slotKey]=null}),p(I)},W.readAsText(F)},S=()=>{n===1&&a&&c.length>0?r(2):n===2&&Object.values(h).every(k=>k!==null)&&r(3)},E=()=>{n>1&&r(n-1)},T=()=>{const k={},F={};c.forEach(W=>{var L,U;const q=(L=W.EventID)==null?void 0:L.trim();if(!q||((U=W["Event cancelled"])==null?void 0:U.toLowerCase())==="true")return;const H=US(W),_=h[H];_&&(_.startsWith("class-")?k[q]=parseInt(_.slice(6),10):_.startsWith("service-")&&(F[q]=parseInt(_.slice(8),10)))}),C.mutate({csvData:o,mapping:k,serviceMapping:F})},z=()=>{r(1),i(null),l(""),d([]),u([]),p({}),y([]),x(null)},O=()=>n===1?a&&c.length>0&&v.length===0:n===2?Object.values(h).every(k=>k!=null&&k!==""):!1,D=()=>{let k=0;return c.forEach(F=>{var U,J,I,re,R;const W=(U=F["Event title"])==null?void 0:U.trim(),q=(J=F.EventID)==null?void 0:J.trim(),H=(I=F["Attendee email"])==null?void 0:I.trim(),_=(re=F["Contact email"])==null?void 0:re.trim();(((R=F["Event cancelled"])==null?void 0:R.toLowerCase())==="true"||!W||!q||!H&&!_)&&k++}),k};return s.jsx(Ct,{open:e,onOpenChange:t,children:s.jsxs(St,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Import Bookings from Bookwhen"}),s.jsx(yn,{children:"Import attendance data from Bookwhen CSV export"})]}),s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"flex items-center space-x-4 mb-2",children:[1,2,3,4].map(k=>s.jsx("div",{className:`flex items-center justify-center w-8 h-8 rounded-full border-2 ${k===n?"border-blue-600 bg-blue-600 text-white":k<n?"border-green-600 bg-green-600 text-white":"border-gray-300 bg-gray-100 text-gray-500"}`,children:k<n?s.jsx(qt,{className:"h-4 w-4"}):k},k))}),s.jsxs("div",{className:"flex justify-between text-sm text-gray-600",children:[s.jsx("span",{children:"Upload"}),s.jsx("span",{children:"Map Events"}),s.jsx("span",{children:"Preview"}),s.jsx("span",{children:"Complete"})]})]}),n===1&&s.jsx("div",{className:"space-y-6",children:s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center",children:[s.jsx(ad,{
682className:"h-5 w-5 mr-2"}),"Upload Bookwhen Attendance CSV"]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center",children:[s.jsx(me,{type:"file",accept:".csv",onChange:P,className:"mb-4"}),s.jsx("p",{className:"text-sm text-gray-600",children:"Select your Bookwhen attendance export CSV file"})]}),s.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:s.jsxs("div",{className:"flex items-start",children:[s.jsx(Mr,{className:"h-5 w-5 text-blue-600 mr-2 mt-0.5"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-blue-800",children:"Create your classes first"}),s.jsx("p",{className:"text-sm text-blue-700",children:"You'll map Bookwhen events to existing Classta classes in the next step. Make sure you've created your classes before importing."})]})]})}),a&&c.length>0&&s.jsx(Ce,{children:s.jsxs(Ee,{className:"pt-6",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"File"}),s.jsx("p",{className:"text-sm text-gray-600",children:a.name})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Rows"}),s.jsx("p",{className:"text-sm text-gray-600",children:c.length})]})]}),m.length>0&&s.jsxs("div",{className:"mt-4",children:[s.jsx(V,{className:"text-sm font-medium",children:"Event slots (by day and time)"}),s.jsx("div",{className:"mt-2 space-y-1 max-h-48 overflow-y-auto",children:m.map(k=>s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsxs("span",{className:"text-gray-700",children:[k.title," — ",k.dayTimeLabel]}),s.jsxs(Je,{variant:"secondary",children:[k.count," occurrences"]})]},k.slotKey))})]}),D()>0&&s.jsx("div",{className:"mt-4 p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx(Mr,{className:"h-4 w-4 text-yellow-600 mr-2"}),s.jsxs("span",{className:"text-sm text-yellow-800",children:[D()," rows will be skipped (missing emails or cancelled events)"]})]})})]})}),v.length>0&&s.jsx(Ce,{className:"border-red-200",children:s.jsxs(Ee,{className:"pt-6",children:[s.jsxs("div",{className:"flex items-center mb-2",children:[s.jsx(Mr,{className:"h-4 w-4 text-red-600 mr-2"}),s.jsx("span",{className:"text-sm font-medium text-red-800",children:"Parse Errors"})]}),s.jsx("ul",{className:"text-sm text-red-700 space-y-1",children:v.map((k,F)=>s.jsxs("li",{children:["• ",k]},F))})]})})]})]})}),n===2&&s.jsx("div",{className:"space-y-6",children:s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Map Events to Classes"}),s.jsx(Ys,{children:"Map each Bookwhen event to an existing Classta class or service"})]}),s.jsxs(Ee,{children:[s.jsx("div",{className:"space-y-4",children:m.map(k=>s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:k.title}),s.jsxs("p",{className:"text-sm text-gray-600",children:[k.dayTimeLabel," — ",k.count," occurrences"]})]}),s.jsx("div",{className:"w-80 min-w-0",children:s.jsxs(Bt,{value:h[k.slotKey]??"",onValueChange:F=>{p({...h,[k.slotKey]:F})},children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"Select class or service..."})}),s.jsxs(It,{children:[j.map(F=>s.jsxs(ce,{value:`class-${F.id}`,children:[F.name," — ",dve(F)]},`class-${F.id}`)),N.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground border-t mt-1 pt-1",children:"Services"}),N.map(F=>s.jsxs(ce,{value:`service-${F.id}`,children:["Service: ",F.name]},`service-${F.id}`))]})]})]})})]},k.slotKey))}),s.jsxs("div",{className:"mt-6 space-y-4",children:[s.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:s.jsxs("div",{className:"flex items-start",children:[s.jsx(Mr,{className:"h-5 w-5 text-amber-600 mr-2 mt-0.5"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-amber-800",children:"Important: Class Schedule Matching"}),s.jsx("p",{className:"text-sm text-amber-700",children:"The imported times from Bookwhen will be used for the bookings. Make sure you select Classta classes that match the original schedules."})]})]})}),s.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:s.jsxs("div",{className:"flex items-start",children:[s.jsx(Mr,{className:"h-5 w-5 text-blue-600 mr-2 mt-0.5"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-blue-800",children:"Can't find a match?"}),s.jsx("p",{className:"text-sm text-blue-700",children:"Cancel and create the class in /admin → Classes, then come back."})]})]})})]})]})]})}),n===3&&s.jsx("div",{className:"space-y-6",children:s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Import Preview"}),s.jsx(Ys,{children:"Review what will be imported"})]}),s.jsxs(Ee,{children:[s.jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4 mb-6",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx(Mr,{className:"h-5 w-5 text-yellow-600 mr-2"}),s.jsx("span",{className:"text-sm font-medium text-yellow-800",children:"No changes have been made yet. Review below, then click Confirm Import."})]})}),s.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[s.jsx(Ce,{children:s.jsxs(Ee,{className:"pt-6 text-center",children:[s.jsx(sr,{className:"h-8 w-8 mx-auto text-blue-600 mb-2"}),s.jsx("p",{className:"text-2xl font-bold text-blue-600",children:new Set(c.map(k=>{var F;return(F=k["Attendee email"]||k["Contact email"])==null?void 0:F.toLowerCase().trim()}
682).filter(Boolean)).size}),s.jsx("p",{className:"text-sm text-gray-600",children:"Customers to create/update"})]})}),s.jsx(Ce,{children:s.jsxs(Ee,{className:"pt-6 text-center",children:[s.jsx(Ls,{className:"h-8 w-8 mx-auto text-green-600 mb-2"}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:c.filter(k=>{var F,W;return((F=k["Event cancelled"])==null?void 0:F.toLowerCase())!=="true"&&((W=k["Event title"])==null?void 0:W.trim())&&(k["Attendee email"]||k["Contact email"])&&h[US(k)]}).length}),s.jsx("p",{className:"text-sm text-gray-600",children:"Bookings to create"})]})}),s.jsx(Ce,{children:s.jsxs(Ee,{className:"pt-6 text-center",children:[s.jsx(qt,{className:"h-8 w-8 mx-auto text-purple-600 mb-2"}),s.jsx("p",{className:"text-2xl font-bold text-purple-600",children:c.filter(k=>{var F,W;return((F=k["Attended?"])==null?void 0:F.trim())||((W=k["Attendance status"])==null?void 0:W.toLowerCase())==="complete"}).length}),s.jsx("p",{className:"text-sm text-gray-600",children:"Attendance statuses to set"})]})})]}),D()>0&&s.jsx(Ce,{className:"border-yellow-200",children:s.jsxs(Ee,{className:"pt-6",children:[s.jsxs("div",{className:"flex items-center mb-2",children:[s.jsx(Mr,{className:"h-4 w-4 text-yellow-600 mr-2"}),s.jsxs("span",{className:"text-sm font-medium text-yellow-800",children:["Skipped Rows (",D(),")"]})]}),s.jsx("p",{className:"text-sm text-yellow-700",children:"Rows will be skipped due to missing emails, cancelled events, or invalid dates."})]})})]})]})}),n===4&&g&&s.jsx("div",{className:"space-y-6",children:s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center text-green-600",children:[s.jsx(qt,{className:"h-5 w-5 mr-2"}),"Import Complete"]})}),s.jsxs(Ee,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-6",children:[s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Customers Created"}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:g.customersCreated})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Customers Updated"}),s.jsx("p",{className:"text-2xl font-bold text-blue-600",children:g.customersUpdated})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Bookings Created"}),s.jsx("p",{className:"text-2xl font-bold text-purple-600",children:g.bookingsCreated})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Attendance Set"}),s.jsx("p",{className:"text-2xl font-bold text-orange-600",children:g.attendanceSet})]})]}),g.skipped>0&&s.jsxs("div",{className:"mb-4",children:[s.jsx(V,{className:"text-sm font-medium",children:"Skipped Rows"}),s.jsx("p",{className:"text-lg font-semibold text-yellow-600",children:g.skipped})]}),g.errors.length>0&&s.jsx(Ce,{className:"border-red-200",children:s.jsxs(Ee,{className:"pt-6",children:[s.jsxs("div",{className:"flex items-center mb-2",children:[s.jsx(Mr,{className:"h-4 w-4 text-red-600 mr-2"}),s.jsx("span",{className:"text-sm font-medium text-red-800",children:"Import Errors"})]}),s.jsx("ul",{className:"text-sm text-red-700 space-y-1 max-h-32 overflow-y-auto",children:g.errors.map((k,F)=>s.jsxs("li",{children:["• ",k]},F))})]})})]})]})}),s.jsxs("div",{className:"flex justify-between pt-6",children:[s.jsx("div",{children:n>1&&n<4&&s.jsxs(B,{variant:"outline",onClick:E,children:[s.jsx(xr,{className:"h-4 w-4 mr-2"}),"Back"]})}),s.jsx("div",{className:"flex space-x-2",children:n===4?s.jsxs(s.Fragment,{children:[s.jsx(B,{variant:"outline",onClick:t,children:"Close"}),s.jsx(B,{onClick:z,children:"Import Another File"})]}):s.jsxs(s.Fragment,{children:[s.jsx(B,{variant:"outline",onClick:t,children:"Cancel"}),n<3&&s.jsxs(B,{onClick:S,disabled:!O(),children:["Continue",s.jsx(qn,{className:"h-4 w-4 ml-2"})]}),n===3&&s.jsx(B,{onClick:T,disabled:C.isPending,children:C.isPending?"Importing...":"Confirm Import"})]})})]})]})})}function mve({isOpen:e,onClose:t}){const[n,r]=f.useState(1),[a,i]=f.useState(null),[o,l]=f.useState(""),[c,d]=f.useState([]),[m,u]=f.useState([]),[h,p]=f.useState({}),[v,y]=f.useState([]),[g,x]=f.useState(null),{toast:b}=Yt(),w=jn(),{data:j=[]}=Ue({queryKey:["/api/admin/classes"]}
682),N=xt({mutationFn:async D=>{const k=await Pe("POST","/api/admin/import/generic",D);if(!k.ok){const F=await k.json();throw new Error(F.message||"Import failed")}return k.json()},onSuccess:D=>{x(D.stats),r(4),w.invalidateQueries({queryKey:["/api/admin/bookings"]}),w.invalidateQueries({queryKey:["/api/clients"]}),b({title:"Import Successful",description:D.message})},onError:D=>{b({title:"Import Failed",description:D.message||"Failed to import CSV data",variant:"destructive"})}}),C=D=>{var W;const k=(W=D.target.files)==null?void 0:W[0];if(!k)return;if(!k.name.endsWith(".csv")){b({title:"Invalid File",description:"Please upload a CSV file",variant:"destructive"});return}i(k);const F=new FileReader;F.onload=q=>{var I;const H=(I=q.target)==null?void 0:I.result;l(H);const _=HV.parse(H,{header:!0,skipEmptyLines:!0,transformHeader:re=>re.trim().toLowerCase()});if(_.errors.length>0){y(_.errors.map(re=>re.message)),b({title:"CSV Parse Errors",description:`Found ${_.errors.length} parsing errors`,variant:"destructive"});return}if(d(_.data),y([]),_.data.length>0){const re=Object.keys(_.data[0]),Y=["email","class_name","date","time"].filter(M=>!re.includes(M));if(Y.length>0){y([`Missing required columns: ${Y.join(", ")}. Required columns: email, class_name, date, time. Optional columns: firstname, surname, phone`]),b({title:"Invalid CSV Format",description:`Missing required columns: ${Y.join(", ")}`,variant:"destructive"});return}}const L={};_.data.forEach(re=>{var Y;const R=(Y=re.class_name)==null?void 0:Y.trim();R&&(L[R]=(L[R]||0)+1)});const U=Object.entries(L).map(([re,R])=>({name:re,count:R}));u(U);const J={};U.forEach(re=>{J[re.name]=null}),p(J)},F.readAsText(k)},P=()=>{n===1&&a&&c.length>0?r(2):n===2&&Object.values(h).every(D=>D!==null)&&r(3)},S=()=>{n>1&&r(n-1)},E=()=>{N.mutate({csvData:o,mapping:h})},T=()=>{r(1),i(null),l(""),d([]),u([]),p({}),y([]),x(null)},z=()=>n===1?a&&c.length>0&&v.length===0:n===2?Object.values(h).every(D=>D!==null):!1,O=()=>{let D=0;return c.forEach(k=>{var _,L,U,J;const F=(_=k.email)==null?void 0:_.trim(),W=(L=k.class_name)==null?void 0:L.trim(),q=(U=k.date)==null?void 0:U.trim(),H=(J=k.time)==null?void 0:J.trim();(!F||!W||!q||!H)&&D++}),D};return s.jsx(Ct,{open:e,onOpenChange:t,children:s.jsxs(St,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Import Bookings from CSV"}),s.jsx(yn,{children:"Import bookings from a generic CSV file with columns: email, firstname, surname, phone, class_name, date, time"})]}),s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"flex items-center space-x-4 mb-2",children:[1,2,3,4].map(D=>s.jsx("div",{className:`flex items-center justify-center w-8 h-8 rounded-full border-2 ${D===n?"border-blue-600 bg-blue-600 text-white":D<n?"border-green-600 bg-green-600 text-white":"border-gray-300 bg-gray-100 text-gray-500"}`,children:D<n?s.jsx(qt,{className:"h-4 w-4"}):D},D))}),s.jsxs("div",{className:"flex justify-between text-sm text-gray-600",children:[s.jsx("span",{children:"Upload"}),s.jsx("span",{children:"Map Classes"}),s.jsx("span",{children:"Preview"}),s.jsx("span",{children:"Complete"})]})]}),n===1&&s.jsx("div",{className:"space-y-6",children:s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center",children:[s.jsx(ad,{className:"h-5 w-5 mr-2"}),"Upload CSV File"]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center",children:[s.jsx(me,{type:"file",accept:".csv",onChange:C,className:"mb-4"}),s.jsx("p",{className:"text-sm text-gray-600",children:"Select your CSV file with columns: email, firstname, surname, phone, class_name, date, time"})]}),s.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:s.jsxs("div",{className:"flex items-start",children:[s.jsx(Mr,{className:"h-5 w-5 text-blue-600 mr-2 mt-0.5"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-blue-800",children:"CSV Format Requirements"}),s.jsxs("p",{className:"text-sm text-blue-700",children:["Required columns: ",s.jsx("strong",{children:"email"}),", ",s.jsx("strong",{children:"class_name"}),", ",s.jsx("strong",{children:"date"}),", ",s.jsx("strong",{children:"time"}),s.jsx("br",{}),"Optional columns: ",s.jsx("strong",{children:"firstname"}),", ",s.jsx("strong",{children:"surname"}),", ",s.jsx("strong",{children:"phone"}),s.jsx("br",{}),"Date format: YYYY-MM-DD or any standard date format",s.jsx("br",{}),"Time format: HH:MM or HH:MM:SS (24-hour format)"]})]})]})}),s.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:s.jsxs("div",{className:"flex items-start",children:[s.jsx(Mr,{className:"h-5 w-5 text-amber-600 mr-2 mt-0.5"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-amber-800",children:"Create your classes first"}),s.jsx("p",{className:"text-sm text-amber-700",children:"You'll map CSV class names to existing Classta classes in the next step. Make sure you've created your classes before importing."})]})]})}),a&&c.length>0&&s.jsx(Ce,{children:s.jsxs(Ee,{className:"pt-6",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"File"}),s.jsx("p",{className:"text-sm text-gray-600",children:a.name})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Rows"}),s.jsx("p",{className:"text-sm text-gray-600",children:c.length})]})]}),m.length>0&&s.jsxs("div",{className:"mt-4",children:[s.jsx(V,{className:"text-sm font-medium",children:"Class Names Found"}),s.jsx("div",{className:"mt-2 space-y-1",children:m.map(D=>s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-gray-700",children:D.name}),s.jsxs(Je,{variant:"secondary",children:[D.count," occurrences"]})]},D.name))})]}),O()>0&&s.jsx("div",{className:"mt-4 p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx(Mr,{className:"h-4 w-4 text-yellow-600 mr-2"}),s.jsxs("span",{className:"text-sm text-yellow-800",children:[O()," rows will be skipped (missing required fields)"]})]})})]})}),v.length>0&&s.jsx(Ce,{className:"border-red-200",children:s.jsxs(Ee,{className:"pt-6",children:[s.jsxs("div",{className:"flex items-center mb-2",children:[s.jsx(Mr,{className:"h-4 w-4 text-red-600 mr-2"}),s.jsx("span",{className:"text-sm font-medium text-red-800",children:"Parse Errors"})]}),s.jsx("ul",{className:"text-sm text-red-700 space-y-1",children:v.map((D,k)=>s.jsxs("li",{children:["• ",D]},k))})]})})]})]})}),n===2&&s.jsx("div",{className:"space-y-6",children:s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Map Classes"}),s.jsx(Ys,{children:"Map each CSV class name to an existing Classta class"})]}),s.jsxs(Ee,{children:[s.jsx("div",{className:"space-y-4",children:m.map(D=>{var k;return s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:D.name}),s.jsxs("p",{className:"text-sm text-gray-600",children:[D.count," occurrences"]})]}),s.jsx("div",{className:"w-64",children:s.jsxs(Bt,{value:((k=h[D.name])==null?void 0:k.toString())||"",onValueChange:F=>{p({...h,[D.name]:parseInt(F)})},children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"Select class..."})}),s.jsx(It,{children:j.map(F=>s.jsx(ce,{value:F.id.toString(),children:F.name},F.id))})]})})]},D.name)})}),s.jsx("div",{className:"mt-6 space-y-4",children:s.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:s.jsxs("div",{className:"flex items-start",children:[s.jsx(Mr,{className:"h-5 w-5 text-blue-600 mr-2 mt-0.5"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-blue-800",children:"Can't find a match?"}),s.jsx("p",{className:"text-sm text-blue-700",children:"Cancel and create the class in /admin → Classes, then come back."})]})]})})})]})]})}),n===3&&s.jsx("div",{className:"space-y-6",children:s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Import Preview"}),s.jsx(Ys,{children:"Review what will be imported"})]}),s.jsxs(Ee,{children:[s.jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4 mb-6",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx(Mr,{className:"h-5 w-5 text-yellow-600 mr-2"}),s.jsx("span",{className:"text-sm font-medium text-yellow-800",children:"No changes have been made yet. Review below, then click Confirm Import."})]})}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-6",children:[s.jsx(Ce,{children:s.jsxs(Ee,{className:"pt-6 text-center",children:[s.jsx(sr,{className:"h-8 w-8 mx-auto text-blue-600 mb-2"}),s.jsx("p",{className:"text-2xl font-bold text-blue-600",children:new Set(c.map(D=>{var k;return(k=D.email)==null?void 0:k.toLowerCase().trim()}
682).filter(Boolean)).size}),s.jsx("p",{className:"text-sm text-gray-600",children:"Customers to create/update"})]})}),s.jsx(Ce,{children:s.jsxs(Ee,{className:"pt-6 text-center",children:[s.jsx(Ls,{className:"h-8 w-8 mx-auto text-green-600 mb-2"}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:c.filter(D=>{var k,F,W,q;return((k=D.email)==null?void 0:k.trim())&&((F=D.class_name)==null?void 0:F.trim())&&((W=D.date)==null?void 0:W.trim())&&((q=D.time)==null?void 0:q.trim())}).length}),s.jsx("p",{className:"text-sm text-gray-600",children:"Bookings to create"})]})})]}),O()>0&&s.jsx(Ce,{className:"border-yellow-200",children:s.jsxs(Ee,{className:"pt-6",children:[s.jsxs("div",{className:"flex items-center mb-2",children:[s.jsx(Mr,{className:"h-4 w-4 text-yellow-600 mr-2"}),s.jsxs("span",{className:"text-sm font-medium text-yellow-800",children:["Skipped Rows (",O(),")"]})]}),s.jsx("p",{className:"text-sm text-yellow-700",children:"Rows will be skipped due to missing required fields (email, class_name, date, or time)."})]})})]})]})}),n===4&&g&&s.jsx("div",{className:"space-y-6",children:s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center text-green-600",children:[s.jsx(qt,{className:"h-5 w-5 mr-2"}),"Import Complete"]})}),s.jsxs(Ee,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-6",children:[s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Customers Created"}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:g.customersCreated})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Customers Updated"}),s.jsx("p",{className:"text-2xl font-bold text-blue-600",children:g.customersUpdated})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Bookings Created"}),s.jsx("p",{className:"text-2xl font-bold text-purple-600",children:g.bookingsCreated})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Skipped"}),s.jsx("p",{className:"text-2xl font-bold text-yellow-600",children:g.skipped})]})]}),g.errors.length>0&&s.jsx(Ce,{className:"border-red-200",children:s.jsxs(Ee,{className:"pt-6",children:[s.jsxs("div",{className:"flex items-center mb-2",children:[s.jsx(Mr,{className:"h-4 w-4 text-red-600 mr-2"}),s.jsx("span",{className:"text-sm font-medium text-red-800",children:"Import Errors"})]}),s.jsx("ul",{className:"text-sm text-red-700 space-y-1 max-h-32 overflow-y-auto",children:g.errors.map((D,k)=>s.jsxs("li",{children:["• ",D]},k))})]})})]})]})}),s.jsxs("div",{className:"flex justify-between pt-6",children:[s.jsx("div",{children:n>1&&n<4&&s.jsxs(B,{variant:"outline",onClick:S,children:[s.jsx(xr,{className:"h-4 w-4 mr-2"}),"Back"]})}),s.jsx("div",{className:"flex space-x-2",children:n===4?s.jsxs(s.Fragment,{children:[s.jsx(B,{variant:"outline",onClick:t,children:"Close"}),s.jsx(B,{onClick:T,children:"Import Another File"})]}):s.jsxs(s.Fragment,{children:[s.jsx(B,{variant:"outline",onClick:t,children:"Cancel"}),n<3&&s.jsxs(B,{onClick:P,disabled:!z(),children:["Continue",s.jsx(qn,{className:"h-4 w-4 ml-2"})]}),n===3&&s.jsx(B,{onClick:E,disabled:N.isPending,children:N.isPending?"Importing...":"Confirm Import"})]})})]})]})})}function hve(){const[e,t]=f.useState(!1),[n,r]=f.useState(null),[a,i]=f.useState(!1),[o,l]=f.useState(!1),c=()=>{n==="bookwhen"?(t(!1),i(!0)):n==="generic"&&(t(!1),l(!0))},d=()=>{t(!1),r(null)},m=()=>{i(!1),r(null)},u=()=>{l(!1),r(null)};return s.jsxs(s.Fragment,{children:[s.jsxs(Ct,{open:e,onOpenChange:t,children:[s.jsx(Jr,{asChild:!0,children:s.jsxs(B,{className:"hidden lg:flex",children:[s.jsx(id,{className:"h-4 w-4 mr-2"}),"Import"]})}),s.jsx(Jr,{asChild:!0,children:s.jsx(B,{size:"sm",className:"lg:hidden h-9 w-9 p-0",title:"Import Bookings",children:s.jsx(id,{className:"h-4 w-4"})})}),s.jsxs(St,{className:"max-w-md",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Import Bookings"}),s.jsx(yn,{children:"Select the type of data you want to import"})]}),s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium",children:"Import Type"}),s.jsxs(Bt,{value:n||"",onValueChange:h=>r(h),children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"Select import type..."})}),s.jsxs(It,{children:[s.jsx(ce,{value:"bookwhen",children:"Bookwhen Attendance Export"}),s.jsx(ce,{value:"generic",children:"Generic CSV (email, firstname, surname, phone, 
682class_name, date, time)"})]})]}),s.jsx("p",{className:"text-sm text-gray-600",children:"Got a different format, or need to import from somewhere else? Contact us"})]})}),s.jsxs("div",{className:"flex justify-end space-x-2",children:[s.jsx(B,{variant:"outline",onClick:d,children:"Cancel"}),s.jsx(B,{onClick:c,disabled:!n,children:"Continue"})]})]})]}),a&&s.jsx(uve,{isOpen:a,onClose:m}),o&&s.jsx(mve,{isOpen:o,onClose:u})]})}function fve({booking:e,isOpen:t,onClose:n,onConfirm:r,isProcessing:a,currency:i}){var C,P;const[o,l]=f.useState(!1),[c,d]=f.useState(""),[m,u]=f.useState(0),[h,p]=f.useState(!1);f.useEffect(()=>{if(!e){l(!1),d(""),u(0),p(!1);return}if(e.bookingType!=="single"||!!e.packageId||!!e.packageStartDate){l(!1),d(""),u(0),p(!1);return}const E=e.stripePaymentIntentId,T=E&&!E.startsWith("paypal_")&&!E.startsWith("cash_");if(p(!!T),T&&e.amount){const z=parseFloat(e.amount);u(z),d(z.toFixed(2))}else u(0),d("")},[e]);const v=S=>{const E=S.replace(/[^0-9.]/g,"");d(E)},y=()=>{if(o){const S=parseFloat(c);if(isNaN(S)||S<=0||S>m)return;r({refundEnabled:!0,refundAmount:S})}else r({refundEnabled:!1})},g=()=>{a||(l(!1),d(""),n())};if(!e)return null;const x=e.bookingType!=="single"||!!e.packageId||!!e.packageStartDate,b=mt(i||"GBP"),w=e.amount?parseFloat(e.amount):0,j=parseFloat(c)||0,N=!o||j>0&&j<=m;return s.jsx(Zi,{open:t,onOpenChange:g,children:s.jsxs(bi,{className:"sm:max-w-[500px]",children:[s.jsxs(wi,{children:[s.jsx(Ni,{children:"Cancel Booking"}),s.jsxs(Ci,{className:"space-y-2",children:[s.jsxs("div",{children:["Are you sure you want to cancel this booking? ",s.jsx("strong",{children:"This action cannot be undone."})]}),x&&s.jsx("div",{className:"text-sm text-amber-700 bg-amber-50 border border-amber-200 rounded p-2",children:"This is one session from a package. Cancelling will remove this session only; no refund is issued for individual package sessions."}),e.client&&s.jsxs("div",{className:"pt-2 border-t",children:[s.jsx("div",{className:"text-sm font-medium",children:"Booking Details:"}),s.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[s.jsxs("div",{children:[s.jsx("strong",{children:"Client:"})," ",e.client.name||e.client.email]}),s.jsxs("div",{children:[s.jsx("strong",{children:"Class/Service:"})," ",((C=e.service)==null?void 0:C.name)||((P=e.class)==null?void 0:P.name)||"N/A"]}),e.classDate&&s.jsxs("div",{children:[s.jsx("strong",{children:"Date:"})," ",new Date(e.classDate).toLocaleDateString("en-GB",{weekday:"short",year:"numeric",month:"short",day:"numeric"})]}),w>0&&s.jsxs("div",{children:[s.jsx("strong",{children:"Amount Paid:"})," ",b,w.toFixed(2)]})]})]})]})]}),h&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"refund-checkbox",checked:o,onCheckedChange:S=>{l(S===!0),S&&m>0?d(m.toFixed(2)):d("")},disabled:a}),s.jsx(V,{htmlFor:"refund-checkbox",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Issue refund for this booking"})]}),o&&s.jsxs("div",{className:"space-y-2 pl-6",children:[s.jsx(V,{htmlFor:"refund-amount",className:"text-sm",children:"Refund Amount"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("span",{className:"text-sm font-medium",children:b}),s.jsx(me,{id:"refund-amount",type:"text",value:c,onChange:S=>v(S.target.value),placeholder:"0.00",disabled:a,className:N?"":"border-red-500"})]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Maximum refundable: ",b,m.toFixed(2)]}),!N&&o&&s.jsxs("p",{className:"text-xs text-red-500",children:["Please enter a valid amount between ",b,"0.01 and"," ",b,m.toFixed(2)]})]})]}),s.jsxs(ji,{children:[s.jsx(B,{variant:"outline",onClick:g,disabled:a,children:"Close"}),s.jsx(B,{variant:"destructive",onClick:y,disabled:a||o&&!N,children:a?"Processing...":"Cancel Booking"})]})]})})}function pve(e){var a,i,o,l;const t=((a=e.client)==null?void 0:a.name)||((i=e.client)==null?void 0:i.email)||"Unknown",n=((o=e.service)==null?void 0:o.name)||((l=e.class)==null?void 0:l.name)||"Session",r=e.classDate?new Date(e.classDate).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short",year:"numeric"}):"";return`${t} · ${n}${r?` · ${r}`:""}`}function KV({booking:e,open:t,onOpenChange:n,onSaved:r}){const[a,i]=f.useState(""),[o,l]=f.useState(!1),[c,d]=f.useState(null);f.useEffect(()=>{e&&(i(e.notes??""),d(null))},[e,t]);const m=async()=>
682{if(e){l(!0),d(null);try{const u=await Pe("PATCH",`/api/bookings/${e.id}`,{notes:a.trim()||null});if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(h.message||"Failed to save notes")}r==null||r(),n(!1)}catch(u){d((u==null?void 0:u.message)||"Failed to save notes")}finally{l(!1)}}};return e?s.jsx(Ct,{open:t,onOpenChange:n,children:s.jsxs(St,{className:"sm:max-w-md",children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Booking notes"})}),s.jsx("p",{className:"text-sm text-slate-600 mb-2",children:pve(e)}),s.jsx(Is,{value:a,onChange:u=>i(u.target.value),placeholder:"Address, session type, special requirements...",rows:5,className:"resize-none"}),c&&s.jsx("p",{className:"text-sm text-red-600",children:c}),s.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[s.jsx(B,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),s.jsx(B,{onClick:m,disabled:o,children:o?"Saving...":"Save"})]})]})}):null}function xve({class:e,date:t,bookings:n,onClientClick:r,currency:a,getPaymentMethod:i,onMarkAttended:o,onEdit:l,onDelete:c,onMarkPaid:d,isMarkingAttended:m,isDeleting:u,termSingular:h,classes:p,onClose:v,onClientClickWithClose:y,hideRevenue:g=!1}){const x=D=>{if(!D||D==="undefined")return"TBD";const[k,F]=D.split(":");if(!k||!F||isNaN(parseInt(k))||isNaN(parseInt(F)))return"TBD";const W=parseInt(k),q=W===0?12:W>12?W-12:W,H=W>=12?"PM":"AM";return`${q}:${F} ${H}`},b=()=>{if(!("startTime"in e)){if(n.length>0){const D=new Date(n[0].classDate),k=D.getHours().toString().padStart(2,"0"),F=D.getMinutes().toString().padStart(2,"0");return`${k}:${F}`}return"09:00"}if(e.startTime){if(e.frequency==="daily")try{const D=JSON.parse(e.startTime);if(typeof D=="object"&&D!==null){const k=t.getDay();return D[k.toString()]||Object.values(D)[0]||"09:00"}}catch{}return e.startTime||"09:00"}return"09:00"},w="name"in e?e.name:"Service",j=b(),N=x(j),[C,P]=f.useState(!1),[S,E]=f.useState(null),T=jn(),z=async()=>{try{const D=localStorage.getItem("auth_token");if(!D){alert("You must be logged in to print");return}const[k,F]=await Promise.all([fetch("/api/admin/memberships",{headers:{Authorization:`Bearer ${D}`},credentials:"include"}),fetch("/api/admin/member-subscriptions",{headers:{Authorization:`Bearer ${D}`},credentials:"include"})]);let W=new Map;if(k.ok&&F.ok){const H=await k.json();(await F.json()).filter(L=>L.status==="active").forEach(L=>{var J;const U=H.find(I=>I.id===L.membershipId);if(U){const I=((J=L.email)==null?void 0:J.toLowerCase())||"";W.has(I)||W.set(I,[]),W.get(I).push(U.name)}})}const q={className:w,date:t.toLocaleDateString("en-GB",{weekday:"long",year:"numeric",month:"long",day:"numeric"}),time:N,bookings:n.map(H=>{var J,I,re,R,Y,M,se;const _=i(H),L=((I=(J=H.client)==null?void 0:J.email)==null?void 0:I.toLowerCase())||"",U=W.get(L)||[];return{clientName:((re=H.client)==null?void 0:re.name)||((R=H.client)==null?void 0:R.email)||"Unknown",clientEmail:((Y=H.client)==null?void 0:Y.email)||void 0,clientPhone:((se=(M=H.client)==null?void 0:M.phone)==null?void 0:se.trim())||void 0,paymentMethod:_?_==="stripe"?"Stripe":_==="paypal"?"PayPal":_==="bundle"?"Bundle":_==="free"?"Free":"Cash":null,amount:H.amount?parseFloat(H.amount.toString()).toFixed(2):null,bookingType:H.bookingType,memberships:U.join(", ")||null,notes:H.notes&&H.notes.trim()?H.notes.trim():null}}),currency:a||"GBP"};localStorage.setItem("print_class_register_data",JSON.stringify(q)),window.open("/admin/print-class-register","_blank")}catch(D){console.error("Error fetching membership data:",D);const k={className:w,date:t.toLocaleDateString("en-GB",{weekday:"long",year:"numeric",month:"long",day:"numeric"}),time:N,bookings:n.map(F=>{var q,H,_,L,U;const W=i(F);return{clientName:((q=F.client)==null?void 0:q.name)||((H=F.client)==null?void 0:H.email)||"Unknown",clientEmail:((_=F.client)==null?void 0:_.email)||void 0,clientPhone:((U=(L=F.client)==null?void 0:L.phone)==null?void 0:U.trim())||void 0,paymentMethod:W?W==="stripe"?"Stripe":W==="paypal"?"PayPal":W==="bundle"?"Bundle":W==="free"?"Free":"Cash":null,amount:F.amount?parseFloat(F.amount.toString()).toFixed(2):null,bookingType:F.bookingType,memberships:null,notes:F.notes&&F.notes.trim()?F.notes.trim():null}}),currency:a||"GBP"};localStorage.setItem("print_class_register_data",JSON.stringify(k)),window.open("/admin/print-class-register","_blank")}},O=async()=>{const D=prompt("Enter email address to send the class register to:");if(!D)return;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(D)){alert("Please enter a valid email address");return}P(!0);try{const F="id"in e?e.id:null;if(!F)throw new Error("Class or service ID not found");const W=t.toISOString().split("T")[0],q=localStorage.getItem("auth_token");if(!q){alert("You must be logged in to send emails"),P(!1);return}const _=!("startTime"in e)?`/api/services/service/${F}/register/email`:`/api/classes/${F}/register/email`,L=await fetch(_,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${q}`},credentials:"include",body:JSON.stringify({date:W,email:D})});if(!L.ok){const U=await L.json();throw new Error(U.message||"Failed to send email")}alert("Class register sent by email successfully!")}catch(F){console.error("Error sending email:",F),alert(`Failed to send email: ${F.message||"Unknown error"}`)}finally{P(!1)}};return s.jsxs(Ct,{open:!0,onOpenChange:D=>
682{D||document.querySelector("[data-client-details-modal]")||v()},children:[s.jsxs(St,{className:"w-full max-w-3xl max-h-[90vh] overflow-y-auto overflow-x-hidden min-w-0",children:[s.jsxs(kt,{className:"flex-col sm:flex-row items-start sm:items-center justify-between space-y-1 sm:space-y-0",children:[s.jsxs(Pt,{className:"flex-1 min-w-0 pr-2 sm:pr-4",children:[w," - ",t.toLocaleDateString("en-GB",{weekday:"long",year:"numeric",month:"long",day:"numeric"})," at ",N]}),s.jsxs("div",{className:"flex gap-2 flex-shrink-0 sm:mr-12 self-end sm:self-center mb-0 sm:mb-auto",children:[s.jsxs(B,{variant:"outline",size:"sm",onClick:z,children:[s.jsx(Q2,{className:"h-4 w-4 mr-2"}),"Print"]}),s.jsxs(B,{variant:"outline",size:"sm",onClick:O,disabled:C,children:[s.jsx(_n,{className:"h-4 w-4 mr-2"}),C?"Sending...":"Email"]})]})]}),s.jsx("div",{className:"mt-2 sm:mt-4 min-w-0 overflow-hidden",children:n.length===0?s.jsx("p",{className:"text-center text-slate-500 py-8",children:"No bookings found"}):s.jsx("div",{className:"space-y-3 min-w-0",children:n.map(D=>{var W,q,H,_,L,U,J,I,re,R;const k=i(D),F=((W=D.client)==null?void 0:W.name)||((q=D.client)==null?void 0:q.email)||"Unknown";return s.jsx(Ce,{className:"min-w-0 overflow-hidden",children:s.jsxs(Ee,{className:"p-4 min-w-0",children:[s.jsxs("div",{className:"hidden lg:block space-y-3 min-w-0 overflow-hidden",children:[s.jsxs("div",{className:"flex items-center flex-wrap gap-2 min-w-0",children:[s.jsxs("div",{className:"flex items-center space-x-2 cursor-pointer hover:text-primary transition-colors",onClick:Y=>{Y.stopPropagation(),y?(v(),setTimeout(()=>{y(D.client)},100)):r(D.client)},children:[s.jsx(Dr,{className:"h-4 w-4 text-slate-400"}),s.jsx("span",{className:"font-medium",children:F})]}),((H=D.client)==null?void 0:H.email)&&s.jsx("span",{className:"text-sm text-slate-500",children:D.client.email}),((_=D.client)==null?void 0:_.phone)&&s.jsxs("span",{className:"text-sm text-slate-500",children:["• ",D.client.phone]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(Je,{variant:D.bookingType==="single"?"default":D.bookingType==="member"?"secondary":D.bookingType==="free"?"outline":"secondary",children:D.bookingType==="single"?"single":D.bookingType==="service"?"service":D.bookingType==="member"?"member":D.bookingType==="free"?"free":"package"}),k&&s.jsx(Je,{variant:"outline",className:k==="stripe"?"text-blue-600 border-blue-200 bg-blue-50":k==="paypal"?"text-indigo-600 border-indigo-200 bg-indigo-50":k==="bundle"?"text-orange-600 border-orange-200 bg-orange-50":k==="free"?"text-purple-600 border-purple-200 bg-purple-50":"text-gray-600 border-gray-200 bg-gray-50",children:k==="stripe"?"Stripe":k==="paypal"?"PayPal":k==="bundle"?"Bundle":k==="free"?"Free":"Cash"}),!g&&(D.bookingType==="single"||D.bookingType!=="single"&&D.stripePaymentIntentId)&&D.amount&&(()=>{const M=i(D)==="cash"&&!D.paid,se=D.paid;return s.jsxs(Je,{variant:"outline",className:`${se?"text-green-600 border-green-200 bg-green-50":M?"text-yellow-600 border-yellow-200 bg-yellow-50 cursor-pointer hover:bg-yellow-100":"text-green-600 border-green-200 bg-green-50"}`,onClick:M&&d?Q=>{Q.stopPropagation(),d(D)}:void 0,title:M?"Click to mark as paid":se?"Paid":void 0,children:[mt(a||"GBP"),parseFloat(D.amount.toString()).toFixed(2)]})})(),D.attended&&s.jsxs(Je,{variant:"outline",className:"text-green-600 border-green-200 bg-green-50",children:[s.jsx(qt,{className:"h-3 w-3 mr-1"}),"Attended"]})]})]}),s.jsx("div",{className:"min-w-0 w-full overflow-hidden",children:s.jsx("p",{role:"button",tabIndex:0,onClick:Y=>{Y.stopPropagation(),E(D)},onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),E(D))},title:(L=D.notes)!=null&&L.trim()?"View or edit notes":"Add notes",className:"text-sm text-slate-600 text-primary hover:underline cursor-pointer truncate block w-full min-w-0 m-0",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((U=D.notes)==null?void 0:U.trim())||"Add notes"})}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsxs(B,{variant:D.attended?"outline":"default",size:"sm",onClick:()=>o({bookingId:D.id,attended:!D.attended}),disabled:m,children:[s.jsx(qt,{className:"h-4 w-4 mr-1"}),D.attended?"Unmark":"Mark"," Attended"]}),!D.attended&&s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>l(D),className:"whitespace-nowrap",children:[s.jsx(Ur,{className:"h-4 w-4 mr-1"}),"Edit"]}),s.jsxs(B,{variant:"destructive",size:"sm",onClick:()=>c(D),disabled:u,className:"whitespace-nowrap",children:[s.jsx(ln,{className:"h-4 w-4 mr-1"}),"Cancel"]})]})]}),s.jsxs("div",{className:"lg:hidden space-y-3",children:[s.jsxs("div",{className:"flex items-start space-x-2 cursor-pointer hover:text-primary transition-colors",onClick:Y=>{Y.stopPropagation(),y?(v(),setTimeout(()=>{y(D.client)},100)):r(D.client)},children:[s.jsx(Dr,{className:"h-4 w-4 text-slate-400 mt-0.5 flex-shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"font-medium text-sm",children:F}),((J=D.client)==null?void 0:J.email)&&s.jsx("div",{className:"text-xs text-slate-500 break-all",children:D.client.email}),((I=D.client)==null?void 0:I.phone)&&s.jsx("div",{className:"text-xs text-slate-500",children:D.client.phone})]})]}),s.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[s.jsx(Je,{variant:D.bookingType==="single"?"default":D.bookingType==="member"?"secondary":D.bookingType==="free"?"outline":"secondary",className:"text-xs",children:D.bookingType==="single"?"single":D.bookingType==="service"?"service":D.bookingType==="member"?"member":D.bookingType==="free"?"free":"package"}
682),k&&s.jsx(Je,{variant:"outline",className:`text-xs ${k==="stripe"?"text-blue-600 border-blue-200 bg-blue-50":k==="paypal"?"text-indigo-600 border-indigo-200 bg-indigo-50":k==="bundle"?"text-orange-600 border-orange-200 bg-orange-50":k==="free"?"text-purple-600 border-purple-200 bg-purple-50":"text-gray-600 border-gray-200 bg-gray-50"}`,children:k==="stripe"?"Stripe":k==="paypal"?"PayPal":k==="bundle"?"Bundle":k==="free"?"Free":"Cash"}),!g&&(D.bookingType==="single"||D.bookingType!=="single"&&D.stripePaymentIntentId)&&D.amount&&s.jsxs(Je,{variant:"outline",className:"text-green-600 border-green-200 bg-green-50 text-xs",children:[mt(a||"GBP"),parseFloat(D.amount.toString()).toFixed(2)]}),D.attended&&s.jsxs(Je,{variant:"outline",className:"text-green-600 border-green-200 bg-green-50 text-xs",children:[s.jsx(qt,{className:"h-3 w-3 mr-1"}),"Attended"]})]}),s.jsx("div",{className:"min-w-0 w-full overflow-hidden",children:s.jsx("p",{role:"button",tabIndex:0,onClick:Y=>{Y.stopPropagation(),E(D)},onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),E(D))},title:(re=D.notes)!=null&&re.trim()?"View or edit notes":"Add notes",className:"text-sm text-slate-600 text-primary hover:underline cursor-pointer truncate block w-full min-w-0 m-0",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((R=D.notes)==null?void 0:R.trim())||"Add notes"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(B,{variant:D.attended?"outline":"default",size:"sm",onClick:()=>o({bookingId:D.id,attended:!D.attended}),disabled:m,className:"flex-1",children:[s.jsx(qt,{className:"h-4 w-4 mr-1"}),s.jsxs("span",{className:"hidden xs:inline",children:[D.attended?"Unmark":"Mark"," Attended"]}),s.jsx("span",{className:"xs:hidden",children:"Attended"})]}),!D.attended&&s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>l(D),className:"flex-1",children:[s.jsx(Ur,{className:"h-4 w-4 mr-1"}),s.jsx("span",{className:"hidden xs:inline",children:"Edit"})]}),s.jsxs(B,{variant:"destructive",size:"sm",onClick:()=>c(D),disabled:u,className:"flex-1",children:[s.jsx(ln,{className:"h-4 w-4 mr-1"}),s.jsx("span",{className:"hidden xs:inline",children:"Cancel"})]})]})]})]})},D.id)})})})]}),s.jsx(KV,{booking:S,open:!!S,onOpenChange:D=>!D&&E(null),onSaved:()=>{T.invalidateQueries({queryKey:["/api/admin/bookings"]}
682),T.invalidateQueries({queryKey:["/api/bookings"]})}})]})}function gve({bookings:e,classes:t,services:n=[],onClientClick:r,currency:a,termSingular:i,onMarkAttended:o,onEdit:l,onDelete:c,onMarkPaid:d,isMarkingAttended:m,isDeleting:u,getPaymentMethod:h,hideRevenue:p=!1}){const[v,y]=f.useState(()=>{const L=new Date,U=L.getDay(),J=L.getDate()-U+(U===0?-6:1);return new Date(L.setDate(J))}),[g,x]=f.useState(null),[b,w]=f.useState(!1),N=(L=>{const U=new Date(L.getFullYear(),L.getMonth(),L.getDate()),J=U.getDay(),I=U.getDate()-J+(J===0?-6:1);U.setDate(I);const re=[];for(let R=0;R<7;R++){const Y=new Date(U.getFullYear(),U.getMonth(),U.getDate()+R);re.push(Y)}return re})(v),C=["MON","TUE","WED","THU","FRI","SAT","SUN"],P=L=>{const U=L.getFullYear(),J=String(L.getMonth()+1).padStart(2,"0"),I=String(L.getDate()).padStart(2,"0");return`${U}-${J}-${I}`},S=L=>{const U=L.serviceId??L.service_id;if(U!=null)return Number(U);const J=L.classId??L.class_id;return J!=null?Number(J):null},E=L=>{const U=new Date(L.classDate),J=U.getHours().toString().padStart(2,"0"),I=U.getMinutes().toString().padStart(2,"0");return`${J}:${I}`},T=f.useMemo(()=>{const L=new Map;return e.forEach(U=>{const J=P(new Date(U.classDate)),I=S(U);if(I==null)return;const R=(U.serviceId??U.service_id)!=null?`${I}-${J}|${E(U)}`:`${I}-${J}`;L.has(R)||L.set(R,[]),L.get(R).push(U)}),L},[e]),z=f.useMemo(()=>{if(!g)return[];const L=P(g.date),U="id"in g.class?g.class.id:null;if(U==null)return[];const I=!("startTime"in g.class)&&g.timeStr!=null?`${U}-${L}|${g.timeStr}`:`${U}-${L}`;return T.get(I)||[]},[g,T]),O=L=>{const U=P(L),J=[],I=new Set(t.map(R=>R.id));t.forEach(R=>{const Y=`${R.id}-${U}`,M=T.get(Y)||[];M.length>0&&J.push({class:R,bookings:M,bookingCount:M.length})}),T.forEach((R,Y)=>{const M=Y.indexOf("|"),se=M!==-1,Q=Y.indexOf("-");if((se?Y.slice(Q+1,M):Y.slice(Q+1))!==U)return;const G=parseInt(Y.slice(0,Y.indexOf("-")),10);if(Number.isNaN(G)||!se&&I.has(G))return;const Z=R[0];if(!Z)return;const ie=Z.service&&typeof Z.service=="object"&&"id"in Z.service?Z.service:n.find(ge=>ge.id===G)||{id:G,name:"Service"},A=se?Y.slice(M+1):void 0;J.push({class:ie,bookings:R,bookingCount:R.length,timeStr:A})});const re=new Set(J.filter(R=>!("startTime"in R.class)).map(R=>{const Y="timeStr"in R&&R.timeStr?`|${R.timeStr}`:"";return`${"id"in R.class?R.class.id:0}-${U}${Y}`}));return e.forEach(R=>{const Y=R.serviceId??R.service_id;if(Y==null||P(new Date(R.classDate))!==U)return;const se=E(R),Q=`${Y}-${U}|${se}`;if(re.has(Q))return;re.add(Q);const te=R.service&&typeof R.service=="object"&&"id"in R.service?R.service:n.find(G=>G.id===Y)||{id:Y,name:"Service"};J.push({class:te,bookings:[R],bookingCount:1,timeStr:se})}),J.sort((R,Y)=>{const M=D(R.class,L),se=D(Y.class,L),[Q,te]=M.split(":").map(Number),[G,Z]=se.split(":").map(Number),ie=(Q||0)*60+(te||0),A=(G||0)*60+(Z||0);return ie-A}),J},D=(L,U)=>{if(!("startTime"in L)){const J="id"in L?L.id:null,I=J!=null?e.find(re=>{const R=re.serviceId??re.service_id;return R!=null&&Number(R)===J&&P(new Date(re.classDate))===P(U)}):void 0;if(I){const re=new Date(I.classDate),R=re.getHours().toString().padStart(2,"0"),Y=re.getMinutes().toString().padStart(2,"0");return`${R}:${Y}`}return"09:00"}if(L.startTime){if(L.frequency==="daily")try{const J=JSON.parse(L.startTime);if(typeof J=="object"&&J!==null){const I=U.getDay();return J[I.toString()]||Object.values(J)[0]||"09:00"}}catch{}return L.startTime||"09:00"}return"09:00"},k=L=>{if(!L||L==="undefined")return"TBD";const[U,J]=L.split(":");if(!U||!J||isNaN(parseInt(U))||isNaN(parseInt(J)))return"TBD";const I=parseInt(U),re=I===0?12:I>12?I-12:I,R=I>=12?"PM":"AM";return`${re}:${J} ${R}`},F=L=>{if(!L)return"bg-slate-100 border-slate-200 hover:bg-slate-200 text-slate-700";switch(L.toLowerCase()){case"pilates":return"bg-primary/10 border-primary/20 hover:bg-primary/20 text-primary";case"hiit":case"bootcamp":return"bg-secondary/10 border-secondary/20 hover:bg-secondary/20 text-secondary";case"yoga":return"bg-accent/10 border-accent/20 hover:bg-accent/20 text-accent";default:return"bg-slate-100 border-slate-200 hover:bg-slate-200 text-slate-700"}},W=L=>{const U=new Date(v);U.setDate(U.getDate()+(L==="next"?7:-7)),y(U)},q=()=>{const L=new Date,U=L.getDay(),J=L.getDate()-U+(U===0?-6:1),I=new Date(L.setDate(J));y(I),w(!0)};f.useEffect(()=>{b&&setTimeout(()=>{const L=document.getElementById("today-booking-card");L&&L.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),w(!1)},100)},[b,N]);const H=()=>{const L=new Date,U=new Date(L),J=L.getDay(),I=L.getDate()-J+(J===0?-6:1);return U.setDate(I),v.toDateString()===U.toDateString()},_=f.useMemo(()=>N.some(L=>O(L).length>0),[N,e,t]);return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-2 sm:gap-0",children:[s.jsxs("div",{className:"flex items-center space-x-2 flex-1 min-w-0",children:[s.jsx(B,{variant:"outline",size:"sm",onClick:()=>W("prev"),className:"flex-shrink-0",children:s.jsx(lm,{className:"h-4 w-4"})}),s.jsx("div",{className:"text-xs sm:text-sm font-medium text-center flex-1 min-w-0 px-1",children:s.jsxs("span",{className:"whitespace-nowrap",children:[N[0].toLocaleDateString("en-GB",{day:"numeric",month:"short"})," -"," ",N[6].toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})]})}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>W("next"),className:"flex-shrink-0",children:s.jsx(Ji,{className:"h-4 w-4"})})]}),s.jsx(B,{variant:H()?"default":"outline",size:"sm",onClick:q,className:"w-full sm:w-auto flex-shrink-0",children:"Today"})]}),_?s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3 sm:gap-4 lg:gap-6",children:N.map((L,U)=>{const J=O(L),I=L.toDateString()===new Date().toDateString(),re=J.length===0;return s.jsx(Ce,{id:I?"today-booking-card":void 0,className:`${re?"hidden sm:block sm:min-h-[150px] lg:min-h-[200px]":"min-h-[250px] sm:min-h-[300px]"} ${I?"ring-2 ring-primary":""}`,children:s.jsxs(Ee,{className:"p-3 sm:p-4",children:[s.jsxs("div",{className:"text-center mb-3 sm:mb-4",children:[s.jsx("div",{className:"text-xs sm:text-sm font-medium text-slate-500",children:C[U]}),s.jsx("div",{className:`text-xl sm:text-2xl font-bold ${I?"text-primary":"text-slate-900"}`,children:L.getDate()})]}),s.jsx("div",{className:"space-y-2 sm:space-y-3",children:re?s.jsx("div",{className:"text-center text-slate-400 text-xs sm:text-sm mt-6 sm:mt-8",children:"No bookings"}):J.map(R=>{const Y="timeStr"in R&&R.timeStr?R.timeStr:D(R.class,L),M=k(Y),se="classType"in R.class?R.class.classType:void 0;return s.jsxs("div",{className:`${F(se)} border rounded-lg p-2 sm:p-3 cursor-pointer transition-colors`,onClick:()=>x({class:R.class,date:L,timeStr:"timeStr"in R?R.timeStr:void 0}),children:[s.jsx("div",{className:"text-xs sm:text-sm font-semibold leading-tight mb-1",children:"name"in R.class?R.class.name:"Service"}),s.jsx("div",{className:"text-xs text-slate-600 mb-1 sm:mb-2",children:M}),"location"in R.class&&R.class.location&&s.jsxs("div",{className:"text-xs text-slate-500 mb-1 leading-tight",children:["📍 ",R.class.location]}),s.jsxs(Je,{variant:"secondary",className:"text-xs w-full justify-center mt-1",children:[R.bookingCount," ",R.bookingCount===1?"booking":"bookings"]})]},`${"id"in R.class?R.class.id:"service"}-${L.toISOString()}-${"timeStr"in R?R.timeStr??"":""}`)})})]})},L.toISOString())})}):s.jsx("div",{className:"text-center py-12 sm:py-16",children:s.jsx("p",{className:"text-slate-500 text-sm sm:text-base",children:"No bookings this week"})}),g&&s.jsx(xve,{class:g.class,date:g.date,bookings:z,onClientClick:r,onClientClickWithClose:L=>{x(null),r(L)},currency:a,getPaymentMethod:h,onMarkAttended:o,onEdit:l,onDelete:c,onMarkPaid:d,isMarkingAttended:m,isDeleting:u,termSingular:i,classes:t,onClose:()=>x(null),hideRevenue:p})]})}function yve({open:e,onOpenChange:t,booking:n,currency:r="GBP",onSuccess:a}){var v,y,g,x,b;const[i,o]=f.useState(""),{toast:l}=Yt(),c=jn();f.useEffect(()=>{n&&e&&o(parseFloat(n.amount.toString()).toFixed(2))},[n,e]);const d=xt({mutationFn:async w=>{const j=await Pe("POST",`/api/bookings/${n==null?void 0:n.id}/mark-paid`,{paidAmount:w});if(!j.ok){const N=await j.json();throw new Error(N.message||"Failed to mark booking as paid")}return j.json()},onSuccess:w=>{l({title:"Success",description:`Booking marked as paid. Client balance: ${mt(r)}${w.clientBalance.toFixed(2)}`}),c.invalidateQueries({queryKey:["/api/bookings"]}),c.invalidateQueries({queryKey:["/api/clients"]}),t(!1),a==null||a()},onError:w=>{l({title:"Error",description:w.message,variant:"destructive"})}}),m=w=>{w.preventDefault();const j=parseFloat(i);if(isNaN(j)||j<0){l({title:"Invalid amount",description:"Please enter a valid amount",variant:"destructive"});return}d.mutate(j)};if(!n)return null;const u=parseFloat(n.amount.toString()),h=(v=n.client)!=null&&v.balance?parseFloat(n.client.balance.toString()):0,p=h+parseFloat(i||"0");return s.jsx(Ct,{open:e,onOpenChange:t,children:s.jsxs(St,{children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Mark Booking as Paid"}),s.jsx(yn,{children:"Record payment for this booking. The client's balance will be updated accordingly."})]}),s.jsxs("form",{onSubmit:m,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2 p-4 bg-slate-50 rounded-lg",children:[s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Client:"})," ",((y=n.client)==null?void 0:y.name)||((g=n.client)==null?void 0:g.email)||"Unknown"]}),s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Class/Service:"})," ",((x=n.class)==null?void 0:x.name)||((b=n.service)==null?void 0:b.name)||"Unknown"]}),s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Booking Amou
682nt:"})," ",mt(r),u.toFixed(2)]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"paidAmount",children:"Amount Paid"}),s.jsx(me,{id:"paidAmount",type:"number",step:"0.01",min:"0",value:i,onChange:w=>o(w.target.value),placeholder:u.toFixed(2),required:!0}),s.jsx("p",{className:"text-xs text-slate-500",children:"Enter the amount that was paid. This can differ from the booking amount for partial payments or overpayments."})]}),s.jsxs("div",{className:"space-y-2 p-4 bg-slate-50 rounded-lg",children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-slate-600",children:"Current Balance:"}),s.jsxs("span",{className:`font-medium ${h<0?"text-red-600":h>0?"text-green-600":"text-slate-900"}`,children:[mt(r),h.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-slate-600",children:"Payment Amount:"}),s.jsxs("span",{className:"font-medium text-slate-900",children:["+",mt(r),parseFloat(i||"0").toFixed(2)]})]}),s.jsx("div",{className:"border-t border-slate-200 pt-2 mt-2",children:s.jsxs("div",{className:"flex justify-between text-sm font-medium",children:[s.jsx("span",{className:"text-slate-900",children:"New Balance:"}),s.jsxs("span",{className:p<0?"text-red-600":p>0?"text-green-600":"text-slate-900",children:[mt(r),p.toFixed(2)]})]})})]}),s.jsxs("div",{className:"flex justify-end space-x-2",children:[s.jsx(B,{type:"button",variant:"outline",onClick:()=>t(!1),disabled:d.isPending,children:"Cancel"}),s.jsx(B,{type:"submit",disabled:d.isPending,children:d.isPending?"Marking as Paid...":"Mark as Paid"})]})]})]})})}function vve({open:e,onOpenChange:t}){const{toast:n}=Yt(),{data:r=[],isLoading:a}=Ue({queryKey:["/api/admin/waitlist"],queryFn:async()=>{const c=await Pe("GET","/api/admin/waitlist");if(!c.ok)throw new Error("Failed to fetch waitlist");return c.json()},enabled:e}),i=f.useMemo(()=>{const c={};return r.forEach(d=>{const m=`${d.className}-${d.classDate}-${d.classTime}`;c[m]||(c[m]={className:d.className,classDate:d.classDate,classTime:d.classTime,entries:[]}),c[m].entries.push(d)}),Object.values(c).forEach(d=>{d.entries.sort((m,u)=>{const h=new Date(m.whenAdded).getTime(),p=new Date(u.whenAdded).getTime();return h-p})}),Object.values(c).sort((d,m)=>d.className!==m.className?d.className.localeCompare(m.className):d.classDate.localeCompare(m.classDate))},[r]),o=c=>{try{return new Date(c+"T00:00:00").toLocaleDateString("en-GB",{weekday:"short",year:"numeric",month:"short",day:"numeric"})}catch{return c}},l=async c=>{try{await navigator.clipboard.writeText(c),n({title:"Copied!",description:"Email address copied to clipboard"})}catch{n({title:"Failed to copy",description:"Please copy the email manually",variant:"destructive"})}};return s.jsx(Ct,{open:e,onOpenChange:t,children:s.jsxs(St,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Waitlist"})}),s.jsx("div",{className:"mt-4",children:a?s.jsx("div",{className:"text-center py-8 text-slate-500",children:"Loading waitlist..."}):i.length===0?s.jsx("div",{className:"text-center py-8 text-slate-500",children:"No one is currently on the waitlist."}):s.jsx("div",{className:"space-y-6",children:i.map((c,d)=>s.jsxs("div",{className:"border-b border-slate-200 pb-4 last:border-b-0 last:pb-0",children:[s.jsx("h3",{className:"font-semibold text-slate-900 mb-2",children:c.className}),s.jsxs("p",{className:"text-sm text-slate-600 mb-3",children:[o(c.classDate)," at ",c.classTime]}),s.jsx("div",{className:"space-y-2",children:c.entries.map(m=>s.jsx("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded",children:s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm font-medium text-slate-900 mb-1",children:m.name}),s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsxs("a",{href:`mailto:${m.emailAddress}`,className:"text-xs text-blue-600 hover:text-blue-800 hover:underline flex items-center gap-1",children:[s.jsx(_n,{className:"h-3 w-3"}),m.emailAddress]}),s.jsx(B,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>l(m.emailAddress),title:"Copy email address",children:s.jsx(pr,{className:"h-3 w-3"})})]}),m.phoneNumber&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Fre,{className:"h-3 w-3 text-slate-500"}),s.jsx("a",{href:`tel:${m.phoneNumber}`,className:"text-xs text-slate-600 hover:text-slate-900",children:m.phoneNumber})]})]})},m.id))})]},d))})})]})})}function bve(e){const t=wve(e),n=f.forwardRef((r,a)=>{const{children:i,...o}=r,l=f.Children.toArray(i),c=l.find(Nve);if(c){const d=c.props.children,m=l.map(u=>u===c?f.Children.count(d)>1?f.Children.only(null):f.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...o,ref:a,children:f.isValidElement(d)?f.cloneElement(d,void 0,m):null})}return s.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function wve(e){const t=f.forwardRef((n,r)=>{const{children:a,...i}=n;
vendor: 5,099 bytes, line 682
682if(f.isValidElement(a)){const o=Sve(a),l=Cve(i,a.props);return a.type!==f.Fragment&&(l.ref=r?Pl(r,o):o),f.cloneElement(a,l)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jve=Symbol("radix.slottable");function Nve(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jve}function Cve(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function Sve(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var f1="Popover",[GV]=ua(f1,[Rd]),Sv=Rd(),[kve,Vd]=GV(f1),YV=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!1}=e,l=Sv(t),c=f.useRef(null),[d,m]=f.useState(!1),[u,h]=yi({prop:r,defaultProp:a??!1,onChange:i,caller:f1});return s.jsx(UN,{...l,children:s.jsx(kve,{scope:t,contentId:pi(),triggerRef:c,open:u,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:d,onCustomAnchorAdd:f.useCallback(()=>m(!0),[]),onCustomAnchorRemove:f.useCallback(()=>m(!1),[]),modal:o,children:n})})};YV.displayName=f1;var QV="PopoverAnchor",Pve=f.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=Vd(QV,n),i=Sv(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=a;return f.useEffect(()=>(o(),()=>l()),[o,l]),s.jsx(cv,{...i,...r,ref:t})});Pve.displayName=QV;var JV="PopoverTrigger",XV=f.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=Vd(JV,n),i=Sv(n),o=Us(t,a.triggerRef),l=s.jsx(ms.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":nK(a.open),...r,ref:o,onClick:At(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:s.jsx(cv,{asChild:!0,...i,children:l})});XV.displayName=JV;var uO="PopoverPortal",[Eve,Dve]=GV(uO,{forceMount:void 0}),ZV=e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,i=Vd(uO,t);return s.jsx(Eve,{scope:t,forceMount:n,children:s.jsx(Na,{present:n||i.open,children:s.jsx(yp,{asChild:!0,container:a,children:r})})})};ZV.displayName=uO;var Bf="PopoverContent",eK=f.forwardRef((e,t)=>{const n=Dve(Bf,e.__scopePopover),{forceMount:r=n.forceMount,...a}=e,i=Vd(Bf,e.__scopePopover);return s.jsx(Na,{present:r||i.open,children:i.modal?s.jsx(Tve,{...a,ref:t}):s.jsx(Ove,{...a,ref:t})})});eK.displayName=Bf;var Ave=bve("PopoverContent.RemoveScroll"),Tve=f.forwardRef((e,t)=>{const n=Vd(Bf,e.__scopePopover),r=f.useRef(null),a=Us(t,r),i=f.useRef(!1);return f.useEffect(()=>{const o=r.current;if(o)return QN(o)},[]),s.jsx(uv,{as:Ave,allowPinchZoom:!0,children:s.jsx(tK,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:At(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:At(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:At(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ove=f.forwardRef((e,t)=>{const n=Vd(Bf,e.__scopePopover),r=f.useRef(!1),a=f.useRef(!1);return s.jsx(tK,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),tK=f.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:m,...u}=e,h=Vd(Bf,n),p=Sv(n);return GN(),s.jsx(dv,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(Pm,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:m,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>h.onOpenChange(!1),children:s.jsx(zN,{"data-state":nK(h.open),role:"dialog",id:h.contentId,...p,...u,ref:t,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),sK="PopoverClose",Fve=f.forwardRef((e,t)=>
682{const{__scopePopover:n,...r}=e,a=Vd(sK,n);return s.jsx(ms.button,{type:"button",...r,ref:t,onClick:At(e.onClick,()=>a.onOpenChange(!1))})});Fve.displayName=sK;var _ve="PopoverArrow",Mve=f.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=Sv(n);return s.jsx(qN,{...a,...r,ref:t})});Mve.displayName=_ve;function nK(e){return e?"open":"closed"}var $ve=YV,Ive=XV,Rve=ZV,rK=eK;const Bve=$ve,Lve=Ive,aK=f.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>s.jsx(Rve,{children:s.jsx(rK,{ref:a,align:t,sideOffset:n,className:bt("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 origin-[--radix-popover-content-transform-origin]",e),...r})}));aK.displayName=rK.displayName;function Uve(){const[e,t]=f.useState(!0);return f.useEffect(()=>{const n=window.matchMedia("(max-width: 768px), (pointer: coarse)");t(n.matches);const r=()=>t(n.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}function zve(e){return Sr(e,"yyyy-MM")}const qve={height:"min(280px, 55vh)",minHeight:"120px",WebkitOverflowScrolling:"touch",touchAction:"pan-y"};function Wve({entityType:e,occurrences:t,value:n,isPast:r,handleSelect:a,onWheel:i}){return s.jsx("div",{role:"listbox",tabIndex:0,className:"rounded-md border overflow-y-auto overscroll-contain",style:qve,onWheel:i,children:s.jsx("ul",{className:"space-y-1 p-1",children:t.map(o=>{const l=o.date,c=e==="class",d=c?o:null,m=c?null:o,u=r(l),h=c&&d.maxCapacity>0&&d.availableSpots<=0,p=c?`${d.time} — ${h?`full (${d.availableSpots}/${d.maxCapacity})`:`${d.availableSpots}/${d.maxCapacity} spots`}${u?" · past":""}`:`${m.slotCount} slot${m.slotCount!==1?"s":""}${u?" · past":""}`,v=Wx(l),y=Sr(v,"EEE d MMM");return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>a(l),className:bt("w-full text-left px-3 py-2 rounded-md text-sm transition-colors","hover:bg-accent hover:text-accent-foreground",n===l&&"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground",r(l)&&n!==l&&"text-muted-foreground"),children:[s.jsx("span",{className:"font-medium",children:y}),s.jsx("span",{className:bt("ml-2",n===l?"opacity-90":"text-muted-foreground"),children:p})]})},l)})})})}function G$({entityType:e,entityId:t,value:n,onChange:r,placeholder:a="Select date",disabled:i=!1,id:o,className:l,"aria-label":c}){const[d,m]=f.useState(!1),u=Uve(),[h,p]=f.useState(()=>{if(n)try{const T=Wx(n);if(!isNaN(T.getTime()))return h5(T)}catch{}return h5(new Date)}),v=zve(h),{data:y,isLoading:g}=Ue({queryKey:["occurrence-dates",e,t,v],enabled:!!t&&d,queryFn:async()=>{const T=e==="class"?`/api/classes/${t}/occurrence-dates`:`/api/services/service/${t}/occurrence-dates`;return(await Pe("GET",`${T}?month=${v}`)).json()},staleTime:6e4}),x=(y==null?void 0:y.occurrences)??[],b=n?Wx(n):null,w=n?Sr(b,"EEE, d MMM yyyy"):a,j=T=>{r(T),m(!1)},N=()=>p(T=>$me(T)),C=()=>p(T=>hW(T,1)),P=T=>{const z=Wx(T),O=new Date;return O.setHours(0,0,0,0),z.setHours(0,0,0,0),z<O},S=T=>{const z=T.currentTarget,{scrollTop:O,scrollHeight:D,clientHeight:k}=z,F=O>0,W=O<D-k-1;(T.deltaY<0&&F||T.deltaY>0&&W)&&T.stopPropagation()},E=s.jsxs("div",{className:"p-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 mb-3",children:[s.jsx(B,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:N,"aria-label":"Previous month",children:s.jsx(lm,{className:"h-4 w-4"})}),s.jsx("span",{className:"text-sm font-medium min-w-[140px] text-center",children:Sr(h,"MMMM yyyy")}),s.jsx(B,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:C,"aria-label":"Next month",children:s.jsx(Ji,{className:"h-4 w-4"})})]}),g?s.jsx("p",{className:"text-sm text-muted-foreground py-6 text-center",children:"Loading…"}):x.length===0?s.jsx("p",{className:"text-sm text-muted-foreground py-6 text-center",children:"No sessions this month"}):s.jsx(Wve,{entityType:e,occurrences:x,value:n,isPast:P,handleSelect:j,onWheel:S})]});return u?s.jsxs("div",{className:"space-y-2",children:[s.jsxs(B,{id:o,type:"button",variant:"outline",disabled:i,className:bt("w-full justify-start text-left font-normal",!n&&"text-muted-foreground",l),"aria-label":c??"Booking date","aria-expanded":d,onClick:()=>m(T=>!T),children:[s.jsx(Ls,{className:"mr-2 h-4 w-4"}),w]}),d&&E]}):s.jsxs(Bve,{open:d,onOpenChange:m,children:[s.jsx(Lve,{asChild:!0,children:s.jsxs(B,{id:o,variant:"outline",disabled:i,className:bt("w-full justify-start text-left font-normal",!n&&"text-muted-foreground",l),"aria-label":c??"Booking date",children:[s.jsx(Ls,{className:"mr-2 h-4 w-4"}),w]})}),s.jsx(aK,{className:"w-auto p-0",align:"start",children:E})]})}function iK(e){var t,n,r;return((n=(t=e==null?void 0:e.class)==null?void 0:t.instructor)==null?void 0:n.timezone)||((r=e==null?void 0:e.instructor)==null?void 0:r.timezone)||"Europe/London"}function $h(e){const t=e!=null&&e.classDate?new Date(e.classDate):null;return!t||isNaN(t.getTime())?"Invalid date":t.toLocaleDateString("en-GB",{weekday:"short",year:"numeric",month:"short",day:"numeric",timeZone:iK(e)})}function Hve(e){const t=e!=null&&e.classDate?new Date(e.classDate):null;if(!t||isNaN(t.getTime()))return"";const n=iK(e);return new Intl.DateTimeFormat("en-CA",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit"}).format(t)}function Vve({termSingular:e,termPlural:t,currency:n,onClientClick:r,hideRevenue:a=!1,showTestReminderButtons:i=!1}){const[o,l]=f.useState(!1),[c,d]=f.useState(null),[m,u]=f.useState(null),[h,p]=f.useState(null),[v,y]=f.useState(null),[g,x]=f.useState(!1),[b,w]=f.useState("list"),[j,N]=f.useState(""),[C,P]=f.useState("date"),[S,E]=f.useState("asc"),[T,z]=f.useState(!1),[O,D]=f.useState(""),[k,F]=f.useState(""),[W,q]=f.useState("any"),[H,_]=f.useState(""),[L,U]=f.useState(""),[J,I]=f.useState(""),[re,R]=f.useState(!1),{toast:Y}=Yt(),M=jn();function se(de){var fe;if(de.serviceId||de.bookingType==="service"){if(!de.classDate)return console.warn("⚠️ Service booking missing classDate - Booking ID:",de.id,"Full booking:",de),"Time TBD";let le;if(de.classDate instanceof Date)le=de.classDate;else if(typeof de.classDate=="string")le=new Date(de.classDate);else return console.warn("⚠️ Service booking classDate in unexpected format - Booking ID:",de.id,"classDate:",de.classDate,"type:",typeof de.classDate,"Full booking:",de),"Time TBD";return isNaN(le.getTime())?(console.error("❌ Service booking classDate is INVALID - Booking ID:",de.id,"classDate value:",de.classDate,"Full booking object:",JSON.stringify(de,null,2)),"Time TBD"):le.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}if((fe=de.class)!=null&&fe.startTime)try{if(de.class.startTime.startsWith("{")){const le=JSON.parse(de.class.startTime);if(typeof le=="object"&&le!==null){const Ke=new Date(de.classDate);if(isNaN(Ke.getTime()))return"Time TBD";const We=Ke.getDay(),vt=le[We.toString()]||Object.values(le)[0]||"09:00",[Zt,Ht]=vt.split(":"),Tt=parseInt(Zt);if(isNaN(Tt)||isNaN(parseInt(Ht)))return"Time TBD";const Ot=Tt===0?12:Tt>12?Tt-12:Tt,Ft=Tt>=12?"PM":"AM";return`${Ot}:${Ht} ${Ft}`}}else{const[le,Ke]=de.class.startTime.split(":"),We=parseInt(le);if(isNaN(We)||isNaN(parseInt(Ke)))return"Time TBD";const vt=We===0?12:We>12?We-12:We,Zt=We>=12?"PM":"AM";return`${vt}:${Ke} ${Zt}`}}catch(le){return console.error("Error parsing booking time:",le),"Time TBD"}return"Time TBD"}function Q(de){var fe;if(de.serviceId||de.bookingType==="service"){if(!de.classDate)return"00:00";let le;if(de.classDate instanceof Date)le=de.classDate;else if(typeof de.classDate=="string")le=new Date(de.classDate);else return"00:00";if(isNaN(le.getTime()))return"00:00";const Ke=le.getHours().toString().padStart(2,"0"),We=le.getMinutes().toString().padStart(2,"0");return`${Ke}:${We}`}if((fe=de.class)!=null&&fe.startTime)try{if(de.class.startTime.startsWith("{")){const le=JSON.parse(de.class.startTime),We=new Date(de.classDate).getDay(),vt=le[We.toString()]||"09:00",[Zt,Ht]=vt.split(":");return`${Zt.padStart(2,"0")}:${Ht.padStart(2,"0")}`}else{const[le,Ke]=de.class.startTime.split(":");return`${le.padStart(2,"0")}:${Ke.padStart(2,"0")}`}}
682catch{const[le,Ke]=de.class.startTime.split(":");return`${le.padStart(2,"0")}:${Ke.padStart(2,"0")}`}return"00:00"}const{data:te=[],isLoading:G}=Ue({queryKey:["/api/admin/bookings"]}),ie=(()=>{var de;try{const fe=localStorage.getItem("admin_session");if(fe)return(de=JSON.parse(fe).instructor)==null?void 0:de.id}catch(fe){console.error("Error reading session:",fe)}return null})(),{data:A=[]}=Ue({queryKey:["/api/admin/classes"]}),{data:ge=[]}=Ue({queryKey:[`/api/services/admin/${ie}`],enabled:!!ie,queryFn:async()=>{if(!ie)return[];const de=await Pe("GET",`/api/services/admin/${ie}`);if(!de.ok)throw new Error("Failed to fetch services");return de.json()}}),{data:je}=Ue({queryKey:[`/api/instructors/${ie}`],enabled:!!ie}),{data:ke=[]}=Ue({queryKey:["/api/clients"]}),Ie=de=>{const fe=ke.find(le=>le.id===de);return fe!=null&&fe.balance?parseFloat(fe.balance.toString()):0},$e=de=>{if(de.bundleCode)return"bundle";const fe=de.stripePaymentIntentId;if(fe)return fe.startsWith("free_")?"free":fe.startsWith("paypal_")?"paypal":fe.startsWith("pi_")?"stripe":"cash";if(de.packageStartDate&&(de.bookingType==="package"||de.remainingClasses!==null)){const le=de.packageStartDate instanceof Date?de.packageStartDate.toISOString():de.packageStartDate,Ke=te.find(We=>{const vt=We.packageStartDate instanceof Date?We.packageStartDate.toISOString():We.packageStartDate;return We.clientId===de.clientId&&We.bookingType===de.bookingType&&vt===le&&We.classId===de.classId&&(We.stripePaymentIntentId||We.bundleCode)});if(Ke){if(Ke.bundleCode)return"bundle";if(Ke.stripePaymentIntentId){const We=Ke.stripePaymentIntentId;if(We.startsWith("free_"))return"free";if(We.startsWith("paypal_"))return"paypal";if(We.startsWith("pi_"))return"stripe"}}return!de.amount||parseFloat(de.amount.toString())===0?"free":"cash"}return!de.amount||parseFloat(de.amount.toString())===0?"free":"cash"},qe=f.useMemo(()=>{let de=te;if(j){const fe=j.toLowerCase();de=de.filter(le=>{var Ke,We;return le.client.email.toLowerCase().includes(fe)||le.client.name&&le.client.name.toLowerCase().includes(fe)||((Ke=le.class)==null?void 0:Ke.name)&&le.class.name.toLowerCase().includes(fe)||((We=le.service)==null?void 0:We.name)&&le.service.name.toLowerCase().includes(fe)})}if(T){const fe=new Date().toISOString().slice(0,10);de=de.filter(le=>new Date(le.classDate).toISOString().slice(0,10)===fe)}return(O||k)&&(de=de.filter(fe=>{const le=new Date(fe.classDate).toISOString().slice(0,10);return O&&k?le>=O&&le<=k:O?le>=O:k?le<=k:!0})),W!=="any"&&(de=de.filter(fe=>{const le=Q(fe);return W==="specific"?H?le===H:!0:W==="range"?!L||!J?!0:le>=L&&le<=J:!0})),de.sort((fe,le)=>{let Ke=0;if(C==="date")Ke=new Date(fe.classDate).getTime()-new Date(le.classDate).getTime();else if(C==="name"){const We=fe.client.name||fe.client.email,vt=le.client.name||le.client.email;Ke=We.localeCompare(vt)}return S==="desc"?-Ke:Ke}),de},[te,j,C,S,T,O,k,W,H,L,J]),ft=xt({mutationFn:async({bookingId:de,attended:fe})=>(await Pe("PATCH",`/api/bookings/${de}`,{attended:fe})).json(),onSuccess:()=>{M.invalidateQueries({queryKey:["/api/admin/bookings"]}),Y({title:"Success",description:"Booking attendance updated successfully"})},onError:()=>{Y({title:"Error",description:"Failed to update attendance",variant:"destructive"})}}),[be,Fe]=f.useState({}),_e=xt({mutationFn:async({bookingId:de,newDate:fe,newClassId:le,newTime:Ke})=>{const We={bookingDate:fe};return le&&(We.classId=le),Ke!=null&&Ke!==""&&(We.bookingTime=Ke),(await Pe("PATCH",`/api/bookings/${de}`,We)).json()},onSuccess:(de,fe)=>{console.log("🎉 Date update mutation onSuccess triggered"),console.log("🔄 Invalidating cache for booking:",fe.bookingId),M.invalidateQueries({queryKey:["/api/admin/bookings"]}),M.removeQueries({queryKey:[`/api/bookings/${fe.bookingId}/smart-dates`]}),M.removeQueries({predicate:le=>le.queryKey[0]==="/api/bookings"&&typeof le.queryKey[1]=="string"&&le.queryKey[1].includes("/smart-dates")}),M.removeQueries({predicate:le=>le.queryKey[0]==="/api/classes"&&typeof le.queryKey[2]=="string"&&le.queryKey[2].includes("availability")}),d(null),Y({title:"Success",description:fe.newClassId?"Booking moved to different class successfully":"Booking date updated successfully"})},onError:(de,fe)=>{Y({title:"Error",description:fe.newClassId?"Failed to move booking to different class":"Failed to update booking date",variant:"destructive"})}}),ze=xt({mutationFn:async({moves:de,notifyClient:fe})=>{const le=await Pe("POST","/api/bookings/bulk-move",{moves:de,notifyClient:fe}),Ke=await le.json();if(!le.ok){const We=new Error(Ke.message||"Failed to move bookings");throw We.errors=Ke.errors,We}return Ke},onSuccess:de=>{Fe({}),M.invalidateQueries({queryKey:["/api/admin/bookings"]}),M.removeQueries({predicate:fe=>fe.queryKey[0]==="/api/bookings"&&typeof fe.queryKey[1]=="string"&&fe.queryKey[1].includes("/smart-dates")}),d(null),Y({title:"Success",description:`${de.movedCount} booking${de.movedCount!==1?"s":""} moved successfully`})},onError:de=>{if(de!=null&&de.errors&&Array.isArray(de.errors)){const fe={};for(const le of de.errors)le.bookingId!=null&&(fe[le.bookingId]=le.message);Fe(fe)}Y({title:"Error",description:(de==null?void 0:de.message)||"Failed to move bookings",variant:"destructive"})}}),ue=xt({mutationFn:async({bookingId:de,refundEnabled:fe,refundAmount:le})=>(await Pe("DELETE",`/api/bookings/${de}`,{refundEnabled:fe,refundAmount:le})).json(),onSuccess:de=>{M.invalidateQueries({queryKey:["/api/admin/bookings"]}),M.invalidateQueries({queryKey:["/api/stats"]}),M.invalidateQueries({queryKey:["/api/bookings"],type:"all"}),M.invalidateQueries({queryKey:["/api/classes"],type:"all"}),p(null);const fe=de.refunded?de.refundAmount?`Booking cancelled and ${mt(n||"GBP")}${de.refundAmount.toFixed(2)} refunded successfully`:"Booking cancelled and refunded successfully":"Booking cancelled successfully";Y({title:"Success",description:fe})},onError:de=>{const fe=(de==null?void 0:de.message)||"Failed to cancel booking";Y({title:"Error",description:fe,variant:"destructive"})}}),Me=xt({mutationFn:async de=>(await Pe("POST",`/api/bookings/${de}/send-test-reminder`)).json(),onSuccess:de=>{const fe=de.previewRecipient!=null&&de.previewRecipient!==""?` (${de.previewRecipient})`:"";Y({title:"Test reminder sent",description:(de.message||"Preview sent to Superadmin notification email")+fe})},onError:de=>{Y({title:"Test reminder failed",description:(de==null?void 0:de.message)||"Request failed",variant:"destructive"})}});te.filter(de=>{var fe,le,Ke,We,vt,Zt,Ht,Tt;return((le=(fe=de.client)==null?void 0:fe.email)==null?void 0:le.toLowerCase().includes(j.toLowerCase()))||((We=(Ke=de.client)==null?void 0:Ke.phone)==null?void 0:We.toLowerCase().includes(j.toLowerCase()))||((Zt=(vt=de.class)==null?void 0:vt.name)==null?void 0:Zt.toLowerCase().includes(j.toLowerCase()))||((Tt=(Ht=de.service)==null?void 0:Ht.name)==null?void 0:Tt.toLowerCase().includes(j.toLowerCase()))});const pt=()=>{if(qe.length===0){Y({title:"Nothing to export",description:"No bookings match your current filters.",variant:"destructive"});return}const de=Tt=>{if(Tt==null)return"";const Ot=String(Tt);return Ot.includes(",")||Ot.includes('"')||Ot.includes(`
683`)||Ot.includes("\r")?`"${Ot.replace(/"/g,'""')}"`:Ot},fe=Tt=>{const Ot=$e(Tt);return Ot==="stripe"?"Stripe":Ot==="paypal"?"PayPal":Ot==="bundle"?"Bundle":Ot==="free"?"Free":Ot==="cash"?"Cash":""},le=a?["Booking ID","Client Name","Email","Phone","Class or Service","Session Date","Session Time","Booking Type","Payment Method","Paid","Attended","Status","Notes"]:["Booking ID","Client Name","Email","Phone","Class or Service","Session Date","Session Time","Booking Type","Payment Method","Amount","Currency","Paid","Attended","Status","Notes"],Ke=Tt=>{var Cs,Ne,rt,ht,Mt;const Ot=[Tt.id,((Cs=Tt.client)==null?void 0:Cs.name)||"",((Ne=Tt.client)==null?void 0:Ne.email)||"",((rt=Tt.client)==null?void 0:rt.phone)||"",((ht=Tt.service)==null?void 0:ht.name)||((Mt=Tt.class)==null?void 0:Mt.name)||"",Hve(Tt),se(Tt),Tt.bookingType||"",fe(Tt)],Ft=[Tt.paid?"Yes":"No",Tt.attended?"Yes":"No",Tt.status||"",Tt.notes||""];if(a)return[...Ot.map(String),...Ft.map(String)];const is=Tt.amount!=null?parseFloat(Tt.amount.toString()).toFixed(2):"";return[...Ot.map(String),is,n||"GBP",...Ft.map(String)]},We=[le.map(de).join(","),...qe.map(Tt=>Ke(Tt).map(de).join(","))].join(`
684`),vt=new Blob(["\uFEFF"+We],{type:"text/csv;charset=utf-8;"}
684),Zt=URL.createObjectURL(vt),Ht=document.createElement("a");Ht.href=Zt,Ht.download=`bookings-export-${new Date().toISOString().split("T")[0]}.csv`,Ht.click(),URL.revokeObjectURL(Zt),Y({title:"Export started",description:`Exported ${qe.length} booking(s) to CSV.`})};return G?s.jsx("div",{className:"flex items-center justify-center p-8",children:"Loading bookings..."}):s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("h3",{className:"text-lg font-semibold text-slate-900",children:[s.jsx("span",{className:"sm:hidden",children:"Bookings"}),s.jsx("span",{className:"hidden sm:inline",children:"Booking Management"})]}),s.jsxs("p",{className:"text-sm text-slate-600 hidden sm:block",children:["Create, edit, and track ",e||"class"," bookings"]})]}),s.jsxs("div",{className:"flex shrink-0 items-center space-x-2",children:[s.jsxs("div",{className:"flex items-center border border-slate-300 rounded-md overflow-hidden",children:[s.jsxs(B,{variant:b==="list"?"default":"ghost",size:"sm",onClick:()=>w("list"),className:"rounded-none border-0",children:[s.jsx(_N,{className:"h-4 w-4 mr-1"}),s.jsx("span",{className:"hidden sm:inline",children:"List"})]}),s.jsxs(B,{variant:b==="calendar"?"default":"ghost",size:"sm",onClick:()=>w("calendar"),className:"rounded-none border-0",children:[s.jsx(wre,{className:"h-4 w-4 mr-1"}),s.jsx("span",{className:"hidden sm:inline",children:"Calendar"})]})]}),s.jsx(hve,{}),s.jsxs(B,{variant:"outline",className:"hidden lg:flex",onClick:pt,disabled:qe.length===0,children:[s.jsx(Li,{className:"h-4 w-4 mr-2"}),"Export"]}),s.jsx(B,{variant:"outline",size:"sm",className:"lg:hidden h-9 w-9 p-0",onClick:pt,disabled:qe.length===0,title:"Export bookings (CSV)",children:s.jsx(Li,{className:"h-4 w-4"})}),s.jsxs(Ct,{open:o,onOpenChange:l,children:[s.jsx(Jr,{asChild:!0,children:s.jsxs(B,{className:"hidden lg:flex",children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Create Booking"]})}),s.jsx(Jr,{asChild:!0,children:s.jsx(B,{size:"sm",className:"lg:hidden h-9 w-9 p-0",title:"Create Booking",children:s.jsx(Gs,{className:"h-4 w-4"})})}),s.jsxs(St,{className:"max-h-[90vh] overflow-y-auto w-[95vw] sm:w-full",children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Create New Booking"})}),s.jsx(Gve,{classes:A,services:ge,onSuccess:()=>{l(!1),M.invalidateQueries({queryKey:["/api/admin/bookings"]})}})]})]})]})]}),b==="list"&&s.jsxs(s.Fragment,{children:[i&&s.jsxs("p",{className:"text-xs text-amber-900 bg-amber-50 border border-amber-200 rounded-md px-3 py-2 mb-3",children:[s.jsx("strong",{children:"Test reminder mode"})," (",s.jsx("code",{className:"text-[11px]",children:"?testreminders=1"}),"): amber buttons send a class reminder preview to the Superadmin notification email only — clients are not emailed or texted."]}),s.jsxs("div",{className:"flex flex-wrap gap-4 items-end",children:[s.jsxs("div",{className:"flex-1 min-w-[200px] max-w-md",children:[s.jsx(V,{htmlFor:"search",children:"Search Bookings"}),s.jsxs("div",{className:"relative mt-1",children:[s.jsx(Eh,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-slate-400"}),s.jsx(me,{id:"search",placeholder:"Search by name, email, or class...",value:j,onChange:de=>N(de.target.value),className:"pl-10"})]})]}),s.jsxs("div",{className:"min-w-[140px]",children:[s.jsx(V,{htmlFor:"sort",children:"Sort By"}),s.jsxs(Bt,{value:`${C}-${S}`,onValueChange:de=>{const[fe,le]=de.split("-");P(fe),E(le)},children:[s.jsx($t,{className:"w-40 mt-1",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"date-desc",children:"Date (Newest First)"}),s.jsx(ce,{value:"date-asc",children:"Date (Oldest First)"}),s.jsx(ce,{value:"name-asc",children:"Name (A-Z)"}),s.jsx(ce,{value:"name-desc",children:"Name (Z-A)"})]})]})]}),s.jsxs("div",{className:"flex items-center min-w-[120px] mt-2 lg:mt-0 mb-2",children:[s.jsx(Xt,{id:"showTodayOnly",checked:T,onCheckedChange:de=>z(!!de),className:"mr-2"}),s.jsx(V,{htmlFor:"showTodayOnly",className:"text-sm font-normal select-none cursor-pointer ",children:"For Classes Today"})]})]}),s.jsxs("div",{className:"bg-slate-50 rounded-lg border border-slate-200 overflow-hidden",children:[s.jsxs("button",{onClick:()=>R(!re),className:"w-full flex items-center justify-between p-4 hover:bg-slate-100 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(V,{className:"text-sm font-medium cursor-pointer",children:"Date & Time Filters"}),(O||k||W!=="any")&&s.jsx(Je,{variant:"secondary",className:"text-xs",children:"Active"})]}),re?s.jsx(ON,{className:"h-4 w-4 text-slate-500"}):s.jsx(vi,{className:"h-4 w-4 text-slate-500"})]}),re&&s.jsx("div",{className:"p-4 pt-0",children:s.jsxs("div",{className:"flex flex-wrap gap-4 items-end",children:[s.jsxs("div",{className:"min-w-[150px]",children:[s.jsx(V,{htmlFor:"fromDate",children:"From Date"}),s.jsx(me,{id:"fromDate",type:"date",value:O,onChange:de=>D(de.target.value),className:"mt-1"})]}),s.jsxs("div",{className:"min-w-[150px]",children:[s.jsx(V,{htmlFor:"toDate",children:"To Date"}),s.jsx(me,{id:"toDate",type:"date",value:k,onChange:de=>F(de.target.value),className:"mt-1"})]}),s.jsxs("div",{className:"min-w-[140px]",children:[s.jsx(V,{htmlFor:"timeFilterType",children:"Time Filter"}),s.jsxs(Bt,{value:W,onValueChange:de=>{q(de),de==="any"&&(_(""),U(""),I(""))},children:[s.jsx($t,{className:"mt-1",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"any",children:"Any Time"}),s.jsx(ce,{value:"specific",children:"Specific Time"}),s.jsx(ce,{value:"range",children:"Time Range"})]})]})]}),W==="specific"&&s.jsxs("div",{className:"min-w-[130px]",children:[s.jsx(V,{htmlFor:"specificTime",children:"Time"}),s.jsx(me,{id:"specificTime",type:"time",value:H,onChange:de=>_(de.target.value),className:"mt-1"})]}),W==="range"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"min-w-[130px]",children:[s.jsx(V,{htmlFor:"timeFrom",children:"From Time"}),s.jsx(me,{id:"timeFrom",type:"time",value:L,onChange:de=>U(de.target.value),className:"mt-1"})]}),s.jsxs("div",{className:"min-w-[130px]",children:[s.jsx(V,{htmlFor:"timeTo",children:"To Time"}),s.jsx(me,{id:"timeTo",type:"time",value:J,onChange:de=>I(de.target.value),className:"mt-1"})]})]}),(O||k||W!=="any"||T)&&s.jsx("div",{className:"ml-auto",children:s.jsx(B,{variant:"outline",size:"sm",onClick:()=>{D(""),F(""),q("any"),_(""),U(""),I(""),z(!1)},children:"Clear Filters"})})]})})]}),s.jsx("div",{className:"space-y-4 max-h-[32rem] overflow-y-auto",children:qe.length===0?s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6 text-center",children:s.jsx("p",{className:"text-slate-500",children:j?"No bookings found matching your search.":"No bookings found."})})}):qe.map(de=>{var fe,le,Ke,We,vt,Zt,Ht,Tt,Ot,Ft,is,Cs;return s.jsx(Ce,{className:"relative",children:s.jsxs(Ee,{className:"p-4",children:[s.jsxs("div",{className:"hidden lg:flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center space-x-4",children:s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Dr,{className:"h-4 w-4 text-slate-400"}),s.jsx("span",{className:"font-medium cursor-pointer hover:text-primary transition-colors",onClick:()=>r==null?void 0:r(de.client),children:(fe=de.client)!=null&&fe.name?`${de.client.name} - ${(le=de.client)==null?void 0:le.email}`:(Ke=de.client)==null?void 0:Ke.email}),((We=de.client)==null?void 0:We.phone)&&s.jsxs("span",{className:"text-sm text-slate-500",children:["• ",de.client.phone]}
684)]}),s.jsxs("div",{className:"flex items-center space-x-2 mt-1",children:[s.jsx(Ls,{className:"h-4 w-4 text-slate-400"}),s.jsx("span",{className:"text-sm",children:((vt=de.service)==null?void 0:vt.name)||((Zt=de.class)==null?void 0:Zt.name)}),s.jsxs("span",{className:"text-sm text-slate-500",children:["•"," ",typeof de.classDate=="string"&&!isNaN(new Date(de.classDate).getTime())?s.jsxs("button",{type:"button",onClick:Ne=>{Ne.stopPropagation(),u(de)},className:"cursor-pointer hover:text-primary hover:underline text-left",title:"View booking details and notes",children:[$h(de),", ",se(de)]}):s.jsx("span",{className:"text-red-500",children:"Invalid date"})]}),s.jsx(Je,{variant:de.bookingType==="single"?"default":de.bookingType==="member"?"secondary":de.bookingType==="free"||de.bookingType==="custom"?"outline":"secondary",children:de.bookingType==="single"?"single":de.bookingType==="service"?"service":de.bookingType==="member"?"member":de.bookingType==="free"?"free":de.bookingType==="custom"?"custom":"package"}),(()=>{const Ne=$e(de);return Ne?s.jsx(Je,{variant:"outline",className:Ne==="stripe"?"text-blue-600 border-blue-200 bg-blue-50":Ne==="paypal"?"text-indigo-600 border-indigo-200 bg-indigo-50":Ne==="bundle"?"text-orange-600 border-orange-200 bg-orange-50":Ne==="free"?"text-purple-600 border-purple-200 bg-purple-50":"text-gray-600 border-gray-200 bg-gray-50",children:Ne==="stripe"?"Stripe":Ne==="paypal"?"PayPal":Ne==="bundle"?"Bundle":Ne==="free"?"Free":"Cash"}):null})(),!a&&(de.bookingType==="single"||de.bookingType==="custom"||de.bookingType!=="single"&&de.bookingType!=="custom"&&de.stripePaymentIntentId)&&de.amount&&(()=>{const rt=$e(de)==="cash"&&!de.paid,ht=de.paid;return s.jsxs(Je,{variant:"outline",className:`${ht?"text-green-600 border-green-200 bg-green-50":rt?"text-yellow-600 border-yellow-200 bg-yellow-50 cursor-pointer hover:bg-yellow-100":"text-green-600 border-green-200 bg-green-50"}`,onClick:rt?Mt=>{Mt.stopPropagation(),y(de)}:void 0,title:rt?"Click to mark as paid":ht?"Paid":void 0,children:[mt(n||"GBP"),parseFloat(de.amount).toFixed(2)]})})(),de.attended&&s.jsxs(Je,{variant:"outline",className:"text-green-600 border-green-200 bg-green-50",children:[s.jsx(qt,{className:"h-3 w-3 mr-1"}),"Attended"]})]})]})}),s.jsxs("div",{className:"flex items-center space-x-2",children:[i&&de.classId!=null&&s.jsxs(B,{type:"button",variant:"outline",size:"sm",className:"whitespace-nowrap border-amber-300 text-amber-900 hover:bg-amber-50",title:"Send class reminder preview to Superadmin notification email only (client not notified)",onClick:()=>Me.mutate(de.id),disabled:Me.isPending,children:[Me.isPending&&Me.variables===de.id?s.jsx(Qr,{className:"h-4 w-4 mr-1 animate-spin"}):s.jsx(_n,{className:"h-4 w-4 mr-1"}),"Test reminder"]}),s.jsxs(B,{variant:de.attended?"outline":"default",size:"sm",onClick:()=>ft.mutate({bookingId:de.id,attended:!de.attended}),disabled:ft.isPending,children:[s.jsx(qt,{className:"h-4 w-4 mr-1"}),de.attended?"Unmark":"Mark"," Attended"]}),!de.attended&&s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>{d(de)},className:"whitespace-nowrap",children:[s.jsx(Ur,{className:"h-4 w-4 mr-1"}),"Edit"]}),s.jsxs(B,{variant:"destructive",size:"sm",onClick:()=>{p(de)},disabled:ue.isPending,className:"whitespace-nowrap",children:[s.jsx(ln,{className:"h-4 w-4 mr-1"}),"Cancel"]})]})]}),s.jsxs("div",{className:"lg:hidden",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Dr,{className:"h-4 w-4 text-slate-400 mt-0.5"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"font-medium text-sm truncate cursor-pointer hover:text-primary transition-colors",onClick:()=>r==null?void 0:r(de.client),children:(Ht=de.client)!=null&&Ht.name?`${de.client.name} - ${(Tt=de.client)==null?void 0:Tt.email}`:(Ot=de.client)==null?void 0:Ot.email}),((Ft=de.client)==null?void 0:Ft.phone)&&s.jsx("div",{className:"text-xs text-slate-500",children:de.client.phone})]})]}),s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Ls,{className:"h-4 w-4 text-slate-400 mt-0.5"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm font-medium",children:((is=de.service)==null?void 0:is.name)||((Cs=de.class)==null?void 0:Cs.name)}),s.jsx("div",{className:"text-xs text-slate-500",children:typeof de.classDate=="string"&&!isNaN(new Date(de.classDate).getTime())?s.jsxs("button",{type:"button",onClick:Ne=>{Ne.stopPropagation(),u(de)},className:"cursor-pointer hover:text-primary hover:underline text-left",title:"View booking details and notes",children:[$h(de),", ",se(de)]}):s.jsx("span",{className:"text-red-500",children:"Invalid date"})})]})]}),s.jsxs("div",{className:"flex items-center space-x-2 flex-wrap gap-1",children:[s.jsx(Je,{variant:de.bookingType==="single"?"default":de.bookingType==="member"?"secondary":de.bookingType==="free"||de.bookingType==="custom"?"outline":"secondary",className:"text-xs",children:de.bookingType==="single"?"single":de.bookingType==="service"?"service":de.bookingType==="member"?"member":de.bookingType==="free"?"free":de.bookingType==="custom"?"custom"
684:"package"}),(()=>{const Ne=$e(de);return Ne?s.jsx(Je,{variant:"outline",className:`text-xs ${Ne==="stripe"?"text-blue-600 border-blue-200 bg-blue-50":Ne==="paypal"?"text-indigo-600 border-indigo-200 bg-indigo-50":Ne==="bundle"?"text-orange-600 border-orange-200 bg-orange-50":Ne==="free"?"text-purple-600 border-purple-200 bg-purple-50":"text-gray-600 border-gray-200 bg-gray-50"}`,title:Ne==="stripe"?"Stripe":Ne==="paypal"?"PayPal":Ne==="bundle"?"Bundle":Ne==="free"?"Free":"Cash",children:Ne==="stripe"?"S":Ne==="paypal"?"P":Ne==="bundle"?"B":Ne==="free"?"F":"C"}):null})(),!a&&(de.bookingType==="single"||de.bookingType==="custom"||de.bookingType!=="single"&&de.bookingType!=="custom"&&de.stripePaymentIntentId)&&de.amount&&(()=>{const rt=$e(de)==="cash"&&!de.paid,ht=de.paid;return s.jsxs(Je,{variant:"outline",className:`text-xs ${ht?"text-green-600 border-green-200 bg-green-50":rt?"text-yellow-600 border-yellow-200 bg-yellow-50 cursor-pointer hover:bg-yellow-100":"text-green-600 border-green-200 bg-green-50"}`,onClick:rt?Mt=>{Mt.stopPropagation(),y(de)}:void 0,title:rt?"Click to mark as paid":ht?"Paid":void 0,children:[mt((je==null?void 0:je.currency)||"GBP"),parseFloat(de.amount).toFixed(2)]})})()]})]}),s.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center space-x-1",children:[i&&de.classId!=null&&s.jsx(B,{type:"button",variant:"outline",size:"sm",className:"h-8 w-8 p-0 border-amber-300 text-amber-900",title:"Test reminder → Superadmin email only",onClick:()=>Me.mutate(de.id),disabled:Me.isPending,children:Me.isPending&&Me.variables===de.id?s.jsx(Qr,{className:"h-4 w-4 animate-spin"}):s.jsx(_n,{className:"h-4 w-4"})}),s.jsx(B,{variant:de.attended?"outline":"default",size:"sm",className:`h-8 w-8 p-0 ${de.attended?"bg-green-500 border-green-500 text-white hover:bg-green-600":""}`,onClick:()=>ft.mutate({bookingId:de.id,attended:!de.attended}),disabled:ft.isPending,title:de.attended?"Unmark Attended":"Mark Attended",children:s.jsx(qt,{className:"h-4 w-4"})}),!de.attended&&s.jsx(B,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>d(de),title:"Edit Date",children:s.jsx(Ur,{className:"h-4 w-4"})}),s.jsx(B,{variant:"destructive",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{p(de)},disabled:ue.isPending,title:"Cancel Booking",children:s.jsx(ln,{className:"h-4 w-4"})})]})]})]})},de.id)})}),s.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-slate-200",children:[s.jsxs("p",{className:"text-sm text-slate-600",children:["Showing ",s.jsx("span",{className:"font-semibold text-slate-900",children:qe.length})," ",qe.length===1?"booking":"bookings",(O||k||W!=="any"||j||T)&&s.jsxs(s.Fragment,{children:[" ","out of"," ",s.jsx("span",{className:"font-semibold text-slate-900",children:te.length})," total"]})]}),s.jsx("button",{onClick:()=>x(!0),className:"text-sm text-slate-600 hover:text-slate-900 underline",children:"View waitlist"})]})]}),b==="calendar"&&s.jsx(gve,{bookings:te,classes:A,services:ge,onClientClick:r||(()=>{}),currency:n,termSingular:e,onMarkAttended:({bookingId:de,attended:fe})=>{ft.mutate({bookingId:de,attended:fe})},onMarkPaid:de=>{y(de)},onEdit:d,onDelete:p,isMarkingAttended:ft.isPending,isDeleting:ue.isPending,getPaymentMethod:$e,hideRevenue:a}),s.jsx(Ct,{open:!!c,onOpenChange:de=>{de||(d(null),Fe({}))},children:s.jsxs(St,{className:"max-h-[90vh] overflow-hidden",children:[s.jsx(kt,{children:s.jsx(Pt,{children:c!=null&&c.serviceId?"Edit Service Booking":"Edit Booking Date"})}),c!=null&&c.serviceId?s.jsx(Jve,{booking:c,services:ge,onUpdate:(de,fe)=>{_e.mutate({bookingId:c.id,newDate:de,newTime:fe})},onClose:()=>d(null),isLoading:_e.isPending,formatBookingDateDisplay:$h,getBookingTime:se}):c?s.jsx(Xve,{classItem:A.find(de=>de.id===c.classId),termSingular:e,booking:c,classes:A,allBookings:te,onUpdate:(de,fe)=>{const le={newDate:de};fe&&(le.newClassId=fe),_e.mutate({bookingId:c.id,...le})},onBulkMove:(de,fe)=>{ze.mutate({moves:de,notifyClient:fe})},isLoading:_e.isPending,isBulkMoving:ze.isPending,bulkMoveRowErrors:be}):null]})}),s.jsx(fve,{booking:h,isOpen:!!h,onClose:()=>p(null),onConfirm:({refundEnabled:de,refundAmount:fe})=>{h&&ue.mutate({bookingId:h.id,refundEnabled:de,refundAmount:fe})},isProcessing:ue.isPending,currency:(je==null?void 0:je.currency)||n||"GBP"}),s.jsx(KV,{booking:m,open:!!m,onOpenChange:de=>!de&&u(null),onSaved:()=>{M.invalidateQueries({queryKey:["/api/admin/bookings"]}),M.invalidateQueries({queryKey:["/api/bookings"]})}}),v&&s.jsx(yve,{open:!!v,onOpenChange:de=>!de&&y(null),booking:{...v,client:v.client?{...v.client,balance:Ie(v.client.id).toString()}:void 0},currency:(je==null?void 0:je.currency)||n||"GBP",onSuccess:()=>{M.invalidateQueries({queryKey:["/api/bookings"]}),M.invalidateQueries({queryKey:["/api/admin/bookings"]})}}),s.jsx(vve,{open:g,onOpenChange:x})]})}function Y$(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function Kve(e){return e.classRunsOnDate===!0?!0:e.classRunsOnDate===!1?!1:typeof e.isPastCutoff=="boolean"||typeof e.isBeforeOpenTime=="boolean"||typeof e.bookedSpots=="number"&&e.bookedSpots>0?!0:e.isAvailable===!0}function Gve({classes:e,services:t,onSuccess:n}){var T,z,O;const[r,a]=f.useState("class"),[i,o]=f.useState({name:"",email:"",ph
684one:"",emergencyContactName:"",emergencyContactPhone:"",classId:"",serviceId:"",instructorName:"",bookingDate:"",bookingTime:"",bookingType:"",customAmount:"",bundleCode:"",notes:"",sendConfirmationEmail:!1,allowConcurrentBookings:!1,useCustomServiceTime:!1}),[l,c]=f.useState([]),[d,m]=f.useState(null),{toast:u}=Yt(),h=jn(),{data:p=[]}=Ue({queryKey:["/api/clients"]}),{data:v}=Ue({queryKey:["/api/instructor/profile"]}),{data:y}=Ue({queryKey:[`/api/services/service/${i.serviceId}/availability/${i.bookingDate}`],enabled:!!i.serviceId&&!!i.bookingDate&&r==="service"&&!i.allowConcurrentBookings,queryFn:async()=>{if(!i.serviceId||!i.bookingDate)return null;const D=await fetch(`/api/services/service/${i.serviceId}/availability/${i.bookingDate}`);return D.ok?D.json():(console.error("Failed to fetch service availability:",D.status),{availableSlots:[],isAvailable:!1})}}),{data:g}=Ue({queryKey:[`/api/services/service/${i.serviceId}/availability/${i.bookingDate}`,"includeBookedSlots"],enabled:!!i.serviceId&&!!i.bookingDate&&r==="service"&&!!i.allowConcurrentBookings,queryFn:async()=>{if(!i.serviceId||!i.bookingDate)return null;const D=await fetch(`/api/services/service/${i.serviceId}/availability/${i.bookingDate}?includeBookedSlots=true`);return D.ok?D.json():(console.error("Failed to fetch service slots with counts:",D.status),{slots:[],isAvailable:!1})}}),x=t.find(D=>D.id.toString()===i.serviceId);he.useEffect(()=>{x&&r==="service"&&o(D=>({...D,instructorName:x.instructorName||""}))},[x,r]);const{data:b}=Ue({queryKey:[`/api/classes/${i.classId}/available-dates`],enabled:!!i.classId,staleTime:3e4}),{data:w}=Ue({queryKey:[`/api/classes/${i.classId}/availability/${i.bookingDate}`],enabled:!!i.classId&&!!i.bookingDate,staleTime:3e4}),{data:j=[]}=Ue({queryKey:[`/api/classes/${i.classId}/packages`],enabled:!!i.classId,staleTime:3e4}),{data:N=[]}=Ue({queryKey:[`/api/classes/${i.classId}/memberships`],enabled:!!i.classId,staleTime:3e4}),C=e.find(D=>D.id.toString()===i.classId);he.useEffect(()=>{if(b&&(b!=null&&b.availableDates)){const D=b.availableDates.map(k=>k.date);c(D)}else c([])},[b,i.classId]),he.useEffect(()=>{if(w&&i.bookingDate){const D=w,k=i.bookingDate<Y$(new Date),F=Kve(D),W=D.availableSpots||0,q=F&&W<=0;let H;F?D.isPastCutoff?H="Booking window has closed for clients; you can still add this booking as admin.":D.isBeforeOpenTime?H="Booking window has not opened for clients yet; you can still add this booking as admin.":q&&(H=k?"This class was full on this date. You can still add this booking as admin.":"This class is full. You can still add this booking as admin."):H=k?"This class did not run on this date.":"This class does not run on this date.",m({isValid:F,isFull:q,availableSpots:W,maxCapacity:D.maxCapacity||0,message:H})}else m(null)},[w,i.bookingDate]),he.useEffect(()=>{i.classId&&i.bookingType!=="free"&&i.bookingType!=="none"&&i.bookingType!==""&&!((C==null?void 0:C.allowSingleBooking)!==!1)&&i.bookingType==="single"&&o(k=>({...k,bookingType:"none"}))},[i.classId,C,j]);const P=D=>{o(F=>({...F,email:D}));const k=p.find(F=>F.email.toLowerCase()===D.toLowerCase());k&&o(F=>({...F,name:k.name,email:k.email,phone:k.phone||"",emergencyContactName:k.emergencyContactName||"",emergencyContactPhone:k.emergencyContactPhone||""}))}
684,S=xt({mutationFn:async D=>{console.log("=== FRONTEND: Sending admin booking data ==="),console.log("Form data:",D),console.log("Booking date value:",D.bookingDate),console.log("Booking date type:",typeof D.bookingDate);const k=await Pe("POST","/api/admin/manual-bookings",D);if(!k.ok){const F=await k.json();throw new Error(F.message||"Failed to create booking")}return k.json()},onSuccess:D=>{console.log("✅ Booking created successfully:",D),h.invalidateQueries({queryKey:["/api/bookings"]}),h.invalidateQueries({queryKey:["/api/clients"]}),h.invalidateQueries({queryKey:["/api/stats"]}),u({title:"Success",description:"Booking created successfully"}),n()},onError:D=>{console.error("❌ Booking creation failed:",D),u({title:"Error",description:D.message||"Failed to create booking",variant:"destructive"})}}),E=D=>{if(D.preventDefault(),r==="service"){if(!i.name||!i.email||!i.serviceId||!i.bookingDate||!i.bookingTime||!i.instructorName){u({title:"Error",description:"Please fill in all required fields (including service, date, time, and instructor name)",variant:"destructive"});return}}else{if(!i.name||!i.email||!i.classId||!i.bookingDate){u({title:"Error",description:"Please fill in all required fields",variant:"destructive"});return}if(d&&!d.isValid){u({title:"Invalid Date",description:d.message||"This class does not run on the selected date. Please choose a valid class date.",variant:"destructive"});return}}if(i.bookingType==="custom"){const F=parseFloat(i.customAmount);if(i.customAmount.trim()===""||isNaN(F)||F<0){u({title:"Invalid amount",description:"Please enter a valid custom amount (0 or greater).",variant:"destructive"});return}}const k={...i,classId:r==="class"?i.classId:void 0,serviceId:r==="service"?i.serviceId:void 0,allowConcurrentBookings:r==="service"?i.allowConcurrentBookings:void 0,customServiceTime:r==="service"?i.useCustomServiceTime:void 0};S.mutate(k)};return s.jsxs("form",{onSubmit:E,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",children:"Client Email *"}),s.jsx(me,{id:"email",type:"email",value:i.email,onChange:D=>P(D.target.value),placeholder:"Start typing email to find existing client or enter new email",required:!0,list:"client-emails"}),s.jsx("datalist",{id:"client-emails",children:p.map(D=>s.jsx("option",{value:D.email},D.id))}),i.email&&p.find(D=>D.email.toLowerCase()===i.email.toLowerCase())&&s.jsx("p",{className:"text-sm text-green-600 mt-1",children:"✓ Existing client found - details auto-filled"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"name",children:"Client Name *"}),s.jsx(me,{id:"name",value:i.name,onChange:D=>o(k=>({...k,name:D.target.value})),placeholder:"Full name",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"phone",children:"Phone Number"}),s.jsx(me,{id:"phone",value:i.phone,onChange:D=>o(k=>({...k,phone:D.target.value}))})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Booking Type *"}),s.jsxs(Bt,{value:r,onValueChange:D=>{a(D),o(k=>({...k,classId:"",serviceId:"",instructorName:"",bookingTime:"",allowConcurrentBookings:!1,useCustomServiceTime:!1}))},children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"class",children:"Book Class"}),s.jsx(ce,{value:"service",children:"Book Service"})]})]})]}),r==="class"&&s.jsxs("div",{children:[s.jsx(V,{htmlFor:"classId",children:"Class *"}),s.jsxs(Bt,{value:i.classId,onValueChange:D=>o(k=>({...k,classId:D})),children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"Select a class"})}),s.jsx(It,{children:e.map(D=>s.jsxs(ce,{value:D.id.toString(),children:[D.name,Mw(D)?` · ${Mw(D)}`:""]},D.id))})]})]}),r==="service"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"serviceId",children:"Service *"}),s.jsxs(Bt,{value:i.serviceId,onValueChange:D=>o(k=>({...k,serviceId:D})),children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"Select a service"})}),s.jsx(It,{children:t.length===0?s.jsx(ce,{value:"none",disabled:!0,children:"No services available"}):t.map(D=>s.jsx(ce,{value:D.id.toString(),children:D.name},D.id))})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"instructorName",children:"Instructor Name *"}),s.jsx(me,{id:"instructorName",value:i.instructorName,onChange:D=>o(k=>({...k,instructorName:D.target.value})),placeholder:"Instructor name",required:!0}),x&&s.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["Default: ",x.instructorName]})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"bookingDate",children:"Booking Date *"}),s.jsxs("div",{className:"space-y-2",children:[r==="class"&&i.classId||r==="service"&&i.serviceId?s.jsxs(s.Fragment,{children:[s.jsx(G$,{id:"bookingDate",entityType:r,entityId:r==="class"?i.classId:i.serviceId,value:i.bookingDate,onChange:D=>o(k=>({...k,bookingDate:D})),placeholder:"Select date","aria-label":"Booking date",className:d&&!d.isValid?"border-red-500 focus:border-red-500":d&&d.isFull?"border-amber-500 focus:border-amber-500":""}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Grey dates are past sessions and can still be selected. You can add a client even when a class is full."})]}):s.jsx(G$,{id:"bookingDate",entityType:"class",entityId:"",value:i.bookingDate,onChange:D=>o(k=>({...k,bookingDate:D})),placeholder:"Select class or service first",disabled:!0,"aria-label":"Booking date"}),r==="class"&&d&&!d.isValid&&s.jsxs("p",{className:"text-sm text-red-600",children:["❌ ",d.message||"This class does not run on this date."]}),d&&d.isValid&&d.isFull&&s.jsxs("p",{className:"text-sm text-amber-600",children:["⚠️ ",d.message||"This class is full. You can still add this booking as admin."]}),d&&d.isValid&&d.message&&d.message.includes("as admin")&&!d.isFull&&s.jsxs("p",{className:"text-sm text-amber-600",children:["ℹ️ ",d.message]}),d&&d.isValid&&!d.isFull&&i.bookingDate&&!(d.message&&d.message.includes("as admin"))&&s.jsxs("p",{className:"text-sm text-green-600",children:["✓ Valid date. ",d.availableSpots," of ",d.maxCapacity," spots available."]}),i.bookingDate&&i.bookingDate<Y$(new Date)&&d&&d.isValid&&s.jsx("p",{className:"text-sm text-gray-600",children:"📅 Past date selected. This is useful for marking attendance retroactively."})]})]}),r==="service"&&i.serviceId&&i.bookingDate&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"allowConcurrentBookings",checked:i.allowConcurrentBookings,onCheckedChange:D=>o(k=>({...k,allowConcurrentBookings:!!D,bookingTime:""}))}),s.jsx(V,{htmlFor:"allowConcurrentBookings",className:"text-sm font-normal cursor-pointer",children:"Allow double-booking"})]}),r==="service"&&i.serviceId&&i.bookingDate&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[s.jsx(Xt,{id:"useCustomServiceTime",checked:i.useCustomServiceTime,onCheckedChange:D=>o(k=>({...k,useCustomServiceTime:!!D,...D?{}:{bookingTime:""}}))}),s.jsx(V,{htmlFor:"useCustomServiceTime",className:"text-sm font-normal cursor-pointer",children:"Custom time (override availability)"})]}),i.useCustomServiceTime?s.jsxs("div",{children:[s.jsx(V,{htmlFor:"bookingTime",children:"Booking Time *"}),s.jsx(me,{id:"bookingTime",type:"time",value:i.bookingTime,onChange:D=>o(k=>({...k,bookingTime:D.target.value}))}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Any time on this date. Not limited by the service's availability schedule."})]}):s.jsxs(s.Fragment,{children:[s.jsx(V,{htmlFor:"bookingTime",children:"Booking Time *"}),s.jsxs(Bt,{value:i.bookingTime,onValueChange:D=>o(k=>({...k,bookingTime:D})),children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"Select a time"})}),s.jsx(It,{children:i.allowConcurrentBookings?((T=g==null?void 0:g.slots)==null?void 0:T.length)>0?g.slots.map(D=>s.jsxs(ce,{value:D.time,children:[D.time," — ",D.bookingCount===0?"Available":`${D.bookingCount} Booking${D.bookingCount===1?"":"s"}`]},D.time)):s.jsx(ce,{value:"no-slots",disabled:!0,children:g===void 0?"Loading...":"No time slots for this date"}):((z=y==null?void 0:y.availableSlots)==null?void 0:z.length)>0?y.availableSlots.map(D=>s.jsx(ce,{value:D,children:D},D)):s.jsx(ce,{value:"no-slots",disabled:!0,children:y===void 0?"Loading...":"No available times"})})]}),!i.allowConcurrentBookings&&y&&((O=y.availableSlots)==null?void 0:O.length)===0&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:"No available time slots for this date"})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"bookingType",children:"Pricing Type (Optional)"}),s.jsxs(Bt,{value:i.bookingType,onValueChange:D=>o(k=>({...k,bookingType:D})),disabled:r==="service"?!i.serviceId:!i.classId,children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:r==="service"?i.serviceId?"Select pricing type (optional)":"Select a service first":i.classId?"Select pricing type (optional)":"Select a class first"})}),s.jsx(It,{children:r==="service"?s.jsxs(s.Fragment,{children:[s.jsxs(ce,{value:"none",children:["None (Free Booking) - ",mt((v==null?void 0:v.currency)||"GBP"),"0.00"]}),x&&s.jsxs(ce,{value:"single",children:["Single Service - ",mt((v==null?void 0:v.currency)||"GBP"),x.price||"0.00"]}),s.jsx(ce,{value:"custom",children:"Custom amount..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ce,{value:"none",children:["None (Free Booking) - ",mt((v==null?void 0:v.currency)||"GBP"),"0.00"]}),(C==null?void 0:C.allowSingleBooking)!==!1&&s.jsxs(ce,{value:"single",children:["Single Class ",C!=null&&C.singlePrice?`- ${mt((v==null?void 0:v.currency)||"GBP")}${C.singlePrice}`:""]}),N&&N.length>0&&s.jsxs(ce,{value:"member",children:["Member - ",mt((v==null?void 0:v.currency)||"GBP"),"0.00"]}),j&&j.length>0&&j.map(D=>s.jsxs(ce,{value:D.id.toString(),children:[D.name," - ",mt((v==null?void 0:v.currency)||"GBP"),D.price]},D.id)),s.jsx(ce,{value:"custom",children:"Custom amount..."})]})})]}),i.bookingType==="custom"&&s.jsxs("div",{className:"mt-2",children:[s.jsx(V,{htmlFor:"customAmount",children:"Custom amount"}),s.jsxs("div",{className:"relative mt-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:mt((v==null?void 0:v.currency)||"GBP")}),s.jsx(me,{id:"customAmount",type:"number",min:"0",step:"0.01",value:i.customAmount,onChange:D=>o(k=>({...k,customAmount:D.target.value})),placeholder:"0.00",className:"pl-7"})]})]}),i.classId&&s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:`Select "None (Free Booking)" for a £0.00 booking (won't affect revenue stats)`})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"bundleCode",children:"Bundle Code (Optional)"}),s.jsx(me,{id:"bundleCode",type:"text",value:i.bundleCode,onChange:D=>o(k=>({...k,bundleCode:D.target.value.toUpperCase()})),placeholder:"Enter bundle code to decrement bundle count"}),i.bundleCode&&s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"If provided, this will decrement the bundle's session count when the booking is created."})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"notes",children:"Notes (optional)"}),s.jsx(Is,{id:"notes",value:i.notes,onChange:D=>o(k=>({...k,notes:D.target.value})),placeholder:"e.g. address, session type, special requirements...",rows:3,className:"resize-none"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"sendConfirmationEmail",checked:i.sendConfirmationEmail,onCheckedChange:D=>o(k=>
684({...k,sendConfirmationEmail:D}))}),s.jsx(V,{htmlFor:"sendConfirmationEmail",className:"text-sm font-normal",children:"Send booking confirmation email to client"})]}),s.jsx(B,{type:"submit",disabled:S.isPending,className:"w-full",children:S.isPending?"Creating...":"Create Booking"})]})}const Q$=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Ow(e){const t=String(e||"").match(/(\d{1,2}):(\d{2})/);if(!t)return e||"";const n=parseInt(t[1],10),r=t[2],a=n>=12?"PM":"AM";return`${n%12||12}:${r} ${a}`}function Fw(e){return e?e.split(",")[0].trim():""}function oK(e){const t=e.startTime??"";try{const n=JSON.parse(t);if(n&&typeof n=="object"&&!Array.isArray(n))return n}catch{}return{}}function _w(e){const t=oK(e);return t[String(e.dayOfWeek)]??Object.values(t)[0]??e.startTime??""}function Mw(e){const t=e.startTime??"",n=oK(e);if(e.frequency==="daily"){let i=[];try{i=e.enabledDays?JSON.parse(e.enabledDays):[]}catch{i=[]}if(i.length>0)return i.slice().sort((o,l)=>o-l).map(o=>{const l=n[String(o)]??Object.values(n)[0]??t;return`${Q$[o]??o} ${Ow(l)}`.trim()}).filter(Boolean).join(", ")}const r=_w(e);return[Q$[e.dayOfWeek]??"",Ow(r)].filter(Boolean).join(" ")}function Yve(e){const t=Mw(e),n=Fw(e.location);return[e.name,t,n].filter(Boolean).join(" · ")}function ZP({cls:e,isCurrent:t=!1}){const n=[Mw(e),Fw(e.location)].filter(Boolean).join(" · ");return s.jsxs("div",{className:"flex flex-col items-start py-0.5 text-left whitespace-normal",children:[s.jsxs("span",{className:t?"font-medium":"",children:[e.name,t?" (current)":""]}),n&&s.jsx("span",{className:"text-xs text-muted-foreground",children:n})]})}function eE(e,t){var r;const n=(r=t.class)==null?void 0:r.dayOfWeek;return[...e].sort((a,i)=>{const o=a.id===t.classId?0:1,l=i.id===t.classId?0:1;if(o!==l)return o-l;const c=n!=null&&a.dayOfWeek===n?0:1,d=n!=null&&i.dayOfWeek===n?0:1;return c!==d?c-d:a.dayOfWeek!==i.dayOfWeek?a.dayOfWeek-i.dayOfWeek:_w(a).localeCompare(_w(i))})}function lK(e,t){const n=new Date;return n.setHours(0,0,0,0),e.filter(r=>r.clientId===t.clientId&&r.classId===t.classId&&!r.serviceId&&!r.attended&&r.status!=="cancelled"&&new Date(r.classDate)>=n).sort((r,a)=>new Date(r.classDate).getTime()-new Date(a.classDate).getTime())}function Qve({termSingular:e,booking:t,classes:n,allBookings:r,onApply:a,onBack:i,isLoading:o,rowErrors:l={}}){var z,O,D;const c=f.useMemo(()=>lK(r,t),[r,t]),d=f.useMemo(()=>{const k=new Map;for(const F of c)k.set(F.id,F);return k},[c]),[m,u]=f.useState(t.classId??0),[h,p]=f.useState(!0),[v,y]=f.useState({}),[g,x]=f.useState(!1),[b,w]=f.useState(null),[j,N]=f.useState(()=>c.map(k=>({bookingId:k.id,move:!0,newClassId:t.classId??0,newDate:""}))),C=he.useCallback(async k=>{const F=`/api/bookings/${t.id}/smart-dates?limit=50&offset=0`+(k!==t.classId?`&classId=${k}`:""),W=await Pe("GET",F),q=await W.json();if(!W.ok)throw new Error(q.message||"Failed to load dates");const H=q.availableDates||[];return y(_=>({..._,[k]:H})),H},[t.id,t.classId]),P=he.useCallback((k,F,W)=>{const q=W.map((H,_)=>({row:H,index:_})).filter(({row:H})=>H.move);return W.map((H,_)=>{if(!H.move)return{...H,newClassId:k};const L=q.findIndex(J=>J.index===_),U=L>=0?F[L]:void 0;return{...H,newClassId:k,newDate:(U==null?void 0:U.date)||H.newDate}})},[]);he.useEffect(()=>{let k=!1;return x(!0),w(null),C(m).then(F=>{k||N(W=>P(m,F,W))}).catch(F=>{k||w((F==null?void 0:F.message)||"Failed to load dates")}).finally(()=>{k||x(!1)}),()=>{k=!0}},[m,C,P]);const S=async k=>{u(k)},E=async(k,F)=>{N(W=>W.map(q=>q.bookingId===k?{...q,newClassId:F,newDate:""}:q));try{const W=await C(F);N(q=>{const H=q.findIndex(U=>U.bookingId===k);if(H<0)return q;const _=q.slice(0,H+1).filter(U=>U.move&&U.newClassId===F).length-1,L=W[Math.max(0,_)];return q.map(U=>U.bookingId===k&&U.move?{...U,newClassId:F,newDate:(L==null?void 0:L.date)||""}:U.bookingId===k?{...U,newClassId:F}:U)})}catch(W){w((W==null?void 0:W.message)||"Failed to load dates for class")}},T=j.filter(k=>k.move).length;return s.jsxs("div",{className:"flex flex-col max-h-[75vh]",children:[s.jsxs("div",{className:"space-y-3 mb-4",children:[s.jsxs("div",{className:"bg-gray-50 p-3 rounded-lg text-sm",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Client:"})," ",((z=t.client)==null?void 0:z.name)||((O=t.client)==null?void 0:O.email)]}),s.jsxs("p",{className:"text-muted-foreground mt-1",children:[c.length," upcoming session",c.length!==1?"s":""," on"," ",((D=t.class)==null?void 0:D.name)||"this class"]})]}),s.jsxs("div",{className:"p-3 border rounded-lg bg-slate-50",children:[s.jsxs(V,{className:"text-sm font-medium mb-2 block",children:["Move all to ",e||"class",":"]}
684),s.jsxs(Bt,{value:m.toString(),onValueChange:k=>S(parseInt(k,10)),children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsx(It,{children:eE(n||[],t).map(k=>s.jsx(ce,{value:k.id.toString(),children:s.jsx(ZP,{cls:k,isCurrent:k.id===t.classId})},k.id))})]}),g&&s.jsxs("p",{className:"text-xs text-muted-foreground mt-2 flex items-center gap-1",children:[s.jsx(Qr,{className:"h-3 w-3 animate-spin"}),"Loading available dates..."]}),b&&s.jsx("p",{className:"text-xs text-red-600 mt-2",children:b})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto border rounded-lg",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-muted sticky top-0",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left p-2 font-medium",children:"Current"}),s.jsx("th",{className:"text-left p-2 font-medium w-28",children:"Action"}),s.jsxs("th",{className:"text-left p-2 font-medium",children:["New ",e]}),s.jsx("th",{className:"text-left p-2 font-medium",children:"New date"})]})}),s.jsx("tbody",{children:j.map(k=>{var H;const F=d.get(k.bookingId);if(!F)return null;const W=v[k.newClassId]||[],q=l[k.bookingId];return s.jsxs("tr",{className:"border-t align-top",children:[s.jsxs("td",{className:"p-2",children:[s.jsx("div",{className:"font-medium",children:$h(F)}),s.jsx("div",{className:"text-xs text-muted-foreground",children:(H=F.class)==null?void 0:H.name})]}),s.jsx("td",{className:"p-2",children:s.jsxs(Bt,{value:k.move?"move":"skip",onValueChange:_=>N(L=>L.map(U=>U.bookingId===k.bookingId?{...U,move:_==="move"}:U)),children:[s.jsx($t,{className:"h-8 text-xs",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"move",children:"Move"}),s.jsx(ce,{value:"skip",children:"Don't move"})]})]})}),s.jsx("td",{className:"p-2",children:s.jsxs(Bt,{value:k.newClassId.toString(),disabled:!k.move,onValueChange:_=>E(k.bookingId,parseInt(_,10)),children:[s.jsx($t,{className:"h-8 text-xs",children:s.jsx(Lt,{})}),s.jsx(It,{children:eE(n||[],t).map(_=>s.jsx(ce,{value:_.id.toString(),children:s.jsx(ZP,{cls:_})},_.id))})]})}),s.jsxs("td",{className:"p-2",children:[s.jsxs(Bt,{value:k.newDate||void 0,disabled:!k.move||W.length===0,onValueChange:_=>N(L=>L.map(U=>U.bookingId===k.bookingId?{...U,newDate:_}:U)),children:[s.jsx($t,{className:`h-8 text-xs ${q?"border-red-500":""}`,children:s.jsx(Lt,{placeholder:"Select date..."})}),s.jsx(It,{children:W.map(_=>s.jsxs(ce,{value:_.date,children:[_.displayDate," (",_.dayName,") ",_.time," —"," ",_.availability,"/",_.maxCapacity]},_.date))})]}),q&&s.jsx("p",{className:"text-xs text-red-600 mt-1",children:q})]})]},k.bookingId)})})]})}),s.jsxs("div",{className:"flex items-center gap-2 mt-4",children:[s.jsx(Xt,{id:"notify-client-multi-move",checked:h,onCheckedChange:k=>p(k===!0)}),s.jsx(V,{htmlFor:"notify-client-multi-move",className:"text-sm cursor-pointer",children:"Notify client by email"})]}),s.jsxs("div",{className:"flex gap-2 mt-4",children:[s.jsx(B,{variant:"outline",onClick:i,disabled:o,children:"Back"}),s.jsx(B,{className:"flex-1",disabled:o||g||T===0||j.some(k=>k.move&&!k.newDate),onClick:()=>{const k=j.filter(F=>F.move&&F.newDate).map(F=>({bookingId:F.bookingId,newClassId:F.newClassId,newDate:F.newDate}));a(k,h)},children:o?"Applying...":`Apply (${T} session${T!==1?"s":""})`})]})]})}function Jve({booking:e,services:t,onUpdate:n,onClose:r,isLoading:a,formatBookingDateDisplay:i,getBookingTime:o}){var b,w,j;const l=e.serviceId??e.service_id,c=e.service??t.find(N=>N.id===Number(l)),[d,m]=f.useState(()=>new Date(e.classDate).toISOString().split("T")[0]),[u,h]=f.useState(()=>{const N=new Date(e.classDate);return`${N.getHours().toString().padStart(2,"0")}:${N.getMinutes().toString().padStart(2,"0")}`}),{data:p}=Ue({queryKey:[`/api/services/service/${l}/availability/${d}`,"includeBookedSlots"],enabled:!!l&&!!d,queryFn:async()=>{const N=await fetch(`/api/services/service/${l}/availability/${d}?includeBookedSlots=true`);if(!N.ok)throw new Error("Failed to load times");return N.json()}}),v=(p==null?void 0:p.slots)??[],y=new Date(e.classDate).toISOString().split("T")[0],g=`${new Date(e.classDate).getHours().toString().padStart(2,"0")}:${new Date(e.classDate).getMinutes().toString().padStart(2,"0")}`,x=d!==y||u!==g;return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-slate-50 p-3 rounded-lg text-sm",children:[s.jsx("div",{className:"font-medium mb-1",children:"Current booking"}),s.jsxs("div",{className:"text-slate-600",children:[i(e),", ",o(e)]}),s.jsxs("div",{className:"text-slate-600 mt-1",children:[((b=e.service)==null?void 0:b.name)||(c==null?void 0:c.name)," · ",((w=e.client)==null?void 0:w.name)||((j=e.client)==null?void 0:j.email)]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-service-date",children:"New date"}),s.jsx(me,{id:"edit-service-date",type:"date",value:d,onChange:N=>{m(N.target.value),h("")},className:"mt-1"})]}),d&&s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-service-time",children:"New time"}),s.jsxs(Bt,{value:u,onValueChange:h,children:[s.jsx($t,{id:"edit-service-time",children:s.jsx(Lt,{placeholder:"Select time"})}),s.jsx(It,{children:v.length===0?s.jsx(ce,{value:"_none",disabled:!0,children:p===void 0?"Loading…":"No slots for this date"}):v.map(N=>s.jsxs(ce,{value:N.time,children:[N.time," — ",N.bookingCount===0?"Available":`${N.bookingCount} Booking${N.bookingCount===1?"":"s"}`]},N.time))})]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(B,{variant:"outline",onClick:r,className:"flex-1",children:"Cancel"}),s.jsx(B,{className:"flex-1",disabled:a||!d||!u||!x||u==="_none",onClick:()=>n(d,u),children:a?"Updating…":"Update date & time"})]})]})}function Xve({termSingular:e,classItem:t,booking:n,onUpdate:r,isLoading:a,classes:i,allBookings:o,onBulkMove:l,isBulkMoving:c,bulkMoveRowErrors:d}){var se,Q,te,G,Z,ie;const[m,u]=f.useState(!1),[h,p]=f.useState(""),[v,y]=f.useState(n.classId??0),[g,x]=f.useState(!1),[b,w]=f.useState(0),[j,N]=f.useState([]),[C,P]=f.useState(!1),[S,E]=f.useState(!1),[T,z]=f.useState(null),[O,D]=f.useState([]),[k,F]=f.useState(null),W=f.useMemo(()=>lK(o,n),[o,n]);he.useEffect(()=>{u(!1),p(""),y(n.classId??0),x(!1),w(0),N([]),z(null),D([]),F(null)},[n.id,n.classId]);const q=f.useMemo(()=>{const A=(i||[]).find(je=>je.id===n.classId);if(!(A!=null&&A.id))return[];const ge=A.parentClassId??A.id;return(i||[]).filter(je=>je.id===ge||je.parentClassId===ge)},[i,n.classId]),H=q.length>1,_=v!==n.classId&&!q.some(A=>A.id===v),L=he.useRef(v);L.current=v;const U=he.useCallback(async A=>{F(null);try{if(H&&!_)return{availableDates:(await Promise.all(q.map(async qe=>
684{const ft=`/api/bookings/${n.id}/smart-dates?limit=40&offset=0`+(qe.id!==n.classId?`&classId=${qe.id}`:""),be=await Pe("GET",ft),Fe=await be.json();if(!be.ok)throw new Error(Fe.message||"Failed to fetch dates");return(Fe.availableDates||[]).map(_e=>({..._e,classId:qe.id}))}))).flat().sort((qe,ft)=>qe.date.localeCompare(ft.date)||String(qe.time).localeCompare(String(ft.time))),moreAvailable:!1};const ge=L.current,je=`/api/bookings/${n.id}/smart-dates?limit=12&offset=${A}`+(ge!==n.classId?`&classId=${ge}`:"");return await Pe("GET",je).then(Ie=>Ie.json())}catch(ge){return F((ge==null?void 0:ge.message)||"Failed to fetch dates"),{availableDates:[],moreAvailable:!1}}},[n.id,n.classId,H,_,q]);he.useEffect(()=>{let A=!0;return U(0).then(ge=>{if(A&&(N(ge.availableDates||[]),P(!!ge.moreAvailable),z(ge.packageInfo||null),D(ge.clientFutureBookings||[]),ge.availableDates&&ge.availableDates.length>0)){const je=$e=>$e.classId==null||$e.classId===n.classId,Ie=ge.availableDates.find($e=>$e.isRecommended&&je($e))||ge.availableDates.find($e=>$e.isRecommended)||ge.availableDates.find(je)||ge.availableDates[0];p(Ie.date),Ie.classId&&y(Ie.classId)}}),()=>{A=!1}},[U]);const J=async()=>{E(!0);const A=j.length,ge=await U(A);N(je=>[...je,...ge.availableDates||[]]),P(!!ge.moreAvailable),E(!1)},I=f.useMemo(()=>eE(i||[],n),[i,n]),re=I.find(A=>A.id===v),R=t!=null&&t.excludeDates?t.excludeDates.split(/[\n,]+/).map(A=>A.trim()).filter(A=>A):[],Y=j.filter(A=>!R.includes(A.date));if(!m&&!j.length)return k?s.jsx("div",{className:"text-center text-red-600 py-8",children:k}):s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{className:"animate-pulse",children:[s.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/3 mb-2"}),s.jsx("div",{className:"h-10 bg-gray-200 rounded"})]})});const M=Y;return m?s.jsx(Qve,{termSingular:e,booking:n,classes:i,allBookings:o,onApply:l,onBack:()=>u(!1),isLoading:c,rowErrors:d}):s.jsxs("div",{className:"flex flex-col h-[70vh]",children:[s.jsxs("div",{className:"space-y-3 mb-3 pb-0",children:[s.jsxs("div",{className:"bg-gray-50 p-3 rounded-lg",children:[s.jsx("h4",{className:"font-medium mb-2",children:"Current Booking"}),s.jsxs("div",{className:"text-sm text-gray-600 grid grid-cols-1 gap-1",children:[s.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:[s.jsxs("span",{children:[s.jsx("strong",{children:"Client:"})," ",((se=n.client)==null?void 0:se.name)||((Q=n.client)==null?void 0:Q.email)]}),s.jsxs("span",{children:[s.jsxs("strong",{children:[e,":"]})," ",((te=n.service)==null?void 0:te.name)||((G=n.class)==null?void 0:G.name)]})]}),s.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:[s.jsxs("span",{children:[s.jsx("strong",{children:"Date:"})," ",$h(n)]}),T&&s.jsxs("span",{children:[s.jsx("strong",{children:"Package:"})," ",T.name," (",new Date(T.windowStartDate).toLocaleDateString("en-GB")," - ",new Date(T.windowEndDate).toLocaleDateString("en-GB"),")"]})]})]})]}),O&&O.length>0&&s.jsxs("div",{className:"bg-blue-50 p-2 rounded-lg mt-2",children:[s.jsx("h4",{className:"font-medium mb-1 text-blue-900 text-sm",children:"Client's Other Future Bookings"}),s.jsx("div",{className:"text-xs text-blue-800 flex flex-wrap gap-x-3 gap-y-1",children:O.map(A=>{var ge;return s.jsxs("span",{children:[$h(A)," - ",(ge=A.class)==null?void 0:ge.name]},A.id)})})]}),s.jsxs("div",{className:"mb-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-3",children:[s.jsx(B,{variant:"outline",size:"sm",onClick:()=>x(!g),children:g?"Cancel Class Change":`Move to Different ${e||"Class"}`}),W.length>1&&s.jsx(B,{variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:()=>u(!0),children:"Move multiple bookings"})]}),g&&s.jsxs("div",{className:"p-3 border rounded-lg bg-slate-50 mb-4",children:[s.jsxs(V,{className:"text-sm font-medium mb-2 block",children:["Select New ",e||"Class",":"]}),!I||I.length===0?s.jsx("div",{className:"text-sm text-gray-500 py-2",children:"No classes found."}):s.jsxs(Bt,{value:v.toString(),onValueChange:A=>{const ge=parseInt(A);y(ge),p(""),N([]),w(0)},children:[s.jsx($t,{className:"h-auto min-h-10 py-2",children:s.jsx(Lt,{placeholder:`Select ${e||"class"}...`})}),s.jsx(It,{children:I.map(A=>s.jsx(ce,{value:A.id.toString(),children:s.jsx(ZP,{cls:A,isCurrent:A.id===n.classId})},A.id))})]}),_&&!0&&s.jsxs("p",{className:"text-xs text-orange-600 mt-2",children:["⚠️ This will move the booking to ",re?Yve(re):`a different ${e||"class"}`]})]})]}),s.jsx(V,{className:"text-base font-medium",children:H?"Select a time":"Select New Date"})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto pr-2 mb-3",children:[s.jsx("div",{className:"space-y-1.5",children:M&&M.length>0?M.map(A=>s.jsx("div",{className:`p-2.5 border rounded-lg cursor-pointer transition-all ${h===A.date&&(A.classId==null||v===A.classId)?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,onClick:()=>{p(A.date),A.classId&&y(A.classId)},children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"font-medium text-sm",children:A.displayDate}),s.jsxs("span",{className:"text-xs text-gray-500",children:["(",A.dayName,")"]}),s.jsx("span",{className:"text-xs text-gray-600",children:Ow(A.time)}),A.isRecommended&&s.jsx(Je,{variant:"default",className:"bg-green-100 text-green-800 border-green-300 text-xs px-1.5 py-0.5",children:"Recommended"}),T&&(A.isOutsidePackageWindow?s.jsx(Je,{variant:"outline",className:"border-orange-300 text-orange-700 text-xs px-1.5 py-0.5",children:"Outside Window"}):s.jsx(Je,{variant:"outline",className:"border-green-300 text-green-700 text-xs px-1.5 py-0.5",children:"Within Window"}))]}),A.reasonRecommended&&s.jsx("p",{className:"text-xs text-gray-500 mt-0.5 truncate",children:A.reasonRecommended})]}),s.jsxs("div",{className:"text-right ml-2 flex-shrink-0",children:[s.jsx("div",{className:"text-sm",children:s.jsxs("span",{className:`${A.availability<3?"text-orange-600":"text-green-600"}`,children:[A.availability," / ",A.maxCapacity]})}),s.jsx("div",{className:"text-xs text-gray-500",children:"available"})]})]})},`${A.classId??n.classId}-${A.date}`)):s.jsx("div",{className:"text-center text-gray-500 py-8",children:k?s.jsxs("div",{children:[s.jsx("p",{children:"Error loading available dates"}),s.jsx("p",{className:"text-xs mt-1",children:k})]}):s.jsx("p",{children:"No available dates found"})})}),C&&s.jsx(B,{variant:"outline",size:"sm",className:"mt-3 w-full",onClick:J,disabled:S,children:S?"
684Loading...":"Fetch more dates"})]}),s.jsxs("div",{className:"mt-2",children:[h&&re&&s.jsxs("p",{className:"text-xs text-center text-muted-foreground mb-2",children:["Move to ",re.name,","," ",((Z=M.find(A=>A.date===h&&(A.classId==null||A.classId===v)))==null?void 0:Z.displayDate)||h," at ",Ow(((ie=M.find(A=>A.date===h&&(A.classId==null||A.classId===v)))==null?void 0:ie.time)||_w(re)),Fw(re.location)?` · ${Fw(re.location)}`:""]}),s.jsx(B,{onClick:()=>{const A=v!==n.classId;r(h,A?v:void 0)},disabled:a||!h||h===new Date(n.classDate).toISOString().split("T")[0]&&v===n.classId,className:"w-full",children:a?"Updating...":v!==n.classId&&!(H&&q.some(A=>A.id===v))?`Move to Different ${e||"Class"}`:v!==n.classId?"Update time":"Update Date"})]})]})}function Zve({classId:e,className:t}){const{toast:n}=Yt(),[r,a]=f.useState(!1),[i,o]=f.useState(!1),[l,c]=f.useState(null),[d,m]=f.useState(""),[u,h]=f.useState(""),[p,v]=f.useState(""),[y,g]=f.useState(""),{data:x,isLoading:b}=Ue({queryKey:["/api/classes",e,"available-dates"],queryFn:async()=>{const D=await Pe("GET",`/api/classes/${e}/available-dates`);if(!D.ok)throw new Error("Failed to fetch available dates");return D.json()},enabled:r||i,retry:1}),w=(x==null?void 0:x.availableDates)||[],{data:j=[],isLoading:N}=Ue({queryKey:["/api/classes",e,"private-links"],queryFn:async()=>(await Pe("GET",`/api/classes/${e}/private-links`)).json()}),C=xt({mutationFn:async D=>(await Pe("POST",`/api/classes/${e}/private-links`,D)).json(),onSuccess:()=>{Ms.invalidateQueries({queryKey:["/api/classes",e,"private-links"]}),a(!1),m(""),h(""),v(""),g(""),n({title:"Private link created",description:"Your private booking link has been generated successfully."})},onError:D=>{n({title:"Error creating link",description:D.message||"Failed to create private link",variant:"destructive"})}}),P=xt({mutationFn:async D=>{await Pe("DELETE",`/api/private-links/${D}`)},onSuccess:()=>{Ms.invalidateQueries({queryKey:["/api/classes",e,"private-links"]}),n({title:"Link deleted",description:"Private booking link has been removed."})},onError:D=>{n({title:"Error deleting link",description:D.message||"Failed to delete private link",variant:"destructive"})}}),S=xt({mutationFn:async({linkId:D,isActive:k})=>(await Pe("PUT",`/api/private-links/${D}`,{isActive:k})).json(),onSuccess:()=>{Ms.invalidateQueries({queryKey:["/api/classes",e,"private-links"]}),n({title:"Link updated",description:"Private link status has been updated."})}}),E=()=>{const D={};d.trim()&&(D.name=d.trim()),u&&(D.expiresAt=u),p&&parseInt(p)>0&&(D.usageLimit=parseInt(p)),y&&y!=="none"&&(D.preselectedDate=y),C.mutate(D)},T=D=>{const k=`${window.location.origin}/private/${D.token}`;if(D.preselectedDate){const F=new Date(D.preselectedDate),W=F.getFullYear(),q=String(F.getMonth()+1).padStart(2,"0"),H=String(F.getDate()).padStart(2,"0"),_=`${W}-${q}-${H}`;return`${k}?date=${_}`}return k},z=D=>{const k=T(D);navigator.clipboard.writeText(k),n({title:"Link copied",description:"Private booking link has been copied to clipboard."})},O=D=>{const k=T(D);window.open(k,"_blank")};return N?s.jsx(Ce,{children:s.jsxs(gt,{children:[s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(Lr,{className:"h-5 w-5"}),"Private Booking Links"]}),s.jsx(Ys,{children:"Loading private links..."})]})}):s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs(Nt,{className:"flex items-center gap-2 mb-2 text-base sm:text-lg",children:[s.jsx(Lr,{className:"h-4 w-4 sm:h-5 sm:w-5"}),"Private Booking Links"]}),s.jsxs(Ys,{className:"text-xs sm:text-sm pr-0 sm:pr-4",children:["Create private links to share ",t," with specific people without showing it on the public page"]})]}),s.jsxs(Ct,{open:r,onOpenChange:a,children:[s.jsx(Jr,{asChild:!0,children:s.jsxs(B,{className:"shrink-0",children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Create Link"]})}),s.jsxs(St,{className:"max-w-[95vw] sm:max-w-md p-3 sm:p-6",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Create Private Booking Link"}),s.jsxs(yn,{children:["Generate a private link that allows specific people to book"," ",t," without it appearing on the public schedule."]})]}),s.jsxs("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto pr-1",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"linkName",children:"Link Name (Optional)"}),s.jsx(me,{id:"linkName",placeholder:"e.g., VIP Members, Corporate Team",value:d,onChange:D=>m(D.target.value)})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"expiresAt",children:"Expires At (Optional)"}),s.jsx(me,{id:"expiresAt",type:"datetime-local",value:u,onChange:D=>h(D.target.value)})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"usageLimit",children:"Usage Limit (Optional)"}),s.jsx(me,{id:"usageLimit",type:"number",placeholder:"e.g., 10 bookings",value:p,onChange:D=>v(D.target.value)})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"preselectedDate",children:"Preselect Class Date (Optional)"}),s.jsxs(Bt,{value:y||void 0,onValueChange:D=>{g(D==="none"?"":D)},disabled:b,children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:b?"Loading dates...":"Select a date (or leave blank)"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"none",children:"No preselection"}),b?s.jsx(ce,{value:"loading",disabled:!0,children:"Loading dates..."}):w.length===0?s.jsx(ce,{value:"no-dates",disabled:!0,children:"No available dates found"}):w.map(D=>s.jsxs(ce,{value:D.date,children:[D.dayName,", ",D.displayDate," at ",D.time," 
684(",D.availability," / ",D.maxCapacity," spots available)"]},D.date))]})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"When clients visit this link, the selected date will be automatically chosen."})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row justify-end gap-2 pt-2",children:[s.jsx(B,{variant:"outline",onClick:()=>a(!1),className:"w-full sm:w-auto",children:"Cancel"}),s.jsx(B,{onClick:E,disabled:C.isPending,className:"w-full sm:w-auto",children:C.isPending?"Creating...":"Create Link"})]})]})]})]})]})}),s.jsx(Ee,{children:j.length===0?s.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[s.jsx(Lr,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),s.jsx("p",{children:"No private links created yet"}),s.jsx("p",{className:"text-sm",children:"Create your first private booking link to share with specific people"})]}):s.jsx("div",{className:"space-y-4",children:j.map(D=>s.jsxs("div",{className:"border rounded-lg p-3 sm:p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium text-sm sm:text-base",children:D.name||`Private Link #${D.id}`}),s.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Created"," ",Sr(new Date(D.createdAt),"MMM d, yyyy")]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(Je,{variant:D.isActive?"default":"secondary",className:"text-xs",children:D.isActive?"Active":"Inactive"}),D.expiresAt&&new Date(D.expiresAt)<new Date&&s.jsx(Je,{variant:"destructive",className:"text-xs",children:"Expired"}),D.usageLimit&&D.usageCount>=D.usageLimit&&s.jsx(Je,{variant:"destructive",className:"text-xs",children:"Limit Reached"})]})]}),s.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[D.usageLimit&&s.jsxs("p",{children:["Usage: ",D.usageCount," / ",D.usageLimit," bookings"]}),!D.usageLimit&&D.usageCount>0&&s.jsxs("p",{children:["Used ",D.usageCount," times"]}),D.expiresAt&&s.jsxs("p",{children:["Expires: "," ",Sr(new Date(D.expiresAt),"MMM d, yyyy 'at' h:mm a")]}),D.preselectedDate&&s.jsxs("p",{children:["Preselected date: ",Sr(new Date(D.preselectedDate),"MMM d, yyyy")]})]}),s.jsx("div",{className:"bg-muted p-2 sm:p-3 rounded text-xs sm:text-sm font-mono break-all mb-2 cursor-pointer overflow-x-auto",onClick:()=>z(D),title:"Click to copy",children:T(D)}),s.jsxs("div",{className:"flex flex-row gap-1 sm:gap-2 justify-end flex-wrap",children:[s.jsx(B,{variant:D.isActive?"default":"outline",size:"sm",onClick:()=>S.mutate({linkId:D.id,isActive:!D.isActive}),disabled:S.isPending,title:D.isActive?"Click to deactivate":"Click to activate",children:D.isActive?s.jsx(bn,{className:"h-4 w-4 text-white"}):s.jsx(ja,{className:"h-4 w-4"})}),window.navigator.share&&s.jsx(B,{variant:"outline",size:"sm",onClick:async()=>{const k=T(D);if(window.navigator.share)try{await window.navigator.share({title:D.name||`Private Link #${D.id}`,text:`Book ${t} privately`,url:k})}catch(F){const W=F;W&&W.name!=="AbortError"&&n({title:"Share failed",description:W.message||"Could not share link.",variant:"destructive"})}else n({title:"Share not supported",description:"Your browser does not support the Web Share API.",variant:"destructive"})},title:"Share link",children:s.jsx(Ff,{className:"h-4 w-4"})}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>z(D),children:s.jsx(pr,{className:"h-4 w-4"})}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>O(D),children:s.jsx(Lr,{className:"h-4 w-4"})}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>P.mutate(D.id),disabled:P.isPending,children:s.jsx(ln,{className:"h-4 w-4"})})]})]},D.id))})})]})}/*!
685 * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
686 *
687 * Copyright (c) 2014-2017, Jon Schlinkert.
688 * Released under the MIT License.
689 */function J$(e){return Object.prototype.toString.call(e)==="[object Object]"}function oa(e){var t,n;return J$(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(J$(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var cK=Symbol.for("immer-nothing"),X$=Symbol.for("immer-draftable"),Si=Symbol.for("immer-state");function Eo(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Mg=Object.getPrototypeOf;function xm(e){return!!e&&!!e[Si]}function gm(e){var t;return e?dK(e)||Array.isArray(e)||!!e[X$]||!!((t=e.constructor)!=null&&t[X$])||kv(e)||x1(e):!1}var e0e=Object.prototype.constructor.toString(),Z$=new WeakMap;function dK(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;
689if(typeof n!="function")return!1;let r=Z$.get(n);return r===void 0&&(r=Function.toString.call(n),Z$.set(n,r)),r===e0e}function $w(e,t,n=!0){p1(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(a=>{t(a,e[a],e)}):e.forEach((r,a)=>t(a,r,e))}function p1(e){const t=e[Si];return t?t.type_:Array.isArray(e)?1:kv(e)?2:x1(e)?3:0}function tE(e,t){return p1(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function uK(e,t,n){const r=p1(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function t0e(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function kv(e){return e instanceof Map}function x1(e){return e instanceof Set}function ou(e){return e.copy_||e.base_}function sE(e,t){if(kv(e))return new Map(e);if(x1(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=dK(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Si];let a=Reflect.ownKeys(r);for(let i=0;i<a.length;i++){const o=a[i],l=r[o];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(r[o]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[o]})}return Object.create(Mg(e),r)}else{const r=Mg(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function mO(e,t=!1){return g1(e)||xm(e)||!gm(e)||(p1(e)>1&&Object.defineProperties(e,{set:F0,add:F0,clear:F0,delete:F0}),Object.freeze(e),t&&Object.values(e).forEach(n=>mO(n,!0))),e}function s0e(){Eo(2)}var F0={value:s0e};function g1(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var n0e={};function ym(e){const t=n0e[e];return t||Eo(0,e),t}var $g;function mK(){return $g}function r0e(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function eI(e,t){t&&(ym("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function nE(e){rE(e),e.drafts_.forEach(a0e),e.drafts_=null}function rE(e){e===$g&&($g=e.parent_)}function tI(e){return $g=r0e($g,e)}function a0e(e){const t=e[Si];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function sI(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Si].modified_&&(nE(t),Eo(4)),gm(e)&&(e=Iw(t,e),t.parent_||Rw(t,e)),t.patches_&&ym("Patches").generateReplacementPatches_(n[Si].base_,e,t.patches_,t.inversePatches_)):e=Iw(t,n,[]),nE(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==cK?e:void 0}function Iw(e,t,n){if(g1(t))return t;const r=e.immer_.shouldUseStrictIteration(),a=t[Si];if(!a)return $w(t,(i,o)=>nI(e,a,t,i,o,n),r),t;if(a.scope_!==e)return t;if(!a.modified_)return Rw(e,a.base_,!0),a.base_;if(!a.finalized_){a.finalized_=!0,a.scope_.unfinalizedDrafts_--;const i=a.copy_;let o=i,l=!1;a.type_===3&&(o=new Set(i),i.clear(),l=!0),$w(o,(c,d)=>nI(e,a,i,c,d,n,l),r),Rw(e,i,!1),n&&e.patches_&&ym("Patches").generatePatches_(a,n,e.patches_,e.inversePatches_)}return a.copy_}function nI(e,t,n,r,a,i,o){if(a==null||typeof a!="object"&&!o)return;const l=g1(a);if(!(l&&!o)){if(xm(a)){const c=i&&t&&t.type_!==3&&!tE(t.assigned_,r)?i.concat(r):void 0,d=Iw(e,a,c);if(uK(n,r,d),xm(d))e.canAutoFreeze_=!1;else return}else o&&n.add(a);if(gm(a)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===a&&l)return;Iw(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(kv(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Rw(e,a)}}}function Rw(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&mO(t,n)}function i0e(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:mK(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=hO;n&&(a=[r],i=Ig);const{revoke:o,proxy:l}=Proxy.revocable(a,i);return r.draft_=l,r.revoke_=o,l}var hO={get(e,t){if(t===Si)return e;const n=ou(e);if(!tE(n,t))return o0e(e,n,t);const r=n[t];return e.finalized_||!gm(r)?r:r===zS(e.base_,t)?(qS(e),e.copy_[t]=iE(r,e)):r},has(e,t){return t in ou(e)},ownKeys(e){return Reflect.ownKeys(ou(e))},set(e,t,n){const r=hK(ou(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=zS(ou(e),t),i=a==null?void 0:a[Si];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(t0e(n,a)&&(n!==void 0||tE(e.base_,t)))return!0;qS(e),aE(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return zS(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,qS(e),aE(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ou(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Eo(11)},getPrototypeOf(e){return Mg(e.base_)},setPrototypeOf(){Eo(12)}},Ig={};$w(hO,(e,t)=>{Ig[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Ig.deleteProperty=function(e,t){return Ig.set.call(this,e,t,void 0)};Ig.set=function(e,t,n){return hO.set.call(this,e[0],t,n,e[0])};function zS(e,t){const n=e[Si];return(n?ou(n):e)[t]}function o0e(e,t,n){var a;const r=hK(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function hK(e,t){if(!(t in e))return;let n=Mg(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Mg(n)}}function aE(e){e.modified_||(e.modified_=!0,e.parent_&&aE(e.parent_))}function qS(e){e.copy_||(e.copy_=sE(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var l0e=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const o=this;return function(c=i,...d){return o.produce(c,m=>n.call(this,m,...d))}}typeof n!="function"&&Eo(6),r!==void 0&&typeof r!="function"&&Eo(7);let a;if(gm(t)){const i=tI(this),o=iE(t,void 0);let l=!0;try{a=n(o),l=!1}finally{l?nE(i):rE(i)}return eI(i,r),sI(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===cK&&(a=void 0),this.autoFreeze_&&mO(a,!0),r){const i=[],o=[];ym("Patches").generateReplacementPatches_(t,a,i,o),r(i,o)}return a}else Eo(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let r,a;return[this.produce(t,n,(o,l)=>{r=o,a=l}),r,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){gm(e)||Eo(8),xm(e)&&(e=c0e(e));const t=tI(this),n=iE(e,void 0);
689return n[Si].isManual_=!0,rE(t),n}finishDraft(e,t){const n=e&&e[Si];(!n||!n.isManual_)&&Eo(9);const{scope_:r}=n;return eI(r,t),sI(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const a=t[n];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}n>-1&&(t=t.slice(n+1));const r=ym("Patches").applyPatches_;return xm(e)?r(e,t):this.produce(e,a=>r(a,t))}};function iE(e,t){const n=kv(e)?ym("MapSet").proxyMap_(e,t):x1(e)?ym("MapSet").proxySet_(e,t):i0e(e,t);return(t?t.scope_:mK()).drafts_.push(n),n}function c0e(e){return xm(e)||Eo(10,e),fK(e)}function fK(e){if(!gm(e)||g1(e))return e;const t=e[Si];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=sE(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=sE(e,!0);return $w(n,(a,i)=>{uK(n,a,fK(i))},r),t&&(t.finalized_=!1),n}var Rg=new l0e,fO=Rg.produce,rI=Rg.createDraft.bind(Rg),aI=Rg.finishDraft.bind(Rg),d0e={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Oe.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},u0e={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Vs.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},m0e={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Xe.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Bw=new WeakMap,Lw=new WeakMap,Kx=new WeakMap,pK=new WeakMap,iI=new WeakMap,oI=new WeakMap,lI=new WeakMap,Oe={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=Oe.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],o=t[n];return Oe.equals(r,a)&&i>o},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return Oe.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],o=t[n];return Oe.equals(r,a)&&i<o},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return Oe.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&Oe.compare(e,t)===0},isBefore(e,t){return Oe.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&Oe.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&Oe.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&Oe.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&Oe.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&Oe.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!Oe.isAncestor(t,e)&&!Oe.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(Oe.equals(i,r)||Oe.endsBefore(i,r)||Oe.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:o}=t;if(Oe.equals(o,r)||Oe.isAncestor(o,r))return null;Oe.endsBefore(o,r)&&(r[o.length-1]-=1);break}case"merge_node":{var{path:l,position:c}=t;Oe.equals(l,r)||Oe.endsBefore(l,r)?r[l.length-1]-=1:Oe.isAncestor(l,r)&&(r[l.length-1]-=1,r[l.length]+=c);break}case"split_node":{var{path:d,position:m}=t;if(Oe.equals(d,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else Oe.endsBefore(d,r)?r[d.length-1]+=1:Oe.isAncestor(d,r)&&e[d.length]>=m&&(r[d.length-1]+=1,r[d.length]-=m);break}case"move_node":{var{path:u,newPath:h}=t;if(Oe.equals(u,h))return r;if(Oe.isAncestor(u,r)||Oe.equals(u,r)){var p=h.slice();return Oe.endsBefore(u,h)&&u.length<h.length&&(p[u.length-1]-=1),p.concat(r.slice(u.length))}else Oe.isSibling(u,h)&&(Oe.isAncestor(h,r)||Oe.equals(h,r))?Oe.endsBefore(u,r)?r[u.length-1]-=1:r[u.length-1]+=1:Oe.endsBefore(h,r)||Oe.equals(h,r)||Oe.isAncestor(h,r)?(Oe.endsBefore(u,r)&&(r[u.length-1]-=1),r[h.length-1]+=1):Oe.endsBefore(u,r)&&(Oe.equals(h,r)&&(r[h.length-1]+=1),r[u.length-1]-=1);break}}return r}};function Bg(e){"@babel/helpers - typeof";return Bg=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},Bg(e)}function h0e(e,t){if(Bg(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Bg(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function f0e(e){var t=h0e(e,"string");return Bg(t)==="symbol"?t:String(t)}function Ua(e,t,n){return t=f0e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ix(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
689t%2?cI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var p0e=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=Dt.parent(e,r),o=r[r.length-1];if(o>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(o,0,a),t)for(var[l,c]of Xe.points(t))t[c]=Vs.transform(l,n);break}case"insert_text":{var{path:d,offset:m,text:u}=n;if(u.length===0)break;var h=Dt.leaf(e,d),p=h.text.slice(0,m),v=h.text.slice(m);if(h.text=p+u+v,t)for(var[y,g]of Xe.points(t))t[g]=Vs.transform(y,n);break}case"merge_node":{var{path:x}=n,b=Dt.get(e,x),w=Oe.previous(x),j=Dt.get(e,w),N=Dt.parent(e,x),C=x[x.length-1];if(os.isText(b)&&os.isText(j))j.text+=b.text;else if(!os.isText(b)&&!os.isText(j))j.children.push(...b.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(x,"] to nodes of different interfaces: ").concat(Yr.stringify(b)," ").concat(Yr.stringify(j)));if(N.children.splice(C,1),t)for(var[P,S]of Xe.points(t))t[S]=Vs.transform(P,n);break}case"move_node":{var{path:E,newPath:T}=n;
689if(Oe.isAncestor(E,T))throw new Error("Cannot move a path [".concat(E,"] to new path [").concat(T,"] because the destination is inside itself."));var z=Dt.get(e,E),O=Dt.parent(e,E),D=E[E.length-1];O.children.splice(D,1);var k=Oe.transform(E,n),F=Dt.get(e,Oe.parent(k)),W=k[k.length-1];if(F.children.splice(W,0,z),t)for(var[q,H]of Xe.points(t))t[H]=Vs.transform(q,n);break}case"remove_node":{var{path:_}=n,L=_[_.length-1],U=Dt.parent(e,_);if(U.children.splice(L,1),t)for(var[J,I]of Xe.points(t)){var re=Vs.transform(J,n);if(t!=null&&re!=null)t[I]=re;else{var R=void 0,Y=void 0;for(var[M,se]of Dt.texts(e))if(Oe.compare(se,_)===-1)R=[M,se];else{Y=[M,se];break}var Q=!1;R&&Y&&(Oe.equals(Y[1],_)?Q=!Oe.hasPrevious(Y[1]):Q=Oe.common(R[1],_).length<Oe.common(Y[1],_).length),R&&!Q?(J.path=R[1],J.offset=R[0].text.length):Y?(J.path=Y[1],J.offset=0):t=null}}break}case"remove_text":{var{path:te,offset:G,text:Z}=n;if(Z.length===0)break;var ie=Dt.leaf(e,te),A=ie.text.slice(0,G),ge=ie.text.slice(G+Z.length);if(ie.text=A+ge,t)for(var[je,ke]of Xe.points(t))t[ke]=Vs.transform(je,n);break}case"set_node":{var{path:Ie,properties:$e,newProperties:qe}=n;if(Ie.length===0)throw new Error("Cannot set properties on the root node!");var ft=Dt.get(e,Ie);for(var be in qe){if(be==="children"||be==="text")throw new Error('Cannot set the "'.concat(be,'" property of nodes!'));var Fe=qe[be];Fe==null?delete ft[be]:ft[be]=Fe}for(var _e in $e)qe.hasOwnProperty(_e)||delete ft[_e];break}case"set_selection":{var{newProperties:ze}=n;if(ze==null)t=ze;else{if(t==null){if(!Xe.isRange(ze))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Yr.stringify(ze)," when there is no current selection."));t=ix({},ze)}for(var ue in ze){var Me=ze[ue];if(Me==null){if(ue==="anchor"||ue==="focus")throw new Error('Cannot remove the "'.concat(ue,'" selection property'));delete t[ue]}else t[ue]=Me}}break}case"split_node":{var{path:pt,position:de,properties:fe}=n;if(pt.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(pt,"] because the root node cannot be split."));var le=Dt.get(e,pt),Ke=Dt.parent(e,pt),We=pt[pt.length-1],vt;if(os.isText(le)){var Zt=le.text.slice(0,de),Ht=le.text.slice(de);le.text=Zt,vt=ix(ix({},fe),{},{text:Ht})}else{var Tt=le.children.slice(0,de),Ot=le.children.slice(de);le.children=Tt,vt=ix(ix({},fe),{},{children:Ot})}if(Ke.children.splice(We+1,0,vt),t)for(var[Ft,is]of Xe.points(t))t[is]=Vs.transform(Ft,n);break}}return t},x0e={transform(e,t){e.children=rI(e.children);var n=e.selection&&rI(e.selection);try{n=p0e(e,n,t)}finally{e.children=aI(e.children),n?e.selection=xm(n)?aI(n):n:e.selection=null}}},g0e={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},y0e={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},xK=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(oa(r)&&oa(a)){if(!xK(r,a))return!1}else if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==a[i])return!1}else if(r!==a)return!1}for(var o in t)if(e[o]===void 0&&t[o]!==void 0)return!1;return!0};function v0e(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function pc(e,t){if(e==null)return{};var n=v0e(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var b0e=["anchor","focus"];function dI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function w0e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
689t%2?dI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xe={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return Xe.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=Xe.edges(e);return t},equals(e,t){return Vs.equals(e.anchor,t.anchor)&&Vs.equals(e.focus,t.focus)},surrounds(e,t){var n=Xe.intersection(e,t);return n?Xe.equals(n,t):!1},includes(e,t){if(Xe.isRange(t)){if(Xe.includes(e,t.anchor)||Xe.includes(e,t.focus))return!0;var[n,r]=Xe.edges(e),[a,i]=Xe.edges(t);return Vs.isBefore(n,a)&&Vs.isAfter(r,i)}var[o,l]=Xe.edges(e),c=!1,d=!1;return Vs.isPoint(t)?(c=Vs.compare(t,o)>=0,d=Vs.compare(t,l)<=0):(c=Oe.compare(t,o.path)>=0,d=Oe.compare(t,l.path)<=0),c&&d},intersection(e,t){var n=pc(e,b0e),[r,a]=Xe.edges(e),[i,o]=Xe.edges(t),l=Vs.isBefore(r,i)?i:r,c=Vs.isBefore(a,o)?a:o;return Vs.isBefore(c,l)?null:w0e({anchor:l,focus:c},n)},isBackward(e){var{anchor:t,focus:n}=e;return Vs.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Vs.equals(t,n)},isExpanded(e){return!Xe.isCollapsed(e)},isForward(e){return!Xe.isBackward(e)},isRange(e){return oa(e)&&Vs.isPoint(e.anchor)&&Vs.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Xe.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return fO(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,o;if(a==="inward"){var l=Xe.isCollapsed(r);Xe.isForward(r)?(i="forward",o=l?i:"backward"):(i="backward",o=l?i:"forward")}else a==="outward"?Xe.isForward(r)?(i="backward",o="forward"):(i="forward",o="backward"):(i=a,o=a);var c=Vs.transform(r.anchor,t,{affinity:i}),d=Vs.transform(r.focus,t,{affinity:o});if(!c||!d)return null;r.anchor=c,r.focus=d})}},uI=e=>oa(e)&&Dt.isNodeList(e.children)&&!ne.isEditor(e),rs={isAncestor(e){return oa(e)&&Dt.isNodeList(e.children)},isElement:uI,isElementList(e){return Array.isArray(e)&&e.every(t=>rs.isElement(t))},isElementProps(e){return e.children!==void 0},isElementType:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"type";return uI(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},j0e=["children"],N0e=["text"],mI=new WeakMap,Dt={ancestor(e,t){var n=Dt.get(e,t);if(os.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Yr.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of Oe.ancestors(t,n)){var a=Dt.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(os.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Yr.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Yr.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=Dt.ancestor(e,t),{children:i}=a,o=r?i.length-1:0;r?o>=0:o<i.length;){var l=Dt.child(a,o),c=t.concat(o);yield[l,c],o=r?o-1:o+1}}()},common(e,t,n){var r=Oe.common(t,n),a=Dt.get(e,r);return[a,r]},descendant(e,t){var n=Dt.get(e,t);if(ne.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Yr.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of Dt.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of Dt.nodes(e,t))rs.isElement(n)&&(yield[n,r])}()},extractProps(e){if(rs.isAncestor(e)){var t=pc(e,j0e);return t}else{var t=pc(e,N0e);return t}},first(e,t){for(var n=t.slice(),r=Dt.get(e,n);r&&!(os.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(os.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Yr.stringify(e)));var n=fO({children:e.children},r=>{var[a,i]=Xe.edges(t),o=Dt.nodes(r,{reverse:!0,pass:h=>{var[,p]=h;return!Xe.includes(t,p)}});for(var[,l]of o){if(!Xe.includes(t,l)){var c=Dt.parent(r,l),d=l[l.length-1];c.children.splice(d,1)}if(Oe.equals(l,i.path)){var m=Dt.leaf(r,l);m.text=m.text.slice(0,i.offset)}if(Oe.equals(l,a.path)){var u=Dt.leaf(r,l);u.text=u.text.slice(a.offset)}}ne.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){var n=Dt.getIf(e,t);if(n===void 0)throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Yr.stringify(e)));return n},getIf(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(os.isText(n)||!n.children[a])return;n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(os.isText(n)||!n.children[a])return!1;
689n=n.children[a]}return!0},isNode(e){return os.isText(e)||rs.isElement(e)||ne.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=mI.get(e);if(t!==void 0)return t;var n=e.every(r=>Dt.isNode(r));return mI.set(e,n),n},last(e,t){for(var n=t.slice(),r=Dt.get(e,n);r&&!(os.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=Dt.get(e,t);if(!os.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Yr.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of Oe.levels(t,n)){var a=Dt.get(e,r);yield[a,r]}}()},matches(e,t){return rs.isElement(e)&&rs.isElementProps(t)&&rs.matches(e,t)||os.isText(e)&&os.isTextProps(t)&&os.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,o=new Set,l=[],c=e;!(i&&(r?Oe.isBefore(l,i):Oe.isAfter(l,i)));){if(o.has(c)||(yield[c,l]),!o.has(c)&&!os.isText(c)&&c.children.length!==0&&(n==null||n([c,l])===!1)){o.add(c);var d=r?c.children.length-1:0;Oe.isAncestor(l,a)&&(d=a[l.length]),l=l.concat(d),c=Dt.get(e,l);continue}if(l.length===0)break;if(!r){var m=Oe.next(l);if(Dt.has(e,m)){l=m,c=Dt.get(e,l);continue}}if(r&&l[l.length-1]!==0){var u=Oe.previous(l);l=u,c=Dt.get(e,l);continue}l=Oe.parent(l),c=Dt.get(e,l),o.add(c)}}()},parent(e,t){var n=Oe.parent(t),r=Dt.get(e,n);if(os.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return os.isText(e)?e.text:e.children.map(Dt.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of Dt.nodes(e,t))os.isText(n)&&(yield[n,r])}()}};function hI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var cd={isNodeOperation(e){return cd.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!oa(e))return!1;switch(e.type){case"insert_node":return Oe.isPath(e.path)&&Dt.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&Oe.isPath(e.path);case"merge_node":return typeof e.position=="number"&&Oe.isPath(e.path)&&oa(e.properties);case"move_node":return Oe.isPath(e.path)&&Oe.isPath(e.newPath);case"remove_node":return Oe.isPath(e.path)&&Dt.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&Oe.isPath(e.path);case"set_node":return Oe.isPath(e.path)&&oa(e.properties)&&oa(e.newProperties);case"set_selection":return e.properties===null&&Xe.isRange(e.newProperties)||e.newProperties===null&&Xe.isRange(e.properties)||oa(e.properties)&&oa(e.newProperties);case"split_node":return Oe.isPath(e.path)&&typeof e.position=="number"&&oa(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>cd.isOperation(t))},isSelectionOperation(e){return cd.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return cd.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Xn(Xn({},e),{},{type:"remove_node"});case"insert_text":return Xn(Xn({},e),{},{type:"remove_text"});case"merge_node":return Xn(Xn({},e),{},{type:"split_node",path:Oe.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(Oe.equals(t,n))return e;if(Oe.isSibling(n,t))return Xn(Xn({},e),{},{path:t,newPath:n});var r=Oe.transform(n,e),a=Oe.transform(Oe.next(n),e);return Xn(Xn({},e),{},{path:r,newPath:a})}case"remove_node":return Xn(Xn({},e),{},{type:"insert_node"});case"remove_text":return Xn(Xn({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:o}=e;return Xn(Xn({},e),{},{properties:o,newProperties:i})}case"set_selection":{var{properties:l,newProperties:c}=e;return l==null?Xn(Xn({},e),{},{properties:c,newProperties:null}):c==null?Xn(Xn({},e),{},{properties:null,newProperties:l}):Xn(Xn({},e),{},{properties:c,newProperties:l})}case"split_node":return Xn(Xn({},e),{},{type:"merge_node",path:Oe.next(e.path)})}}},fI=new WeakMap,C0e=e=>{var t=fI.get(e);if(t!==void 0)return t;if(!oa(e))return!1;var n=typeof e.addMark=="function"&&typeof e.apply=="function"&&typeof e.deleteFragment=="function"&&typeof e.insertBreak=="function"&&typeof e.insertSoftBreak=="function"&&typeof e.insertFragment=="function"&&typeof e.insertN
689ode=="function"&&typeof e.insertText=="function"&&typeof e.isElementReadOnly=="function"&&typeof e.isInline=="function"&&typeof e.isSelectable=="function"&&typeof e.isVoid=="function"&&typeof e.normalizeNode=="function"&&typeof e.onChange=="function"&&typeof e.removeMark=="function"&&typeof e.getDirtyPaths=="function"&&(e.marks===null||oa(e.marks))&&(e.selection===null||Xe.isRange(e.selection))&&Dt.isNodeList(e.children)&&cd.isOperationList(e.operations);return fI.set(e,n),n},ne={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return C0e(e)},isElementReadOnly(e,t){return e.isElementReadOnly(t)},isEmpty(e,t){return e.isEmpty(t)},isEnd(e,t,n){return e.isEnd(t,n)},isInline(e,t){return e.isInline(t)},isNormalizing(e){return e.isNormalizing()},isSelectable(e,t){return e.isSelectable(t)},isStart(e,t,n){return e.isStart(t,n)},isVoid(e,t){return e.isVoid(t)},last(e,t){return e.last(t)},leaf(e,t,n){return e.leaf(t,n)},levels(e,t){return e.levels(t)},marks(e){return e.getMarks()},next(e,t){return e.next(t)},node(e,t,n){return e.node(t,n)},nodes(e,t){return e.nodes(t)},normalize(e,t){e.normalize(t)},parent(e,t,n){return e.parent(t,n)},path(e,t,n){return e.path(t,n)},pathRef(e,t,n){return e.pathRef(t,n)},pathRefs(e){return e.pathRefs()},point(e,t,n){return e.point(t,n)},pointRef(e,t,n){return e.pointRef(t,n)},pointRefs(e){return e.pointRefs()},positions(e,t){return e.positions(t)},previous(e,t){return e.previous(t)},range(e,t,n){return e.range(t,n)},rangeRef(e,t,n){return e.rangeRef(t,n)},rangeRefs(e){return e.rangeRefs()},removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start(e,t){return e.start(t)},string(e,t,n){return e.string(t,n)},unhangRange(e,t,n){return e.unhangRange(t,n)},void(e,t){return e.void(t)},withoutNormalizing(e,t){e.withoutNormalizing(t)},shouldMergeNodesRemovePrevNode:(e,t,n)=>e.shouldMergeNodesRemovePrevNode(t,n)},S0e={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(Oe.isPath)}};function pI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function xI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Vs={compare(e,t){var n=Oe.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Vs.compare(e,t)===1},isBefore(e,t){return Vs.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&Oe.equals(e.path,t.path)},isPoint(e){return oa(e)&&typeof e.offset=="number"&&Oe.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return fO(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:o}=r;switch(t.type){case"insert_node":case"move_node":{r.path=Oe.transform(i,t,n);break}case"insert_text":{Oe.equals(t.path,i)&&(t.offset<o||t.offset===o&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{Oe.equals(t.path,i)&&(r.offset+=t.position),r.path=Oe.transform(i,t,n);break}case"remove_text":{Oe.equals(t.path,i)&&t.offset<=o&&(r.offset-=Math.min(o-t.offset,t.text.length));break}case"remove_node":{if(Oe.equals(t.path,i)||Oe.isAncestor(t.path,i))return null;r.path=Oe.transform(i,t,n);break}case"split_node":{if(Oe.equals(t.path,i)){if(t.position===o&&a==null)return null;(t.position<o||t.position===o&&a==="forward")&&(r.offset-=t.position,r.path=Oe.transform(i,t,xI(xI({},n),{},{affinity:"forward"})))}else r.path=Oe.transform(i,t,n);break}}})}},gI=void 0,Yr={setScrubber(e){gI=e},stringify(e){return JSON.stringify(e,gI)}},k0e=["text"],P0e=["anchor","focus","merge"];function yI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Fl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
689t%2?yI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var os={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var o=pc(i,k0e);return o}return xK(r?a(e):e,r?a(t):t)},isText(e){return oa(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>os.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[{leaf:Fl({},e)}];for(var r of t){var{anchor:a,focus:i,merge:o}=r,l=pc(r,P0e),[c,d]=Xe.edges(r),m=[],u=0,h=c.offset,p=d.offset,v=o??Object.assign;for(var{leaf:y}of n){var{length:g}=y.text,x=u;if(u+=g,h<=x&&u<=p){v(y,l),m.push({leaf:y});continue}if(h!==p&&(h===u||p===x)||h>u||p<x||p===x&&x!==0){m.push({leaf:y});continue}var b=y,w=void 0,j=void 0;if(p<u){var N=p-x;j={leaf:Fl(Fl({},b),{},{text:b.text.slice(N)})},b=Fl(Fl({},b),{},{text:b.text.slice(0,N)})}if(h>x){var C=h-x;w={leaf:Fl(Fl({},b),{},{text:b.text.slice(0,C)})},b=Fl(Fl({},b),{},{text:b.text.slice(C)})}v(b,l),w&&m.push(w),m.push({leaf:b}),j&&m.push(j)}n=m}if(n.length>1){var P=0;for(var[S,E]of n.entries()){var T=P,z=T+E.leaf.text.length,O={start:T,end:z};S===0&&(O.isFirst=!0),S===n.length-1&&(O.isLast=!0),E.position=O,P=z}}return n}},pO=e=>e.selection?e.selection:e.children.length>0?ne.end(e,[]):[0],kp=(e,t)=>{var[n]=ne.node(e,t);return r=>r===n},xO=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?F0e(t):t,i=$s.None,o=$s.None,l=0,c=null,d=null;for(var m of a){var u=m.codePointAt(0);if(!u)break;var h=H0e(m,u);if([i,o]=r?[o,h]:[h,i],xh(i,$s.ZWJ)&&xh(o,$s.ExtPict)&&(r?c=vI(t.substring(0,l)):c=vI(t.substring(0,t.length-l)),!c)||xh(i,$s.RI)&&xh(o,$s.RI)&&(d!==null?d=!d:r?d=!0:d=Q0e(t.substring(0,t.length-l)),!d)||i!==$s.None&&o!==$s.None&&K0e(i,o))break;l+=m.length}return l||1},E0e=/\s/,D0e=/[\u002B\u0021-\u0023\u0025-\u002A\u002C-\u002F\u003A\u003B\u003F\u0040\u005B-\u005D\u005F\u007B\u007D\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E3B\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/,A0e=/['\u2018\u2019]/,T0e=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=xO(t,n),[o,l]=gO(t,i,n);if(O0e(o,l,n))a=!0,r+=i;else if(!a)r+=i;else break;t=l}return r},gO=(e,t,n)=>{if(n){var r=e.length-t;return[e.slice(r,e.length),e.slice(0,r)]}return[e.slice(0,t),e.slice(t)]},O0e=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(E0e.test(t))return!1;if(A0e.test(t)){var a=xO(n,r),[i,o]=gO(n,a,r);if(e(i,o,r))return!0}return!D0e.test(t)},F0e=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(M0e(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(_0e(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},_0e=e=>e>=55296&&e<=56319,M0e=e=>e>=56320&&e<=57343,$s;(function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"})($s||($s={}));
689var $0e=/^(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])$/,I0e=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,R0e=/^(?:[\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E\u094F\u0982\u0983\u09BF\u09C0\u09C7\u09C8\u09CB\u09CC\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB\u0ACC\u0B02\u0B03\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0C01-\u0C03\u0C41-\u0C44\u0C82\u0C83\u0CBE\u0CC0\u0CC1\u0CC3\u0CC4\u
6890CC7\u0CC8\u0CCA\u0CCB\u0D02\u0D03\u0D3F\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D82\u0D83\u0DD0\u0DD1\u0DD8-\u0DDE\u0DF2\u0DF3\u0E33\u0EB3\u0F3E\u0F3F\u0F7F\u1031\u103B\u103C\u1056\u1057\u1084\u1715\u1734\u17B6\u17BE-\u17C5\u17C7\u17C8\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1A19\u1A1A\u1A55\u1A57\u1A6D-\u1A72\u1B04\u1B3B\u1B3D-\u1B41\u1B43\u1B44\u1B82\u1BA1\u1BA6\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1C24-\u1C2B\u1C34\u1C35\u1CE1\u1CF7\uA823\uA824\uA827\uA880\uA881\uA8B4-\uA8C3\uA952\uA953\uA983\uA9B4\uA9B5\uA9BA\uA9BB\uA9BE-\uA9C0\uAA2F\uAA30\uAA33\uAA34\uAA4D\uAAEB\uAAEE\uAAEF\uAAF5\uABE3\uABE4\uABE6\uABE7\uABE9\uABEA\uABEC]|\uD804[\uDC00\uDC02\uDC82\uDCB0-\uDCB2\uDCB7\uDCB8\uDD2C\uDD45\uDD46\uDD82\uDDB3-\uDDB5\uDDBF\uDDC0\uDDCE\uDE2C-\uDE2E\uDE32\uDE33\uDE35\uDEE0-\uDEE2\uDF02\uDF03\uDF3F\uDF41-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF62\uDF63]|\uD805[\uDC35-\uDC37\uDC40\uDC41\uDC45\uDCB1\uDCB2\uDCB9\uDCBB\uDCBC\uDCBE\uDCC1\uDDB0\uDDB1\uDDB8-\uDDBB\uDDBE\uDE30-\uDE32\uDE3B\uDE3C\uDE3E\uDEAC\uDEAE\uDEAF\uDEB6\uDF26]|\uD806[\uDC2C-\uDC2E\uDC38\uDD31-\uDD35\uDD37\uDD38\uDD3D\uDD40\uDD42\uDDD1-\uDDD3\uDDDC-\uDDDF\uDDE4\uDE39\uDE57\uDE58\uDE97]|\uD807[\uDC2F\uDC3E\uDCA9\uDCB1\uDCB4\uDD8A-\uDD8E\uDD93\uDD94\uDD96\uDEF5\uDEF6]|\uD81B[\uDF51-\uDF87\uDFF0\uDFF1]|\uD834[\uDD66\uDD6D])$/,B0e=/^[\u1100-\u115F\uA960-\uA97C]$/,L0e=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,U0e=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,z0e=/^[\uAC00\uAC1C\uAC38\uAC54\uAC70\uAC8C\uACA8\uACC4\uACE0\uACFC\uAD18\uAD34\uAD50\uAD6C\uAD88\uADA4\uADC0\uADDC\uADF8\uAE14\uAE30\uAE4C\uAE68\uAE84\uAEA0\uAEBC\uAED8\uAEF4\uAF10\uAF2C\uAF48\uAF64\uAF80\uAF9C\uAFB8\uAFD4\uAFF0\uB00C\uB028\uB044\uB060\uB07C\uB098\uB0B4\uB0D0\uB0EC\uB108\uB124\uB140\uB15C\uB178\uB194\uB1B0\uB1CC\uB1E8\uB204\uB220\uB23C\uB258\uB274\uB290\uB2AC\uB2C8\uB2E4\uB300\uB31C\uB338\uB354\uB370\uB38C\uB3A8\uB3C4\uB3E0\uB3FC\uB418\uB434\uB450\uB46C\uB488\uB4A4\uB4C0\uB4DC\uB4F8\uB514\uB530\uB54C\uB568\uB584\uB5A0\uB5BC\uB5D8\uB5F4\uB610\uB62C\uB648\uB664\uB680\uB69C\uB6B8\uB6D4\uB6F0\uB70C\uB728\uB744\uB760\uB77C\uB798\uB7B4\uB7D0\uB7EC\uB808\uB824\uB840\uB85C\uB878\uB894\uB8B0\uB8CC\uB8E8\uB904\uB920\uB93C\uB958\uB974\uB990\uB9AC\uB9C8\uB9E4\uBA00\uBA1C\uBA38\uBA54\uBA70\uBA8C\uBAA8\uBAC4\uBAE0\uBAFC\uBB18\uBB34\uBB50\uBB6C\uBB88\uBBA4\uBBC0\uBBDC\uBBF8\uBC14\uBC30\uBC4C\uBC68\uBC84\uBCA0\uBCBC\uBCD8\uBCF4\uBD10\uBD2C\uBD48\uBD64\uBD80\uBD9C\uBDB8\uBDD4\uBDF0\uBE0C\uBE28\uBE44\uBE60\uBE7C\uBE98\uBEB4\uBED0\uBEEC\uBF08\uBF24\uBF40\uBF5C\uBF78\uBF94\uBFB0\uBFCC\uBFE8\uC004\uC020\uC03C\uC058\uC074\uC090\uC0AC\uC0C8\uC0E4\uC100\uC11C\uC138\uC154\uC170\uC18C\uC1A8\uC1C4\uC1E0\uC1FC\uC218\uC234\uC250\uC26C\uC288\uC2A4\uC2C0\uC2DC\uC2F8\uC314\uC330\uC34C\uC368\uC384\uC3A0\uC3BC\uC3D8\uC3F4\uC410\uC42C\uC448\uC464\uC480\uC49C\uC4B8\uC4D4\uC4F0\uC50C\uC528\uC544\uC560\uC57C\uC598\uC5B4\uC5D0\uC5EC\uC608\uC624\uC640\uC65C\uC678\uC694\uC6B0\uC6CC\uC6E8\uC704\uC720\uC73C\uC758\uC774\uC790\uC7AC\uC7C8\uC7E4\uC800\uC81C\uC838\uC854\uC870\uC88C\uC8A8\uC8C4\uC8E0\uC8FC\uC918\uC934\uC950\uC96C\uC988\uC9A4\uC9C0\uC9DC\uC9F8\uCA14\uCA30\uCA4C\uCA68\uCA84\uCAA0\uCABC\uCAD8\uCAF4\uCB10\uCB2C\uCB48\uCB64\uCB80\uCB9C\uCBB8\uCBD4\uCBF0\uCC0C\uCC28\uCC44\uCC60\uCC7C\uCC98\uCCB4\uCCD0\uCCEC\uCD08\uCD24\uCD40\uCD5C\uCD78\uCD94\uCDB0\uCDCC\uCDE8\uCE04\uCE20\uCE3C\uCE58\uCE74\uCE90\uCEAC\uCEC8\uCEE4\uCF00\uCF1C\uCF38\uCF54\uCF70\uCF8C\uCFA8\uCFC4\uCFE0\uCFFC\uD018\uD034\uD050\uD06C\uD088\uD0A4\uD0C0\uD0DC\uD0F8\uD114\uD130\uD14C\uD168\uD184\uD1A0\uD1BC\uD1D8\uD1F4\uD210\uD22C\uD248\uD264\uD280\uD29C\uD2B8\uD2D4\uD2F0\uD30C\uD328\uD344\uD360\uD37C\uD398\uD3B4\uD3D0\uD3EC\uD408\uD424\uD440\uD45C\uD478\uD494\uD4B0\uD4CC\uD4E8\uD504\uD520\uD53C\uD558\uD574\uD590\uD5AC\uD5C8\uD5E4\uD600\uD61C\uD638\uD654\uD670\uD68C\uD6A8\uD6C4\uD6E0\uD6FC\uD718\uD734\uD750\uD76C\uD788]$/,q0e=/^[\uAC01-\uAC1B\uAC1D-\uAC37\uAC39-\uAC53\uAC55-\uAC6F\uAC71-\uAC8B\uAC8D-\uACA7\uACA9-\uACC3\uACC5-\uACDF\uACE1-\uACFB\uACFD-\uAD17\uAD19-\uAD33\uAD35-\uAD4F\uAD51-\uAD6B\uAD6D-\uAD87\uAD89-\uADA3\uADA5-\uADBF\uADC1-\uADDB\uADDD-\uADF7\uADF9-\uAE13\uAE15-\uAE2F\uAE31-\uAE4B\uAE4D-\uAE67\uAE69-\uAE83\uAE85-\uAE9F\uAEA1-\uAEBB\uAEBD-\uAED7\uAED9-\uAEF3\uAEF5-\uAF0F\uAF11-\uAF2B\uAF2D-\uAF47\uAF49-\uAF63\uAF65-\uAF7F\uAF81-\uAF9B\uAF9D-\uAFB7\uAFB9-\uAFD3\uAFD5-\uAFEF\uAFF1-\uB00B\uB00D-\uB027\uB029-\uB043\uB045-\uB05F\uB061-\uB07B\uB07D-\uB097\uB099-\uB0B3\uB0B5-\uB0CF\uB0D1-\uB0EB\uB0ED-\uB107\uB109-\uB123\uB125-\uB13F\uB141-\uB15B\uB15D-\uB177\uB179-\uB193\uB195-\uB1AF\uB1B1-\uB1CB\uB1CD-\uB1E7\uB1E9-\uB203\uB205-\uB21F\uB221-\uB23B\uB23D-\uB257\uB259-\uB273\uB275-\uB28F\uB291-\uB2AB\uB2AD-\uB2C7\uB2C9-\uB2E3\uB2E5-\uB2FF\uB301-\uB31B\uB31D-\uB337\uB339-\uB353\uB355-\uB36F\uB371-\uB38B\uB38D-\uB3A7\uB3A9-\uB3C3\uB3C5-\uB3DF\uB3E1-\uB3FB\uB3FD-\uB417\uB419-\uB433\uB435-\uB44F\uB451-\uB46B\uB46D-\uB487\uB489-\uB4A3\uB4A5-\uB4BF\uB4C1-\uB4DB\uB4DD-\uB4F7\uB4F9-\uB513\uB515-\uB52F\uB531-\uB54B\uB54D-\uB567\uB569-\uB583\uB585-\uB59F\uB5A1-\uB5BB\uB5BD-\uB5D7\uB5D9-\uB5F3\uB5F5-\uB60F\uB611-\uB62B\uB62D-\uB647\uB649-\uB663\uB665-\uB67F\uB681-\uB69B\uB69D-\uB6B7\uB6B9-\uB6D3\uB6D5-\uB6EF\uB6F1-\uB70B\uB70D-\uB727\uB729-\uB743\uB745-\uB75F\uB761-\uB77B\uB77D-\uB797\uB799-\uB7B3\uB7B5-\uB7CF\uB7D1-\uB7EB\uB7ED-\uB807\uB809-\uB823\uB825-\uB83F\uB841-\uB85B\uB85D-\uB877\uB879-\uB893\uB895-\uB8AF\uB8B1-\uB8CB\uB8CD-\uB8E7\uB8E9-\uB903\uB905-\uB91F\uB921-\uB93B\uB93D-\uB957\uB959-\uB973\uB975-\uB98F\uB991-\uB9AB\uB9AD-\uB9C7\uB9C9-\uB9E3\uB9E5-\uB9FF\uBA01-\uBA1B\uBA1D-\uBA37\uBA39-\uBA53\uBA55-\uBA6F\uBA71-\uBA8B\uBA8D-\uBAA7\uBAA9-\uBAC3\uBAC5-\uBADF\uBAE1-\uBAFB\uBAFD-\uBB17\uBB19-\uBB33\uBB35-\uBB4F\uBB51-\uBB6B\uBB6D-\uBB87\uBB89-\uBBA3\uBBA5-\uBBBF\uBBC1-\uBBDB\uBBDD-\uBBF7\uBBF9-\uBC13\uBC15-\uBC2F\uBC31-\uBC4B\uBC4D-\uBC67\uBC69-\uBC83\uBC85-\uBC9F\uBCA1-\uBCBB\uBCBD-\uBCD7\uBCD9-\uBCF3\uBCF5-\uBD0F\uBD11-\uBD2B\uBD2D-\uBD47\uBD49-\uBD63\uBD65-\uBD7F\uBD81-\uBD9B\uBD9D-\uBDB7\uBDB9-\uBDD3\uBDD5-\uBDEF\uBDF1-\uBE0B\uBE0D-\uBE27\uBE29-\uBE43\uBE45-\uBE5F\uBE61-\uBE7B\uBE7D-\uBE97\uBE99-\uBEB3\uBEB5-\uBECF\uBED1-\uBEEB\uBEED-\uBF07\uBF09-\uBF23\uBF25-\uBF3F\uBF41-\uBF5B\uBF5D-\uBF77\uBF79-\uBF93\uBF95-\uBFAF\uBFB1-\uBFCB\uBFCD-\uBFE7\uBFE9-\uC003\uC005-\uC01F\uC021-\uC03B\uC03D-\uC057\uC059-\uC073\uC075-\uC08F\uC091-\uC0AB\uC0AD-\uC0C7\uC0C9-\uC0E3\uC0E5-\uC0FF\uC101-\uC11B\uC11D-\uC137\uC139-\uC153\uC155-\uC16F\uC171-\uC18B\uC18D-\uC1A7\uC1A9-\uC1C3\uC1C5-\uC1DF\uC1E1-\uC1FB\uC1FD-\uC217\uC219-\uC233\uC235-\uC24F\uC251-\uC26B\uC26D-\uC287\uC289-\uC2A3\uC2A5-\uC2BF\uC2C1-\uC2DB\uC2DD-\uC2F7\u
689C2F9-\uC313\uC315-\uC32F\uC331-\uC34B\uC34D-\uC367\uC369-\uC383\uC385-\uC39F\uC3A1-\uC3BB\uC3BD-\uC3D7\uC3D9-\uC3F3\uC3F5-\uC40F\uC411-\uC42B\uC42D-\uC447\uC449-\uC463\uC465-\uC47F\uC481-\uC49B\uC49D-\uC4B7\uC4B9-\uC4D3\uC4D5-\uC4EF\uC4F1-\uC50B\uC50D-\uC527\uC529-\uC543\uC545-\uC55F\uC561-\uC57B\uC57D-\uC597\uC599-\uC5B3\uC5B5-\uC5CF\uC5D1-\uC5EB\uC5ED-\uC607\uC609-\uC623\uC625-\uC63F\uC641-\uC65B\uC65D-\uC677\uC679-\uC693\uC695-\uC6AF\uC6B1-\uC6CB\uC6CD-\uC6E7\uC6E9-\uC703\uC705-\uC71F\uC721-\uC73B\uC73D-\uC757\uC759-\uC773\uC775-\uC78F\uC791-\uC7AB\uC7AD-\uC7C7\uC7C9-\uC7E3\uC7E5-\uC7FF\uC801-\uC81B\uC81D-\uC837\uC839-\uC853\uC855-\uC86F\uC871-\uC88B\uC88D-\uC8A7\uC8A9-\uC8C3\uC8C5-\uC8DF\uC8E1-\uC8FB\uC8FD-\uC917\uC919-\uC933\uC935-\uC94F\uC951-\uC96B\uC96D-\uC987\uC989-\uC9A3\uC9A5-\uC9BF\uC9C1-\uC9DB\uC9DD-\uC9F7\uC9F9-\uCA13\uCA15-\uCA2F\uCA31-\uCA4B\uCA4D-\uCA67\uCA69-\uCA83\uCA85-\uCA9F\uCAA1-\uCABB\uCABD-\uCAD7\uCAD9-\uCAF3\uCAF5-\uCB0F\uCB11-\uCB2B\uCB2D-\uCB47\uCB49-\uCB63\uCB65-\uCB7F\uCB81-\uCB9B\uCB9D-\uCBB7\uCBB9-\uCBD3\uCBD5-\uCBEF\uCBF1-\uCC0B\uCC0D-\uCC27\uCC29-\uCC43\uCC45-\uCC5F\uCC61-\uCC7B\uCC7D-\uCC97\uCC99-\uCCB3\uCCB5-\uCCCF\uCCD1-\uCCEB\uCCED-\uCD07\uCD09-\uCD23\uCD25-\uCD3F\uCD41-\uCD5B\uCD5D-\uCD77\uCD79-\uCD93\uCD95-\uCDAF\uCDB1-\uCDCB\uCDCD-\uCDE7\uCDE9-\uCE03\uCE05-\uCE1F\uCE21-\uCE3B\uCE3D-\uCE57\uCE59-\uCE73\uCE75-\uCE8F\uCE91-\uCEAB\uCEAD-\uCEC7\uCEC9-\uCEE3\uCEE5-\uCEFF\uCF01-\uCF1B\uCF1D-\uCF37\uCF39-\uCF53\uCF55-\uCF6F\uCF71-\uCF8B\uCF8D-\uCFA7\uCFA9-\uCFC3\uCFC5-\uCFDF\uCFE1-\uCFFB\uCFFD-\uD017\uD019-\uD033\uD035-\uD04F\uD051-\uD06B\uD06D-\uD087\uD089-\uD0A3\uD0A5-\uD0BF\uD0C1-\uD0DB\uD0DD-\uD0F7\uD0F9-\uD113\uD115-\uD12F\uD131-\uD14B\uD14D-\uD167\uD169-\uD183\uD185-\uD19F\uD1A1-\uD1BB\uD1BD-\uD1D7\uD1D9-\uD1F3\uD1F5-\uD20F\uD211-\uD22B\uD22D-\uD247\uD249-\uD263\uD265-\uD27F\uD281-\uD29B\uD29D-\uD2B7\uD2B9-\uD2D3\uD2D5-\uD2EF\uD2F1-\uD30B\uD30D-\uD327\uD329-\uD343\uD345-\uD35F\uD361-\uD37B\uD37D-\uD397\uD399-\uD3B3\uD3B5-\uD3CF\uD3D1-\uD3EB\uD3ED-\uD407\uD409-\uD423\uD425-\uD43F\uD441-\uD45B\uD45D-\uD477\uD479-\uD493\uD495-\uD4AF\uD4B1-\uD4CB\uD4CD-\uD4E7\uD4E9-\uD503\uD505-\uD51F\uD521-\uD53B\uD53D-\uD557\uD559-\uD573\uD575-\uD58F\uD591-\uD5AB\uD5AD-\uD5C7\uD5C9-\uD5E3\uD5E5-\uD5FF\uD601-\uD61B\uD61D-\uD637\uD639-\uD653\uD655-\uD66F\uD671-\uD68B\uD68D-\uD6A7\uD6A9-\uD6C3\uD6C5-\uD6DF\uD6E1-\uD6FB\uD6FD-\uD717\uD719-\uD733\uD735-\uD74F\uD751-\uD76B\uD76D-\uD787\uD789-\uD7A3]$/,W0e=/^(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])$/,H0e=(e,t)=>{var n=$s.Any;return e.search($0e)!==-1&&(n|=$s.Extend),t===8205&&(n|=$s.ZWJ),t>=127462&&t<=127487&&(n|=$s.RI),e.search(I0e)!==-1&&(n|=$s.Prepend),e.search(R0e)!==-1&&(n|=$s.SpacingMark),e.search(B0e)!==-1&&(n|=$s.L),e.search(L0e)!==-1&&(n|=$s.V),e.search(U0e)!==-1&&(n|=$s.T),e.search(z0e)!==-1&&(n|=$s.LV),e.search(q0e)!==-1&&(n|=$s.LVT),e.search(W0e)!==-1&&(n|=$s.ExtPict),n};function xh(e,t){return(e&t)!==0}var V0e=[[$s.L,$s.L|$s.V|$s.LV|$s.LVT],[$s.LV|$s.V,$s.V|$s.T],[$s.LVT|$s.T,$s.T],[$s.Any,$s.Extend|$s.ZWJ],[$s.Any,$s.SpacingMark],[$s.Prepend,$s.Any],[$s.ZWJ,$s.ExtPict],[$s.RI,$s.RI]];function K0e(e,t){return V0e.findIndex(n=>xh(e,n[0])&&xh(t,n[1]))===-1}var G0e=/(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])(?:[\u0300-\u036F\u0483-\u0489\u
6890591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])*\u200D$/,vI=e=>e.search(G0e)!==-1,Y0e=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Q0e=e=>{var t=e.match(Y0e);if(t===null)return!1;var n=t[0].length/2;return n%2===1},J0e={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ne.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=pO(e)}=n;
689if(Oe.isPath(a)&&(a=ne.range(e,a)),Xe.isRange(a))if(Xe.isCollapsed(a))a=a.anchor;else{var i=Xe.end(a);if(!r&&ne.void(e,{at:i}))return;var o=Xe.start(a),l=ne.pointRef(e,o),c=ne.pointRef(e,i);ut.delete(e,{at:a,voids:r});var d=l.unref(),m=c.unref();a=d||m,ut.setSelection(e,{anchor:a,focus:a})}if(!(!r&&ne.void(e,{at:a})||ne.elementReadOnly(e,{at:a}))){var{path:u,offset:h}=a;t.length>0&&e.apply({type:"insert_text",path:u,offset:h,text:t})}})}};function bI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function _0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ut=_0(_0(_0(_0({},x0e),g0e),y0e),J0e),Mb=new WeakMap,X0e=e=>Mb.get(e)||!1,Z0e=(e,t,n)=>{var r=Mb.get(e)||!1;Mb.set(e,!0);try{t(),n()}finally{Mb.set(e,r)}};function gK(e,t,n){var r=Bw.get(e)||[],a=Lw.get(e)||new Set,i,o,l=u=>{if(u){var h=u.join(",");o.has(h)||(o.add(h),i.push(u))}};if(n){i=[],o=new Set;for(var c of r){var d=n(c);l(d)}}else i=r,o=a;for(var m of t)l(m);Bw.set(e,i),Lw.set(e,o)}var ebe=(e,t)=>{for(var n of ne.pathRefs(e))d0e.transform(n,t);for(var r of ne.pointRefs(e))u0e.transform(r,t);for(var a of ne.rangeRefs(e))m0e.transform(a,t);if(!X0e(e)){var i=Oe.operationCanTransformPath(t)?o=>Oe.transform(o,t):void 0;gK(e,e.getDirtyPaths(t),i)}ut.transform(e,t),e.operations.push(t),ne.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Kx.get(e)||(Kx.set(e,!0),Promise.resolve().then(()=>{Kx.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},tbe=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return Oe.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=Oe.levels(a),o=os.isText(r)?[]:Array.from(Dt.nodes(r),T=>{var[,z]=T;return a.concat(z)});return[...i,...o]}case"merge_node":{var{path:l}=t,c=Oe.ancestors(l),d=Oe.previous(l);return[...c,d]}case"move_node":{var{path:m,newPath:u}=t;if(Oe.equals(m,u))return[];var h=[],p=[];for(var v of Oe.ancestors(m)){var y=Oe.transform(v,t);h.push(y)}for(var g of Oe.ancestors(u)){var x=Oe.transform(g,t);p.push(x)}var b=p[p.length-1],w=u[u.length-1],j=b.concat(w);return[...h,...p,j]}case"remove_node":{var{path:N}=t,C=Oe.ancestors(N);return[...C]}case"split_node":{var{path:P}=t,S=Oe.levels(P),E=Oe.next(P);return[...S,E]}default:return[]}},sbe=e=>{var{selection:t}=e;return t?Dt.fragment(e,t):[]},nbe=(e,t)=>{var[n,r]=t;if(!os.isText(n)){if(rs.isElement(n)&&n.children.length===0){var a={text:""};ut.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=ne.isEditor(n)?!1:rs.isElement(n)&&(e.isInline(n)||n.children.length===0||os.isText(n.children[0])||e.isInline(n.children[0])),o=0,l=0;l<n.children.length;l++,o++){var c=Dt.get(e,r);if(!os.isText(c)){var d=c.children[o],m=c.children[o-1],u=l===n.children.length-1,h=os.isText(d)||rs.isElement(d)&&e.isInline(d);if(h!==i)h?ut.removeNodes(e,{at:r.concat(o),voids:!0}):ut.unwrapNodes(e,{at:r.concat(o),voids:!0}),o--;else if(rs.isElement(d)){if(e.isInline(d)){if(m==null||!os.isText(m)){var p={text:""};ut.insertNodes(e,p,{at:r.concat(o),voids:!0}),o++}else if(u){var v={text:""};ut.insertNodes(e,v,{at:r.concat(o+1),voids:!0}),o++}}}else{if(!os.isText(d)&&!("children"in d)){var y=d;y.children=[]}m!=null&&os.isText(m)&&(os.equals(d,m,{loose:!0})?(ut.mergeNodes(e,{at:r.concat(o),voids:!0}),o--):m.text===""?(ut.removeNodes(e,{at:r.concat(o-1),voids:!0}),o--):d.text===""&&(ut.removeNodes(e,{at:r.concat(o),voids:!0}),o--))}}}}},rbe=(e,t)=>{var{iteration:n,initialDirtyPathsLength:r}=t,a=r*42;if(n>a)throw new Error("Could not completely normalize the editor after ".concat(a," iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state."));return!0},abe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:o}=n;if(i){var l=ne.path(t,i),c=a==="lowest";for(var[d,m]of ne.levels(t,{at:l,voids:r,match:o,reverse:c}
689))if(!os.isText(d)){if(Xe.isRange(i)){if(Oe.isAncestor(m,i.anchor.path)&&Oe.isAncestor(m,i.focus.path))return[d,m]}else if(!Oe.equals(l,m))return[d,m]}}};function wI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function jI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?wI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ibe=(e,t,n)=>{var{selection:r}=e;if(r){var a=(u,h)=>{if(!os.isText(u))return!1;var[p,v]=ne.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},i=Xe.isExpanded(r),o=!1;if(!i){var[l,c]=ne.node(e,r);if(l&&a(l,c)){var[d]=ne.parent(e,c);o=d&&e.markableVoid(d)}}if(i||o)ut.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var m=jI(jI({},ne.marks(e)||{}),{},{[t]:n});e.marks=m,Kx.get(e)||e.onChange()}}};function NI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function CI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?NI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var obe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=ne.point(t,n,{edge:"end"}),i=ne.end(t,[]),o={anchor:a,focus:i},{distance:l=1}=r,c=0,d;for(var m of ne.positions(t,CI(CI({},r),{},{at:o}))){if(c>l)break;c!==0&&(d=m),c++}return d};function SI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function kI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?SI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var lbe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=ne.start(t,[]),i=ne.point(t,n,{edge:"start"}),o={anchor:a,focus:i},{distance:l=1}=r,c=0,d;for(var m of ne.positions(t,kI(kI({},r),{},{at:o,reverse:!0}))){if(c>l)break;c!==0&&(d=m),c++}return d},cbe=(e,t)=>{var{selection:n}=e;n&&Xe.isCollapsed(n)&&ut.delete(e,{unit:t,reverse:!0})},dbe=(e,t)=>{var{selection:n}=e;n&&Xe.isCollapsed(n)&&ut.delete(e,{unit:t})},ube=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&Xe.isExpanded(r)&&ut.delete(t,{reverse:n==="backward"})},mbe=(e,t)=>[ne.start(e,t),ne.end(e,t)];function PI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function EI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?PI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var hbe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ne.above(t,EI(EI({},n),{},{match:r=>rs.isElement(r)&&ne.isElementReadOnly(t,r)}
689))},fbe=(e,t)=>ne.point(e,t,{edge:"end"}),pbe=(e,t)=>{var n=ne.path(e,t,{edge:"start"});return ne.node(e,n)},xbe=(e,t)=>{var n=ne.range(e,t);return Dt.fragment(e,n)};function DI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function AI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?DI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var gbe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ne.above(t,AI(AI({},n),{},{match:r=>rs.isElement(r)&&ne.isVoid(t,r)}))},ybe=(e,t)=>t.children.some(n=>rs.isElement(n)&&ne.isBlock(e,n)),vbe=(e,t)=>t.children.some(n=>os.isText(n)||ne.isInline(e,n)),bbe=(e,t)=>Dt.has(e,t),wbe=(e,t)=>t.children.every(n=>os.isText(n)),jbe=e=>{ut.splitNodes(e,{always:!0})},Nbe=(e,t,n)=>{ut.insertNodes(e,t,n)},Cbe=e=>{ut.splitNodes(e,{always:!0})};function TI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Sbe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?TI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):TI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var kbe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a,marks:i}=t;if(a){if(i){var o=Sbe({text:n},i);ut.insertNodes(t,o,{at:r.at,voids:r.voids})}else ut.insertText(t,n,r);t.marks=null}},Pbe=(e,t)=>!e.isInline(t),Ebe=(e,t,n)=>ne.isStart(e,t,n)||ne.isEnd(e,t,n),Dbe=(e,t)=>
689{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&os.isText(r)&&r.text===""&&!e.isVoid(t)},Abe=(e,t,n)=>{var r=ne.end(e,n);return Vs.equals(t,r)},Tbe=e=>{var t=pK.get(e);return t===void 0?!0:t},Obe=(e,t,n)=>{if(t.offset!==0)return!1;var r=ne.start(e,n);return Vs.equals(t,r)},Fbe=(e,t)=>{var n=ne.path(e,t,{edge:"end"});return ne.node(e,n)},_be=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=ne.path(t,n,r),i=Dt.leaf(t,a);return[i,a]};function Mbe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var o=[],l=ne.path(e,n);for(var[c,d]of Dt.levels(e,l))if(i(c,d)&&(o.push([c,d]),!a&&rs.isElement(c)&&ne.isVoid(e,c)))break;r&&o.reverse(),yield*o}}()}var $be=["text"],Ibe=["text"],Rbe=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(Xe.isExpanded(r)){var o=Xe.isBackward(r);o&&([i,a]=[a,i]);var l=ne.isEnd(t,a,a.path);if(l){var c=ne.after(t,a);c&&(a=c)}var[d]=ne.nodes(t,{match:os.isText,at:{anchor:a,focus:i}});if(d){var[m]=d,u=pc(m,$be);return u}else return{}}var{path:h}=a,[p]=ne.leaf(t,h);if(a.offset===0){var v=ne.previous(t,{at:h,match:os.isText}),y=ne.above(t,{match:N=>rs.isElement(N)&&ne.isVoid(t,N)&&t.markableVoid(N)});if(!y){var g=ne.above(t,{match:N=>rs.isElement(N)&&ne.isBlock(t,N)});if(v&&g){var[x,b]=v,[,w]=g;Oe.isAncestor(w,b)&&(p=x)}}}var j=pc(p,Ibe);return j},Bbe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:o=t.selection}=n;if(o){var l=ne.after(t,o,{voids:a});if(l){var[,c]=ne.last(t,[]),d=[l.path,c];if(Oe.isPath(o)&&o.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(Oe.isPath(o)){var[m]=ne.parent(t,o);i=h=>m.children.includes(h)}else i=()=>!0;var[u]=ne.nodes(t,{at:d,match:i,mode:r,voids:a});return u}}},Lbe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=ne.path(t,n,r),i=Dt.get(t,a);return[i,a]};function Ube(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:o=!1,pass:l,ignoreNonSelectable:c=!1}=t,{match:d}=t;if(d||(d=()=>!0),!!n){var m,u;if(S0e.isSpan(n))m=n[0],u=n[1];else{var h=ne.path(e,n,{edge:"start"}),p=ne.path(e,n,{edge:"end"});m=i?p:h,u=i?h:p}var v=Dt.nodes(e,{reverse:i,from:m,to:u,pass:N=>{var[C,P]=N;return l&&l([C,P])?!0:rs.isElement(C)?!!(!o&&(ne.isVoid(e,C)||ne.isElementReadOnly(e,C))||c&&!ne.isSelectable(e,C)):!1}}),y=[],g;for(var[x,b]of v)if(!(c&&rs.isElement(x)&&!ne.isSelectable(e,x))){var w=g&&Oe.compare(b,g[1])===0;if(!(r==="highest"&&w)){if(!d(x,b)){if(a&&!w&&os.isText(x))return;continue}if(r==="lowest"&&w){g=[x,b];continue}var j=r==="lowest"?g:[x,b];j&&(a?y.push(j):yield j),g=[x,b]}}r==="lowest"&&g&&(a?y.push(g):yield g),a&&(yield*y)}}()}var zbe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=m=>Bw.get(m)||[],o=m=>Lw.get(m)||new Set,l=m=>{var u=i(m).pop(),h=u.join(",");return o(m).delete(h),u};if(ne.isNormalizing(t)){if(r){var c=Array.from(Dt.nodes(t),m=>{var[,u]=m;return u}),d=new Set(c.map(m=>m.join(",")));Bw.set(t,c),Lw.set(t,d)}i(t).length!==0&&ne.withoutNormalizing(t,()=>{for(var m of i(t))if(Dt.has(t,m)){var u=ne.node(t,m),[h,p]=u;rs.isElement(h)&&h.children.length===0&&t.normalizeNode(u,{operation:a})}for(var v=i(t),y=v.length,g=0;v.length!==0;){if(!t.shouldNormalize({dirtyPaths:v,iteration:g,initialDirtyPathsLength:y,operation:a}))return;var x=l(t);if(Dt.has(t,x)){var b=ne.node(t,x);t.normalizeNode(b,{operation:a})}g++,v=i(t)}})}},qbe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=ne.path(t,n,r),i=Oe.parent(a),o=ne.node(t,i);return o},Wbe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:l}=i,c=ne.pathRefs(t);return c.delete(i),i.current=null,l}},o=ne.pathRefs(t);return o.add(i),i},Hbe=e=>{var t=iI.get(e);return t||(t=new Set,iI.set(e,t)),t},Vbe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(Oe.isPath(n)){if(i==="start"){var[,o]=Dt.first(t,n);n=o}else if(i==="end"){var[,l]=Dt.last(t,n);n=l}}return Xe.isRange(n)&&(i==="start"?n=Xe.start(n):i==="end"?n=Xe.end(n):n=Oe.common(n.anchor.path,n.focus.path)),Vs.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},Kbe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:l}=i,c=ne.pointRefs(t);return c.delete(i),i.current=null,l}},o=ne.pointRefs(t);return o.add(i),i},Gbe=e=>{var t=oI.get(e);return t||(t=new Set,oI.set(e,t)),t},Ybe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(Oe.isPath(n)){var i;if(a==="end"){var[,o]=Dt.last(t,n);i=o}else{var[,l]=Dt.first(t,n);i=l}var c=Dt.get(t,i);if(!os.isText(c))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?c.text.length:0}}if(Xe.isRange(n)){var[d,m]=Xe.edges(n);return a==="start"?d:m}return n};function Qbe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:o=!1}=t;if(!n)return;var l=ne.range(e,n),[c,d]=Xe.edges(l),m=a?d:c,u=!1,h="",p=0,v=0,y=0;for(var[g,x]of ne.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:o})){if(rs.isElement(g)){if(!i&&(e.isVoid(g)||e.isElementReadOnly(g))){yield ne.start(e,x);continue}if(e.isInline(g))continue;if(ne.hasInlines(e,g)){var b=Oe.isAncestor(x,d.path)?d:ne.end(e,x),w=Oe.isAncestor(x,c.path)?c:ne.start(e,x);h=ne.string(e,{anchor:w,focus:b},{voids:i}),u=!0}}if(os.isText(g)){var j=Oe.equals(x,m.path);for(j?(v=a?m.offset:g.text.length-m.offset,y=m.offset):(v=g.text.length,y=a?v:0),(j||u||r==="offset")&&(yield{path:x,offset:y},u=!1);;){if(p===0){if(h==="")break;p=N(h,r,a),h=gO(h,p,a)[1]}if(y=a?y-p:y+p,v=v-p,v<0){p=-v;break}p=0,yield{path:x,offset:y}}}}function N(C,P,S){return P==="character"?xO(C,S):P==="word"?T0e(C,S):P==="line"||P==="block"?C.length:1}}()}var Jbe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:o=t.selection}=n;if(o){var l=ne.before(t,o,{voids:a});if(l){var[,c]=ne.first(t,[]),d=[l.path,c];if(Oe.isPath(o)&&o.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(Oe.isPath(o)){var[m]=ne.parent(t,o);i=h=>m.children.includes(h)}else i=()=>!0;var[u]=ne.nodes(t,{reverse:!0,at:d,match:i,mode:r,voids:a});return u}}},Xbe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:l}=i,c=ne.rangeRefs(t);return c.delete(i),i.current=null,l}},o=ne.rangeRefs(t);return o.add(i),i},Zbe=e=>{var t=lI.get(e);return t||(t=new Set,lI.set(e,t)),t},ewe=(e,t,n)=>{if(Xe.isRange(t)&&!n)return t;var r=ne.start(e,t),a=ne.end(e,n||t);return{anchor:r,focus:a}};function OI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function twe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
689t%2?OI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var swe=(e,t)=>{var{selection:n}=e;if(n){var r=(m,u)=>{if(!os.isText(m))return!1;var[h,p]=ne.parent(e,u);return!e.isVoid(h)||e.markableVoid(h)},a=Xe.isExpanded(n),i=!1;if(!a){var[o,l]=ne.node(e,n);if(o&&r(o,l)){var[c]=ne.parent(e,l);i=c&&e.markableVoid(c)}}if(a||i)ut.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var d=twe({},ne.marks(e)||{});delete d[t],e.marks=d,Kx.get(e)||e.onChange()}}},nwe=(e,t)=>{pK.set(e,t)},rwe=(e,t)=>ne.point(e,t,{edge:"start"}),awe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=ne.range(t,n),[o,l]=Xe.edges(i),c="";for(var[d,m]of ne.nodes(t,{at:i,match:os.isText,voids:a})){var u=d.text;Oe.equals(m,l.path)&&(u=u.slice(0,l.offset)),Oe.equals(m,o.path)&&(u=u.slice(o.offset)),c+=u}return c},iwe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,o]=Xe.edges(n);if(i.offset!==0||o.offset!==0||Xe.isCollapsed(n)||Oe.hasPrevious(o.path))return n;var l=ne.above(t,{at:o,match:v=>rs.isElement(v)&&ne.isBlock(t,v),voids:a}),c=l?l[1]:[],d=ne.start(t,i),m={anchor:d,focus:o},u=!0;for(var[h,p]of ne.nodes(t,{at:m,match:os.isText,reverse:!0,voids:a})){if(u){u=!1;continue}if(h.text!==""||Oe.isBefore(p,c)){o={path:p,offset:h.text.length};break}}return{anchor:i,focus:o}},owe=(e,t)=>{var n=ne.isNormalizing(e);ne.setNormalizing(e,!1);try{t()}finally{ne.setNormalizing(e,n)}ne.normalize(e)},lwe=(e,t,n)=>{var[r,a]=t;return rs.isElement(r)&&ne.isEmpty(e,r)||os.isText(r)&&r.text===""&&a[a.length-1]!==0},cwe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ne.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:o="character",distance:l=1,voids:c=!1}=n,{at:d=t.selection,hanging:m=!1}=n;if(d){var u=!1;if(Xe.isRange(d)&&Xe.isCollapsed(d)&&(u=!0,d=d.anchor),Vs.isPoint(d)){var h=ne.void(t,{at:d,mode:"highest"});if(!c&&h){var[,p]=h;d=p}else{var v={unit:o,distance:l},y=i?ne.before(t,d,v)||ne.start(t,[]):ne.after(t,d,v)||ne.end(t,[]);d={anchor:d,focus:y},m=!0}}if(Oe.isPath(d)){ut.removeNodes(t,{at:d,voids:c});return}if(!Xe.isCollapsed(d)){if(!m){var[,g]=Xe.edges(d),x=ne.end(t,[]);Vs.equals(g,x)||(d=ne.unhangRange(t,d,{voids:c}))}var[b,w]=Xe.edges(d),j=ne.above(t,{match:A=>rs.isElement(A)&&ne.isBlock(t,A),at:b,voids:c}),N=ne.above(t,{match:A=>rs.isElement(A)&&ne.isBlock(t,A),at:w,voids:c}),C=j&&N&&!Oe.equals(j[1],N[1]),P=Oe.equals(b.path,w.path),S=c?null:(r=ne.void(t,{at:b,mode:"highest"}))!==null&&r!==void 0?r:ne.elementReadOnly(t,{at:b,mode:"highest"}),E=c?null:(a=ne.void(t,{at:w,mode:"highest"}))!==null&&a!==void 0?a:ne.elementReadOnly(t,{at:w,mode:"highest"});if(S){var T=ne.before(t,b);T&&j&&Oe.isAncestor(j[1],T.path)&&(b=T)}if(E){var z=ne.after(t,w);z&&N&&Oe.isAncestor(N[1],z.path)&&(w=z)}var O=[],D;for(var k of ne.nodes(t,{at:d,voids:c})){var[F,W]=k;D&&Oe.compare(W,D)===0||(!c&&rs.isElement(F)&&(ne.isVoid(t,F)||ne.isElementReadOnly(t,F))||!Oe.isCommon(W,b.path)&&!Oe.isCommon(W,w.path))&&(O.push(k),D=W)}var q=Array.from(O,A=>{var[,ge]=A;return ne.pathRef(t,ge)}),H=ne.pointRef(t,b),_=ne.pointRef(t,w),L="";if(!P&&!S){var U=H.current,[J]=ne.leaf(t,U),{path:I}=U,{offset:re}=b,R=J.text.slice(re);R.length>0&&(t.apply({type:"remove_text",path:I,offset:re,text:R}),L=R)}if(q.reverse().map(A=>A.unref()).filter(A=>A!==null).forEach(A=>ut.removeNodes(t,{at:A,voids:c})),!E){var Y=_.current,[M]=ne.leaf(t,Y),{path:se}=Y,Q=P?b.offset:0,te=M.text.slice(Q,w.offset);te.length>0&&(t.apply({type:"remove_text",path:se,offset:Q,text:te}),L=te)}!P&&C&&_.current&&H.current&&ut.mergeNodes(t,{at:_.current,hanging:!0,voids:c}),u&&i&&o==="character"&&L.length>1&&L.match(/[\u0E00-\u0E7F]+/)&&ut.insertText(t,L.slice(0,L.length-l));var G=H.unref(),Z=_.unref(),ie=i?G||Z:Z||G;n.at==null&&ie&&ut.select(t,ie)}}})},dwe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ne.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:o=pO(t),batchDirty:l=!0}=r;if(n.length){if(Xe.isRange(o))if(a||(o=ne.unhangRange(t,o,{voids:i})),Xe.isCollapsed(o))o=o.anchor;else{var[,c]=Xe.edges(o);if(!i&&ne.void(t,{at:c}))return;var d=ne.pointRef(t,c);ut.delete(t,{at:o}),o=d.unref()}else Oe.isPath(o)&&(o=ne.start(t,o));if(!(!i&&ne.void(t,{at:o}))){var m=ne.above(t,{at:o,match:R=>rs.isElement(R)&&ne.isInline(t,R),mode:"highest",voids:i});if(m){var[,u]=m;if(ne.isEnd(t,o,u)){var h=ne.after(t,u);o=h}else if(ne.isStart(t,o,u)){var p=ne.before(t,u);
689o=p}}var v=ne.above(t,{match:R=>rs.isElement(R)&&ne.isBlock(t,R),at:o,voids:i}),[,y]=v,g=ne.isStart(t,o,y),x=ne.isEnd(t,o,y),b=g&&x,w=!g||g&&x,j=!x,[,N]=Dt.first({children:n},[]),[,C]=Dt.last({children:n},[]),P=[],S=R=>{var[Y,M]=R,se=M.length===0;return se?!1:b?!0:!(w&&Oe.isAncestor(M,N)&&rs.isElement(Y)&&!t.isVoid(Y)&&!t.isInline(Y)||j&&Oe.isAncestor(M,C)&&rs.isElement(Y)&&!t.isVoid(Y)&&!t.isInline(Y))};for(var E of Dt.nodes({children:n},{pass:S}))S(E)&&P.push(E);var T=[],z=[],O=[],D=!0,k=!1;for(var[F]of P)rs.isElement(F)&&!t.isInline(F)?(D=!1,k=!0,z.push(F)):D?T.push(F):O.push(F);var[W]=ne.nodes(t,{at:o,match:R=>os.isText(R)||ne.isInline(t,R),mode:"highest",voids:i}),[,q]=W,H=ne.isStart(t,o,q),_=ne.isEnd(t,o,q),L=ne.pathRef(t,x&&!O.length?Oe.next(y):y),U=ne.pathRef(t,_?Oe.next(q):q);ut.splitNodes(t,{at:o,match:R=>k?rs.isElement(R)&&ne.isBlock(t,R):os.isText(R)||ne.isInline(t,R),mode:k?"lowest":"highest",always:k&&(!g||T.length>0)&&(!x||O.length>0),voids:i});var J=ne.pathRef(t,!H||H&&_?Oe.next(q):q);if(ut.insertNodes(t,T,{at:J.current,match:R=>os.isText(R)||ne.isInline(t,R),mode:"highest",voids:i,batchDirty:l}),b&&!T.length&&z.length&&!O.length&&ut.delete(t,{at:y,voids:i}),ut.insertNodes(t,z,{at:L.current,match:R=>rs.isElement(R)&&ne.isBlock(t,R),mode:"lowest",voids:i,batchDirty:l}),ut.insertNodes(t,O,{at:U.current,match:R=>os.isText(R)||ne.isInline(t,R),mode:"highest",voids:i,batchDirty:l}),!r.at){var I;if(O.length>0&&U.current?I=Oe.previous(U.current):z.length>0&&L.current?I=Oe.previous(L.current):J.current&&(I=Oe.previous(J.current)),I){var re=ne.end(t,I);ut.select(t,re)}}J.unref(),L.unref(),U.unref()}}})},uwe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")ut.select(t,a.anchor);else if(r==="focus")ut.select(t,a.focus);else if(r==="start"){var[i]=Xe.edges(a);ut.select(t,i)}else if(r==="end"){var[,o]=Xe.edges(a);ut.select(t,o)}}else return},mwe=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},hwe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:o=!1}=n,{edge:l=null}=n;if(r){l==="start"&&(l=Xe.isBackward(r)?"focus":"anchor"),l==="end"&&(l=Xe.isBackward(r)?"anchor":"focus");
689var{anchor:c,focus:d}=r,m={distance:a,unit:i,ignoreNonSelectable:!0},u={};if(l==null||l==="anchor"){var h=o?ne.before(t,c,m):ne.after(t,c,m);h&&(u.anchor=h)}if(l==null||l==="focus"){var p=o?ne.before(t,d,m):ne.after(t,d,m);p&&(u.focus=p)}ut.setSelection(t,u)}},fwe=(e,t)=>{var{selection:n}=e;if(t=ne.range(e,t),n){ut.setSelection(e,t);return}if(!Xe.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(Yr.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function FI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function _I(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?FI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var pwe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=Xe.isBackward(a)?"focus":"anchor"),i==="end"&&(i=Xe.isBackward(a)?"anchor":"focus");
689var{anchor:o,focus:l}=a,c=i==="anchor"?o:l;ut.setSelection(t,{[i==="anchor"?"anchor":"focus"]:_I(_I({},c),n)})}},xwe=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Vs.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Vs.equals(t.focus,n.focus)||i!=="anchor"&&i!=="focus"&&t[i]!==n[i])&&(r[i]=n[i],a[i]=t[i]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:a})}},gwe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ne.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:o="lowest",batchDirty:l=!0}=r,{at:c,match:d,select:m}=r;if(Dt.isNode(n)&&(n=[n]),n.length!==0){var[u]=n;if(c||(c=pO(t),m!==!1&&(m=!0)),m==null&&(m=!1),Xe.isRange(c))if(a||(c=ne.unhangRange(t,c,{voids:i})),Xe.isCollapsed(c))c=c.anchor;else{var[,h]=Xe.edges(c),p=ne.pointRef(t,h);ut.delete(t,{at:c}),c=p.unref()}if(Vs.isPoint(c)){d==null&&(os.isText(u)?d=T=>os.isText(T):t.isInline(u)?d=T=>os.isText(T)||ne.isInline(t,T):d=T=>rs.isElement(T)&&ne.isBlock(t,T));var[v]=ne.nodes(t,{at:c.path,match:d,mode:o,voids:i});if(v){var[,y]=v,g=ne.pathRef(t,y),x=ne.isEnd(t,c,y);ut.splitNodes(t,{at:c,match:d,mode:o,voids:i});var b=g.unref();c=x?Oe.next(b):b}else return}var w=Oe.parent(c),j=c[c.length-1];if(!(!i&&ne.void(t,{at:w}))){if(l){var N=[],C=Oe.levels(w);Z0e(t,()=>{var T=function(){var D=w.concat(j);j++;var k={type:"insert_node",path:D,node:z};t.apply(k),c=Oe.next(c),N.push(k),os.isText(z)?C.push(D):C.push(...Array.from(Dt.nodes(z),F=>{var[,W]=F;return D.concat(W)}))};for(var z of n)T()},()=>{gK(t,C,T=>{var z=T;for(var O of N)if(Oe.operationCanTransformPath(O)&&(z=Oe.transform(z,O),!z))return null;return z})})}else for(var P of n){var S=w.concat(j);j++,t.apply({type:"insert_node",path:S,node:P}),c=Oe.next(c)}if(c=Oe.previous(c),m){var E=ne.end(t,c);E&&ut.select(t,E)}}}})},ywe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ne.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:o}=n;if(o==null&&(o=Oe.isPath(r)?kp(t,r):j=>rs.isElement(j)&&ne.isBlock(t,j)),!!r){var l=ne.nodes(t,{at:r,match:o,mode:a,voids:i}),c=Array.from(l,j=>{var[,N]=j;return ne.pathRef(t,N)});for(var d of c){var m=d.unref();if(m.length<2)throw new Error("Cannot lift node at a path [".concat(m,"] because it has a depth of less than `2`."));var u=ne.node(t,Oe.parent(m)),[h,p]=u,v=m[m.length-1],{length:y}=h.children;if(y===1){var g=Oe.next(p);ut.moveNodes(t,{at:m,to:g,voids:i}),ut.removeNodes(t,{at:p,voids:i})}else if(v===0)ut.moveNodes(t,{at:m,to:p,voids:i});else if(v===y-1){var x=Oe.next(p);ut.moveNodes(t,{at:m,to:x,voids:i})}else{var b=Oe.next(m),w=Oe.next(p);ut.splitNodes(t,{at:b,voids:i}),ut.moveNodes(t,{at:m,to:w,voids:i})}}}})},vwe=["text"],bwe=["children"],yK=(e,t)=>{if(rs.isElement(t)){var n=t;return ne.isVoid(e,t)?!0:n.children.length===1?yK(e,n.children[0]):!1}else return!ne.isEditor(t)},wwe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ne.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:o=!1,mode:l="lowest"}=n;if(a){if(r==null)if(Oe.isPath(a)){var[c]=ne.parent(t,a);r=T=>c.children.includes(T)}else r=T=>rs.isElement(T)&&ne.isBlock(t,T);if(!i&&Xe.isRange(a)&&(a=ne.unhangRange(t,a,{voids:o})),Xe.isRange(a))if(Xe.isCollapsed(a))a=a.anchor;else{var[,d]=Xe.edges(a),m=ne.pointRef(t,d);ut.delete(t,{at:a}),a=m.unref(),n.at==null&&ut.select(t,a)}var[u]=ne.nodes(t,{at:a,match:r,voids:o,mode:l}),h=ne.previous(t,{at:a,match:r,voids:o,mode:l});if(!(!u||!h)){var[p,v]=u,[y,g]=h;if(!(v.length===0||g.length===0)){var x=Oe.next(g),b=Oe.common(v,g),w=Oe.isSibling(v,g),j=Array.from(ne.levels(t,{at:v}),T=>{var[z]=T;return z}).slice(b.length).slice(0,-1),N=ne.above(t,{at:v,mode:"highest",match:T=>j.includes(T)&&yK(t,T)}),C=N&&ne.pathRef(t,N[1]),P,S;if(os.isText(p)&&os.isText(y)){var E=pc(p,vwe);S=y.text.length,P=E}else if(rs.isElement(p)&&rs.isElement(y)){var E=pc(p,bwe);S=y.children.length,P=E}else throw new Error("Cannot merge the node at path [".concat(v,"] with the previous sibling because it is not the same kind: ").concat(Yr.stringify(p)," ").concat(Yr.stringify(y)));w||ut.moveNodes(t,{at:v,to:x,voids:o}),C&&ut.removeNodes(t,{at:C.current,voids:o}),ne.shouldMergeNodesRemovePrevNode(t,h,u)?ut.removeNodes(t,{at:g,voids:o}):t.apply({type:"merge_node",path:x,position:S,properties:P}),C&&C.unref()}}}})},jwe=(e,t)=>{ne.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:o}=t;if(r){o==null&&(o=Oe.isPath(r)?kp(e,r):p=>rs.isElement(p)&&ne.isBlock(e,p));var l=ne.pathRef(e,n),c=ne.nodes(e,{at:r,match:o,mode:a,voids:i}),d=Array.from(c,p=>{var[,v]=p;return ne.pathRef(e,v)});for(var m of d){var u=m.unref(),h=l.current;u.length!==0&&e.apply({type:"move_node",path:u,newPath:h}),l.current&&Oe.isSibling(h,u)&&Oe.isAfter(h,u)&&(l.current=Oe.next(l.current))}l.unref()}})},Nwe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ne.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:o=t.selection,match:l}=n;if(o){l==null&&(l=Oe.isPath(o)?kp(t,o):p=>
689rs.isElement(p)&&ne.isBlock(t,p)),!r&&Xe.isRange(o)&&(o=ne.unhangRange(t,o,{voids:a}));var c=ne.nodes(t,{at:o,match:l,mode:i,voids:a}),d=Array.from(c,p=>{var[,v]=p;return ne.pathRef(t,v)});for(var m of d){var u=m.unref();if(u){var[h]=ne.node(t,u);t.apply({type:"remove_node",path:u,node:h})}}}})},Cwe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ne.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:o,merge:l}=r,{hanging:c=!1,mode:d="lowest",split:m=!1,voids:u=!1}=r;if(i){if(a==null&&(a=Oe.isPath(i)?kp(t,i):S=>rs.isElement(S)&&ne.isBlock(t,S)),!c&&Xe.isRange(i)&&(i=ne.unhangRange(t,i,{voids:u})),m&&Xe.isRange(i)){if(Xe.isCollapsed(i)&&ne.leaf(t,i.anchor)[0].text.length>0)return;var h=ne.rangeRef(t,i,{affinity:"inward"}),[p,v]=Xe.edges(i),y=d==="lowest"?"lowest":"highest",g=ne.isEnd(t,v,v.path);ut.splitNodes(t,{at:v,match:a,mode:y,voids:u,always:!g});var x=ne.isStart(t,p,p.path);ut.splitNodes(t,{at:p,match:a,mode:y,voids:u,always:!x}),i=h.unref(),r.at==null&&ut.select(t,i)}o||(o=(S,E)=>S!==E);for(var[b,w]of ne.nodes(t,{at:i,match:a,mode:d,voids:u})){var j={},N={};if(w.length!==0){var C=!1;for(var P in n)P==="children"||P==="text"||o(n[P],b[P])&&(C=!0,b.hasOwnProperty(P)&&(j[P]=b[P]),l?n[P]!=null&&(N[P]=l(b[P],n[P])):n[P]!=null&&(N[P]=n[P]));C&&t.apply({type:"set_node",path:w,properties:j,newProperties:N})}}}})},Swe=(e,t)=>{if(Xe.isCollapsed(t))return t.anchor;var[,n]=Xe.edges(t),r=ne.pointRef(e,n);return ut.delete(e,{at:t}),r.unref()},kwe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ne.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:o=t.selection,height:l=0,always:c=!1}=n;if(i==null&&(i=_=>rs.isElement(_)&&ne.isBlock(t,_)),Xe.isRange(o)&&(o=Swe(t,o)),Oe.isPath(o)){var d=o,m=ne.point(t,d),[u]=ne.parent(t,d);i=_=>_===u,l=m.path.length-d.length+1,o=m,c=!0}if(o){var h=ne.pointRef(t,o,{affinity:"backward"}),p;try{var[v]=ne.nodes(t,{at:o,match:i,mode:r,voids:a});if(!v)return;var y=ne.void(t,{at:o,mode:"highest"}),g=0;if(!a&&y){var[x,b]=y;if(rs.isElement(x)&&t.isInline(x)){var w=ne.after(t,b);if(!w){var j={text:""},N=Oe.next(b);ut.insertNodes(t,j,{at:N,voids:a}),w=ne.point(t,N)}o=w,c=!0}var C=o.path.length-b.length;l=C+1,c=!0}p=ne.pointRef(t,o);var P=o.path.length-l,[,S]=v,E=o.path.slice(0,P),T=l===0?o.offset:o.path[P]+g;for(var[z,O]of ne.levels(t,{at:E,reverse:!0,voids:a})){var D=!1;if(O.length<S.length||O.length===0||!a&&rs.isElement(z)&&ne.isVoid(t,z))break;var k=h.current,F=ne.isEnd(t,k,O);if(c||!h||!ne.isEdge(t,k,O)){D=!0;var W=Dt.extractProps(z);t.apply({type:"split_node",path:O,position:T,properties:W})}T=O[O.length-1]+(D||F?1:0)}if(n.at==null){var q=p.current||ne.end(t,[]);ut.select(t,q)}}finally{var H;h.unref(),(H=p)===null||H===void 0||H.unref()}}})},Pwe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;ut.setNodes(t,a,r)},Ewe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ne.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:o=t.selection,match:l}=n;if(o){l==null&&(l=Oe.isPath(o)?kp(t,o):p=>rs.isElement(p)&&ne.isBlock(t,p)),Oe.isPath(o)&&(o=ne.range(t,o));var c=Xe.isRange(o)?ne.rangeRef(t,o):null,d=ne.nodes(t,{at:o,match:l,mode:r,voids:i}),m=Array.from(d,p=>{var[,v]=p;return ne.pathRef(t,v)}).reverse(),u=function(){var v=h.unref(),[y]=ne.node(t,v),g=ne.range(t,v);a&&c&&(g=Xe.intersection(c.current,g)),ut.liftNodes(t,{at:g,match:x=>rs.isAncestor(y)&&y.children.includes(x),voids:i})};for(var h of m)u();c&&c.unref()}})};function MI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function $I(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?MI(Object(n),!0).forEach(function(r){Ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MI(Object(n)).forEac
689h(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Dwe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ne.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:o=!1}=r,{match:l,at:c=t.selection}=r;if(c){if(l==null&&(Oe.isPath(c)?l=kp(t,c):t.isInline(n)?l=g=>rs.isElement(g)&&ne.isInline(t,g)||os.isText(g):l=g=>rs.isElement(g)&&ne.isBlock(t,g)),i&&Xe.isRange(c)){var[d,m]=Xe.edges(c),u=ne.rangeRef(t,c,{affinity:"inward"});ut.splitNodes(t,{at:m,match:l,voids:o}),ut.splitNodes(t,{at:d,match:l,voids:o}),c=u.unref(),r.at==null&&ut.select(t,c)}var h=Array.from(ne.nodes(t,{at:c,match:t.isInline(n)?g=>rs.isElement(g)&&ne.isBlock(t,g):g=>ne.isEditor(g),mode:"lowest",voids:o})),p=function(){var x=Xe.isRange(c)?Xe.intersection(c,ne.range(t,y)):c;if(!x)return 0;var b=Array.from(ne.nodes(t,{at:x,match:l,mode:a,voids:o}));if(b.length>0){var[w]=b,j=b[b.length-1],[,N]=w,[,C]=j;if(N.length===0&&C.length===0)return 0;var P=Oe.equals(N,C)?Oe.parent(N):Oe.common(N,C),S=ne.range(t,N,C),E=ne.node(t,P),[T]=E,z=P.length+1,O=Oe.next(C.slice(0,z)),D=$I($I({},n),{},{children:[]});ut.insertNodes(t,D,{at:O,voids:o}),ut.moveNodes(t,{at:S,match:k=>rs.isAncestor(T)&&T.children.includes(k),to:O.concat(0),voids:o})}},v;for(var[,y]of h)v=p()}})},Awe=()=>{var e={children:[],operations:[],selection:null,marks:null,isElementReadOnly:()=>!1,isInline:()=>!1,isSelectable:()=>!0,isVoid:()=>!1,markableVoid:()=>!1,onChange:()=>{},apply:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ebe(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ibe(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cbe(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dbe(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ube(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sbe(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jbe(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cbe(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dwe(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Nbe(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kbe(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nbe(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return swe(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tbe(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rbe(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return abe(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return obe(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lbe(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uwe(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cwe(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mwe(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mbe(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hbe(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fbe(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pbe(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xbe(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rbe(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ybe(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vbe(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bbe(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wbe(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gwe(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pbe(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ebe(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dbe(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Abe(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tbe(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Obe(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fbe(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _be(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mbe(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ywe(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wwe(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hwe(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jwe(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bbe(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lbe(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ube(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zbe(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qbe(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vbe(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wbe(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hbe(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ybe(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kbe(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gbe(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qbe(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jbe(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ewe(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xbe(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zbe(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Nwe(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fwe(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cwe(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nwe(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pwe(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xwe(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kwe(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rwe(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return awe(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iwe(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pwe(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ewe(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gbe(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return owe(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dwe(e,...r)},shouldMergeNodesRemovePrevNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lwe(e,...r)}};return e},Twe=_we,vK="֑-߿יִ-﷽ﹰ-ﻼ",bK="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Owe=new RegExp("^[^"+bK+"]*["+vK+"]"),Fwe=new RegExp("^[^"+vK+"]*["+bK+"]");function _we(e){return e=String(e||""),Owe.test(e)?"rtl":Fwe.test(e)?"ltr":"neutral"}const wK=Qs(Twe),II=e=>typeof e=="object"&&e!=null&&e.nodeType===1,RI=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",M0=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return RI(n.overflowY,t)||RI(n.overflowX,t)||(r=>{const a=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)})(e)}return!1},$0=(e,t,n,r,a,i,o,l)=>i<e&&o>t||i>e&&o<t?0:i<=e&&l<=n||o>=t&&l>=n?i-e-r:o>t&&l<n||i<e&&l>n?o-t+a:0,Mwe=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},BI=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:o,block:l,inline:c,boundary:d,skipOverflowHiddenElements:m}=t,u=typeof d=="function"?d:W=>W!==d;if(!II(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let v=e;for(;II(v)&&u(v);){if(v=Mwe(v),v===h){p.push(v);break}v!=null&&v===document.body&&M0(v)&&!M0(document.documentElement)||v!=null&&M0(v,m)&&p.push(v)}
689const y=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,g=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:x,scrollY:b}=window,{height:w,width:j,top:N,right:C,bottom:P,left:S}=e.getBoundingClientRect(),{top:E,right:T,bottom:z,left:O}=(W=>{const q=window.getComputedStyle(W);return{top:parseFloat(q.scrollMarginTop)||0,right:parseFloat(q.scrollMarginRight)||0,bottom:parseFloat(q.scrollMarginBottom)||0,left:parseFloat(q.scrollMarginLeft)||0}})(e);let D=l==="start"||l==="nearest"?N-E:l==="end"?P+z:N+w/2-E+z,k=c==="center"?S+j/2-O+T:c==="end"?C+T:S-O;const F=[];for(let W=0;W<p.length;W++){const q=p[W],{height:H,width:_,top:L,right:U,bottom:J,left:I}=q.getBoundingClientRect();if(o==="if-needed"&&N>=0&&S>=0&&P<=g&&C<=y&&(q===h&&!M0(q)||N>=L&&P<=J&&S>=I&&C<=U))return F;const re=getComputedStyle(q),R=parseInt(re.borderLeftWidth,10),Y=parseInt(re.borderTopWidth,10),M=parseInt(re.borderRightWidth,10),se=parseInt(re.borderBottomWidth,10);let Q=0,te=0;const G="offsetWidth"in q?q.offsetWidth-q.clientWidth-R-M:0,Z="offsetHeight"in q?q.offsetHeight-q.clientHeight-Y-se:0,ie="offsetWidth"in q?q.offsetWidth===0?0:_/q.offsetWidth:0,A="offsetHeight"in q?q.offsetHeight===0?0:H/q.offsetHeight:0;if(h===q)Q=l==="start"?D:l==="end"?D-g:l==="nearest"?$0(b,b+g,g,Y,se,b+D,b+D+w,w):D-g/2,te=c==="start"?k:c==="center"?k-y/2:c==="end"?k-y:$0(x,x+y,y,R,M,x+k,x+k+j,j),Q=Math.max(0,Q+b),te=Math.max(0,te+x);else{Q=l==="start"?D-L-Y:l==="end"?D-J+se+Z:l==="nearest"?$0(L,J,H,Y,se+Z,D,D+w,w):D-(L+H/2)+Z/2,te=c==="start"?k-I-R:c==="center"?k-(I+_/2)+G/2:c==="end"?k-U+M+G:$0(I,U,_,R,M+G,k,k+j,j);const{scrollLeft:ge,scrollTop:je}=q;Q=A===0?0:Math.max(0,Math.min(je+Q/A,q.scrollHeight-H/A+Z)),te=ie===0?0:Math.max(0,Math.min(ge+te/ie,q.scrollWidth-_/ie+G)),D+=je-Q,k+=ge-te}F.push({el:q,top:Q,left:te})}return F},$we=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Iwe(e,t){if(!e.isConnected||!(a=>{let i=a;for(;i&&i.parentNode;){if(i.parentNode===document)return!0;i=i.parentNode instanceof ShadowRoot?i.parentNode.host:i.parentNode}return!1})(e))return;const n=(a=>{const i=window.getComputedStyle(a);return{top:parseFloat(i.scrollMarginTop)||0,right:parseFloat(i.scrollMarginRight)||0,bottom:parseFloat(i.scrollMarginBottom)||0,left:parseFloat(i.scrollMarginLeft)||0}})(e);if((a=>typeof a=="object"&&typeof a.behavior=="function")(t))return t.behavior(BI(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:o}of BI(e,$we(t))){const l=i-n.top+n.bottom,c=o-n.left+n.right;a.scroll({top:l,left:c,behavior:r})}}var Cc={};Object.defineProperty(Cc,"__esModule",{value:!0});var Rwe=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),WS={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},jK={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Rwe?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},yO={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222};for(var I0=1;I0<20;I0++)yO["f"+I0]=111+I0;function y1(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(o){return NK(o,t)}),a=function(l){return r.some(function(c){return CK(c,l)})},i=n==null?a:a(n);return i}function Bwe(e,t){return y1(e,t)}function Lwe(e,t){return y1(e,{byKey:!0},t)}function NK(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var o in WS)r[WS[o]]=!1;var l=!0,c=!1,d=void 0;try{for(var m=a[Symbol.iterator](),u;!(l=(u=m.next()).done);l=!0){var h=u.value,p=h.endsWith("?")&&h.length>1;p&&(h=h.slice(0,-1));var v=vO(h),y=WS[v];if(h.length>1&&!y&&!jK[h]&&!yO[v])throw new TypeError('Unknown modifier: "'+h+'"');(i===1||!y)&&(n?r.key=v:r.which=SK(h)),y&&(r[y]=p?null:!0)}}catch(g){c=!0,d=g}finally{try{!l&&m.return&&m.return()}finally{if(c)throw d}}return r}function CK(e,t){for(var n in e){var r=e[n],a=void 0;if(r!=null&&(n==="key"&&t.key!=null?a=t.key.toLowerCase():n==="which"?a=r===91&&t.which===93?91:t.which:a=t[n],!(a==null&&r===!1)&&a!==r))return!1}return!0}function SK(e){e=vO(e);
689var t=yO[e]||e.toUpperCase().charCodeAt(0);return t}function vO(e){return e=e.toLowerCase(),e=jK[e]||e,e}var Uwe=Cc.default=y1,HS=Cc.isHotkey=y1;Cc.isCodeHotkey=Bwe;Cc.isKeyHotkey=Lwe;Cc.parseHotkey=NK;Cc.compareHotkey=CK;Cc.toKeyCode=SK;Cc.toKeyName=vO;var kK=globalThis.Node,zwe=globalThis.Text,bO=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,qwe=e=>Od(e)&&e.nodeType===8,Ui=e=>Od(e)&&e.nodeType===1,Od=e=>{var t=bO(e);return!!t&&e instanceof t.Node},oE=e=>{var t=e&&e.anchorNode&&bO(e.anchorNode);return!!t&&e instanceof t.Selection},PK=e=>Od(e)&&e.nodeType===3,Wwe=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,Hwe=e=>{var[t,n]=e;if(Ui(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=EK(t,a,r?"backward":"forward"),r=a<n;Ui(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=Kwe(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},Vwe=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},EK=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,o=!1,l=!1;(qwe(a)||Ui(a)&&a.childNodes.length===0||Ui(a)&&a.getAttribute("contenteditable")==="false")&&!(o&&l);){if(i>=r.length){o=!0,i=t-1,n="backward";continue}if(i<0){l=!0,i=t+1,n="forward";continue}a=r[i],t=i,i+=n==="forward"?1:-1}return[a,t]},Kwe=(e,t,n)=>{var[r]=EK(e,t,n);return r},DK=e=>{var t="";if(PK(e)&&e.nodeValue)return e.nodeValue;if(Ui(e)){for(var n of Array.from(e.childNodes))t+=DK(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
690`)}return t},Gwe=/data-slate-fragment="(.+?)"/m,Ywe=e=>{var t=e.getData("text/html"),[,n]=t.match(Gwe)||[];return n},Gx=e=>e.getSelection!=null?e.getSelection():document.getSelection(),wO=(e,t,n)=>{var{target:r}=t;if(Ui(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=Bs.getWindow(e);if(a.contains(r))return Bs.hasDOMNode(e,r,{editable:!0});var i=n.find(o=>{var{addedNodes:l,removedNodes:c}=o;for(var d of l)if(d===r||d.contains(r))return!0;for(var m of c)if(m===r||m.contains(r))return!0});return!i||i===t?!1:wO(e,i,n)},Qwe=()=>{for(var e=document.activeElement;(t=e)!==null&&t!==void 0&&t.shadowRoot&&(n=e.shadowRoot)!==null&&n!==void 0&&n.activeElement;){var t,n,r;e=(r=e)===null||r===void 0||(r=r.shadowRoot)===null||r===void 0?void 0:r.activeElement}return e},LI=(e,t)=>!!(e.compareDocumentPosition(t)&kK.DOCUMENT_POSITION_PRECEDING),Jwe=(e,t)=>!!(e.compareDocumentPosition(t)&kK.DOCUMENT_POSITION_FOLLOWING),VS,KS,AK=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,UI=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),_a=typeof navigator<"u"&&/Android/.test(navigator.userAgent),gh=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),lu=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Xwe=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),TK=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Zwe=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),eje=_a&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),tje=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),sje=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),nje=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),$b=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&/Version\/(\d+)/.test(navigator.userAgent)&&((VS=navigator.userAgent.match(/Version\/(\d+)/))!==null&&VS!==void 0&&VS[1]&&parseInt((KS=navigator.userAgent.match(/Version\/(\d+)/))===null||KS===void 0?void 0:KS[1],10)<17);var Tc=(!Zwe||!eje)&&!Xwe&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function";function Lg(e){"@babel/helpers - typeof";return Lg=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},Lg(e)}function rje(e,t){if(Lg(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Lg(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function aje(e){var t=rje(e,"string");return Lg(t)==="symbol"?t:String(t)}function OK(e,t,n){return t=aje(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ije=0;class oje{constructor(){OK(this,"id",void 0),this.id="".concat(ije++)}}var Ih=new WeakMap,jO=new WeakMap,NO=new WeakMap,FK=new WeakMap,Ib=new WeakMap,lE=new WeakMap,Ug=new WeakMap,Gu=ne
690w WeakMap,Uw=new WeakMap,v1=new WeakMap,cE=new WeakMap,dd=new WeakMap,vu=new WeakMap,Yx=new WeakMap,dE=new WeakMap,CO=new WeakMap,Oo=new WeakMap,Jl=new WeakMap,Ha=new WeakMap,Bc=new WeakMap,Lc=new WeakMap,_K=new WeakMap,Lf=Symbol("placeholder"),MK=Symbol("mark-placeholder"),Bs={androidPendingDiffs:e=>Ha.get(e),androidScheduleFlush:e=>{var t;(t=CO.get(e))===null||t===void 0||t()},blur:e=>{var t=Bs.toDOMNode(e,e),n=Bs.findDocumentOrShadowRoot(e);dd.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=Bs.findDocumentOrShadowRoot(e),r=Gx(n);r&&r.rangeCount>0&&r.removeAllRanges(),t&&ut.deselect(e)},findDocumentOrShadowRoot:e=>{var t=Bs.toDOMNode(e,e),n=t.getRootNode();return n instanceof Document||n instanceof ShadowRoot?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=Bs.toSlateNode(e,t.target),o=Bs.findPath(e,i);if(rs.isElement(i)&&ne.isVoid(e,i)){var l=a.getBoundingClientRect(),c=e.isInline(i)?n-l.left<l.left+l.width-n:r-l.top<l.top+l.height-r,d=ne.point(e,o,{edge:c?"start":"end"}),m=c?ne.before(e,d):ne.after(e,d);if(m){var u=ne.range(e,m);return u}}var h,{document:p}=Bs.getWindow(e);if(p.caretRangeFromPoint)h=p.caretRangeFromPoint(n,r);else{var v=p.caretPositionFromPoint(n,r);v&&(h=p.createRange(),h.setStart(v.offsetNode,v.offset),h.setEnd(v.offsetNode,v.offset))}if(!h)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var y=Bs.toSlateRange(e,h,{exactMatch:!1,suppressThrow:!1});return y},findKey:(e,t)=>{var n=Uw.get(t);return n||(n=new oje,Uw.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=NO.get(r);if(a==null){if(ne.isEditor(r))return n;break}var i=jO.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Yr.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!dd.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{Bs.focus(t,{retries:n.retries-1})},10);return}var r=Bs.toDOMNode(t,t),a=Bs.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=Gx(a),o=Bs.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(o)}t.selection||ut.select(t,ne.start(t,[])),dd.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=FK.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:a=!1}=r,i=Bs.toDOMNode(t,t),o;try{o=Ui(n)?n:n.parentElement}catch(l){if(l instanceof Error&&!l.message.includes('Permission denied to access property "nodeType"'))throw l}return o?o.closest("[data-slate-editor]")===i&&(!a||o.isContentEditable?!0:typeof o.isContentEditable=="boolean"&&o.closest('[contenteditable="false"]')===i||!!o.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>Od(t)&&Bs.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>
690{var{anchor:n,focus:r}=t;return ne.hasPath(e,n.path)&&ne.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>Bs.hasEditableTarget(e,t)||Bs.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>Od(t)&&Bs.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!vu.get(e),isFocused:e=>!!dd.get(e),isReadOnly:e=>!!cE.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(cE.get(e))return!1;var n=Bs.hasTarget(e,t)&&Bs.toSlateNode(e,t);return rs.isElement(n)&&ne.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=v1.get(e),r=ne.isEditor(t)?Ib.get(e):n==null?void 0:n.get(Bs.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Yr.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=ne.node(e,t.path),r=Bs.toDOMNode(e,n),a;ne.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",o=Array.from(r.querySelectorAll(i)),l=0,c=0;c<o.length;c++){var d=o[c],m=d.childNodes[0];if(!(m==null||m.textContent==null)){var{length:u}=m.textContent,h=d.getAttribute("data-slate-length"),p=h==null?u:parseInt(h,10),v=l+p,y=o[c+1];if(t.offset===v&&y!==null&&y!==void 0&&y.hasAttribute("data-slate-mark-placeholder")){var g,x=y.childNodes[0];a=[x instanceof zwe?x:y,(g=y.textContent)!==null&&g!==void 0&&g.startsWith("\uFEFF")?1:0];break}if(t.offset<=v){var b=Math.min(u,Math.max(0,t.offset-l));a=[m,b];break}l=v}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Yr.stringify(t)));return a},toDOMRange:(e,t)=>
690{var{anchor:n,focus:r}=t,a=Xe.isBackward(t),i=Bs.toDOMPoint(e,n),o=Xe.isCollapsed(t)?i:Bs.toDOMPoint(e,r),l=Bs.getWindow(e),c=l.document.createRange(),[d,m]=a?o:i,[u,h]=a?i:o,p=Ui(d)?d:d.parentElement,v=!!p.getAttribute("data-slate-zero-width"),y=Ui(u)?u:u.parentElement,g=!!y.getAttribute("data-slate-zero-width");return c.setStart(d,v?1:m),c.setEnd(u,g?1:h),c},toSlateNode:(e,t)=>{var n=Ui(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Ug.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:a,searchDirection:i="backward"}=n,[o,l]=r?t:Hwe(t),c=o.parentNode,d=null,m=0;if(c){var u,h,p=Bs.toDOMNode(e,e),v=c.closest('[data-slate-void="true"]'),y=v&&p.contains(v)?v:null,g=c.closest('[contenteditable="false"]'),x=g&&p.contains(g)?g:null,b=c.closest("[data-slate-leaf]"),w=null;if(b){if(d=b.closest('[data-slate-node="text"]'),d){var j=Bs.getWindow(e),N=j.document.createRange();N.setStart(d,0),N.setEnd(o,l);var C=N.cloneContents(),P=[...Array.prototype.slice.call(C.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(C.querySelectorAll("[contenteditable=false]"))];P.forEach(I=>{if(_a&&!r&&I.hasAttribute("data-slate-zero-width")&&I.textContent.length>0&&I.textContext!=="\uFEFF"){I.textContent.startsWith("\uFEFF")&&(I.textContent=I.textContent.slice(1));return}I.parentNode.removeChild(I)}),m=C.textContent.length,w=d}}else if(y){for(var S=y.querySelectorAll("[data-slate-leaf]"),E=0;E<S.length;E++){var T=S[E];if(Bs.hasDOMNode(e,T)){b=T;break}}b?(d=b.closest('[data-slate-node="text"]'),w=b,m=w.textContent.length,w.querySelectorAll("[data-slate-zero-width]").forEach(I=>{m-=I.textContent.length})):m=1}else if(x){var z=I=>I?I.querySelectorAll("[data-slate-leaf]:not(:scope [data-slate-editor] [data-slate-leaf])"):[],O=x.closest('[data-slate-node="element"]');if(i==="forward"){var D,k=[...z(O),...z(O==null?void 0:O.nextElementSibling)];b=(D=k.find(I=>Jwe(x,I)))!==null&&D!==void 0?D:null}else{var F,W=[...z(O==null?void 0:O.previousElementSibling),...z(O)];b=(F=W.findLast(I=>LI(x,I)))!==null&&F!==void 0?F:null}b&&(d=b.closest('[data-slate-node="text"]'),w=b,i==="forward"?m=0:(m=w.textContent.length,w.querySelectorAll("[data-slate-zero-width]").forEach(I=>{m-=I.textContent.length})))}w&&m===w.textContent.length&&_a&&w.getAttribute("data-slate-zero-width")==="z"&&(u=w.textContent)!==null&&u!==void 0&&u.startsWith("\uFEFF")&&(c.hasAttribute("data-slate-zero-width")||gh&&(h=w.textContent)!==null&&h!==void 0&&h.endsWith(`
691
692`))&&m--}if(_a&&!d&&!r){var q=c.hasAttribute("data-slate-node")?c:c.closest("[data-slate-node]");if(q&&Bs.hasDOMNode(e,q,{editable:!0})){var H=Bs.toSlateNode(e,q),{path:_,offset:L}=ne.start(e,Bs.findPath(e,H));return q.querySelector("[data-slate-leaf]")||(L=l),{path:_,offset:L}}}if(!d){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}
692var U=Bs.toSlateNode(e,d),J=Bs.findPath(e,U);return{path:J,offset:m}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,o=oE(t)?t.anchorNode:t.startContainer,l,c,d,m,u;if(o)if(oE(t)){if(gh&&t.rangeCount>1){d=t.focusNode;var h=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(d instanceof HTMLTableRowElement&&h.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let P=function(S){return S.childElementCount>0?P(S.children[0]):S};var C=P,v=h.startContainer,y=p.startContainer,g=P(v.children[h.startOffset]),x=P(y.children[p.startOffset]);m=0,x.childNodes.length>0?l=x.childNodes[0]:l=x,g.childNodes.length>0?d=g.childNodes[0]:d=g,x instanceof HTMLElement?c=x.innerHTML.length:c=0}else h.startContainer===d?(l=p.endContainer,c=p.endOffset,m=h.startOffset):(l=h.startContainer,c=h.endOffset,m=p.startOffset)}else l=t.anchorNode,c=t.anchorOffset,d=t.focusNode,m=t.focusOffset;TK&&Vwe(l)||gh?u=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:u=t.isCollapsed}else l=t.startContainer,c=t.startOffset,d=t.endContainer,m=t.endOffset,u=t.collapsed;if(l==null||d==null||c==null||m==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));gh&&(r=d.textContent)!==null&&r!==void 0&&r.endsWith(`
693
694`)&&m===d.textContent.length&&m--;var b=Bs.toSlatePoint(e,[l,c],{exactMatch:a,suppressThrow:i});if(!b)return null;var w=LI(l,d)||l===d&&m<c,j=u?b:Bs.toSlatePoint(e,[d,m],{exactMatch:a,suppressThrow:i,searchDirection:w?"forward":"backward"});if(!j)return null;var N={anchor:b,focus:j};return Xe.isExpanded(N)&&Xe.isForward(N)&&Ui(d)&&ne.void(e,{at:N.focus,mode:"highest"})&&(N=ne.unhangRange(e,N,{voids:!0})),N}};function lje(e,t){var{path:n,diff:r}=t;if(!ne.hasPath(e,n))return!1;var a=Dt.get(e,n);if(!os.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=Oe.next(n);if(!ne.hasPath(e,i))return!1;var o=Dt.get(e,i);return os.isText(o)&&o.text.startsWith(r.text)}function $K(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((a,i)=>a.slice(0,i.start)+i.text+a.slice(i.end),e)}function cje(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++)if(e.charAt(r)!==t.charAt(r))return r;return n}function dje(e,t,n){for(var r=Math.min(e.length,t.length,n),a=0;a<r;a++)if(e.charAt(e.length-a-1)!==t.charAt(t.length-a-1))return a;return r}function IK(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),o=cje(i,a),l=Math.min(i.length-o,a.length-o),c=dje(i,a,l),d={start:n+o,end:r-c,text:a.slice(o,a.length-c)};return d.start===d.end&&d.text.length===0?null:d}function uje(e,t,n){var r=Math.min(t.start,n.start),a=Math.max(0,Math.min(t.start+t.text.length,n.end)-n.start),i=$K(e,t,n),o=Math.max(n.start+n.text.length,t.start+t.text.length+(t.start+t.text.length>n.start?n.text.length:0)-a),l=i.slice(r,o),c=Math.max(t.end,n.end-t.text.length+(t.end-t.start));return IK(e,{start:r,end:c,text:l})}function mje(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function uE(e,t){var{path:n,offset:r}=t;if(!ne.hasPath(e,n))return null;var a=Dt.get(e,n);if(!os.isText(a))return null;var i=ne.above(e,{match:l=>rs.isElement(l)&&ne.isBlock(e,l),at:n});if(!i)return null;for(;r>a.text.length;){var o=ne.next(e,{at:n,match:os.isText});
694if(!o||!Oe.isDescendant(o[1],i[1]))return null;r-=a.text.length,a=o[0],n=o[1]}return{path:n,offset:r}}function zI(e,t){var n=uE(e,t.anchor);if(!n)return null;if(Xe.isCollapsed(t))return{anchor:n,focus:n};var r=uE(e,t.focus);return r?{anchor:n,focus:r}:null}function mE(e,t,n){var r=Ha.get(e),a=r==null?void 0:r.find(m=>{var{path:u}=m;return Oe.equals(u,t.path)});if(!a||t.offset<=a.diff.start)return Vs.transform(t,n,{affinity:"backward"});var{diff:i}=a;if(t.offset<=i.start+i.text.length){var o={path:t.path,offset:i.start},l=Vs.transform(o,n,{affinity:"backward"});return l?{path:l.path,offset:l.offset+t.offset-i.start}:null}var c={path:t.path,offset:t.offset-i.text.length+i.end-i.start},d=Vs.transform(c,n,{affinity:"backward"});return d?n.type==="split_node"&&Oe.equals(n.path,t.path)&&c.offset<n.position&&i.start<n.position?d:{path:d.path,offset:d.offset+i.text.length-i.end+i.start}:null}function qI(e,t,n){var r=mE(e,t.anchor,n);if(!r)return null;if(Xe.isCollapsed(t))return{anchor:r,focus:r};var a=mE(e,t.focus,n);return a?{anchor:r,focus:a}:null}function hje(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!Oe.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!Oe.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!Oe.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:Oe.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:Oe.transform(n,t,{affinity:"forward"})};case"merge_node":return Oe.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:Oe.transform(n,t)}:{diff:r,id:a,path:Oe.transform(n,t)}}var i=Oe.transform(n,t);return i?{diff:r,path:i,id:a}:null}var WI=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},HI=(e,t,n)=>{var r=Bs.toDOMRange(e,t).getBoundingClientRect(),a=Bs.toDOMRange(e,n).getBoundingClientRect();return WI(r,a)&&WI(a,r)},fje=(e,t)=>{var n=ne.range(e,Xe.end(t)),r=Array.from(ne.positions(e,{at:t})),a=0,i=r.length,o=Math.floor(i/2);if(HI(e,ne.range(e,r[a]),n))return ne.range(e,r[a],n);if(r.length<2)return ne.range(e,r[r.length-1],n);for(;o!==r.length&&o!==a;)HI(e,ne.range(e,r[o]),n)?i=o:a=o,o=Math.floor((a+i)/2);return ne.range(e,r[a],n)};function VI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function KI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?VI(Object(n),!0).forEach(function(r){OK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var pje=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:a,onChange:i,deleteBackward:o,addMark:l,removeMark:c}=r;return v1.set(r,new WeakMap),r.addMark=(d,m)=>{var u,h;(u=CO.get(r))===null||u===void 0||u(),!Oo.get(r)&&(h=Ha.get(r))!==null&&h!==void 0&&h.length&&Oo.set(r,null),Jl.delete(r),l(d,m)},r.removeMark=d=>{var m;!Oo.get(r)&&(m=Ha.get(r))!==null&&m!==void 0&&m.length&&Oo.set(r,null),Jl.delete(r),c(d)},r.deleteBackward=d=>{if(d!=="line")return o(d);if(r.selection&&Xe.isCollapsed(r.selection)){var m=ne.above(r,{match:v=>rs.isElement(v)&&ne.isBlock(r,v),at:r.selection});if(m){var[,u]=m,h=ne.range(r,u,r.selection.anchor),p=fje(r,h);Xe.isCollapsed(p)||ut.delete(r,{at:p})}}},r.apply=d=>{var m=[],u=[],h=Ha.get(r);if(h!=null&&h.length){var p=h.map(k=>
694hje(k,d)).filter(Boolean);Ha.set(r,p)}var v=Lc.get(r);v&&Lc.set(r,qI(r,v,d));var y=Bc.get(r);if(y!=null&&y.at){var g=Vs.isPoint(y==null?void 0:y.at)?mE(r,y.at,d):qI(r,y.at,d);Bc.set(r,g?KI(KI({},y),{},{at:g}):null)}switch(d.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{m.push(...Vm(r,d.path));break}case"set_selection":{var x;(x=Yx.get(r))===null||x===void 0||x.unref(),Yx.delete(r);break}case"insert_node":case"remove_node":{m.push(...Vm(r,Oe.parent(d.path)));break}case"merge_node":{var b=Oe.previous(d.path);m.push(...Vm(r,b));break}case"move_node":{var w=Oe.common(Oe.parent(d.path),Oe.parent(d.newPath));m.push(...Vm(r,w));var j;Oe.isBefore(d.path,d.newPath)?(m.push(...Vm(r,Oe.parent(d.path))),j=d.newPath):(m.push(...Vm(r,Oe.parent(d.newPath))),j=d.path);var N=Dt.get(t,Oe.parent(j)),C=Bs.findKey(r,N),P=ne.pathRef(r,Oe.parent(j));u.push([P,C]);break}}switch(a(d),d.type){case"insert_node":case"remove_node":case"merge_node":case"move_node":case"split_node":case"insert_text":case"remove_text":case"set_selection":Ih.set(r,!0)}for(var[S,E]of m){var[T]=ne.node(r,S);Uw.set(T,E)}for(var[z,O]of u){if(z.current){var[D]=ne.node(r,z.current);Uw.set(D,O)}z.unref()}},r.setFragmentData=d=>{var{selection:m}=r;if(m){var[u,h]=Xe.edges(m),p=ne.void(r,{at:u.path}),v=ne.void(r,{at:h.path});if(!(Xe.isCollapsed(m)&&!p)){var y=Bs.toDOMRange(r,m),g=y.cloneContents(),x=g.childNodes[0];if(g.childNodes.forEach(T=>{T.textContent&&T.textContent.trim()!==""&&(x=T)}),v){var[b]=v,w=y.cloneRange(),j=Bs.toDOMNode(r,b);w.setEndAfter(j),g=w.cloneContents()}if(p&&(x=g.querySelector("[data-slate-spacer]")),Array.from(g.querySelectorAll("[data-slate-zero-width]")).forEach(T=>{var z=T.getAttribute("data-slate-zero-width")==="n";T.textContent=z?`
695`:""}),PK(x)){var N=x.ownerDocument.createElement("span");N.style.whiteSpace="pre",N.appendChild(x),g.appendChild(N),x=N}var C=r.getFragment(),P=JSON.stringify(C),S=window.btoa(encodeURIComponent(P));x.setAttribute("data-slate-fragment",S),d.setData("application/".concat(n),S);var E=g.ownerDocument.createElement("div");return E.appendChild(g),E.setAttribute("hidden","true"),g.ownerDocument.body.appendChild(E),d.setData("text/html",E.innerHTML),d.setData("text/plain",DK(E)),g.ownerDocument.body.removeChild(E),d}}},r.insertData=d=>{r.insertFragmentData(d)||r.insertTextData(d)},r.insertFragmentData=d=>{var m=d.getData("application/".concat(n))||Ywe(d);if(m){var u=decodeURIComponent(window.atob(m)),h=JSON.parse(u);return r.insertFragment(h),!0}return!1},r.insertTextData=d=>{var m=d.getData("text/plain");if(m){var u=m.split(/\r\n|\r|\n/),h=!1;for(var p of u)h&&ut.splitNodes(r,{always:!0}),r.insertText(p),h=!0;return!0}return!1},r.onChange=d=>{var m=dE.get(r);m&&m(d),i(d)},r},Vm=(e,t)=>{var n=[];for(var[r,a]of ne.levels(e,{at:t})){var i=Bs.findKey(e,r);n.push([a,i])}return n},xje=3,gje={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",insertSoftBreak:"shift+enter",splitBlock:"enter",undo:"mod+z"},yje={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},vje={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Zn=e=>{var t=gje[e],n=yje[e],r=vje[e],a=t&&HS(t),i=n&&HS(n),o=r&&HS(r);return l=>!!(a&&a(l)||UI&&i&&i(l)||!UI&&o&&o(l))},ir={isBold:Zn("bold"),isCompose:Zn("compose"),isMoveBackward:Zn("moveBackward"),isMoveForward:Zn("moveForward"),isDeleteBackward:Zn("deleteBackward"),isDeleteForward:Zn("deleteForward"),isDeleteLineBackward:Zn("deleteLineBackward"),isDeleteLineForward:Zn("deleteLineForward"),isDeleteWordBackward:Zn("deleteWordBackward"),isDeleteWord
695Forward:Zn("deleteWordForward"),isExtendBackward:Zn("extendBackward"),isExtendForward:Zn("extendForward"),isExtendLineBackward:Zn("extendLineBackward"),isExtendLineForward:Zn("extendLineForward"),isItalic:Zn("italic"),isMoveLineBackward:Zn("moveLineBackward"),isMoveLineForward:Zn("moveLineForward"),isMoveWordBackward:Zn("moveWordBackward"),isMoveWordForward:Zn("moveWordForward"),isRedo:Zn("redo"),isSoftBreak:Zn("insertSoftBreak"),isSplitBlock:Zn("splitBlock"),isTransposeCharacter:Zn("transposeCharacter"),isUndo:Zn("undo")};function bje(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function GI(e,t){if(e==null)return{};var n=bje(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var wje=["anchor","focus"],jje=["anchor","focus"],Nje=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),RK=(e,t)=>{var n=GI(e,wje),r=GI(t,jje);return e[Lf]===t[Lf]&&Nje(n,r)},Cje=(e,t)=>{if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(!Xe.equals(r,a)||!RK(r,a))return!1}return!0},Sje=(e,t)=>{if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(r.anchor.offset!==a.anchor.offset||r.focus.offset!==a.focus.offset||!RK(r,a))return!1}return!0},Yu=[],kje=function(){return Yu.some(function(e){return e.activeTargets.length>0})},Pje=function(){return Yu.some(function(e){return e.skippedTargets.length>0})},YI="ResizeObserver loop completed with undelivered notifications.",Eje=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:YI}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=YI),window.dispatchEvent(e)},zg;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(zg||(zg={}));var Qu=function(e){return Object.freeze(e)},Dje=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,Qu(this)}return e}(),BK=function(){function e(t,n,r,a){return this.x=t,this.y=n,this.width=r,this.height=a,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Qu(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,a=t.top,i=t.right,o=t.bottom,l=t.left,c=t.width,d=t.height;return{x:n,y:r,top:a,right:i,bottom:o,left:l,width:c,height:d}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),SO=function(e){return e instanceof SVGElement&&"getBBox"in e},LK=function(e){if(SO(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var a=e,i=a.offsetWidth,o=a.offsetHeight;return!(i||o||e.getClientRects().length)},QI=function(e){var t;if(e instanceof Element)return!0;var n=(t=e==null?void 0:e.ownerDocument)===null||t===void 0?void 0:t.defaultView;return!!(n&&e instanceof n.Element)},Aje=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},Qx=typeof window<"u"?window:{},R0=new WeakMap,JI=/auto|scroll/,Tje=/^tb|vertical/,Oje=/msie|trident/i.test(Qx.navigator&&Qx.navigator.userAgent),Yo=function(e){return parseFloat(e||"0")},Rh=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new Dje((n?t:e)||0,(n?e:t)||0)},XI=Qu({devicePixelContentBoxSize:Rh(),borderBoxSize:Rh(),contentBoxSize:Rh(),contentRect:new BK(0,0,0,0)}),UK=function(e,t){if(t===void 0&&(t=!1),R0.has(e)&&!t)return R0.get(e);if(LK(e))return R0.set(e,XI),XI;var n=getComputedStyle(e),r=SO(e)&&e.ownerSVGElement&&e.getBBox(),a=!Oje&&n.boxSizing==="border-box",i=Tje.test(n.writingMode||""),o=!r&&JI.test(n.overflowY||""),l=!r&&JI.test(n.overflowX||""),c=r?0:Yo(n.paddingTop),d=r?0:Yo(n.paddingRight),m=r?0:Yo(n.paddingBottom),u=r?0:Yo(n.paddingLeft),h=r?0:Yo(n.borderTopWidth),p=r?0:Yo(n.borderRightWidth),v=r?0:Yo(n.borderBottomWidth),y=r?0:Yo(n.borderLeftWidth),g=u+d,x=c+m,b=y+p,w=h+v,j=l?e.offsetHeight-w-e.clientHeight:0,N=o?e.offsetWidth-b-e.clientWidth:0,C=a?g+b:0,P=a?x+w:0,S=r?r.width:Yo(n.width)-C-N,E=r?r.height:Yo(n.height)-P-j,T=S+g+N+b,z=E+x+j+w,O=Qu({devicePixelContentBoxSize:Rh(Math.round(S*devicePixelRatio),Math.round(E*devicePixelRatio),i),borderBoxSize:Rh(T,z,i),contentBoxSize:Rh(S,E,i),contentRect:new BK(u,c,S,E)});return R0.set(e,O),O}
vendor: 4,174 bytes, line 695
695,zK=function(e,t,n){var r=UK(e,n),a=r.borderBoxSize,i=r.contentBoxSize,o=r.devicePixelContentBoxSize;switch(t){case zg.DEVICE_PIXEL_CONTENT_BOX:return o;case zg.BORDER_BOX:return a;default:return i}},Fje=function(){function e(t){var n=UK(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=Qu([n.borderBoxSize]),this.contentBoxSize=Qu([n.contentBoxSize]),this.devicePixelContentBoxSize=Qu([n.devicePixelContentBoxSize])}return e}(),qK=function(e){if(LK(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},_je=function(){var e=1/0,t=[];Yu.forEach(function(o){if(o.activeTargets.length!==0){var l=[];o.activeTargets.forEach(function(d){var m=new Fje(d.target),u=qK(d.target);l.push(m),d.lastReportedSize=zK(d.target,d.observedBox),u<e&&(e=u)}),t.push(function(){o.callback.call(o.observer,l,o.observer)}),o.activeTargets.splice(0,o.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},ZI=function(e){Yu.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(qK(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},Mje=function(){var e=0;for(ZI(e);kje();)e=_je(),ZI(e);return Pje()&&Eje(),e>0},GS,WK=[],$je=function(){return WK.splice(0).forEach(function(e){return e()})},Ije=function(e){if(!GS){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return $je()}).observe(n,r),GS=function(){n.textContent="".concat(t?t--:t++)}}WK.push(e),GS()},Rje=function(e){Ije(function(){requestAnimationFrame(e)})},Rb=0,Bje=function(){return!!Rb},Lje=250,Uje={attributes:!0,characterData:!0,childList:!0,subtree:!0},e3=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],t3=function(e){return e===void 0&&(e=0),Date.now()+e},YS=!1,zje=function(){function e(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return e.prototype.run=function(t){var n=this;if(t===void 0&&(t=Lje),!YS){YS=!0;var r=t3(t);Rje(function(){var a=!1;try{a=Mje()}finally{if(YS=!1,t=r-t3(),!Bje())return;a?n.run(1e3):t>0?n.run(t):n.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,n=function(){return t.observer&&t.observer.observe(document.body,Uje)};document.body?n():Qx.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),e3.forEach(function(n){return Qx.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),e3.forEach(function(n){return Qx.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),hE=new zje,s3=function(e){!Rb&&e>0&&hE.start(),Rb+=e,!Rb&&hE.stop()},qje=function(e){return!SO(e)&&!Aje(e)&&getComputedStyle(e).display==="inline"},Wje=function(){function e(t,n){this.target=t,this.observedBox=n||zg.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=zK(this.target,this.observedBox,!0);return qje(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Hje=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),B0=new WeakMap,n3=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},L0=function(){function e(){}return e.connect=function(t,n){var r=new Hje(t,n);B0.set(t,r)},e.observe=function(t,n,r){var a=B0.get(t),i=a.observationTargets.length===0;n3(a.observationTargets,n)<0&&(i&&Yu.push(a),a.observationTargets.push(new Wje(n,r&&r.box)),s3(1),hE.schedule())},e.unobserve=function(t,n){var r=B0.get(t),a=n3(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&Yu.splice(Yu.indexOf(r),1),r.observationTargets.splice(a,1),s3(-1))},e.disconnect=function(t){var n=this,r=B0.get(t);
695r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Vje=function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");L0.connect(this,t)}return e.prototype.observe=function(t,n){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!QI(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");L0.observe(this,t,n)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!QI(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");L0.unobserve(this,t)},e.prototype.disconnect=function(){L0.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();function Kje(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function zw(e,t){if(e==null)return{};var n=Kje(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qg(e){"@babel/helpers - typeof";return qg=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},qg(e)}function Gje(e,t){if(qg(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(qg(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Yje(e){var t=Gje(e,"string");return qg(t)==="symbol"?t:String(t)}function $o(e,t,n){return t=Yje(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var kO=f.createContext(null),Kd=()=>{var e=f.useContext(kO);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Rt=Bs;function r3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function U0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?r3(Object(n),!0).forEach(function(r){$o(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r3(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Qje=25,Jje=200,Xje=function(){},Zje=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function eNe(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,o=null,l=null,c=0,d=!1,m=()=>{var O=Lc.get(t);if(Lc.delete(t),O){var{selection:D}=t,k=zI(t,O);k&&(!D||!Xe.equals(k,D))&&ut.select(t,k)}},u=()=>{var O=Bc.get(t);if(Bc.delete(t),!!O){if(O.at){var D=Vs.isPoint(O.at)?uE(t,O.at):zI(t,O.at);if(!D)return;var k=ne.range(t,D);(!t.selection||!Xe.equals(t.selection,k))&&ut.select(t,D)}O.run()}},h=()=>{if(o&&(clearTimeout(o),o=null),l&&(clearTimeout(l),l=null),!j()&&!w()){m();return}a||(a=!0,setTimeout(()=>a=!1)),w()&&(a="action");var O=t.selection&&ne.rangeRef(t,t.selection,{affinity:"forward"});Jl.set(t,t.marks),Xje("flush",Bc.get(t),Ha.get(t));for(var D=j(),k;k=(F=Ha.get(t))===null||F===void 0?void 0:F[0];){var F,W,q=Oo.get(t);q!==void 0&&(Oo.delete(t),t.marks=q),q&&d===!1&&(d=null);var H=mje(k);(!t.selection||!Xe.equals(t.selection,H))&&ut.select(t,H),k.diff.text?ne.insertText(t,k.diff.text):ne.deleteFragment(t),Ha.set(t,(W=Ha.get(t))===null||W===void 0?void 0:W.filter(U=>{var{id:J}=U;return J!==k.id})),lje(t,k)||(D=!1,Bc.delete(t),Jl.delete(t),a="action",Lc.delete(t),n.cancel(),r.cancel(),O==null||O.unref())}var _=O==null?void 0:O.unref();if(_&&!Lc.get(t)&&(!t.selection||!Xe.equals(_,t.selection))&&ut.select(t,_),w()){u();return}D&&n(),n.flush(),r.flush(),m();var L=Jl.get(t);Jl.delete(t),L!==void 0&&(t.marks=L,t.onChange())},p=O=>{i&&clearTimeout(i),i=setTimeout(()=>{vu.set(t,!1),h()},Qje)},v=O=>{vu.set(t,!0),i&&(clearTimeout(i),i=null)},y=function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,k=lE.get(t);if(k){if(j()||D){k.style.display="none";return}k.style.removeProperty("display")}},g=(O,D)=>{var k,F=(k=Ha.get(t))!==null&&k!==void 0?k:[];Ha.set(t,F);var W=Dt.leaf(t,O),q=F.findIndex(L=>Oe.equals(L.path,O));if(q<0){var H=IK(W.text,D);H&&F.push({path:O,diff:D,id:c++}),y();return}var _=uje(W.text,F[q].diff,D);if(!_){F.splice(q,1),y();return}F[q]=U0(U0({},F[q]),{},{diff:_})},x=function(D){var{at:k}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};d=!1,Lc.delete(t),n.cancel(),r.cancel(),w()&&h(),Bc.set(t,{at:k,run:D}),l=setTimeout(h)},b=O=>{var D;if(o&&(clearTimeout(o),o=null),!Ih.get(t)){var{inputType:k}=O,F=null,W=O.dataTransfer||O.data||void 0;d!==!1&&k!=="insertText"&&k!=="insertCompositionText"&&(d=!1);var[q]=O.getTargetRanges();q&&(F=Rt.toSlateRange(t,q,{exactMatch:!1,suppressThrow:!0}));var H=Rt.getWindow(t),_=H.getSelection();if(!F&&_&&(q=_,F=Rt.toSlateRange(t,_,{exactMatch:!1,suppressThrow:!0})),F=(D=F)!==null&&D!==void 0?D:t.selection,!!F){var L=!0;if(k.startsWith("delete")){if(Xe.isExpanded(F)){var[U,J]=Xe.edges(F),I=Dt.leaf(t,U.path);if(I.text.length===U.offset&&J.offset===0){var re=ne.next(t,{at:U.path,match:os.isText});re&&Oe.equals(re[1],J.path)&&(F={anchor:J,focus:J})}}var R=k.endsWith("Backward")?"backward":"forward",[Y,M]=Xe.edges(F),[se,Q]=ne.leaf(t,Y.path),te={text:"",start:Y.offset,end:M.offset},G=Ha.get(t),Z=G==null?void 0:G.find(pt=>Oe.equals(pt.path,Q)),ie=Z?[Z.diff,te]:[te],A=$K(se.text,...ie);if(A.length===0&&(L=!1),Xe.isExpanded(F)){if(L&&Oe.equals(F.anchor.path,F.focus.path)){var ge={path:F.anchor.path,offset:Y.offset},je=ne.range(t,ge,ge);return P(je),g(F.anchor.path,{text:"",end:M.offset,start:Y.offset})}return x(()=>ne.deleteFragment(t,{direction:R}),{at:F})}}switch(k){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return x(()=>ne.deleteFragment(t),{at:F});
695case"deleteContent":case"deleteContentForward":{var{anchor:ke}=F;if(L&&Xe.isCollapsed(F)){var Ie=Dt.leaf(t,ke.path);if(ke.offset<Ie.text.length)return g(ke.path,{text:"",start:ke.offset,end:ke.offset+1})}return x(()=>ne.deleteForward(t),{at:F})}case"deleteContentBackward":{var $e,{anchor:qe}=F,ft=oE(q)?q.isCollapsed:!!(($e=q)!==null&&$e!==void 0&&$e.collapsed);return L&&ft&&Xe.isCollapsed(F)&&qe.offset>0?g(qe.path,{text:"",start:qe.offset-1,end:qe.offset}):x(()=>ne.deleteBackward(t),{at:F})}case"deleteEntireSoftLine":return x(()=>{ne.deleteBackward(t,{unit:"line"}),ne.deleteForward(t,{unit:"line"})},{at:F});case"deleteHardLineBackward":return x(()=>ne.deleteBackward(t,{unit:"block"}),{at:F});case"deleteSoftLineBackward":return x(()=>ne.deleteBackward(t,{unit:"line"}),{at:F});case"deleteHardLineForward":return x(()=>ne.deleteForward(t,{unit:"block"}),{at:F});case"deleteSoftLineForward":return x(()=>ne.deleteForward(t,{unit:"line"}),{at:F});case"deleteWordBackward":return x(()=>ne.deleteBackward(t,{unit:"word"}),{at:F});
695case"deleteWordForward":return x(()=>ne.deleteForward(t,{unit:"word"}),{at:F});case"insertLineBreak":return x(()=>ne.insertSoftBreak(t),{at:F});case"insertParagraph":return x(()=>ne.insertBreak(t),{at:F});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(Zje(W))return x(()=>Rt.insertData(t,W),{at:F});var be=W??"";if(Oo.get(t)&&(be=be.replace("\uFEFF","")),k==="insertText"&&/.*\n.*\n$/.test(be)&&(be=be.slice(0,-1)),be.includes(`
696`))return x(()=>{var pt=be.split(`
697`);pt.forEach((de,fe)=>{de&&ne.insertText(t,de),fe!==pt.length-1&&ne.insertSoftBreak(t)})},{at:F});if(Oe.equals(F.anchor.path,F.focus.path)){var[Fe,_e]=Xe.edges(F),ze={start:Fe.offset,end:_e.offset,text:be};if(be&&d&&k==="insertCompositionText"){var ue=d.start+d.text.search(/\S|$/),Me=ze.start+ze.text.search(/\S|$/);Me===ue+1&&ze.end===d.start+d.text.length?(ze.start-=1,d=null,T()):d=!1}else k==="insertText"?d===null?d=ze:d&&Xe.isCollapsed(F)&&d.end+d.text.length===Fe.offset?d=U0(U0({},d),{},{text:d.text+be}):d=!1:d=!1;if(L){g(Fe.path,ze);return}}return x(()=>ne.insertText(t,be),{at:F})}}}}},w=()=>!!Bc.get(t),j=()=>{var O;return!!((O=Ha.get(t))!==null&&O!==void 0&&O.length)},N=()=>w()||j(),C=()=>a,P=O=>{Lc.set(t,O),o&&(clearTimeout(o),o=null);var{selection:D}=t;if(O){var k=!D||!Oe.equals(D.anchor.path,O.anchor.path),F=!D||!Oe.equals(D.anchor.path.slice(0,-1),O.anchor.path.slice(0,-1));(k&&d||F)&&(d=!1),(k||j())&&(o=setTimeout(h,Jje))}},S=()=>{(w()||!j())&&h()},E=O=>{j()||(y(!0),setTimeout(y))},T=()=>
697{w()||(l=setTimeout(h))},z=O=>{if(!(j()||w())&&O.some(k=>wO(t,k,O))){var D;(D=_K.get(t))===null||D===void 0||D()}};return{flush:h,scheduleFlush:T,hasPendingDiffs:j,hasPendingAction:w,hasPendingChanges:N,isFlushing:C,handleUserSelect:P,handleCompositionEnd:p,handleCompositionStart:v,handleDOMBeforeInput:b,handleKeyDown:E,handleDomMutations:z,handleInput:S}}function tNe(){var e=f.useRef(!1);return f.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Wg=$b?f.useLayoutEffect:f.useEffect;function sNe(e,t,n){var[r]=f.useState(()=>new MutationObserver(t));Wg(()=>{r.takeRecords()}),f.useEffect(()=>{if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(e.current,n),()=>r.disconnect()},[r,e,n])}var nNe=["node"];function a3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function rNe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?a3(Object(n),!0).forEach(function(r){$o(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a3(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var aNe={subtree:!0,childList:!0,characterData:!0},iNe=_a?e=>{var{node:t}=e,n=zw(e,nNe);if(!_a)return null;var r=Kd(),a=tNe(),[i]=f.useState(()=>eNe(rNe({editor:r},n)));return sNe(t,i.handleDomMutations,aNe),CO.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null;function i3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function oNe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?i3(Object(n),!0).forEach(function(r){$o(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i3(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var lNe=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=Kd(),o=Rt.findPath(i,a),l=Oe.parent(o),c=!!n[MK];return i.isVoid(r)?he.createElement(QS,{length:Dt.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&ne.string(i,l)===""?he.createElement(QS,{isLineBreak:!0,isMarkPlaceholder:c}):n.text===""?he.createElement(QS,{isMarkPlaceholder:c}):t&&n.text.slice(-1)===`
698`?he.createElement(o3,{isTrailing:!0,text:n.text}):he.createElement(o3,{text:n.text})},o3=e=>{var{text:t,isTrailing:n=!1}=e,r=f.useRef(null),a=()=>"".concat(t??"").concat(n?`
699`:""),[i]=f.useState(a);return Wg(()=>{var o=a();r.current&&r.current.textContent!==o&&(r.current.textContent=o)}),he.createElement(cNe,{ref:r},i)},cNe=f.memo(f.forwardRef((e,t)=>he.createElement("span",{"data-slate-string":!0,ref:t},e.children))),QS=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),he.createElement("span",oNe({},a),!(_a||AK)||!n?"\uFEFF":null,n?he.createElement("br",null):null)};function l3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function HK(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?l3(Object(n),!0).forEach(function(r){$o(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l3(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var dNe=_a?300:0;function uNe(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function c3(e){e.current&&(clearTimeout(e.current),e.current=null)}var mNe=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:o=w=>he.createElement(fNe,HK({},w)),leafPosition:l}=e,c=Kd(),d=f.useRef(null),m=f.useRef(null),[u,h]=f.useState(!1),p=f.useRef(null),v=f.useCallback(w=>{if(uNe(d,w==null),w==null){var j;lE.delete(c),(j=t.onPlaceholderResize)===null||j===void 0||j.call(t,null)}else{if(lE.set(c,w),!d.current){var N=window.ResizeObserver||Vje;
699d.current=new N(()=>{var C;(C=t.onPlaceholderResize)===null||C===void 0||C.call(t,w)})}d.current.observe(w),m.current=w}},[m,t,c]),y=he.createElement(lNe,{isLast:n,leaf:t,parent:a,text:r}),g=!!t[Lf];if(f.useEffect(()=>(g?p.current||(p.current=setTimeout(()=>{h(!0),p.current=null},dNe)):(c3(p),h(!1)),()=>c3(p)),[g,h]),g&&u){var x={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:lu?"inherit":void 0},contentEditable:!1,ref:v}};y=he.createElement(he.Fragment,null,i(x),y)}var b={"data-slate-leaf":!0};return o({attributes:b,children:y,leaf:t,text:r,leafPosition:l})},hNe=he.memo(mNe,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&os.equals(t.leaf,e.leaf)&&t.leaf[Lf]===e.leaf[Lf]),fNe=e=>{var{attributes:t,children:n}=e;return he.createElement("span",HK({},t),n)};function d3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function VK(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?d3(Object(n),!0).forEach(function(r){$o(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d3(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var pNe=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,renderText:o=b=>he.createElement(xNe,VK({},b)),text:l}=e,c=Kd(),d=f.useRef(null),m=os.decorations(l,t),u=Rt.findKey(c,l),h=[],p=0;p<m.length;p++){var{leaf:v,position:y}=m[p];h.push(he.createElement(hNe,{isLast:n&&p===m.length-1,key:"".concat(u.id,"-").concat(p),renderPlaceholder:a,leaf:v,leafPosition:y,text:l,parent:r,renderLeaf:i}))}var g=f.useCallback(b=>{var w=v1.get(c);b?(w==null||w.set(u,b),Gu.set(l,b),Ug.set(b,l)):(w==null||w.delete(u),Gu.delete(l),d.current&&Ug.delete(d.current)),d.current=b},[d,c,u,l]),x={"data-slate-node":"text",ref:g};return o({text:l,children:h,attributes:x})},KK=he.memo(pNe,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderText===e.renderText&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Sje(t.decorations,e.decorations)),xNe=e=>{var{attributes:t,children:n}=e;return he.createElement("span",VK({},t),n)};function u3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fE(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?u3(Object(n),!0).forEach(function(r){$o(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u3(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var gNe=e=>{var{decorations:t,element:n,renderElement:r=w=>he.createElement(vNe,fE({},w)),renderPlaceholder:a,renderLeaf:i,renderText:o,selection:l}=e,c=Kd(),d=jNe(),m=c.isInline(n),u=Rt.findKey(c,n),h=f.useCallback(w=>{var j=v1.get(c);w?(j==null||j.set(u,w),Gu.set(n,w),Ug.set(w,n)):(j==null||j.delete(u),Gu.delete(n))},[c,u,n]),p=YK({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,renderText:o,selection:l}),v={"data-slate-node":"element",ref:h};if(m&&(v["data-slate-inline"]=!0),!m&&ne.hasInlines(c,n)){var y=Dt.string(n),g=wK(y);g==="rtl"&&(v.dir=g)}if(ne.isVoid(c,n)){v["data-slate-void"]=!0,!d&&m&&(v.contentEditable=!1);var x=m?"span":"div",[[b]]=Dt.texts(n);p=he.createElement(x,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},he.createElement(KK,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:b})),jO.set(b,0),NO.set(b,n)}return r({attributes:v,children:p,element:n})},yNe=he.memo(gNe,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderText===t.renderText&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Cje(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&Xe.equals(e.selection,t.selection))),vNe=e=>{var{attributes:t,children:n,element:r}=e,a=Kd(),i=a.isInline(r)?"span":"div";return he.createElement(i,fE(fE({},t),{},{style:{position:"relative"}}
699),n)},GK=f.createContext(()=>[]),bNe=()=>f.useContext(GK),wNe=f.createContext(!1),YK=e=>{var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderText:i,renderLeaf:o,selection:l}=e,c=bNe(),d=Kd();Ih.set(d,!1);for(var m=Rt.findPath(d,n),u=[],h=rs.isElement(n)&&!d.isInline(n)&&ne.hasInlines(d,n),p=0;p<n.children.length;p++){var v=m.concat(p),y=n.children[p],g=Rt.findKey(d,y),x=ne.range(d,v),b=l&&Xe.intersection(x,l),w=c([y,v]);for(var j of t){var N=Xe.intersection(j,x);N&&w.push(N)}rs.isElement(y)?u.push(he.createElement(wNe.Provider,{key:"provider-".concat(g.id),value:!!b},he.createElement(yNe,{decorations:w,element:y,key:g.id,renderElement:r,renderPlaceholder:a,renderLeaf:o,renderText:i,selection:b}))):u.push(he.createElement(KK,{decorations:w,key:g.id,isLast:h&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:o,renderText:i,text:y})),jO.set(y,p),NO.set(y,n)}return u},QK=f.createContext(!1),jNe=()=>f.useContext(QK),JK=f.createContext(null),NNe=()=>{var e=f.useContext(JK);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function CNe(){var e=Kd(),t=f.useRef(!1),n=f.useRef(0),r=f.useCallback(()=>{if(!t.current){t.current=!0;var a=Rt.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return f.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var SNe=(e,t)=>{var n=[],r=()=>{n=[]},a=o=>{if(t.current){var l=o.filter(c=>wO(e,c,o));n.push(...l)}};function i(){n.length>0&&(n.reverse().forEach(o=>{o.type!=="characterData"&&(o.removedNodes.forEach(l=>{o.target.insertBefore(l,o.nextSibling)}),o.addedNodes.forEach(l=>{o.target.removeChild(l)}))}),r())}return{registerMutations:a,restoreDOM:i,clear:r}},kNe={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class XK extends f.Component{constructor(){super(...arguments),$o(this,"context",null),$o(this,"manager",null),$o(this,"mutationObserver",null)}observe(){var t,{node:n}=this.props;if(!n.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");(t=this.mutationObserver)===null||t===void 0||t.observe(n.current,kNe)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=SNe(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,a=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(a!=null&&a.length){var i;(i=this.manager)===null||i===void 0||i.registerMutations(a)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}$o(XK,"contextType",kO);var PNe=_a?XK:e=>{var{children:t}=e;return he.createElement(he.Fragment,null,t)},ENe=f.createContext(!1),DNe=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderText","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],ANe=["text"];function m3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Jo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?m3(Object(n),!0).forEach(function(r){$o(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m3(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var TNe=e=>he.createElement(he.Fragment,null,YK(e)),ONe=f.forwardRef((e,t)=>{var n=f.useCallback(M=>he.createElement(FNe,Jo({},M)),[]),{autoFocus:r,decorate:a=_Ne,onDOMBeforeInput:i,placeholder:o,readOnly:l=!1,renderElement:c,renderLeaf:d,renderText:m,renderPlaceholder:u=n,scrollSelectionIntoView:h=MNe,style:p={},as:v="div",disableDefaultStyles:y=!1}
699=e,g=zw(e,DNe),x=NNe(),[b,w]=f.useState(!1),j=f.useRef(null),N=f.useRef([]),[C,P]=f.useState(),S=f.useRef(!1),{onUserInput:E,receivedUserInput:T}=CNe(),[,z]=f.useReducer(M=>M+1,0);_K.set(x,z),cE.set(x,l);var O=f.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);f.useEffect(()=>{j.current&&r&&j.current.focus()},[r]);var D=f.useRef(),k=f.useMemo(()=>c1(()=>{if(Ih.get(x)){k();return}var M=Rt.toDOMNode(x,x),se=M.getRootNode();if(!S.current&&lu&&se instanceof ShadowRoot){S.current=!0;var Q=Qwe();Q?document.execCommand("indent"):ut.deselect(x),S.current=!1;return}var te=D.current;if((_a||!Rt.isComposing(x))&&(!O.isUpdatingSelection||te!=null&&te.isFlushing())&&!O.isDraggingInternally){var G=Rt.findDocumentOrShadowRoot(x),{activeElement:Z}=G,ie=Rt.toDOMNode(x,x),A=Gx(G);if(Z===ie?(O.latestElement=Z,dd.set(x,!0)):dd.delete(x),!A)return ut.deselect(x);var{anchorNode:ge,focusNode:je}=A,ke=Rt.hasEditableTarget(x,ge)||Rt.isTargetInsideNonReadonlyVoid(x,ge),Ie=Rt.hasTarget(x,je);if(ke&&Ie){var $e=Rt.toSlateRange(x,A,{exactMatch:!1,suppressThrow:!0});$e&&(!Rt.isComposing(x)&&!(te!=null&&te.hasPendingChanges())&&!(te!=null&&te.isFlushing())?ut.select(x,$e):te==null||te.handleUserSelect($e))}l&&(!ke||!Ie)&&ut.deselect(x)}},100),[x,l,O]),F=f.useMemo(()=>ZW(k,0),[k]);D.current=iNe({node:j,onDOMSelectionChange:k,scheduleOnDOMSelectionChange:F}),Wg(()=>{var M,se,Q;j.current&&(Q=bO(j.current))?(FK.set(x,Q),Ib.set(x,j.current),Gu.set(x,j.current),Ug.set(j.current,x)):Gu.delete(x);var{selection:te}=x,G=Rt.findDocumentOrShadowRoot(x),Z=Gx(G);if(!(!Z||!Rt.isFocused(x)||(M=D.current)!==null&&M!==void 0&&M.hasPendingAction())){var ie=ke=>{var Ie=Z.type!=="None";if(!(!te&&!Ie)){var $e=Z.focusNode,qe;if(gh&&Z.rangeCount>1){var ft=Z.getRangeAt(0),be=Z.getRangeAt(Z.rangeCount-1);ft.startContainer===$e?qe=be.endContainer:qe=ft.startContainer}else qe=Z.anchorNode;var Fe=Ib.get(x),_e=!1;if(Fe.contains(qe)&&Fe.contains($e)&&(_e=!0),Ie&&_e&&te&&!ke){var ze=Rt.toSlateRange(x,Z,{exactMatch:!0,suppressThrow:!0});if(ze&&Xe.equals(ze,te)){var ue;if(!O.hasMarkPlaceholder||(ue=qe)!==null&&ue!==void 0&&(ue=ue.parentElement)!==null&&ue!==void 0&&ue.hasAttribute("data-slate-mark-placeholder"))return}}if(te&&!Rt.hasRange(x,te)){x.selection=Rt.toSlateRange(x,Z,{exactMatch:!1,suppressThrow:!0});return}O.isUpdatingSelection=!0;var Me=null;try{Me=te&&Rt.toDOMRange(x,te)}catch{}return Me?(Rt.isComposing(x)&&!_a?Z.collapseToEnd():Xe.isBackward(te)?Z.setBaseAndExtent(Me.endContainer,Me.endOffset,Me.startContainer,Me.startOffset):Z.setBaseAndExtent(Me.startContainer,Me.startOffset,Me.endContainer,Me.endOffset),h(x,Me)):Z.removeAllRanges(),Me}};Z.rangeCount<=1&&ie();var A=((se=D.current)===null||se===void 0?void 0:se.isFlushing())==="action";if(!_a||!A){setTimeout(()=>{O.isUpdatingSelection=!1});return}var ge=null,je=requestAnimationFrame(()=>{if(A){var ke=Ie=>{try{var $e=Rt.toDOMNode(x,x);$e.focus(),ie(Ie)}catch{}};ke(),ge=setTimeout(()=>{ke(!0),O.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(je),ge&&clearTimeout(ge)}}});var W=f.useCallback(M=>{f3(x,M);var se=Rt.toDOMNode(x,x),Q=se.getRootNode();if(S!=null&&S.current&&lu&&Q instanceof ShadowRoot){var te=M.getTargetRanges(),G=te[0],Z=new window.Range;Z.setStart(G.startContainer,G.startOffset),Z.setEnd(G.endContainer,G.endOffset);var ie=Rt.toSlateRange(x,Z,{exactMatch:!1,suppressThrow:!1});ut.select(x,ie),M.preventDefault(),M.stopImmediatePropagation();return}if(E(),!l&&Rt.hasEditableTarget(x,M.target)&&!$Ne(M,i)){var A;if(D.current)return D.current.handleDOMBeforeInput(M);F.flush(),k.flush();var{selection:ge}=x,{inputType:je}=M,ke=M.dataTransfer||M.data||void 0,Ie=je==="insertCompositionText"||je==="deleteCompositionText";if(Ie&&Rt.isComposing(x))return;var $e=!1;if(je==="insertText"&&ge&&Xe.isCollapsed(ge)&&M.data&&M.data.length===1&&/[a-z ]/i.test(M.data)&&ge.anchor.offset!==0&&($e=!0,x.marks&&($e=!1),!Ih.get(x))){var qe,ft,{anchor:be}=ge,[Fe,_e]=Rt.toDOMPoint(x,be),ze=(qe=Fe.parentElement)===null||qe===void 0?void 0:qe.closest("a"),ue=Rt.getWindow(x);if($e&&ze&&Rt.hasDOMNode(x,ze)){var Me,pt=ue==null?void 0:ue.document.createTreeWalker(ze,NodeFilter.SHOW_TEXT).lastChild();pt===Fe&&((Me=pt.textContent)===null||Me===void 0?void 0:Me.length)===_e&&($e=!1)}if($e&&Fe.parentElement&&(ue==null||(ft=ue.getComputedStyle(Fe.parentElement))===null||ft===void 0?void 0:ft.whiteSpace)==="pre"){var de=ne.above(x,{at:be.path,match:Zt=>rs.isElement(Zt)&&ne.isBlock(x,Zt)});de&&Dt.string(de[0]).includes("	")&&($e=!1)}}if((!je.startsWith("delete")||je.startsWith("deleteBy"))&&!Ih.get(x)){var[fe]=M.getTargetRanges();if(fe){var le=Rt.toSlateRange(x,fe,{exactMatch:!1,suppressThrow:!1});if(!ge||!Xe.equals(ge,le)){$e=!1;var Ke=!Ie&&x.selection&&ne.rangeRef(x,x.selection);ut.select(x,le),Ke&&Yx.set(x,Ke)}}}if(Ie)return;if($e||M.preventDefault(),ge&&Xe.isExpanded(ge)&&je.startsWith("delete")){var We=je.endsWith("Backward")?"backward":"forward";ne.deleteFragment(x,{direction:We});return}switch(je){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{ne.deleteFragment(x);break}case"deleteContent":case"deleteContentForward":{ne.deleteForward(x);break}case"deleteContentBackward":{ne.deleteBackward(x);break}
699case"deleteEntireSoftLine":{ne.deleteBackward(x,{unit:"line"}),ne.deleteForward(x,{unit:"line"});break}case"deleteHardLineBackward":{ne.deleteBackward(x,{unit:"block"});break}case"deleteSoftLineBackward":{ne.deleteBackward(x,{unit:"line"});break}case"deleteHardLineForward":{ne.deleteForward(x,{unit:"block"});break}case"deleteSoftLineForward":{ne.deleteForward(x,{unit:"line"});break}case"deleteWordBackward":{ne.deleteBackward(x,{unit:"word"});break}case"deleteWordForward":{ne.deleteForward(x,{unit:"word"});break}case"insertLineBreak":ne.insertSoftBreak(x);break;case"insertParagraph":{ne.insertBreak(x);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{je==="insertFromComposition"&&Rt.isComposing(x)&&(w(!1),vu.set(x,!1)),(ke==null?void 0:ke.constructor.name)==="DataTransfer"?Rt.insertData(x,ke):typeof ke=="string"&&($e?N.current.push(()=>ne.insertText(x,ke)):ne.insertText(x,ke));break}}var vt=(A=Yx.get(x))===null||A===void 0?void 0:A.unref();Yx.delete(x),vt&&(!x.selection||!Xe.equals(x.selection,vt))&&ut.select(x,vt)}},[x,k,E,i,l,F]),q=f.useCallback(M=>{M==null?(k.cancel(),F.cancel(),Ib.delete(x),Gu.delete(x),j.current&&Tc&&j.current.removeEventListener("beforeinput",W)):Tc&&M.addEventListener("beforeinput",W),j.current=M,typeof t=="function"?t(M):t&&(t.current=M)},[k,F,x,W,t]);Wg(()=>{var M=Rt.getWindow(x),se=te=>{var{target:G}=te,Z=G instanceof HTMLElement?G:null,ie=Z==null?void 0:Z.tagName;ie==="INPUT"||ie==="TEXTAREA"||F()};M.document.addEventListener("selectionchange",se);var Q=()=>{O.isDraggingInternally=!1};return M.document.addEventListener("dragend",Q),M.document.addEventListener("drop",Q),()=>{M.document.removeEventListener("selectionchange",se),M.document.removeEventListener("dragend",Q),M.document.removeEventListener("drop",Q)}},[F,O]);var H=a([x,[]]),_=o&&x.children.length===1&&Array.from(Dt.texts(x)).length===1&&Dt.string(x)===""&&!b,L=f.useCallback(M=>{if(M&&_){var se;P((se=M.getBoundingClientRect())===null||se===void 0?void 0:se.height)}else P(void 0)},[_]);if(_){var U=ne.start(x,[]);H.push({[Lf]:!0,placeholder:o,onPlaceholderResize:L,anchor:U,focus:U})}var{marks:J}=x;if(O.hasMarkPlaceholder=!1,x.selection&&Xe.isCollapsed(x.selection)&&J){var{anchor:I}=x.selection,re=Dt.leaf(x,I.path),R=zw(re,ANe);if(!os.equals(re,J,{loose:!0})){O.hasMarkPlaceholder=!0;var Y=Object.fromEntries(Object.keys(R).map(M=>[M,null]));H.push(Jo(Jo(Jo({[MK]:!0},Y),J),{},{anchor:I,focus:I}))}}return f.useEffect(()=>{setTimeout(()=>{var{selection:M}=x;if(M){var{anchor:se}=M,Q=Dt.leaf(x,se.path);if(J&&!os.equals(Q,J,{loose:!0})){Oo.set(x,J);return}}Oo.delete(x)})}),he.createElement(QK.Provider,{value:l},he.createElement(ENe.Provider,{value:b},he.createElement(GK.Provider,{value:a},he.createElement(PNe,{node:j,receivedUserInput:T},he.createElement(v,Jo(Jo({role:l?void 0:"textbox","aria-multiline":l?void 0:!0},g),{},{spellCheck:Tc||!$b?g.spellCheck:!1,autoCorrect:Tc||!$b?g.autoCorrect:"false",autoCapitalize:Tc||!$b?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!l,zindex:-1,suppressContentEditableWarning:!0,ref:q,style:Jo(Jo({},y?{}:Jo({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},C?{minHeight:C}:{})),p),onBeforeInput:f.useCallback(M=>{if(!Tc&&!l&&!ka(M,g.onBeforeInput)&&Rt.hasSelectableTarget(x,M.target)&&(M.preventDefault(),!Rt.isComposing(x))){var se=M.data;ne.insertText(x,se)}},[g.onBeforeInput,x,l]),onInput:f.useCallback(M=>{if(!ka(M,g.onInput)){if(D.current){D.current.handleInput();return}for(var se of N.current)se();N.current=[],Rt.isFocused(x)||f3(x,M.nativeEvent)}},[g.onInput,x]),onBlur:f.useCallback(M=>{if(!(l||O.isUpdatingSelection||!Rt.hasSelectableTarget(x,M.target)||ka(M,g.onBlur))){var se=Rt.findDocumentOrShadowRoot(x);if(O.latestElement!==se.activeElement){var{relatedTarget:Q}=M,te=Rt.toDOMNode(x,x);if(Q!==te&&!(Ui(Q)&&Q.hasAttribute("data-slate-spacer"))){if(Q!=null&&Od(Q)&&Rt.hasDOMNode(x,Q)){var G=Rt.toSlateNode(x,Q);if(rs.isElement(G)&&!x.isVoid(G))return}if(lu){var Z=Gx(se);Z==null||Z.removeAllRanges()}dd.delete(x)}}}},[l,O.isUpdatingSelection,O.latestElement,x,g.onBlur]),onClick:f.useCallback(M=>{if(Rt.hasTarget(x,M.target)&&!ka(M,g.onClick)&&Od(M.target)){var se=Rt.toSlateNode(x,M.target),Q=Rt.findPath(x,se);if(!ne.hasPath(x,Q)||Dt.get(x,Q)!==se)return;if(M.detail===xje&&Q.length>=1){var te=Q;if(!(rs.isElement(se)&&ne.isBlock(x,se))){var G,Z=ne.above(x,{match:$e=>rs.isElement($e)&&ne.isBlock(x,$e),at:Q});te=(G=Z==null?void 0:Z[1])!==null&&G!==void 0?G:Q.slice(0,1)}var ie=ne.range(x,te);ut.select(x,ie);return}if(l)return;var A=ne.start(x,Q),ge=ne.end(x,Q),je=ne.void(x,{at:A}),ke=ne.void(x,{at:ge});if(je&&ke&&Oe.equals(je[1],ke[1])){var Ie=ne.range(x,A);ut.select(x,Ie)}}},[x,g.onClick,l]),onCompositionEnd:f.useCallback(M=>{if(Rt.hasSelectableTarget(x,M.target)){var se;if(Rt.isComposing(x)&&Promise.resolve().then(()=>{w(!1),vu.set(x,!1)}),(se=D.current)===null||se===void 0||se.handleCompositionEnd(M),ka(M,g.onCompositionEnd)||_a)return;if(!lu&&!tje&&!AK&&!nje&&!sje&&M.data){var Q=Oo.get(x);Oo.delete(x),Q!==void 0&&(Jl.set(x,x.marks),x.marks=Q),ne.insertText(x,M.data);var te=Jl.get(x);Jl.delete(x),te!==void 0&&(x.marks=te)}}},[g.onCompositionEnd,x]),onCompositionUpdate:f.useCallback(M=>{Rt.hasSelectableTarget(x,M.target)&&!ka(M,g.onCompositionUpdate)&&(Rt.isComposing(x)||(w(!0),vu.set(x,!0)))},[g.onCompositionUpdate,x]),onCompositionStart:f.useCallback(M=>{if(Rt.hasSelectableTarget(x,M.target)){var se;if((se=D.current)===null||se===void 0||se.handleCompositionStart(M),ka(M,g.onCompositionStart)||_a)return;w(!0);var{selection:Q}=x;if(Q&&Xe.isExpanded(Q)){ne.deleteFragment(x);return}}},[g.onCompositionStart,x]),onCopy:f.useCallback(M=>
699{Rt.hasSelectableTarget(x,M.target)&&!ka(M,g.onCopy)&&!h3(M)&&(M.preventDefault(),Rt.setFragmentData(x,M.clipboardData,"copy"))},[g.onCopy,x]),onCut:f.useCallback(M=>{if(!l&&Rt.hasSelectableTarget(x,M.target)&&!ka(M,g.onCut)&&!h3(M)){M.preventDefault(),Rt.setFragmentData(x,M.clipboardData,"cut");var{selection:se}=x;if(se)if(Xe.isExpanded(se))ne.deleteFragment(x);else{var Q=Dt.parent(x,se.anchor.path);ne.isVoid(x,Q)&&ut.delete(x)}}},[l,x,g.onCut]),onDragOver:f.useCallback(M=>{if(Rt.hasTarget(x,M.target)&&!ka(M,g.onDragOver)){var se=Rt.toSlateNode(x,M.target);rs.isElement(se)&&ne.isVoid(x,se)&&M.preventDefault()}},[g.onDragOver,x]),onDragStart:f.useCallback(M=>{if(!l&&Rt.hasTarget(x,M.target)&&!ka(M,g.onDragStart)){var se=Rt.toSlateNode(x,M.target),Q=Rt.findPath(x,se),te=rs.isElement(se)&&ne.isVoid(x,se)||ne.void(x,{at:Q,voids:!0});if(te){var G=ne.range(x,Q);ut.select(x,G)}O.isDraggingInternally=!0,Rt.setFragmentData(x,M.dataTransfer,"drag")}},[l,x,g.onDragStart,O]),onDrop:f.useCallback(M=>{if(!l&&Rt.hasTarget(x,M.target)&&!ka(M,g.onDrop)){M.preventDefault();var se=x.selection,Q=Rt.findEventRange(x,M),te=M.dataTransfer;ut.select(x,Q),O.isDraggingInternally&&se&&!Xe.equals(se,Q)&&!ne.void(x,{at:Q,voids:!0})&&ut.delete(x,{at:se}),Rt.insertData(x,te),Rt.isFocused(x)||Rt.focus(x)}},[l,x,g.onDrop,O]),onDragEnd:f.useCallback(M=>{!l&&O.isDraggingInternally&&g.onDragEnd&&Rt.hasTarget(x,M.target)&&g.onDragEnd(M)},[l,O,g,x]),onFocus:f.useCallback(M=>{if(!l&&!O.isUpdatingSelection&&Rt.hasEditableTarget(x,M.target)&&!ka(M,g.onFocus)){var se=Rt.toDOMNode(x,x),Q=Rt.findDocumentOrShadowRoot(x);if(O.latestElement=Q.activeElement,gh&&M.target!==se){se.focus();return}dd.set(x,!0)}},[l,O,x,g.onFocus]),onKeyDown:f.useCallback(M=>{if(!l&&Rt.hasEditableTarget(x,M.target)){var se;(se=D.current)===null||se===void 0||se.handleKeyDown(M);var{nativeEvent:Q}=M;if(Rt.isComposing(x)&&Q.isComposing===!1&&(vu.set(x,!1),w(!1)),ka(M,g.onKeyDown)||Rt.isComposing(x))return;var{selection:te}=x,G=x.children[te!==null?te.focus.path[0]:0],Z=wK(Dt.string(G))==="rtl";if(ir.isRedo(Q)){M.preventDefault();var ie=x;typeof ie.redo=="function"&&ie.redo();return}if(ir.isUndo(Q)){M.preventDefault();var A=x;typeof A.undo=="function"&&A.undo();return}if(ir.isMoveLineBackward(Q)){M.preventDefault(),ut.move(x,{unit:"line",reverse:!0});return}if(ir.isMoveLineForward(Q)){M.preventDefault(),ut.move(x,{unit:"line"});return}if(ir.isExtendLineBackward(Q)){M.preventDefault(),ut.move(x,{unit:"line",edge:"focus",reverse:!0});return}if(ir.isExtendLineForward(Q)){M.preventDefault(),ut.move(x,{unit:"line",edge:"focus"});return}if(ir.isMoveBackward(Q)){M.preventDefault(),te&&Xe.isCollapsed(te)?ut.move(x,{reverse:!Z}):ut.collapse(x,{edge:Z?"end":"start"});return}if(ir.isMoveForward(Q)){M.preventDefault(),te&&Xe.isCollapsed(te)?ut.move(x,{reverse:Z}):ut.collapse(x,{edge:Z?"start":"end"});return}if(ir.isMoveWordBackward(Q)){M.preventDefault(),te&&Xe.isExpanded(te)&&ut.collapse(x,{edge:"focus"}),ut.move(x,{unit:"word",reverse:!Z});return}if(ir.isMoveWordForward(Q)){M.preventDefault(),te&&Xe.isExpanded(te)&&ut.collapse(x,{edge:"focus"}),ut.move(x,{unit:"word",reverse:Z});return}if(Tc){if((TK||lu)&&te&&(ir.isDeleteBackward(Q)||ir.isDeleteForward(Q))&&Xe.isCollapsed(te)){var ge=Dt.parent(x,te.anchor.path);if(rs.isElement(ge)&&ne.isVoid(x,ge)&&(ne.isInline(x,ge)||ne.isBlock(x,ge))){M.preventDefault(),ne.deleteBackward(x,{unit:"block"});return}}}else{if(ir.isBold(Q)||ir.isItalic(Q)||ir.isTransposeCharacter(Q)){M.preventDefault();return}if(ir.isSoftBreak(Q)){M.preventDefault(),ne.insertSoftBreak(x);return}if(ir.isSplitBlock(Q)){M.preventDefault(),ne.insertBreak(x);return}if(ir.isDeleteBackward(Q)){M.preventDefault(),te&&Xe.isExpanded(te)?ne.deleteFragment(x,{direction:"backward"}):ne.deleteBackward(x);return}if(ir.isDeleteForward(Q)){M.preventDefault(),te&&Xe.isExpanded(te)?ne.deleteFragment(x,{direction:"forward"}):ne.deleteForward(x);return}if(ir.isDeleteLineBackward(Q)){M.preventDefault(),te&&Xe.isExpanded(te)?ne.deleteFragment(x,{direction:"backward"}):ne.deleteBackward(x,{unit:"line"});return}
699if(ir.isDeleteLineForward(Q)){M.preventDefault(),te&&Xe.isExpanded(te)?ne.deleteFragment(x,{direction:"forward"}):ne.deleteForward(x,{unit:"line"});return}if(ir.isDeleteWordBackward(Q)){M.preventDefault(),te&&Xe.isExpanded(te)?ne.deleteFragment(x,{direction:"backward"}):ne.deleteBackward(x,{unit:"word"});return}if(ir.isDeleteWordForward(Q)){M.preventDefault(),te&&Xe.isExpanded(te)?ne.deleteFragment(x,{direction:"forward"}):ne.deleteForward(x,{unit:"word"});return}}}},[l,x,g.onKeyDown]),onPaste:f.useCallback(M=>{!l&&Rt.hasEditableTarget(x,M.target)&&!ka(M,g.onPaste)&&(!Tc||Wwe(M.nativeEvent)||lu)&&(M.preventDefault(),Rt.insertData(x,M.clipboardData))},[l,x,g.onPaste])}),he.createElement(TNe,{decorations:H,node:x,renderElement:c,renderPlaceholder:u,renderLeaf:d,renderText:m,selection:x.selection}))))))}),FNe=e=>{var{attributes:t,children:n}=e;return he.createElement("span",Jo({},t),n,_a&&he.createElement("br",null))},_Ne=()=>[],MNe=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&Xe.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Iwe(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},ka=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},h3=e=>Od(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),$Ne=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},f3=(e,t)=>{var n=e;if(t.inputType==="historyUndo"&&typeof n.undo=="function"){n.undo();return}if(t.inputType==="historyRedo"&&typeof n.redo=="function"){n.redo();return}},INe=f.createContext(!1),RNe=f.createContext({});function BNe(e){var t=f.useRef([]).current,n=f.useRef({editor:e}).current,r=f.useCallback(i=>{n.editor=i,t.forEach(o=>o(i))},[t,n]),a=f.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var ZK=parseInt(he.version.split(".")[0],10),LNe=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],UNe=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:o}=e,l=zw(e,LNe),[c,d]=he.useState(()=>{if(!Dt.isNodeList(o))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Yr.stringify(o)));if(!ne.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Yr.stringify(t)));return t.children=o,Object.assign(t,l),{v:0,editor:t}}),{selectorContext:m,onChange:u}=BNe(t),h=f.useCallback(y=>{var g;switch(r&&r(t.children),y==null||(g=y.operation)===null||g===void 0?void 0:g.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}d(x=>({v:x.v+1,editor:t})),u(t)},[t,u,r,a,i]);f.useEffect(()=>(dE.set(t,h),()=>{dE.set(t,()=>{})}),[t,h]);var[p,v]=f.useState(Rt.isFocused(t));return f.useEffect(()=>{v(Rt.isFocused(t))},[t]),Wg(()=>{var y=()=>v(Rt.isFocused(t));return ZK>=17?(document.addEventListener("focusin",y),document.addEventListener("focusout",y),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",y)}):(document.addEventListener("focus",y,!0),document.addEventListener("blur",y,!0),()=>{document.removeEventListener("focus",y,!0),document.removeEventListener("blur",y,!0)})},[]),he.createElement(RNe.Provider,{value:m},he.createElement(JK.Provider,{value:c},he.createElement(kO.Provider,{value:c.editor},he.createElement(INe.Provider,{value:p},n))))},zNe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t;r=pje(r,n);var{onChange:a}=r;return r.onChange=i=>{var o=ZK<18?ZU.unstable_batchedUpdates:l=>l();o(()=>{a(i)})},r},qNe={isHistory(e){return oa(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||cd.isOperationList(e.redos[0].operations))&&(e.undos.length===0||cd.isOperationList(e.undos[0].operations))}},JS=new WeakMap,tu=new WeakMap,z0=new WeakMap,ul={isHistoryEditor(e){return qNe.isHistory(e.history)&&ne.isEditor(e)},isMerging(e){return tu.get(e)},isSplittingOnce(e){return z0.get(e)},setSplittingOnce(e,t){z0.set(e,t)},isSaving(e){return JS.get(e)},redo(e){e.redo()},undo(e){e.undo()},withMerging(e,t){var n=ul.isMerging(e);tu.set(e,!0),t(),tu.set(e,n)},withNewBatch(e,t){var n=ul.isMerging(e);tu.set(e,!0),z0.set(e,!0),t(),tu.set(e,n),z0.delete(e)},withoutMerging(e,t){var n=ul.isMerging(e);tu.set(e,!1),t(),tu.set(e,n)},withoutSaving(e,t){var n=ul.isSaving(e);JS.set(e,!1);try{t()}finally{JS.set(e,n)}}},WNe=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&ut.setSelection(t,i.selectionBefore),ul.withoutSaving(t,()=>{ne.withoutNormalizing(t,()=>{for(var o of i.operations)t.apply(o)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];ul.withoutSaving(t,()=>{ne.withoutNormalizing(t,()=>{var o=i.operations.map(cd.inverse).reverse();for(var l of o)t.apply(l);i.selectionBefore&&ut.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:o}=i,l=o[o.length-1],c=l&&l.operations[l.operations.length-1],d=ul.isSaving(t),m=ul.isMerging(t);if(d==null&&(d=VNe(r)),d){if(m==null&&(l==null?m=!1:a.length!==0?m=!0:m=HNe(r,c)),ul.isSplittingOnce(t)&&(m=!1,ul.setSplittingOnce(t,void 0)),l&&m)l.operations.push(r);else{var u={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",u)}for(;o.length>100;)o.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},HNe=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&Oe.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&Oe.equals(e.path,t.path)),VNe=(e,t)=>e.type!=="set_selection";const p3={"mod+b":"bold","mod+i":"italic","mod+u":"underline"},Km=e=>{const t=[],n=[{regex:/\*\*(.+?)\*\*/g,format:"bold",priority:1},{regex:/__(.+?)__/g,format:"bold",priority:1},{regex:/\*(.+?)\*/g,format:"italic",priority:2},{regex:/_(.+?)_/g,format:"italic",priority:2}],r=[];
699n.forEach(m=>{let u;const h=new RegExp(m.regex.source,"g");for(;(u=h.exec(e))!==null;)r.push({start:u.index,end:u.index+u[0].length,text:u[1],format:m.format,fullMatch:u[0],priority:m.priority})}),r.sort((m,u)=>m.start!==u.start?m.start-u.start:m.priority-u.priority);const a=[];let i=0;for(const m of r)m.start>=i&&(a.push(m),i=m.end);let o=0;for(const m of a){if(m.start>o){const h=e.slice(o,m.start);h&&t.push({text:h})}const u={text:m.text};m.format==="bold"&&(u.bold=!0),m.format==="italic"&&(u.italic=!0),t.push(u),o=m.end}if(o<e.length){const m=e.slice(o);m&&t.push({text:m})}const l=/\[([^\]]+)\]\(([^)]+)\)/g;let c;const d=[];for(;(c=l.exec(e))!==null;)d.push({start:c.index,end:c.index+c[0].length,text:c[1],url:c[2]});if(d.length>0){const m=[];for(const u of t){let h=u.text;for(const p of d){const v=`[${p.text}](${p.url})`;h.includes(v)&&(h=h.replace(v,`${p.text} (${p.url})`))}m.push({...u,text:h})}return m.length>0?m:[{text:e}]}return t.length>0?t:[{text:e}]},eG=e=>{const t=e.split(`
700`),n=[];let r=null,a=!1,i=[],o="",l=1,c=0;for(;c<t.length;){const d=t[c];if(d.trim().startsWith("```")){a?(r&&(r.type==="numbered-list"&&(l=(r.start||1)+r.children.length),n.push(r),r=null),n.push({type:"code-block",language:o,children:[{text:i.join(`
701`)}]}),i=[],o="",a=!1):(r&&(r.type==="numbered-list"&&(l=(r.start||1)+r.children.length),n.push(r),r=null),a=!0,o=d.trim().slice(3).trim()||""),c++;continue}if(a){i.push(d),c++;continue}if(d.trim()===""){r&&(n.push(r),r=null),c++;continue}if(d.startsWith("# "))r&&(n.push(r),r=null),n.push({type:"heading-one",children:Km(d.slice(2))});else if(d.startsWith("## "))r&&(n.push(r),r=null),n.push({type:"heading-two",children:Km(d.slice(3))});else if(d.startsWith("### "))r&&(n.push(r),r=null),n.push({type:"heading-two",children:Km(d.slice(4))});else if(d.match(/^[-*+]\s/)){const m=d.replace(/^[-*+]\s/,""),u={type:"list-item",children:Km(m)};!r||r.type!=="bulleted-list"?(r&&n.push(r),r={type:"bulleted-list",children:[u]}):r.children.push(u)}else if(d.match(/^\d+\.\s/)){const m=d.replace(/^\d+\.\s/,""),u={type:"list-item",children:Km(m)};!r||r.type!=="numbered-list"?(r&&(r.type==="numbered-list"&&(l=(r.start||1)+r.children.length),n.push(r)),r={type:"numbered-list",start:l,children:[u]},l++):(r.children.push(u),l++)}else{r&&(n.push(r),r=null);let m=d,u=c+1;for(;u<t.length&&t[u].trim()!==""&&!t[u].startsWith("#")&&!t[u].match(/^[-*+]\s/)&&!t[u].match(/^\d+\.\s/)&&!t[u].trim().startsWith("```");)m+=" "+t[u],u++;c=u-1,n.push({type:"paragraph",children:Km(m)})}c++}return r&&n.push(r),n.length>0?n:[{type:"paragraph",children:[{text:""}]}]},pE=({value:e,onChange:t,placeholder:n})=>{const[r,a]=f.useState(""),[i,o]=f.useState(""),[l,c]=f.useState(""),[d,m]=f.useState(""),[u,h]=f.useState(""),[p,v]=f.useState(""),[y,g]=f.useState(!1),[x,b]=f.useState(!1),[w,j]=f.useState(!1),[N,C]=f.useState(!1),[P,S]=f.useState(null),[E,T]=f.useState(!1),[z,O]=f.useState(""),D=f.useCallback(Z=>s.jsx(JNe,{...Z,showLinks:N}),[N]),k=f.useCallback(Z=>s.jsx(XNe,{...Z}),[]),F=f.useMemo(()=>KNe(GNe(YNe(WNe(zNe(Awe()))))),[]),W=f.useMemo(()=>{if(!e)return[{type:"paragraph",children:[{text:""}]}];try{return JSON.parse(e)}catch{return[{type:"paragraph",children:[{text:e.replace(/<[^>]*>/g,"")}]}]}},[e]),q=Z=>{t(JSON.stringify(Z))},H=f.useCallback(()=>{const{selection:Z}=F;if(Z)try{const ie=Array.from(ne.nodes(F,{at:Z,match:A=>A.type==="link"}));if(ie.length>0){const[A]=ie[0];S(A.url||null)}else S(null)}catch{S(null)}else S(null)},[F]);f.useEffect(()=>{H()},[F.selection,H]);const _=(Z,ie)=>{L(Z,ie)?ne.removeMark(Z,ie):ne.addMark(Z,ie,!0)},L=(Z,ie)=>{const A=ne.marks(Z);return A?A[ie]===!0:!1},U=(Z,ie)=>{const A=J(Z,ie),ge=["numbered-list","bulleted-list"].includes(ie);ut.unwrapNodes(Z,{match:ke=>!ne.isEditor(ke)&&rs.isElement(ke)&&["numbered-list","bulleted-list"].includes(ke.type),split:!0});const je={type:A?"paragraph":ge?"list-item":ie};
701if(ut.setNodes(Z,je),!A&&ge){const ke={type:ie,children:[]};ut.wrapNodes(Z,ke)}},J=(Z,ie)=>{const{selection:A}=Z;if(!A)return!1;const[ge]=Array.from(ne.nodes(Z,{at:ne.unhangRange(Z,A),match:je=>!ne.isEditor(je)&&rs.isElement(je)&&je.type===ie}));return!!ge},I=()=>{if(!r)return;const Z={type:"image",url:r,width:i?parseInt(i):void 0,linkUrl:l||void 0,children:[{text:""}]};ut.insertNodes(F,Z);const ie={type:"paragraph",children:[{text:""}]};ut.insertNodes(F,ie),a(""),o(""),c(""),g(!1)},re=Z=>{var A;const ie=(A=Z.target.files)==null?void 0:A[0];if(ie&&ie.type.startsWith("image/")){const ge=new FileReader;ge.onload=je=>{var Ie;const ke=(Ie=je.target)==null?void 0:Ie.result;a(ke)},ge.readAsDataURL(ie)}},R=()=>{if(!u)return;const{selection:Z}=F;if(Z&&Xe.isCollapsed(Z)){const A=p||u;ut.insertNodes(F,{type:"link",url:u,children:[{text:A}]})}else ut.wrapNodes(F,{type:"link",url:u,children:[]},{split:!0}),ut.collapse(F,{edge:"end"});h(""),v(""),j(!1)},Y=()=>{if(!d)return;let Z="";if(d.includes("youtube.com")||d.includes("youtu.be")){const ie=M(d);ie&&(Z=`https://www.youtube.com/embed/${ie}`)}else if(d.includes("vimeo.com")){const ie=se(d);ie&&(Z=`https://player.vimeo.com/video/${ie}`)}else if(d.includes("cloudflarestream.com")){const ie=Q(d);ie&&(Z=`https://${ie.domain}/${ie.videoId}/iframe`)}if(Z){const ie={type:"video",url:Z,children:[{text:""}]};ut.insertNodes(F,ie);const A={type:"paragraph",children:[{text:""}]};ut.insertNodes(F,A)}m(""),b(!1)},M=Z=>{const ie=Z.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([^&\n?#]+)/);return ie?ie[1]:null},se=Z=>{const ie=Z.match(/vimeo\.com\/(\d+)/);return ie?ie[1]:null},Q=Z=>{const ie=Z.split("/"),A=ie.findIndex(ke=>ke.includes("cloudflarestream.com")),ge=ie[A],je=ie[A+1];return ge&&je&&je!=="iframe"?{domain:ge,videoId:je}:null},te=()=>{if(z.trim())try{const Z=eG(z);ut.delete(F,{at:{anchor:ne.start(F,[]),focus:ne.end(F,[])}}),ut.insertNodes(F,Z);const ie=JSON.stringify(Z);t(ie),O(""),T(!1)}catch(Z){console.error("Error parsing markdown:",Z),alert("Error parsing markdown. Please check your markdown syntax.")}},G=f.useRef(null);return f.useEffect(()=>{const Z=G.current;if(!Z)return;const ie=A=>{const{url:ge,text:je}=A.detail;h(ge),v(je),j(!0)};return Z.addEventListener("editLink",ie),()=>{Z.removeEventListener("editLink",ie)}},[]),s.jsxs("div",{ref:G,"data-slate-editor":"true",className:"border rounded-lg w-full h-full min-h-0 min-w-0 max-w-full overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"border-b p-2 flex gap-2 flex-wrap bg-white relative z-50 flex-shrink-0",children:[s.jsx(B,{variant:L(F,"bold")?"default":"outline",size:"sm",onMouseDown:Z=>{Z.preventDefault(),_(F,"bold")},children:s.jsx(bre,{className:"w-4 h-4"})}),s.jsx(B,{variant:L(F,"italic")?"default":"outline",size:"sm",onMouseDown:Z=>{Z.preventDefault(),_(F,"italic")},children:s.jsx(Pre,{className:"w-4 h-4"})}),s.jsx(B,{variant:L(F,"underline")?"default":"outline",size:"sm",onMouseDown:Z=>{Z.preventDefault(),_(F,"underline")},children:s.jsx(Bre,{className:"w-4 h-4"})}),s.jsx(B,{variant:J(F,"heading-one")?"default":"outline",size:"sm",onMouseDown:Z=>{Z.preventDefault(),U(F,"heading-one")},children:"H1"}),s.jsx(B,{variant:J(F,"heading-two")?"default":"outline",size:"sm",onMouseDown:Z=>{Z.preventDefault(),U(F,"heading-two")},children:"H2"}),s.jsx(B,{variant:J(F,"bulleted-list")?"default":"outline",size:"sm",onMouseDown:Z=>{Z.preventDefault(),U(F,"bulleted-list")},children:s.jsx(_N,{className:"w-4 h-4"})}),s.jsx(B,{variant:J(F,"numbered-list")?"default":"outline",size:"sm",onMouseDown:Z=>{Z.preventDefault(),U(F,"numbered-list")},children:s.jsx(Are,{className:"w-4 h-4"})}),s.jsxs(Ct,{open:y,onOpenChange:g,children:[s.jsx(Jr,{asChild:!0,children:s.jsx(B,{variant:"outline",size:"sm",children:s.jsx(Y9,{className:"w-4 h-4"})})}),s.jsxs(St,{children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Insert Image"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"image-file",children:"Upload Image File"}),s.jsx(me,{id:"image-file",type:"file",accept:"image/*",onChange:re,className:"cursor-pointer"})]}),s.jsx("div",{className:"text-center text-sm text-gray-500",children:"or"}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"image-url",children:"Image URL"}),s.jsx(me,{id:"image-url",value:r,onChange:Z=>a(Z.target.value),placeholder:"https://example.com/image.jpg"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"image-width",children:"Width (optional)"}),s.jsx(me,{id:"image-width",type:"number",value:i,onChange:Z=>o(Z.target.value),placeholder:"300"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"image-link",children:"Link URL (optional)"}
701),s.jsx(me,{id:"image-link",value:l,onChange:Z=>c(Z.target.value),placeholder:"https://example.com"}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Make the image clickable by adding a link"})]}),s.jsx(B,{onClick:I,disabled:!r,children:"Insert Image"})]})]})]}),s.jsxs(Ct,{open:w,onOpenChange:Z=>{if(Z){const{selection:ie}=F;if(ie&&!Xe.isCollapsed(ie)){const A=ne.string(F,ie);v(A)}}j(Z)},children:[s.jsx(Jr,{asChild:!0,children:s.jsx(B,{variant:"outline",size:"sm",children:s.jsx(Tf,{className:"w-4 h-4"})})}),s.jsxs(St,{children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Insert Link"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"link-text",children:"Link Text"}),s.jsx(me,{id:"link-text",value:p,onChange:Z=>v(Z.target.value),placeholder:"Click here to visit"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"link-url",children:"URL"}),s.jsx(me,{id:"link-url",value:u,onChange:Z=>h(Z.target.value),placeholder:"https://example.com"})]}),s.jsx(B,{onClick:R,disabled:!u||!p,children:"Insert Link"})]})]})]}),s.jsxs(Ct,{open:x,onOpenChange:b,children:[s.jsx(Jr,{asChild:!0,children:s.jsx(B,{variant:"outline",size:"sm",children:s.jsx(lT,{className:"w-4 h-4"})})}),s.jsxs(St,{children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Insert Video"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"video-url",children:"YouTube, Vimeo, or Cloudflare Stream URL"}),s.jsx(me,{id:"video-url",value:d,onChange:Z=>m(Z.target.value),placeholder:"https://www.youtube.com/watch?v=..."})]}),s.jsx(B,{onClick:Y,children:"Insert Video"})]})]})]}),s.jsxs(Ct,{open:E,onOpenChange:T,children:[s.jsx(Jr,{asChild:!0,children:s.jsx(B,{variant:"outline",size:"sm",title:"Import Markdown",children:s.jsx(ad,{
701className:"w-4 h-4"})})}),s.jsxs(St,{className:"max-w-2xl",children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Import Markdown"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"markdown-input",children:"Paste your markdown content"}),s.jsx(Is,{id:"markdown-input",value:z,onChange:Z=>O(Z.target.value),placeholder:`# Heading 1
702## Heading 2
703
704**Bold text** and *italic text*
705
706- List item 1
707- List item 2
708
7091. Numbered item
7102. Another item
711
712[Link text](https://example.com)`,rows:10,className:"font-mono text-sm"})]}),s.jsxs("div",{className:"text-sm text-gray-600",children:[s.jsx("p",{className:"font-medium mb-1",children:"Supported markdown:"}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[s.jsx("li",{children:"# Heading 1, ## Heading 2, ### Heading 3"}),s.jsx("li",{children:"**bold** or __bold__, *italic* or _italic_"}),s.jsx("li",{children:"- Bulleted lists or * or +"}),s.jsx("li",{children:"1. Numbered lists"}),s.jsx("li",{children:"[Link text](URL) - Note: Links will be converted to plain text with URL"})]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(B,{onClick:te,disabled:!z.trim(),children:"Import Markdown"}),s.jsx(B,{variant:"outline",onClick:()=>T(!1),children:"Cancel"})]})]})]})]}),s.jsxs("div",{className:"flex items-center space-x-2 ml-auto",children:[s.jsx("input",{type:"checkbox",id:"show-links",checked:N,onChange:Z=>C(Z.target.checked),className:"rounded"}),s.jsx("label",{htmlFor:"show-links",className:"text-sm text-gray-600",children:"Preview link URLs"})]})]}),s.jsx(UNe,{editor:F,initialValue:W,onChange:q,children:s.jsx("div",{className:"border rounded-md flex-1 min-h-0 max-h-96 w-full min-w-0 max-w-full overflow-x-hidden overflow-y-auto",children:s.jsx(ONe,{className:"p-4 min-h-32 outline-none max-w-full",renderElement:D,renderLeaf:k,placeholder:n,onKeyDown:Z=>{for(const ie in p3)if(Uwe(ie,Z)){Z.preventDefault();const A=p3[ie];_(F,A)}},onSelect:H,onClick:H})})}),P&&s.jsxs("div",{className:"mt-2 px-3 py-2 bg-blue-50 border border-blue-200 rounded text-sm text-blue-700",children:[s.jsx("span",{className:"font-medium",children:"Link:"})," ",P]})]})},KNe=e=>{const{isInline:t}=e;return e.isInline=n=>n.type==="link"?!0:t(n),e},GNe=e=>{const{insertData:t,isVoid:n}=e;return e.isVoid=r=>r.type==="image"?!0:n(r),e.insertData=r=>{const a=r.getData("text/plain"),{files:i}=r;if(i&&i.length>0)for(const o of i){const l=new FileReader,[c]=o.type.split("/");c==="image"&&(l.addEventListener("load",()=>{const d=l.result;x3(e,d)}),l.readAsDataURL(o))}else if(QNe(a))x3(e,a);else if(a&&(a.includes("```")||a.match(/^#{1,6}\s/m)))try{const o=eG(a);ut.insertNodes(e,o)}catch{t(r)}else t(r)},e},YNe=e=>{const{isVoid:t}=e;return e.isVoid=n=>n.type==="video"?!0:t(n),e},x3=(e,t)=>{const n={type:"image",url:t,children:[{text:""}]};ut.insertNodes(e,n)},QNe=e=>e?/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e):!1,JNe=({attributes:e,children:t,element:n,showLinks:r})=>{switch(n.type){case"bulleted-list":return s.jsx("ul",{...e,children:t});case"numbered-list":return s.jsx("ol",{...e,children:t});case"list-item":return s.jsx("li",{...e,children:t});case"heading-one":return s.jsx("h1",{...e,className:"text-2xl font-bold mb-2",children:t});case"heading-two":return s.jsx("h2",{...e,className:"text-xl font-semibold mb-2",children:t});case"link":return s.jsx("a",{...e,href:n.url,className:`text-blue-600 underline relative ${r?"show-link-url":""}`,title:n.url?`Link to: ${n.url}`:"Link","data-url":n.url,children:t});case"image":const a=s.jsx("img",{src:n.url,alt:"",style:{display:"block",width:n.width?"100%":"auto",maxWidth:n.width?`${n.width}px`:"100%",height:"auto"},className:"rounded"});return s.jsxs("div",{...e,className:"max-w-full min-w-0",children:[s.jsx("div",{contentEditable:!1,className:"my-4 max-w-full overflow-hidden",children:n.linkUrl?s.jsx("a",{href:n.linkUrl,target:"_blank",rel:"noopener noreferrer",className:"block max-w-full",children:a}):a}),t]});case"video":return s.jsxs("div",{...e,children:[s.jsx("div",{contentEditable:!1,className:"my-4",children:s.jsx("iframe",{src:n.url,width:"560",height:"315",frameBorder:"0",allowFullScreen:!0,className:"rounded max-w-full"})}),t]});case"code-block":return s.jsx("pre",{...e,className:"bg-slate-900 text-slate-100 p-4 rounded-lg overflow-x-auto my-4",children:s.jsx("code",{className:n.language?`language-${n.language}`:"",children:t})});default:return s.jsx("p",{...e,children:t})}},XNe=({attributes:e,children:t,leaf:n})=>(n.bold&&(t=s.jsx("strong",{children:t})),n.italic&&(t=s.jsx("em",{children:t})),n.underline&&(t=s.jsx("u",{children:t})),s.jsx("span",{...e,children:t}));function tG(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n;Array.isArray(r.children)?t.push(tG(r.children)):typeof r.text=="string"&&t.push(r.text)}return t.join(" ").replace(/\s+/g," ").trim()}function ZNe(e){try{const t=JSON.parse(e);if(Array.isArray(t))return t;if(t&&typeof t=="object"){const n=t.children;if(Array.isArray(n))return n}return null}catch{return null}}function e1e(e,t=150){if(!(e!=null&&e.trim()))return"New content is available in your membership.";const n=ZNe(e),r=n!==null;let a=r?tG(n):"";
712if(!a&&!r&&(a=e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()),!a)return"New content is available in your membership.";const i=a.replace(/\s+/g," ").trim();return i.length<=t?i:`${i.slice(0,t)}...`}function qw(e){if(e==null||e==="")return"";const t=e instanceof Date?e:new Date(e);if(Number.isNaN(t.getTime()))return"";const n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),a=String(t.getUTCDate()).padStart(2,"0");return`${n}-${r}-${a}`}function sG(e){if(e===!0)return!0;if(e===!1||e==null)return!1;const t=String(e).trim().toLowerCase();return t==="true"||t==="yes"||t==="1"||t==="y"}function PO(e){if(e==null)return null;if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;const t=String(e).trim();if(!t)return null;const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);if(n)return g3(parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10));if(/^\d{4}-\d{2}-\d{2}T/.test(t)){const i=new Date(t);return Number.isNaN(i.getTime())?null:i}const r=/^(\d{1,2})[/\-.](\d{1,2})[/\-.](\d{2,4})$/.exec(t);if(r){const i=parseInt(r[1],10),o=parseInt(r[2],10);let l=parseInt(r[3],10);l<100&&(l+=2e3);let c,d;return i>12&&o<=12?(c=i,d=o):o>12&&i<=12?(d=i,c=o):(c=i,d=o),g3(l,d,c)}const a=new Date(t);return Number.isNaN(a.getTime())?null:a}function XS(e){const t=e.trim().replace(/^\uFEFF/,"");if(!t)return[];if(t.startsWith("["))try{const h=JSON.parse(t);if(Array.isArray(h))return h.map(p=>t1e(p))}catch{}const n=a1e(t);if(n.length===0)return[];const r=n[0].map(h=>h.toLowerCase()),a=r.some(h=>h.includes("email")),i=a?n.slice(1):n;let o=0,l=1,c=2,d=-1,m=-1,u=-1;return a&&(o=r.findIndex(h=>h.includes("email")),l=r.findIndex(h=>s1e(h)),c=r.findIndex(h=>h.includes("status")),d=r.findIndex(h=>n1e(h)),m=r.findIndex(h=>h.includes("tag")),u=r.findIndex(h=>r1e(h)),o===-1&&(o=0),l===-1&&(l=1),c===-1&&(c=2)),i.map(h=>{const p=d>=0?h[d]:void 0,v=p?PO(p):null;return{email:(h[o]||"").trim(),name:l>=0?h[l]:void 0,status:(c>=0?h[c]:void 0)||"active",currentPeriodEnd:v?qw(v):p||void 0,tags:m>=0&&h[m]||void 0,neverExpires:sG(u>=0?h[u]:void 0)}})}function t1e(e){const t=e.renewalDate||e.currentPeriodEnd||e.expiryDate||e["expiry/renewal date"],n=t?PO(t):null;return{email:String(e.email||"").trim(),name:e.name!=null?String(e.name):void 0,status:String(e.status||"active"),currentPeriodEnd:n?qw(n):t||void 0,tags:e.tags!=null?String(e.tags):void 0,neverExpires:sG(e.neverExpires??e["never expires"])}}function s1e(e){const t=e.replace(/[\s/_-]+/g,"");return t==="name"||t.endsWith("name")}function n1e(e){const t=e.replace(/[\s/_-]+/g,"");return t.includes("never")||t.includes("joined")?!1:t.includes("renewal")||t.includes("expir")||t.includes("periodend")}function r1e(e){return e.includes("never")&&e.includes("expir")}function g3(e,t,n){if(t<1||t>12||n<1||n>31)return null;const r=new Date(Date.UTC(e,t-1,n,12,0,0));return r.getUTCFullYear()!==e||r.getUTCMonth()!==t-1||r.getUTCDate()!==n?null:r}function a1e(e){const t=[];let n=[],r="",a=!1;const i=()=>{n.push(r.trim()),r=""},o=()=>{i(),n.some(l=>l.length>0)&&t.push(n),n=[]};for(let l=0;l<e.length;l++){const c=e[l];a?c==='"'?e[l+1]==='"'?(r+='"',l++):a=!1:r+=c:c==='"'?a=!0:c===","?i():c===`
713`?o():c==="\r"?(e[l+1]===`
714`&&l++,o()):r+=c}return(a||r.length>0||n.length>0)&&o(),t}function i1e(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function y3(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return new Date(e).toISOString();const n=parseInt(t[1],10),r=parseInt(t[2],10),a=parseInt(t[3],10);return new Date(Date.UTC(n,r-1,a,12,0,0)).toISOString()}function o1e(e){if(e.status!=="active")return!1;if(e.neverExpires===!0||e.currentPeriodEnd==null||e.currentPeriodEnd===void 0)return!0;const t=new Date(e.currentPeriodEnd).getTime();return Number.isNaN(t)?!0:t>Date.now()}function l1e({membership:e,onClose:t,onMemberClick:n}){const{toast:r}=Yt(),a=jn(),{data:i}=Ue({queryKey:[`/api/instructor/by-id/${e.instructorId}`],queryFn:async()=>(await Pe("GET",`/api/instructor/by-id/${e.instructorId}`)).json(),enabled:!!e.instructorId}),{data:o}=Ue({queryKey:[`/api/memberships/${e.id}/private-link-token`],queryFn:async()=>(await Pe("GET",`/api/memberships/${e.id}/private-link-token`)).json(),enabled:!!e.id}),[l,c]=f.useState([]),[d,m]=f.useState([]),[u,h]=f.useState(!1),[p,v]=f.useState(null),[y,g]=f.useState(e),[x,b]=f.useState({name:e.name,price:e.price,visible:e.visible??!0,showCardInCl
714ientPortal:e.showCardInClientPortal??!1}),[w,j]=f.useState("editor"),[N,C]=f.useState(""),[P,S]=f.useState(!1),[E,T]=f.useState(""),[z,O]=f.useState(!1),[D,k]=f.useState(""),[F,W]=f.useState(""),[q,H]=f.useState(""),[_,L]=f.useState(!1),[U,J]=f.useState(""),[I,re]=f.useState(""),R=f.useRef(null),Y=f.useRef(!1),M=f.useRef(!1),[se,Q]=f.useState(null),[te,G]=f.useState(""),[Z,ie]=f.useState(""),[A,ge]=f.useState("active"),[je,ke]=f.useState(""),[Ie,$e]=f.useState(!1),[qe,ft]=f.useState(""),[be,Fe]=f.useState(!1),[_e,ze]=f.useState(""),[ue,Me]=f.useState([]),[pt,de]=f.useState(null),[fe,le]=f.useState([]),[Ke,We]=f.useState("all"),[vt,Zt]=f.useState("name"),[Ht,Tt]=f.useState("asc"),[Ot,Ft]=f.useState(!1),is=y.logoUrl??e.logoUrl??null,Cs=f.useRef(null),Ne=f.useMemo(()=>{const De=new Date,we=e.reminderDaysBefore||14;return[...l.filter(zt=>{if(Ke==="all")return!0;if(Ke==="active")return zt.status==="active";if(Ke==="cancelled")return zt.status==="cancelled";if(Ke==="expired")return zt.status==="expired"?!0:zt.status!=="active"||!zt.currentPeriodEnd||zt.neverExpires||zt.billingPeriodActive===!0?!1:zt.billingPeriodActive===!1?!0:new Date(zt.currentPeriodEnd)<De;if(zt.status!=="active"||!zt.currentPeriodEnd||zt.billingPeriodActive===!1)return!1;const K=new Date(zt.currentPeriodEnd),$=Math.ceil((K.getTime()-De.getTime())/(1e3*60*60*24));return Ke==="expiring_soon"?$<=we&&$>=0:!1})].sort((zt,K)=>{let $=0;if(vt==="name"){const pe=zt.name||zt.email,ye=K.name||K.email;$=pe.localeCompare(ye)}else vt==="email"?$=zt.email.localeCompare(K.email):vt==="date"&&($=new Date(zt.createdAt||0).getTime()-new Date(K.createdAt||0).getTime());return Ht==="desc"?-$:$})},[l,Ke,e.reminderDaysBefore,vt,Ht]);f.useEffect(()=>{const we=setTimeout(async()=>{if(!D.trim()){Y.current||W(""),M.current=!1;return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(D.trim())){M.current=!1;return}M.current=!0;try{const _t=await Pe("GET",`/api/clients/${encodeURIComponent(D.trim())}?instructorId=${e.instructorId}`);if(_t.ok){const zt=await _t.json();zt&&zt.name&&W(K=>!Y.current&&!K.trim()?zt.name:K)}}catch{}finally{M.current=!1}},500);return()=>clearTimeout(we)},[D,e.instructorId]),f.useEffect(()=>{u||(document.body.style.overflow="unset",C(""),T(""),j("editor")),p&&!u&&(C(p.title),T(p.content),j("editor"))},[u,p]),f.useEffect(()=>{(async()=>{try{const we=await Pe("GET",`/api/memberships/${e.id}/subscriptions`);if(we.ok){const ot=await we.json();c(ot);try{const _t=await Pe("GET","/api/clients");if(_t.ok){const zt=await _t.json();le(zt)}}catch(_t){console.error("Error fetching clients:",_t)}}}catch(we){console.error("Error fetching member subscriptions:",we)}})()},[e.id]);const rt=async()=>{if(!D.trim()){r({title:"Error",description:"Please enter an email address",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(D.trim())){r({title:"Error",description:"Please enter a valid email address",variant:"destructive"});return}if(!F.trim()){r({title:"Error",description:"Please enter a name for the member",variant:"destructive"});return}try{const we={email:D.trim(),name:F.trim()};we.neverExpires=_,q&&!_&&(we.currentPeriodEnd=y3(q)),U&&(we.tags=U),I.trim()&&(we.membershipNumber=I.trim());const ot=await Pe("POST",`/api/memberships/${e.id}/add-member`,we);if(ot.ok){const _t=await Pe("GET",`/api/memberships/${e.id}/subscriptions`);if(_t.ok){const zt=await _t.json();c(zt)}a.invalidateQueries({queryKey:["/api/clients"]}),a.invalidateQueries({queryKey:["/api/clients/tags"]}),r({title:"Success",description:"Member added successfully"}),O(!1),k(""),W(""),H(""),L(!1),J(""),re("")}else{const _t=await ot.json();throw new Error(_t.message||"Failed to add member")}}catch(we){console.error("Error adding member:",we),r({title:"Error",description:we.message||"Failed to add member. Please try again.",variant:"destructive"})}},ht=async()=>{if(!se)return;if(!te.trim()){r({title:"Error",description:"Please enter an email address",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(te.trim())){r({title:"Error",description:"Please enter a valid email address",variant:"destructive"});return}try{const we={email:te.trim(),name:Z.trim()||te.trim(),status:A};we.neverExpires=Ie,je&&!Ie&&(we.currentPeriodEnd=y3(je)),we.membershipNumber=qe.trim();const ot=await Pe("PUT",`/api/memberships/${e.id}/members/${se.id}`,we);if(ot.ok){const _t=await ot.json();c(zt=>zt.map(K=>K.id===se.id?{...K,..._t,paymentMethod:K.paymentMethod,totalPaid:K.totalPaid,billingPeriodActive:o1e({status:_t.status??K.status,neverExpires:_t.neverExpires??K.neverExpires,currentPeriodEnd:_t.currentPeriodEnd??K.currentPeriodEnd})}:K)),r({title:"Success",description:"Member updated successfully"}),Q(null),G(""),ie(""),ge("active"),ke(""),$e(!1),ft("")}else{const _t=await ot.json();throw new Error(_t.message||"Failed to update member")}}catch(we){console.error("Error updating member:",we),r({title:"Error",description:we.message||"Failed to update member. Please try again.",variant:"destructive"})}},Mt=De=>{if(Q(De),G(De.email),ie(De.name||De.email),ge(De.status),$e(De.neverExpires===!0),De.currentPeriodEnd){const we=new Date(De.currentPeriodEnd),ot=we.getUTCFullYear(),_t=String(we.getUTCMonth()+1).padStart(2,"0"),zt=String(we.getUTCDate()).padStart(2,"0");ke(`${ot}-${_t}-${zt}`)}else ke("");ft(De.membershipNumber||"")},Qt=()=>{if(Ne.length===0){r({title:"No members to export",description:"No members match the current filter.",variant:"destructive"});return}const De=ye=>ye==null?'""':`"${String(ye).replace(/"/g,'""')}"`,we=Ne.map(ye=>({Email:ye.email,Name:ye.name||"",Status:ye.status,"Joined Date":qw(ye.createdAt),"Expiry/Renewal Date":qw(ye.currentPeriodEnd),"Never Expires":ye.neverExpires?"Yes":"No",Tags:ye.tags||"","Payment Method":ye.paymentMethod||"","Total Paid":ye.totalPaid!=null?`${mt((i==null?void 0:i.currency)||"GBP")}${Number(ye.totalPaid).toFixed(2)}`:""})),ot=Object.keys(we[0]||{}),_t=[ot.map(De).join(","),...we.map(ye=>ot.map(Be=>De(ye[Be])).join(","))].join(`
715`),zt=new Blob([_t],{type:"text/csv"}),K=window.URL.createObjectURL(zt),$=document.createElement("a");$.href=K;const pe=Ke==="all"?"all":Ke.replace("_","-");$.download=`members-${pe}-${new Date().toISOString().split("T")[0]}.csv`,document.body.appendChild($),$.click(),document.body.removeChild($),window.URL.revokeObjectURL(K),r({title:"Export successful",description:`Exported ${Ne.length} members to CSV`})},ts=async()=>
715{if(!_e.trim()){r({title:"Error",description:"Please enter or upload member data",variant:"destructive"});return}const De=XS(_e);if(De.length===0){r({title:"Error",description:"No valid members found in the data",variant:"destructive"});return}const we=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,ot=De.filter(_t=>!_t.email||!we.test(_t.email));if(ot.length>0){r({title:"Error",description:`Found ${ot.length} invalid email(s). Please fix them before importing.`,variant:"destructive"});return}try{const _t=await Pe("POST",`/api/memberships/${e.id}/import-members`,{members:De});if(_t.ok){const zt=await _t.json();de(zt);const K=await Pe("GET",`/api/memberships/${e.id}/subscriptions`);if(K.ok){const $=await K.json();c($)}zt.failed===0?r({title:"Success",description:`Successfully imported ${zt.success} member(s)`}):r({title:"Partial Success",description:`Imported ${zt.success} member(s), ${zt.failed} failed`,variant:zt.success>0?"default":"destructive"})}else{const zt=await _t.json();throw new Error(zt.message||"Failed to import members")}}catch(_t){console.error("Error importing members:",_t),r({title:"Error",description:_t.message||"Failed to import members. Please try again.",variant:"destructive"})}},Js=De=>{var _t;const we=(_t=De.target.files)==null?void 0:_t[0];if(!we)return;const ot=new FileReader;ot.onload=zt=>{var pe;const K=(pe=zt.target)==null?void 0:pe.result;ze(K);const $=XS(K);Me($)},ot.readAsText(we)};f.useEffect(()=>{if(_e.trim()){const De=XS(_e);Me(De)}else Me([])},[_e]);const xn=async De=>{var Be;const we=De.stripeSubscriptionId||"",ot=we.startsWith("manual_")||we.startsWith("free_")||we.startsWith("onetime_"),_t=!!we&&!ot,zt=De.status==="active"&&(De.neverExpires===!0||De.currentPeriodEnd==null||new Date(De.currentPeriodEnd).getTime()>Date.now()),K=((Be=De.name)==null?void 0:Be.trim())||De.email,$=_t&&zt?`Delete ${K} from this membership?
716
717Warning: this is a Stripe subscription that may still be active until period end. Deleting here only removes local access in Classta and does not cancel Stripe billing.`:`Delete ${K} from this membership?`;if(!window.confirm($))return;const ye=_t&&zt;try{const Ze=ye?`/api/member-subscriptions/${De.id}?force=1`:`/api/member-subscriptions/${De.id}`,es=await Pe("DELETE",Ze);if(es.ok)c(Ns=>Ns.filter(ls=>ls.id!==De.id)),r({title:"Member Removed",description:"The member has been successfully removed from this membership."});else{const Ns=await es.json();throw new Error(Ns.message||"Failed to delete member")}}catch(Ze){console.error("Error deleting member:",Ze),r({title:"Error",description:Ze.message||"Failed to remove member. Please try again.",variant:"destructive"})}},Xs=async De=>{try{const we=await Pe("PUT",`/api/member-subscriptions/${De.id}/cancel`);if(we.ok){const ot=await Pe("GET",`/api/memberships/${e.id}/subscriptions`);if(ot.ok){const _t=await ot.json();c(_t)}r({title:"Subscription Cancelled",description:"The member's subscription has been cancelled successfully."})}else{const ot=await we.json();throw new Error(ot.message||"Failed to cancel subscription")}}catch(we){console.error("Error cancelling subscription:",we),r({title:"Error",description:we.message||"Failed to cancel subscription. Please try again.",variant:"destructive"})}},[nn,Vt]=f.useState(null),[Te,at]=f.useState(null),[ss,ps]=f.useState(!1),bs=async De=>{if(De.length!==0){ps(!0);try{const we=await Pe("POST",`/api/memberships/${e.id}/send-renewal-links`,{memberSubscriptionIds:De}),ot=await we.json();if(we.ok)r({title:"Reminders sent",description:ot.message||`Sent renewal link to ${ot.sent} member${ot.sent===1?"":"s"}`});else throw new Error(ot.message||"Failed to send reminders")}catch(we){r({title:"Error",description:we.message||"Failed to send reminders.",variant:"destructive"})}finally{ps(!1)}}},Ss=async De=>{Vt(De.id);try{const we=await Pe("POST",`/api/memberships/${e.id}/send-renewal-link`,{memberSubscriptionId:De.id});if(we.ok)r({title:"Renewal link sent",description:`Email with renewal link sent to ${De.email}`});else{const ot=await we.json();throw new Error(ot.message||"Failed to send renewal link")}}catch(we){r({title:"Error",description:we.message||"Failed to send renewal link.",variant:"destructive"})}finally{Vt(null)}},xs=async De=>{if(!De.publicId){r({title:"Error",description:"This member does not have a membership card ID yet.",variant:"destructive"});return}at(De.id);try{const we=await Pe("POST",`/api/memberships/${e.id}/send-membership-card`,{memberSubscriptionId:De.id});if(we.ok)r({title:"Membership card sent",description:`Email with membership card sent to ${De.email}`});else{const ot=await we.json();throw new Error(ot.message||"Failed to send membership card")}}catch(we){r({title:"Error",description:we.message||"Failed to send membership card.",variant:"destructive"})}finally{at(null)}};f.useEffect(()=>{(async()=>{try{const we=await Pe("GET",`/api/memberships/${e.id}/posts`);if(we.ok){const ot=await we.json();m(ot)}}catch(we){console.error("Error fetching membership posts:",we)}})()},[e.id]);const hs=async()=>{var zt;const De=JSON.parse(localStorage.getItem("instructorSession")||"{}"),we=JSON.parse(localStorage.getItem("admin_session")||"{}"),ot=De.token||((zt=we.instructor)==null?void 0:zt.token)||localStorage.getItem("auth_token"),_t={"Content-Type":"application/json"};ot&&(_t.Authorization=`Bearer ${ot}`);try{const K=await fetch(`/api/memberships/${e.id}`,{method:"PATCH",headers:_t,body:JSON.stringify(x),credentials:"include"});if(K.ok){const $=await K.json();g(pe=>({...pe,...$})),r({title:"Success",description:"Membership updated successfully"})}else{let $="Failed to update membership";try{const pe=await K.json();pe!=null&&pe.message&&typeof pe.message=="string"&&($=pe.message)}catch{}r({title:"Error",description:$,variant:"destructive"})}}catch(K){console.error("Error updating membership:",K);const $=K instanceof Error?K.message:"Failed to update membership";r({title:"Error",description:$,variant:"destructive"})}},gs=async De=>{var ot;const we=(ot=De.target.files)==null?void 0:ot[0];if(we){if(!we.type.startsWith("image/")){r({title:"Invalid file",description:"Please select an image file.",variant:"destructive"});return}Ft(!0);try{const _t=await Pe("POST","/api/objects/upload",{});if(!_t.ok)throw new Error("Failed to get upload URL");const{uploadURL:zt}=await _t.json();if(!(await fetch(zt,{method:"PUT",headers:{"Content-Type":we.type},body:we})).ok)throw new Error("Upload failed");const $=await Pe("PUT",`/api/memberships/${e.id}/logo`,{logoURL:zt});if(!$.ok)throw new Error("Failed to set logo");const{logoUrl:pe}=await $.json();g(ye=>({...ye,logoUrl:pe})),a.invalidateQueries({queryKey:["/api/memberships"]}
717),r({title:"Logo updated",description:"Membership logo will appear on printed cards."})}catch(_t){r({title:"Upload failed",description:(_t==null?void 0:_t.message)||"Please try again.",variant:"destructive"})}finally{Ft(!1),De.target.value=""}}},Os=async()=>{try{const De=await Pe("PATCH",`/api/memberships/${e.id}`,{logoUrl:null});if(!De.ok)throw new Error("Failed to remove logo");const we=await De.json();g(ot=>({...ot,logoUrl:null})),a.invalidateQueries({queryKey:["/api/memberships"]}),r({title:"Logo removed",description:"Instructor logo will be used on cards."})}catch(De){r({title:"Error",description:(De==null?void 0:De.message)||"Failed to remove logo.",variant:"destructive"})}},cs=async()=>{if(!N.trim()||!E.trim()){r({title:"Error",description:"Please fill in both title and content",variant:"destructive"});return}S(!0);try{const De=await Pe("POST",`/api/memberships/${e.id}/posts`,{title:N,content:E});if(De.ok){const we=await De.json();m(ot=>[we,...ot]),h(!1),C(""),T(""),r({title:"Success",description:"Post created successfully"})}else throw new Error("Failed to create post")}catch(De){console.error("Error creating post:",De),r({title:"Error",description:"Failed to create post",variant:"destructive"})}finally{S(!1)}},Tr=async()=>{if(!p||!N.trim()||!E.trim()){r({title:"Error",description:"Please fill in both title and content",variant:"destructive"});return}S(!0);try{const De=await Pe("PUT",`/api/memberships/${e.id}/posts/${p.id}`,{title:N,content:E});if(De.ok){const we=await De.json();m(ot=>ot.map(_t=>_t.id===p.id?we:_t)),v(null),C(""),T(""),r({title:"Success",description:"Post updated successfully"})}else throw new Error("Failed to update post")}catch(De){console.error("Error updating post:",De),r({title:"Error",description:"Failed to update post",variant:"destructive"})}finally{S(!1)}},rr=async De=>{try{if((await Pe("DELETE",`/api/memberships/${e.id}/posts/${De}`)).ok)m(ot=>ot.filter(_t=>_t.id!==De)),r({title:"Success",description:"Post deleted successfully"});else throw new Error("Failed to delete post")}catch(we){console.error("Error deleting post:",we),r({title:"Error",description:"Failed to delete post",variant:"destructive"})}},xe=async De=>{try{if((await Pe("POST",`/api/memberships/${e.id}/posts/${De}/send-email`)).ok)m(ot=>ot.map(_t=>_t.id===De?{..._t,emailSent:!0}:_t)),r({title:"Success",description:"Email sent to all members"});else throw new Error("Failed to send email")}catch(we){console.error("Error sending email:",we),r({title:"Error",description:"Failed to send email",variant:"destructive"})}},He=De=>{v(De),C(De.title),T(De.content),j("editor")},tt=De=>{if(!De)return"<p>No content yet...</p>";try{const we=JSON.parse(De);return Jt(we)}catch{return De}},Jt=De=>De.map(we=>{if(we.type==="paragraph")return`<p>${ds(we.children)}</p>`;if(we.type==="heading-one")return`<h1 class="text-2xl font-bold mb-2">${ds(we.children)}</h1>`;if(we.type==="heading-two")return`<h2 class="text-xl font-semibold mb-2">${ds(we.children)}</h2>`;if(we.type==="link"){const ot=ds(we.children);return`<a href="${we.url}" class="text-blue-600 underline" target="_blank" rel="noopener noreferrer">${ot}</a>`}else{if(we.type==="bulleted-list")return`<ul class="list-disc pl-5">${we.children.map(_t=>`<li>${ds(_t.children)}</li>`).join("")}</ul>`;if(we.type==="numbered-list")return`<ol class="list-decimal pl-5">${we.children.map(_t=>`<li>${ds(_t.children)}</li>`).join("")}</ol>`;if(we.type==="image"){const ot=we.width?`width="${we.width}"`:"",_t=`<img src="${we.url}" ${ot} style="max-width: 100%; height: auto;" alt="" />`;return we.linkUrl?`<a href="${we.linkUrl}" target="_blank" rel="noopener noreferrer">${_t}</a>`:_t}else if(we.type==="video")return`<iframe src="${we.url}" width="560" height="315" frameborder="0" allowfullscreen style="max-width: 100%;"></iframe>`}return""}).join(""),ds=De=>De.map(we=>{if(we.type==="link"){const ot=ds(we.children);return`<a href="${we.url}" class="text-blue-600 underline" target="_blank" rel="noopener noreferrer">${ot}</a>`}else{let ot=we.text||"";return we.bold&&(ot=`<strong>${ot}</strong>`),we.italic&&(ot=`<em>${ot}</em>
717`),we.underline&&(ot=`<u>${ot}</u>`),ot}}).join(""),zs=(De,we=150)=>De!=null&&De.trim()?e1e(De,we):"No content";return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold",children:y.name}),s.jsxs("p",{className:"text-gray-600 dark:text-gray-400",children:[mt((i==null?void 0:i.currency)||"GBP"),y.price,"/month"]})]}),s.jsx(B,{variant:"outline",onClick:t,children:"Close"})]}),s.jsxs(sc,{defaultValue:"overview",className:"space-y-4",children:[s.jsxs(Hi,{className:"grid w-full grid-cols-4",children:[s.jsxs(Ts,{value:"overview",className:"flex items-center gap-2",children:[s.jsx(ad,{className:"w-4 h-4"}),"Overview"]}),s.jsxs(Ts,{value:"members",className:"flex items-center gap-2",children:[s.jsx(sr,{className:"w-4 h-4"}),"Members"]}),s.jsxs(Ts,{value:"posts",className:"flex items-center gap-2",children:[s.jsx(ad,{className:"w-4 h-4"}),"Posts"]}),s.jsxs(Ts,{value:"settings",className:"flex items-center gap-2",children:[s.jsx(Dd,{className:"w-4 h-4"}),"Settings"]})]}),s.jsx(on,{value:"overview",className:"mt-0",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Total Members"})}),s.jsx(Ee,{children:s.jsx("div",{className:"text-3xl font-bold",children:l.length})})]}),s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Active Subscriptions"})}),s.jsx(Ee,{children:s.jsx("div",{className:"text-3xl font-bold",children:l.filter(De=>De.status==="active").length})})]}),s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Total Posts"})}),s.jsx(Ee,{children:s.jsx("div",{className:"text-3xl font-bold",children:d.length})})]})]})}),s.jsxs(on,{value:"members",className:"mt-0",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Manage Members"}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs(Ct,{open:be,onOpenChange:Fe,children:[s.jsx(Jr,{asChild:!0,children:s.jsxs(B,{variant:"outline",className:"hidden md:flex items-center gap-2",children:[s.jsx(ad,{className:"w-4 h-4"}),"Import Members"]})}),s.jsx(Jr,{asChild:!0,children:s.jsx(B,{variant:"outline",size:"sm",className:"md:hidden h-9 w-9 p-0",title:"Import Members",children:s.jsx(ad,{
717className:"w-4 h-4"})})}),s.jsxs(St,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Import Members"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"import-file",children:"Upload CSV or JSON file"}),s.jsx(me,{id:"import-file",type:"file",accept:".csv,.json,text/csv,application/json",onChange:Js,className:"mt-1"})]}),s.jsx("div",{className:"text-sm text-gray-500",children:"Or paste CSV/JSON data below:"}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"import-data",children:"Member Data"}),s.jsx("textarea",{id:"import-data",value:_e,onChange:De=>ze(De.target.value),placeholder:`CSV format:
718email,name,status,renewalDate,tags
719[email protected],John Doe,active,2025-12-31,poole
720[email protected],Jane Smith,active
721
722JSON format:
723[
724  { "email": "[email protected]", "name": "John Doe", "status": "active", "renewalDate": "2025-12-31", "tags": "poole" },
725  { "email": "[email protected]", "name": "Jane Smith", "status": "active" }
726]`,className:"flex min-h-[200px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
726ing-offset-background 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 font-mono text-xs"})]}),ue.length>0&&s.jsxs("div",{children:[s.jsxs(V,{children:["Preview (",ue.length," member(s))"]}),s.jsx("div",{className:"mt-2 border rounded-md p-3 max-h-48 overflow-y-auto",children:s.jsx("div",{className:"space-y-1 text-sm",children:ue.map((De,we)=>s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"font-medium",children:De.email}),De.name&&s.jsxs("span",{className:"text-gray-500",children:["(",De.name,")"]}),s.jsx(Je,{variant:"secondary",className:"text-xs",children:De.status||"active"}),De.neverExpires?s.jsx(Je,{variant:"outline",className:"text-xs",children:"Never expires"}):De.currentPeriodEnd&&s.jsxs("span",{className:"text-xs text-gray-500",children:["Expires: ",(()=>{const ot=PO(De.currentPeriodEnd);return ot?ot.toLocaleDateString("en-GB"):De.currentPeriodEnd})()]}),De.tags&&s.jsxs("span",{className:"text-xs text-gray-500",children:["Tags: ",De.tags]})]},we))})})]}),pt&&s.jsx("div",{className:"border rounded-md p-3",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"font-medium",children:"Import Results:"}),s.jsxs("div",{className:"text-sm",children:[s.jsxs("div",{className:"text-green-600",children:["✓ Success: ",pt.success]}),s.jsxs("div",{className:"text-red-600",children:["✗ Failed: ",pt.failed]})]}),pt.errors.length>0&&s.jsxs("div",{className:"mt-2",children:[s.jsx("div",{className:"text-sm font-medium",children:"Errors:"}),s.jsx("div",{className:"mt-1 space-y-1 text-xs max-h-32 overflow-y-auto",children:pt.errors.map((De,we)=>s.jsxs("div",{className:"text-red-600",children:[De.email,": ",De.error]},we))})]})]})}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(B,{variant:"outline",onClick:()=>{Fe(!1),ze(""),Me([]),de(null)},children:"Cancel"}),s.jsxs(B,{onClick:ts,disabled:ue.length===0,children:["Import ",ue.length>0?`${ue.length} `:"","Member(s)"]})]})]})]})]}),s.jsxs(Ct,{open:z,onOpenChange:De=>{O(De),De||(k(""),W(""),H(""),J(""),re(""))},children:[s.jsx(Jr,{asChild:!0,children:s.jsxs(B,{className:"hidden md:flex items-center gap-2",children:[s.jsx(Gs,{className:"w-4 h-4"}),"Add Member"]})}),s.jsx(Jr,{asChild:!0,children:s.jsx(B,{size:"sm",className:"md:hidden h-9 w-9 p-0",title:"Add Member",children:s.jsx(Gs,{className:"w-4 h-4"})})}),s.jsxs(St,{children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Add New Member"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"member-email",children:"Email *"}),s.jsx(me,{id:"member-email",type:"email",value:D,onChange:De=>k(De.target.value),placeholder:"[email protected]",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"member-name",children:"Name *"}),s.jsx(me,{ref:R,id:"member-name",value:F,onChange:De=>W(De.target.value),onFocus:()=>{Y.current=!0},onBlur:()=>{Y.current=!1},placeholder:"Member name",required:!0})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"member-never-expires",checked:_,onCheckedChange:De=>{L(De===!0),De===!0&&H("")}}),s.jsx(V,{htmlFor:"member-never-expires",className:"cursor-pointer",children:"Never expires"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"member-expiry",children:"Expiry/Renewal Date (optional)"}),s.jsx(me,{id:"member-expiry",type:"date",value:q,onChange:De=>H(De.target.value),placeholder:"Leave blank to use default",disabled:_}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:_?"Membership will never expire":"If not set, will be calculated based on membership billing frequency"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"member-tags",children:"Tags (optional)"}),s.jsx(wV,{value:U,onChange:J,placeholder:"Type tags separated by commas (e.g., club name, location)..."}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Tags help you group clients (e.g., by club or location). Previously used tags will appear as suggestions."})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"member-membership-number",children:"Membership number (optional)"}),s.jsx(me,{id:"member-membership-number",value:I,onChange:De=>re(De.target.value),placeholder:"Shown on the membership card",maxLength:40}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"If left blank, the card shows the auto-generated ID."})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(B,{variant:"outline",onClick:()=>O(!1),children:"Cancel"}),s.jsx(B,{onClick:rt,children:"Add Member"})]})]})]})]}),s.jsx(B,{variant:"outline",size:"sm",onClick:Qt,disabled:Ne.length===0,className:"shrink-0 h-9 w-9 p-0 md:h-auto md:px-3 md:py-2",title:"Export CSV",children:s.jsx(Li,{className:"w-4 h-4"})})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(B,{variant:Ke==="all"?"default":"outline",size:"sm",onClick:()=>We("all"),children:"All"}),s.jsx(B,{variant:Ke==="active"?"default":"outline",size:"sm",onClick:()=>We("active"),children:"Active"}),s.jsx(B,{variant:Ke==="expiring_soon"?"default":"outline",size:"sm",onClick:()=>We("expiring_soon"),children:"Expiring Soon"}),s.jsx(B,{variant:Ke==="expired"?"default":"outline",size:"sm",onClick:()=>We("expired"),children:"Expired"}),s.jsx(B,{variant:Ke==="cancelled"?"default":"outline",size:"sm",onClick:()=>We("cancelled"),children:"Cancelled"})]}),s.jsxs(Bt,{value:`${vt}-${Ht}`,onValueChange:De=>{const[we,ot]=De.split("-");Zt(we),Tt(ot)}
726,children:[s.jsx($t,{className:"w-48",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"name-asc",children:"Name (A-Z)"}),s.jsx(ce,{value:"name-desc",children:"Name (Z-A)"}),s.jsx(ce,{value:"email-asc",children:"Email (A-Z)"}),s.jsx(ce,{value:"email-desc",children:"Email (Z-A)"}),s.jsx(ce,{value:"date-desc",children:"Newest First"}),s.jsx(ce,{value:"date-asc",children:"Oldest First"})]})]})]}),(()=>{const De=Ne;return De.length===0?s.jsx(Ce,{children:s.jsx(Ee,{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No members found for this filter"})})}):s.jsxs("div",{className:"space-y-3",children:[Ke==="expired"&&De.length>0&&s.jsx("div",{className:"flex justify-end",children:s.jsx(B,{onClick:()=>bs(De.map(we=>we.id)),disabled:ss,children:ss?"Sending…":`Send Reminders (${De.length})`})}),De.map(we=>{const ot=fe.find(Be=>Be.email.toLowerCase()===we.email.toLowerCase()),_t=new Date;let zt=null,K=null,$=!1;const pe=h1(we.stripeSubscriptionId),ye=we.neverExpires===!0;if(!ye&&we.currentPeriodEnd&&we.status==="active"){const Be=new Date(we.currentPeriodEnd);if($=i1e(Be,_t),K=Math.ceil((Be.getTime()-_t.getTime())/(1e3*60*60*24)),we.billingPeriodActive===!1?!0:we.billingPeriodActive===!0?!1:Be<_t)zt="expired";else{const es=e.reminderDaysBefore||14;K<=es?zt="expiring_soon":zt="active"}}return s.jsxs(Ce,{className:`p-4 ${zt==="expired"?"border-red-300 bg-red-50 dark:bg-red-950/20":zt==="expiring_soon"?"border-orange-300 bg-orange-50 dark:bg-orange-950/20":""}`,children:[s.jsxs("div",{className:"hidden md:flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>{n&&ot&&n(ot.email)},children:[ot!=null&&ot.profilePictureUrl?s.jsx("div",{className:"h-12 w-8 flex-shrink-0 rounded overflow-hidden bg-gray-200",children:s.jsx("img",{src:ot.profilePictureUrl,alt:we.name||we.email,className:"w-full h-full object-cover"})}):s.jsx("div",{className:"h-12 w-8 flex-shrink-0 rounded bg-gray-200 flex items-center justify-center",children:s.jsx(Dr,{className:"h-5 w-5 text-gray-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"font-medium",children:we.name||we.email}),s.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:we.email}),we.membershipNumber&&s.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono",children:["No. ",we.membershipNumber]}),s.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Joined ",new Date(we.createdAt).toLocaleDateString(),!ye&&we.currentPeriodEnd&&s.jsx(s.Fragment,{children:zt==="expired"?s.jsxs(s.Fragment,{children:[" · Expired ",new Date(we.currentPeriodEnd).toLocaleDateString()]}):zt==="expiring_soon"&&K!==null?$?s.jsxs(s.Fragment,{children:[" · ",pe?"Renews":"Expires"," today"]}):s.jsxs(s.Fragment,{children:[" · ",pe?"Renews":"Expires"," in ",K," ",K===1?"day":"days"," (",new Date(we.currentPeriodEnd).toLocaleDateString(),")"]}):s.jsxs(s.Fragment,{children:[" · ",pe?"Renews":"Expires"," ",new Date(we.currentPeriodEnd).toLocaleDateString()]})}),we.lastPaidAt&&s.jsxs(s.Fragment,{children:[" · Paid ",new Date(we.lastPaidAt).toLocaleDateString()]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-3",onClick:Be=>Be.stopPropagation(),children:[zt==="expired"&&s.jsx(Je,{variant:"destructive",className:"mr-1",children:"Expired"}),zt==="expiring_soon"&&s.jsx(Je,{variant:"outline",className:"mr-1 border-orange-500 text-orange-700 dark:text-orange-400",children:pe&&we.status==="active"?"Renewing soon":"Expiring soon"}),zt!=="expired"&&s.jsx(Je,{variant:we.status==="active"?"default":we.status==="cancelled"?"destructive":"secondary",className:"capitalize",children:we.status}),we.paymentMethod==="Stripe"&&s.jsxs(Je,{variant:"outline",className:"border-purple-500 text-purple-700 dark:text-purple-400",children:["Stripe",we.totalPaid!=null&&we.totalPaid>0&&s.jsxs("span",{className:"ml-1",children:[mt((i==null?void 0:i.currency)||"GBP"),Number(we.totalPaid).toFixed(2)]})]}),we.stripeStatus&&we.stripeStatus!=="active"&&s.jsxs(Je,{variant:"outline",className:"border-amber-500 text-amber-800 dark:text-amber-400",children:["Stripe: ",we.stripeStatus]}),we.memberBenefitsEligible===!1&&s.jsx(Je,{variant:"destructive",title:we.ineligibleReason||void 0,children:"No member booking"}),s.jsx(B,{size:"sm",variant:"outline",onClick:Be=>{Be.stopPropagation();const Ze=we.publicId||we.id;window.open(`/admin/membership-card/${Ze}`,"_blank")},className:"p-2",title:"Print Membership Card",children:s.jsx(Q2,{className:"w-4 h-4"})}),s.jsx(B,{size:"sm",variant:"outline",onClick:Be=>{Be.stopPropagation(),xs(we)},disabled:Te===we.id||!we.publicId,className:"p-2",title:"Email membership card",children:s.jsx(_n,{className:"w-4 h-4"})}),s.jsx(B,{size:"sm",variant:"outline",onClick:Be=>{Be.stopPropagation(),Ss(we)},disabled:nn===we.id,className:"p-2",title:"Send renewal link",children:s.jsx(Nb,{className:"w-4 h-4"})}),s.jsx(B,{size:"sm",variant:"outline",onClick:Be=>{Be.stopPropagation(),Mt(we)},className:"p-2",title:"Edit Member",children:s.jsx(Ur,{className:"w-4 h-4"})}),we.status==="active"&&s.jsx(B,{size:"sm",variant:"outline",onClick:Be=>{Be.stopPropagation(),Xs(we)},className:"p-2 text-orange-600 hover:text-orange-700",title:"Cancel Subscription",children:s.jsx(Ux,{className:"w-4 h-4"})}),s.jsx(B,{size:"sm",variant:"outline",onClick:Be=>{Be.stopPropagation(),xn(we)},className:"p-2 text-red-600 hover:text-red-700",title:"Delete Member",children:s.jsx(ln,{className:"w-4 h-4"})})]})]}),s.jsxs("div",{className:"md:hidden space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>{n&&ot&&n(ot.email)},children:[ot!=null&&ot.profilePictureUrl?s.jsx("div",{className:"h-12 w-8 flex-shrink-0 rounded overflow-hidden bg-gray-200",children:s.jsx("img",{src:ot.profilePictureUrl,alt:we.name||we.email,className:"w-full h-full object-cover"})}):s.jsx("div",{className:"h-12 w-8 flex-shrink-0 rounded bg-gray-200 flex items-center justify-center",children:s.jsx(Dr,{className:"h-5 w-5 text-gray-600"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"font-medium truncate",children:we.name||we.email}),s.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate",children:we.email}),we.membershipNumber&&s.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono truncate",children:["No. ",we.membershipNumber]}
726),s.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 break-words",children:["Joined ",new Date(we.createdAt).toLocaleDateString(),!ye&&we.currentPeriodEnd&&s.jsx(s.Fragment,{children:zt==="expired"?s.jsxs(s.Fragment,{children:[" · Expired ",new Date(we.currentPeriodEnd).toLocaleDateString()]}):zt==="expiring_soon"&&K!==null?$?s.jsxs(s.Fragment,{children:[" · ",pe?"Renews":"Expires"," today"]}):s.jsxs(s.Fragment,{children:[" · ",pe?"Renews":"Expires"," in ",K," ",K===1?"day":"days"]}):s.jsxs(s.Fragment,{children:[" · ",pe?"Renews":"Expires"," ",new Date(we.currentPeriodEnd).toLocaleDateString()]})})]}),we.lastPaidAt&&s.jsxs("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300 mt-0.5",children:["Last paid ",new Date(we.lastPaidAt).toLocaleDateString()]})]}),s.jsxs("div",{className:"flex flex-col gap-1 items-end flex-shrink-0",children:[zt==="expired"&&s.jsx(Je,{variant:"destructive",className:"text-xs",children:"Expired"}),zt==="expiring_soon"&&s.jsx(Je,{variant:"outline",className:"text-xs border-orange-500 text-orange-700 dark:text-orange-400",children:pe&&we.status==="active"?"Renewing soon":"Expiring soon"}),zt!=="expired"&&s.jsx(Je,{variant:we.status==="active"?"default":we.status==="cancelled"?"destructive":"secondary",className:"capitalize flex-shrink-0 text-xs",children:we.status}),we.paymentMethod==="Stripe"&&s.jsxs(Je,{variant:"outline",className:"text-xs border-purple-500 text-purple-700 dark:text-purple-400",children:["Stripe",we.totalPaid!=null&&we.totalPaid>0&&s.jsxs("span",{className:"ml-1",children:[mt((i==null?void 0:i.currency)||"GBP"),Number(we.totalPaid).toFixed(2)]})]}),we.stripeStatus&&we.stripeStatus!=="active"&&s.jsxs(Je,{variant:"outline",className:"text-xs border-amber-500 text-amber-800 dark:text-amber-400",children:["Stripe: ",we.stripeStatus]}),we.memberBenefitsEligible===!1&&s.jsx(Je,{variant:"destructive",className:"text-xs",title:we.ineligibleReason||void 0,children:"No member booking"})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",onClick:Be=>Be.stopPropagation(),children:[s.jsx(B,{size:"sm",variant:"outline",onClick:Be=>{Be.stopPropagation();const Ze=we.publicId||we.id;window.open(`/admin/membership-card/${Ze}`,"_blank")},className:"p-2",title:"Print Membership Card",children:s.jsx(Q2,{className:"w-4 h-4"})}),s.jsx(B,{size:"sm",variant:"outline",onClick:Be=>{Be.stopPropagation(),xs(we)},disabled:Te===we.id||!we.publicId,className:"p-2",title:"Email membership card",children:s.jsx(_n,{className:"w-4 h-4"})}),s.jsx(B,{size:"sm",variant:"outline",onClick:Be=>{Be.stopPropagation(),Ss(we)},disabled:nn===we.id,className:"p-2",title:"Send renewal link",children:s.jsx(Nb,{className:"w-4 h-4"})}),s.jsx(B,{size:"sm",variant:"outline",onClick:Be=>{Be.stopPropagation(),Mt(we)},className:"p-2",title:"Edit Member",children:s.jsx(Ur,{className:"w-4 h-4"})}),we.status==="active"&&s.jsx(B,{size:"sm",variant:"outline",onClick:Be=>{Be.stopPropagation(),Xs(we)},className:"p-2 text-orange-600 hover:text-orange-700",title:"Cancel Subscription",children:s.jsx(Ux,{className:"w-4 h-4"})}),s.jsx(B,{size:"sm",variant:"outline",onClick:Be=>{Be.stopPropagation(),xn(we)},className:"p-2 text-red-600 hover:text-red-700",title:"Delete Member",children:s.jsx(ln,{className:"w-4 h-4"})})]})]})]},we.id)})]})})()]}),s.jsx(Ct,{open:!!se,onOpenChange:De=>{De||(Q(null),G(""),ie(""),ge("active"),ke(""),$e(!1),ft(""))},children:s.jsxs(St,{children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Edit Member"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-member-email",children:"Email *"}),s.jsx(me,{id:"edit-member-email",type:"email",value:te,onChange:De=>G(De.target.value),placeholder:"[email protected]",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-member-name",children:"Name"}),s.jsx(me,{id:"edit-member-name",value:Z,onChange:De=>ie(De.target.value),placeholder:"Member name"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-member-status",children:"Status"}),s.jsxs(Bt,{value:A,onValueChange:ge,children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"active",children:"Active"}),s.jsx(ce,{value:"cancelled",children:"Cancelled"}),s.jsx(ce,{value:"past_due",children:"Past Due"})]})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"edit-member-never-expires",checked:Ie,onCheckedChange:De=>{$e(De===!0),De===!0&&ke("")}}),s.jsx(V,{htmlFor:"edit-member-never-expires",className:"cursor-pointer",children:"Never expires"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-member-expiry",children:"Expiry/Renewal Date (optional)"}),s.jsx(me,{id:"edit-member-expiry",type:"date",value:je,onChange:De=>ke(De.target.value),placeholder:"Leave blank to use default",disabled:Ie}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:Ie?"Membership will never expire":"Update the expiry/renewal date for this member"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-member-membership-number",children:"Membership number (optional)"}),s.jsx(me,{id:"edit-member-membership-number",value:qe,onChange:De=>ft(De.target.value),placeholder:"Shown on the membership card",maxLength:40}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"If left blank, the card shows the auto-generated ID."})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(B,{variant:"outline",onClick:()=>Q(null),children:"Cancel"}),s.jsx(B,{onClick:ht,children:"Update Member"})]})]})]})})]}),s.jsx(on,{value:"posts",className:"mt-0",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Membership Posts"}),s.jsxs(Ct,{open:u,onOpenChange:h,children:[s.jsx(Jr,{asChild:!0,children:s.jsxs(B,{className:"flex items-center gap-2",children:[s.jsx(Gs,{className:"w-4 h-4"}),"New Post"]})}),s.jsxs(St,{className:"max-w-4xl top-3 bottom-24 translate-y-0 h-auto max-h-none overflow-hidden flex flex-col gap-3 p-4 min-w-0 sm:top-1/2 sm:bottom-auto sm:h-auto sm:max-h-[90dvh] sm:translate-y-[-50%]",children:[s.jsx(kt,{className:"flex-shrink-0",children:s.jsx(Pt,{children:"Create New Post"})}),s.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col gap-3 px-1 min-w-0",children:[s.jsxs("div",{className:"flex-shrink-0",children:[s.jsx(V,{htmlFor:"post-title",children:"Post Title"}),s.jsx(me,{id:"post-title",value:N,onChange:De=>C(De.target.value),placeholder:"Enter post title..."})]}),s.jsxs(sc,{value:w,onValueChange:j,className:"flex-1 min-h-0 flex flex-col",children:[s.jsxs(Hi,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[s.jsx(Ts,{value:"editor",children:"Editor"}),s.jsx(Ts,{value:"preview",children:"Preview"})]}),s.jsx(on,{value:"editor",className:"flex-1 min-h-0 mt-2 overflow-hidden data-[state=active]:flex data-[state=active]:flex-col",children:s.jsx("div",{className:"flex-1 min-h-0 min-w-0 max-w-full overflow-hidden",children:s.jsx(pE,{value:E,onChange:T,placeholder:"Write your post content here... You can add images and videos."})})}),s.jsx(on,{value:"preview",className:"flex-1 min-h-0 mt-2 overflow-hidden data-[state=active]:flex data-[state=active]:flex-col",children:s.jsxs("div",{className:"border rounded-lg p-4 flex-1 min-h-0 overflow-auto bg-white dark:bg-gray-900",children:[s.jsx("h3",{className:"text-xl font-bold mb-4",children:N||"Untitled Post"}),s.jsx("div",{className:"prose dark:prose-invert max-w-none",dangerouslySetInnerHTML:{__html:tt(E)}})]})})]})]}),s.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end gap-2 pt-3 border-t flex-shrink-0",children:[s.jsx(B,{variant:"outline",className:"w-full sm:w-auto",onClick:()=>h(!1),disabled:P,children:"Cancel"}),s.jsx(B,{className:"w-full sm:w-auto",onClick:cs,disabled:P,children:P?s.jsxs(s.Fragment,{children:[s.jsx(Qr,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):"Create Post"})]})]})]})]}),s.jsx(Ct,{open:!!p,onOpenChange:De=>!De&&v(null),children:s.jsxs(St,{className:"max-w-4xl top-3 bottom-24 translate-y-0 h-auto max-h-none overflow-hidden flex flex-col gap-3 p-4 min-w-0 sm:top-1/2 sm:bottom-auto sm:h-auto sm:max-h-[90dvh] sm:translate-y-[-50%]",children:[s.jsx(kt,{className:"flex-shrink-0",children:s.jsx(Pt,{children:"Edit Post"})}),s.jsxs("div",{className:"flex-1 min-h-0 min-w-0 overflow-hidden flex flex-col gap-3 px-1",children:[s.jsxs("div",{className:"flex-shrink-0",children:[s.jsx(V,{htmlFor:"edit-post-title",children:"Post Title"}),s.jsx(me,{id:"edit-post-title",value:N,onChange:De=>C(De.target.value),placeholder:"Enter post title..."})]}),s.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:s.jsxs(sc,{value:w,onValueChange:j,className:"flex-1 min-h-0 flex flex-col",children:[s.jsxs(Hi,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[s.jsx(Ts,{value:"editor",children:"Editor"}),s.jsx(Ts,{value:"preview",children:"Preview"})]}),s.jsx(on,{value:"editor",className:"flex-1 mt-2 min-h-0 min-w-0 overflow-hidden data-[state=active]:flex data-[state=active]:flex-col",children:s.jsx("div",{className:"flex-1 min-h-0 min-w-0 max-w-full overflow-hidden",children:s.jsx(pE,{value:E,onChange:T,placeholder:"Edit your post content here... You can add images and videos."})})}),s.jsx(on,{value:"preview",className:"flex-1 mt-2 min-h-0 overflow-hidden data-[state=active]:flex data-[state=active]:flex-col",children:s.jsxs("div",{className:"border rounded-lg p-4 flex-1 min-h-0 overflow-auto bg-white dark:bg-gray-900",children:[s.jsx("h3",{className:"text-xl font-bold mb-4",children:N||"Untitled Post"}),s.jsx("div",{className:"prose dark:prose-invert max-w-none",dangerouslySetInnerHTML:{__html:tt(E)}})]})})]})})]}),s.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end gap-2 pt-3 border-t flex-shrink-0",children:[s.jsx(B,{variant:"outline",className:"w-full sm:w-auto",onClick:()=>v(null),disabled:P,children:"Cancel"}),s.jsx(B,{className:"w-full sm:w-auto",onClick:Tr,disabled:P,children:P?s.jsxs(s.Fragment,{children:[s.jsx(Qr,{className:"h-4 w-4 animate-spin"}),"Updating..."]}):"Update Post"})]})]})}),d.length===0?s.jsx(Ce,{children:s.jsx(Ee,{className:"pt-6",children:s.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-center py-8",children:"No posts created yet. Create your first post to engage with your members!"})})}):s.jsx("div",{className:"space-y-4",children:d.map(De=>s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx(Nt,{className:"text-lg",children:De.title}),s.jsxs(Ys,{children:["Created ",new Date(De.createdAt).toLocaleDateString(),De.emailSent&&s.jsx(Je,{variant:"secondary",className:"ml-2",children:"Email Sent"})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(B,{variant:"outline",size:"sm",onClick:()=>He(De),children:s.jsx(Ur,{className:"w-4 h-4"})}),!De.emailSent&&s.jsx(B,{variant:"outline",size:"sm",onClick:()=>xe(De.id),children:s.jsx(Nb,{className:"w-4 h-4"})}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>rr(De.id),children:s.jsx(ln,{className:"w-4 h-4"})})]})]})}),s.jsx(Ee,{children:s.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:zs(De.content)})})]},De.id))})]})}),s.jsx(on,{value:"settings",className:"mt-0",children:s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Membership Settings"}),s.jsx(Ys,{children:"Update membership name and pricing"})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"membership-name",children:"Membership Name"}),s.jsx(me,{id:"membership-name",value:x.name,onChange:De=>b(we=>({...we,name:De.target.value})),placeholder:"Enter membership name..."})]}),s.jsxs("div",{children:[s.jsxs(V,{htmlFor:"membership-price",children:["Monthly Price (",mt((i==null?void 0:i.currency)||"GBP"),")"]}),s.jsx(me,{id:"membership-price",type:"number",step:"0.01",value:x.price,onChange:De=>b(we=>({...we,price:De.target.value})),placeholder:"Enter monthly price..."})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(V,{htmlFor:"membership-visible",children:"Show on my client page"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"When enabled, this membership will be visible on your booking page (/classes and /embed)"})]}),s.jsx(Rs,{id:"membership-visible",checked:x.visible,onCheckedChange:De=>b(we=>({...we,visible:De}))})]}),s.jsxs("div",{className:"border-t pt-4 space-y-3",children:[s.jsx(V,{children:"Membership logo"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Shown on the bottom right of printed membership cards. If not set, your instructor logo is used."}),s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[is?s.jsxs(s.Fragment,{children:[s.jsx("img",{src:is,alt:"Membership logo",className:"h-10 w-auto max-w-[80px] object-contain border rounded"}
726),s.jsx(B,{type:"button",variant:"outline",size:"sm",onClick:Os,disabled:Ot,children:"Remove logo"})]}):null,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{ref:Cs,type:"file",accept:"image/*",className:"hidden",onChange:gs}),s.jsx(B,{type:"button",variant:"outline",size:"sm",disabled:Ot,onClick:()=>{var De;return(De=Cs.current)==null?void 0:De.click()},children:Ot?"Uploading…":is?"Change logo":"Upload logo"})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between border-t pt-4",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(V,{htmlFor:"membership-show-card-in-portal",children:"Show membership card in client portal"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"When enabled, clients will see the membership ID and a link to view their membership card under My account → Memberships."})]}),s.jsx(Rs,{id:"membership-show-card-in-portal",checked:x.showCardInClientPortal,onCheckedChange:De=>b(we=>({...we,showCardInClientPortal:De}))})]}),s.jsx("div",{className:"border-t pt-4 space-y-4",children:s.jsxs("div",{children:[s.jsx(V,{children:"Private Membership Link"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Share this link to allow someone to purchase this membership even if it's hidden from your public page."}),i!=null&&i.subdomain&&(o!=null&&o.token)?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(me,{readOnly:!0,value:`${window.location.origin}/classes/${i.subdomain}/memberships?token=${o.token}`,className:"font-mono text-sm"}),s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>{const De=`${window.location.origin}/classes/${i.subdomain}/memberships?token=${o.token}`;navigator.clipboard.writeText(De),r({title:"Link copied",description:"Private membership link has been copied to clipboard."})},children:[s.jsx(pr,{className:"h-4 w-4 mr-2"}),"Copy Link"]})]}):s.jsx("p",{className:"text-sm text-muted-foreground",children:i!=null&&i.subdomain?"Generating private link token...":"Loading instructor information..."})]})}),s.jsx("div",{className:"flex justify-end",children:s.jsx(B,{onClick:hs,children:"Save Changes"})})]})]})})]})]})}function c1e(e,t){const n=t==="yearly"?"year":t==="weekly"?"week":"month";return e===1?`Every ${n}`:`Every ${e} ${n}s`}function d1e(e){return e.ignored?"ignore":e.membershipId?String(e.membershipId):"unset"}function u1e(){const{toast:e}=Yt(),t=jn(),[n,r]=f.useState({}),[a,i]=f.useState(!1),{data:o}=Ue({queryKey:["/api/gocardless/status"],queryFn:async()=>(await Pe("GET","/api/gocardless/status")).json()}),{data:l=[]}=Ue({queryKey:["/api/memberships"],queryFn:async()=>(await Pe("GET","/api/memberships")).json(),enabled:!!(o!=null&&o.connected)}),{data:c,isLoading:d,error:m,refetch:u}=Ue({queryKey:["/api/gocardless/groups"],queryFn:async()=>(await Pe("GET","/api/gocardless/groups")).json(),enabled:!!(o!=null&&o.connected)&&a}),h=(c==null?void 0:c.groups)||[];f.useEffect(()=>{const g={};for(const x of h)g[ZS(x)]=d1e(x);r(g)},[c]);const p=xt({mutationFn:async()=>{const g=h.map(b=>{const w=n[ZS(b)]||"unset";return{matchName:b.matchName,matchAmount:b.matchAmount,matchCurrency:b.matchCurrency,matchInterval:b.matchInterval,matchIntervalUnit:b.matchIntervalUnit,ignored:w==="ignore",membershipId:w!=="ignore"&&w!=="unset"?Number(w):null}});return await Pe("PUT","/api/gocardless/mappings",{mappings:g}),(await Pe("POST","/api/gocardless/sync")).json()},onSuccess:g=>{var b;t.invalidateQueries({queryKey:["/api/gocardless/status"]}),t.invalidateQueries({queryKey:["/api/member-subscriptions"]}),t.invalidateQueries({queryKey:["/api/gocardless/groups"]});const x=g.summary;e({title:"GoCardless sync finished",description:`${x.enrolled} added, ${x.updated} updated, ${x.cancelled} cancelled, ${((b=x.conflicts)==null?void 0:b.length)||0} need a look.`})},onError:g=>{e({title:"Sync failed",description:g.message,variant:"destructive"})}});if(!(o!=null&&o.connected))return null;const v=o.lastSyncSummary,y=h.reduce((g,x)=>g+x.count,0);return s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-4 space-y-4",children:[s.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 text-left",onClick:()=>i(g=>!g),children:[a?s.jsx(vi,{className:"h-4 w-4 shrink-0"}):s.jsx(Ji,{className:"h-4 w-4 shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h4",{className:"font-medium text-slate-900",children:"GoCardless subscriptions"}),s.jsxs("p",{className:"text-sm text-slate-500",children:[v?`Last sync: ${v.enrolled} added, ${v.updated} updated, ${v.cancelled} cancelled.`:"Match GoCardless prices to Classta memberships.",a&&y>0?` ${y} active subscriber${y===1?"":"s"}.`:""]})]})]}),a&&s.jsx("div",{className:"flex justify-end",children:s.jsx(B,{onClick:()=>p.mutate(),disabled:p.isPending||d,children:p.isPending?"Syncing…":"Save and sync"})}),a&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-sm text-slate-500",children:"Match each GoCardless price to a Classta membership. People already on another membership are left unchanged."}),((v==null?void 0:v.conflicts)||[]).slice(0,5).map(g=>s.jsxs("p",{className:"text-sm text-slate-600",children:[g.email||g.name||g.gocardlessSubscriptionId,": ",g.reason]},`${g.gocardlessSubscriptionId}-${g.reason}
726`)),((v==null?void 0:v.paymentFailures)||[]).slice(0,5).map(g=>s.jsxs("p",{className:"text-sm text-slate-600",children:["Payment failed",g.email?` for ${g.email}`:"",": ",g.description]},`${g.gocardlessSubscriptionId}-${g.at}`)),d&&s.jsx("p",{className:"text-sm text-slate-500",children:"Loading GoCardless subscriptions…"}),m&&s.jsxs("p",{className:"text-sm text-red-600",children:[m.message," ",s.jsx("button",{className:"underline",onClick:()=>u(),children:"Try again"})]}),h.length===0&&!d&&s.jsx("p",{className:"text-sm text-slate-500",children:"No active GoCardless subscriptions found."}),s.jsx("div",{className:"space-y-3",children:h.map(g=>{const x=ZS(g);return s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center gap-3 border rounded-lg p-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("p",{className:"font-medium text-slate-900",children:[g.matchName||"Untitled subscription"," · ",_h(g.matchAmount/100,g.matchCurrency)," · ",c1e(g.matchInterval,g.matchIntervalUnit)]}),s.jsxs("p",{className:"text-sm text-slate-500",children:[g.count," subscriber",g.count===1?"":"s"]})]}),s.jsxs(Bt,{value:n[x]||"unset",onValueChange:b=>r(w=>({...w,[x]:b})),children:[s.jsx($t,{className:"md:w-64",children:s.jsx(Lt,{placeholder:"Choose a membership"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"unset",children:"Don’t sync yet"}),s.jsx(ce,{value:"ignore",children:"Ignore"}),l.map(b=>s.jsx(ce,{value:String(b.id),children:b.name},b.id))]})]})]},x)})})]})]})})}function ZS(e){return[e.matchName,e.matchAmount,e.matchCurrency,e.matchInterval,e.matchIntervalUnit].join("|")}const nG=new Set(["never","1_month","1_quarter","1_year"]);function q0(e){const t=(e??"").trim();return nG.has(t)?t:"never"}function m1e(e){return e==="monthly"?"month":e==="four_weekly"?"4 weeks":e==="quarterly"?"quarter":e==="yearly"?"year":e||"month"}function h1e(e){return e==="week"?"week":e==="month"?"month":e==="quarter"?"quarter":e==="year"?"year":"billing period"}function f1e({instructorCurrency:e="GBP",onMemberClick:t}={}){const[n,r]=f.useState(!1),[a,i]=f.useState(null),[o,l]=f.useState(null),[c,d]=f.useState({name:"",description:"",price:"",billingType:"recurring",oneTimeExpiresAfter:"never",billingFrequency:"monthly",renewalDayOfMonth:"",proRateExistingSubscribers:!0,adjustExistingSubscribers:!1,usageLimit:"",usageLimitPeriod:"billing_period",quotaUseCalendarMonth:!1,requirePaidForCalendarMonth:!1,blockMemberBenefitsWhenPastDue:!1,quotaGraceDaysAfterMonthStart:"0",onboardingFormId:"",isActive:!0,sendRenewalReminders:!1,reminderDaysBefore:"14",visible:!0}),{toast:m}=Yt();f.useEffect(()=>{c.billingType==="one_time"&&(nG.has(c.oneTimeExpiresAfter)||d(C=>({...C,oneTimeExpiresAfter:"never"})))},[c.billingType,c.oneTimeExpiresAfter]);const{data:u=[],isLoading:h}=Ue({queryKey:["/api/memberships"],queryFn:async()=>(await Pe("GET","/api/memberships")).json()}),{data:p=[]}=Ue({queryKey:["/api/member-subscriptions"],queryFn:async()=>(await Pe("GET","/api/member-subscriptions")).json()}),{data:v=[]}=Ue({queryKey:["/api/onboarding-forms"],queryFn:async()=>(await Pe("GET","/api/onboarding-forms")).json()}),y=xt({mutationFn:C=>Pe("POST","/api/memberships",C),onSuccess:()=>{Ms.invalidateQueries({queryKey:["/api/memberships"]}),r(!1),b(),m({title:"Success",description:"Membership created successfully"})},onError:()=>{m({title:"Error",description:"Failed to create membership",variant:"destructive"})}}),g=xt({mutationFn:({id:C,data:P})=>Pe("PUT",`/api/memberships/${C}`,P),onSuccess:()=>{Ms.invalidateQueries({queryKey:["/api/memberships"]}),i(null),r(!1),b(),m({title:"Success",description:"Membership updated successfully"})},onError:C=>{const P=C instanceof Error?C.message:"Failed to update membership";m({title:"Error",description:P,variant:"destructive"})}}),x=xt({mutationFn:C=>Pe("DELETE",`/api/memberships/${C}`),onSuccess:()=>{Ms.invalidateQueries({queryKey:["/api/memberships"]}),m({title:"Success",description:"Membership deleted successfully"})},onError:C=>{m({title:"Error",description:C.message||"Failed to delete membership",variant:"destructive"})}}),b=()=>{d({name:"",description:"",price:"",billingType:"recurring",oneTimeExpiresAfter:"never",billingFrequency:"monthly",renewalDayOfMonth:"",proRateExistingSubscribers:!0,adjustExistingSubscribers:!1,usageLimit:"",usageLimitPeriod:"billing_period",quotaUseCalendarMonth:!1,requirePaidForCalendarMonth:!1,blockMemberBenefitsWhenPastDue:!1,quotaGraceDaysAfterMonthStart:"0",onboardingFormId:"",isActive:!0,sendRenewalReminders:!1,reminderDaysBefore:"14",visible:!0})},w=C=>{C.preventDefault();const P={name:c.name,description:c.description,price:parseFloat(c.price),billingType:c.billingType,oneTimeExpiresAfter:c.billingType==="one_time"?q0(c.oneTimeExpiresAfter):"never",billingFrequency:c.billingFrequency,renewalDayOfMonth:c.billingType==="recurring"&&c.billingFrequency!=="four_weekly"&&c.renewalDayOfMonth?parseInt(c.renewalDayOfMonth,10):null,usageLimit:c.usageLimit?parseInt(c.usageLimit):null,usageLimitPeriod:c.usageLimit?c.usageLimitPeriod:null,quotaUseCalendarMonth:c.quotaUseCalendarMonth,requirePaidForCalendarMonth:c.requirePaidForCalendarMonth,blockMemberBenefitsWhenPastDue:c.blockMemberBenefitsWhenPastDue,quotaGraceDaysAfterMonthStart:parseInt(c.quotaGraceDaysAfterMonthStart,10)||0,onboardingFormId:c.onboardingFormId&&c.onboardingFormId!=="none"?parseInt(c.onboardingFormId):null,isActive:c.isActive,sendRenewalReminders:c.send
726RenewalReminders,reminderDaysBefore:c.reminderDaysBefore?parseInt(c.reminderDaysBefore):14,visible:c.visible};c.billingType==="recurring"&&c.renewalDayOfMonth&&parseInt(c.renewalDayOfMonth,10)>=1&&(P.proRateExistingSubscribers=c.proRateExistingSubscribers,a&&(P.adjustExistingSubscribers=c.adjustExistingSubscribers)),a?g.mutate({id:a.id,data:P}):y.mutate(P)},j=C=>{r(!1),i(null),setTimeout(()=>{var P,S,E;i(C),d({name:C.name,description:C.description,price:C.price.toString(),billingType:C.billingType==="one_time"?"one_time":"recurring",oneTimeExpiresAfter:q0(C.oneTimeExpiresAfter),billingFrequency:C.billingFrequency,renewalDayOfMonth:C.renewalDayOfMonth!=null?String(C.renewalDayOfMonth):"",proRateExistingSubscribers:C.proRateExistingSubscribers??!0,adjustExistingSubscribers:!1,usageLimit:((P=C.usageLimit)==null?void 0:P.toString())||"",usageLimitPeriod:C.usageLimitPeriod||"month",quotaUseCalendarMonth:C.quotaUseCalendarMonth??!1,requirePaidForCalendarMonth:C.requirePaidForCalendarMonth??!1,blockMemberBenefitsWhenPastDue:C.blockMemberBenefitsWhenPastDue??!1,quotaGraceDaysAfterMonthStart:String(C.quotaGraceDaysAfterMonthStart??0),onboardingFormId:((S=C.onboardingFormId)==null?void 0:S.toString())||"none",isActive:C.isActive,sendRenewalReminders:C.sendRenewalReminders||!1,reminderDaysBefore:((E=C.reminderDaysBefore)==null?void 0:E.toString())||"14",visible:C.visible??!0}),r(!0)},100)},N=C=>p.filter(P=>P.membershipId===C&&P.status==="active").length;return o?s.jsx(l1e,{membership:o,onClose:()=>l(null),onMemberClick:t}):h?s.jsx("div",{className:"flex items-center justify-center p-8",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"})}):s.jsxs("div",{className:"space-y-6",children:[s.jsx(u1e,{}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Membership Management"}),s.jsx("p",{className:"text-muted-foreground",children:"Create recurring or one-time membership options for your clients"})]}),s.jsxs(B,{onClick:()=>{b(),r(!0)},className:"w-full sm:w-auto",children:[s.jsx(Gs,{className:"w-4 h-4 mr-2"}),"Create Membership"]}),s.jsx(Ct,{open:n,onOpenChange:C=>{r(C),C||(i(null),b())},children:s.jsxs(St,{className:"max-h-[90vh] overflow-y-auto w-[95vw] sm:w-full",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:a?"Edit Membership":"Create New Membership"}),s.jsx(yn,{children:"Set up a recurring subscription or a one-time purchase for your clients"})]}),s.jsx("div",{children:s.jsxs("form",{onSubmit:w,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"name",children:"Membership Name"}),s.jsx(me,{id:"name",value:c.name,onChange:C=>d({...c,name:C.target.value}),placeholder:"e.g., Premium Monthly",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"description",children:"Description"}),s.jsx(Is,{id:"description",value:c.description,onChange:C=>d({...c,description:C.target.value}),placeholder:"Describe what's included in this membership",rows:3})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"billingType",children:"Billing type"}),s.jsxs(Bt,{value:c.billingType,onValueChange:C=>d(P=>({...P,billingType:C,...C==="one_time"?{oneTimeExpiresAfter:q0(P.oneTimeExpiresAfter)}:{}})),children:[s.jsx($t,{id:"billingType",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"recurring",children:"Recurring subscription"}),s.jsx(ce,{value:"one_time",children:"One-time purchase"})]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Recurring charges repeat on your chosen schedule. One-time charges once per purchase."})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(V,{htmlFor:"price",children:["Price (",mt(e),")"]}),s.jsx(me,{id:"price",type:"number",step:"0.01",value:c.price,onChange:C=>d({...c,price:C.target.value}),placeholder:"0.00",required:!0})]}),c.billingType==="recurring"?s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"billingFrequency",children:"Billing"}),s.jsxs(Bt,{value:c.billingFrequency,onValueChange:C=>d({...c,billingFrequency:C,...C==="four_weekly"?{renewalDayOfMonth:"",adjustExistingSubscribers:!1}:{}}),children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"monthly",children:"Monthly"}),s.jsx(ce,{value:"four_weekly",children:"Every 4 weeks"}),s.jsx(ce,{value:"quarterly",children:"Quarterly"}),s.jsx(ce,{value:"yearly",children:"Yearly"})]})]})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"oneTimeExpiresAfter",children:"Expires after"}),s.jsxs(Bt,{value:q0(c.oneTimeExpiresAfter),onValueChange:C=>d({...c,oneTimeExpiresAfter:C}),required:!0,children:[s.jsx($t,{id:"oneTimeExpiresAfter",children:s.jsx(Lt,{placeholder:"Select when access ends"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"never",children:"Never"}),s.jsx(ce,{value:"1_month",children:"1 month"}),s.jsx(ce,{value:"1_quarter",children:"1 quarter (3 months)"}),s.jsx(ce,{value:"1_year",children:"1 year"})]})]})]})]}),c.billingType==="recurring"&&(c.billingFrequency==="monthly"||c.billingFrequency==="yearly"||c.billingFrequency==="quarterly")&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"renewalDayOfMonth",children:"Renew on day of month"}),s.jsxs(Bt,{value:c.renewalDayOfMonth||"off",onValueChange:C=>d({...c,renewalDayOfMonth:C==="off"?"":C}),children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"From signup"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"off",children:"From signup (e.g. 30/90/365 days later)"}),Array.from({length:31},(C,P)=>P+1).map(C=>s.jsx(ce,{value:String(C),children:C===31?"31st (or last day of month)":`${C}${C===1?"st":C===2?"nd":C===3?"rd":"th"}`},C))]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"e.g. 1 = 1st of every month."}),c.renewalDayOfMonth&&parseInt(c.renewalDayOfMonth,10)>=1&&s.jsxs("div",{className:"flex items-center justify-between rounded-md border p-3 mt-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(V,{htmlFor:"proRateExistingSubscribers",children:"Pro-rate first instalment"}),s.jsx("p",{className:"text-xs text-muted-foreground mr-2",children:"Switch ON to pro-rate the first instalment. Switch OFF to charge the full price."})]}),s.jsx(Rs,{id:"proRateExistingSubscribers",checked:c.proRateExistingSubscribers,onCheckedChange:C=>d({...c,proRateExistingSubscribers:C})})]}),a&&c.renewalDayOfMonth&&parseInt(c.renewalDayOfMonth,10)>=1&&N(a.id)>0&&(c.renewalDayOfMonth!==(a.renewalDayOfMonth!=null?String(a.renewalDayOfMonth):"")||c.proRateExistingSubscribers!==(a.proRateExistingSubscribers??!0))&&s.jsxs("div",{className:"flex items-center justify-between rounded-md border border-amber-200 bg-amber-50 p-3 mt-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(V,{htmlFor:"adjustExistingSubscribers",children:"Apply these changes to existing subscribers"}),s.jsxs("p",{className:"text-xs text-muted-foreground mr-2",children:["Update Stripe subscriptions for ",N(a.id)," current subscriber(s) to use the new renewal day and proration setting. If pro-ration is on existing customers may be credited 
726with unused time depending on the renewal day setting."]})]}),s.jsx(Rs,{id:"adjustExistingSubscribers",checked:c.adjustExistingSubscribers,onCheckedChange:C=>d({...c,adjustExistingSubscribers:C})})]})]}),s.jsx("div",{className:"border-t pt-4 space-y-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"usageLimit",children:"Limit Class Bookings (optional)"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Set a limit on how many classes a member can book using this membership per period. Leave empty for unlimited."}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[s.jsx("div",{children:s.jsx(me,{id:"usageLimit",type:"number",min:"1",value:c.usageLimit,onChange:C=>d({...c,usageLimit:C.target.value}),placeholder:"Number of classes"})}),s.jsx("div",{children:s.jsxs(Bt,{value:c.usageLimitPeriod,onValueChange:C=>d({...c,usageLimitPeriod:C}),disabled:!c.usageLimit,children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"billing_period",children:"Per Billing Period"}),s.jsx(ce,{value:"week",children:"Per Week"}),s.jsx(ce,{value:"month",children:"Per Month"}),s.jsx(ce,{value:"quarter",children:"Per Quarter"}),s.jsx(ce,{value:"year",children:"Per Year"})]})]})})]})]})}),s.jsxs("div",{className:"space-y-4 rounded-lg border p-4",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium",children:"Booking rules (optional)"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Defaults follow Stripe billing periods. Enable these for stricter calendar-month access (e.g. class allowance resets on the 1st)."})]}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsx(V,{htmlFor:"quotaUseCalendarMonth",className:"flex-1 cursor-pointer",children:"Always count class allowance by calendar month"}),s.jsx(Rs,{id:"quotaUseCalendarMonth",checked:c.quotaUseCalendarMonth,onCheckedChange:C=>d({...c,quotaUseCalendarMonth:C})})]}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsx(V,{htmlFor:"requirePaidForCalendarMonth",className:"flex-1 cursor-pointer",children:"Require successful payment before member booking (monthly: same calendar month as class; yearly/quarterly/4-weekly: current billing period)"}),s.jsx(Rs,{id:"requirePaidForCalendarMonth",checked:c.requirePaidForCalendarMonth,onCheckedChange:C=>d({...c,requirePaidForCalendarMonth:C})})]}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsx(V,{htmlFor:"blockMemberBenefitsWhenPastDue",className:"flex-1 cursor-pointer",children:"Block member booking when Stripe payment is past due"}),s.jsx(Rs,{id:"blockMemberBenefitsWhenPastDue",checked:c.blockMemberBenefitsWhenPastDue,onCheckedChange:C=>d({...c,blockMemberBenefitsWhenPastDue:C})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"quotaGraceDaysAfterMonthStart",children:"Grace days after month start (quota only)"}),s.jsx(me,{id:"quotaGraceDaysAfterMonthStart",type:"number",min:"0",max:"14",value:c.quotaGraceDaysAfterMonthStart,onChange:C=>d({...c,quotaGraceDaysAfterMonthStart:C.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"onboardingFormId",children:"Required Onboarding Form (optional)"}),s.jsxs("select",{value:c.onboardingFormId,onChange:C=>d({...c,onboardingFormId:C.target.value}),className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
726ing-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium 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",children:[s.jsx("option",{value:"none",children:"No form required"}),v.map(C=>s.jsx("option",{value:C.id.toString(),children:C.name},C.id))]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Forms available: ",v.length," | Current value: ",c.onboardingFormId]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(V,{htmlFor:"isActive",children:"Active"}),s.jsx(Rs,{id:"isActive",checked:c.isActive,onCheckedChange:C=>d({...c,isActive:C})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(V,{htmlFor:"visible",children:"Show on my client page"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"When enabled, this membership will be visible on your booking page (/classes and /embed)"})]}),s.jsx(Rs,{id:"visible",checked:c.visible,onCheckedChange:C=>d({...c,visible:C})})]}),s.jsxs("div",{className:"border-t pt-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(V,{htmlFor:"sendRenewalReminders",children:"Send renewal/expiry notifications"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Send email reminders to members before their subscription expires"})]}),s.jsx(Rs,{id:"sendRenewalReminders",checked:c.sendRenewalReminders,onCheckedChange:C=>d({...c,sendRenewalReminders:C})})]}),c.sendRenewalReminders&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"reminderDaysBefore",children:"Send reminder __ days before expiry"}),s.jsx(me,{id:"reminderDaysBefore",type:"number",min:"1",max:"90",value:c.reminderDaysBefore,onChange:C=>d({...c,reminderDaysBefore:C.target.value}),placeholder:"14"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Default: 14 days. Members will receive an email reminder this many days before their subscription expires."})]})]}),s.jsxs("div",{className:"flex gap-2 pt-4",children:[s.jsx(B,{type:"button",variant:"outline",onClick:()=>{r(!1),i(null),b()},className:"flex-1",children:"Cancel"}),s.jsx(B,{type:"submit",disabled:y.isPending||g.isPending,className:"flex-1",children:a?"Update":"Create"})]})]})})]})})]}),u.length===0?s.jsx(Ce,{children:s.jsxs(Ee,{className:"text-center py-8",children:[s.jsx(sr,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),s.jsx("h3",{className:"font-semibold mb-2",children:"No membership plans yet"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Create your first membership plan to start offering recurring subscriptions"}),s.jsxs(B,{onClick:()=>r(!0),children:[s.jsx(Gs,{className:"w-4 h-4 mr-2"}),"Create Your First Membership"]})]})}):s.jsx("div",{className:"grid gap-4",children:u.map(C=>s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs(Nt,{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[s.jsx("span",{children:C.name}),!C.isActive&&s.jsx(Je,{variant:"secondary",children:"Inactive"})]}),s.jsx(Ys,{className:"mt-1 whitespace-pre-line break-words",children:C.description})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[s.jsxs(B,{size:"sm",onClick:()=>l(C),className:"w-full sm:w-auto",children:[s.jsx(sr,{className:"w-4 h-4 mr-2"}),"Manage"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(B,{size:"sm",variant:"outline",onClick:()=>{j(C),r(!0)},className:"flex-1 sm:flex-none",children:[s.jsx(Ur,{className:"w-4 h-4"}),s.jsx("span",{className:"ml-1 sm:hidden",children:"Edit"})]}),s.jsxs(B,{size:"sm",variant:"outline",onClick:()=>x.mutate(C.id),disabled:x.isPending,className:"flex-1 sm:flex-none",children:[s.jsx(ln,{className:"w-4 h-4"}),s.jsx("span",{className:"ml-1 sm:hidden",children:"Delete"})]})]})]})]})}),s.jsx(Ee,{children:s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-2xl font-bold",children:[mt(e),typeof C.price=="string"?parseFloat(C.price).toFixed(2):C.price.toFixed(2),s.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:C.billingType==="one_time"?" one-time":`/${m1e(C.billingFrequency)}`})]}),C.billingType==="one_time"&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Expires:"," ",C.oneTimeExpiresAfter==="never"?"Never":C.oneTimeExpiresAfter==="1_month"?"After 1 month":C.oneTimeExpiresAfter==="1_quarter"?"After 1 quarter":C.oneTimeExpiresAfter==="1_year"?"After 1 year":C.oneTimeExpiresAfter]}),C.usageLimit&&s.jsxs("p",{className:"text-sm text-muted-foreground",children:[C.usageLimit," class booking",C.usageLimit!==1?"s":""," per ",h1e(C.usageLimitPeriod)]})]}),s.jsx("div",{className:"flex sm:flex-col sm:text-right",children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(sr,{className:"w-4 h-4 text-muted-foreground"}),s.jsx("span",{className:"font-semibold",children:N(C.id)}),s.jsx("span",{className:"text-sm text-muted-foreground ml-1",children:N(C.id)===1?"subscriber":"subscribers"})]})})]})})]},C.id))})]})}function p1e({classId:e,className:t}){const[n,r]=f.useState(null),[a,i]=f.useState(""),[o,l]=f.useState(!0),[c,d]=f.useState(""),[m,u]=f.useState(!1),{toast:h}=Yt(),p=jn(),{data:v,isLoading:y}=Ue({queryKey:["/api/classes",e,"upcoming-dates"],queryFn:async()=>(await Pe("GET",`/api/classes/${e}/upcoming-dates?limit=10`)).json()}),g=xt({mutationFn:async j=>(await Pe("POST",`/api/classes/${e}/move-date`,j)).json(),onSuccess:j=>{h({title:"Class Date Moved Successfully",description:`${j.affectedBookings} booking(s) updated${j.emailsSent?`. ${j.emailsSent} notification emails sent.`:""}`}),p.invalidateQueries({queryKey:["/api/classes",e,"upcoming-dates"]}),p.invalidateQueries({queryKey:["/api/bookings"]}),p.invalidateQueries({queryKey:["/api/admin/bookings"]}),p.invalidateQueries({queryKey:["/api/classes"]}
726),u(!1),r(null),i(""),d("")},onError:j=>{h({title:"Error Moving Class Date",description:j.message||"Failed to move class date",variant:"destructive"})}}),x=()=>{if(!n||!a){h({title:"Error",description:"Please select a new date",variant:"destructive"});return}if(a===n.originalDate){h({title:"Error",description:"New date must be different from the original date",variant:"destructive"});return}g.mutate({originalDate:n.originalDate,newDate:a,notifyClients:o,reason:c.trim()||void 0})},b=j=>{try{return Sr(Wx(j),"EEEE, MMMM d, yyyy")}catch{return j}},w=j=>j.originalDate!==j.effectiveDate?{status:"moved",label:"Moved",color:"text-orange-600 bg-orange-50"}:j.hasBookings?{status:"booked",label:"Booked",color:"text-green-600 bg-green-50"}:{status:"available",label:"Available",color:"text-blue-600 bg-blue-50"};return y?s.jsx(Ce,{children:s.jsx(Ee,{children:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"animate-spin w-6 h-6 border-2 border-primary border-t-transparent rounded-full"})})})}):s.jsx(Ce,{className:"w-full min-w-0 border-0 shadow-none",children:s.jsx(Ee,{className:"min-w-0 p-0 sm:p-4",children:!v||v.length===0?s.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No upcoming class dates found"}):s.jsx("div",{className:"space-y-3",children:v.map((j,N)=>{const C=w(j),P=j.originalDate===j.effectiveDate;return s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-2 sm:p-4 border rounded-lg hover:bg-gray-50 gap-3 sm:gap-2",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium text-sm sm:text-base",children:b(j.effectiveDate)}),!P&&s.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:["Originally: ",b(j.originalDate)]})]}),s.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-shrink-0 self-end sm:self-auto",children:[s.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${C.color}`,children:C.label}),j.hasBookings&&s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[s.jsx(sr,{className:"h-4 w-4"}),j.bookingCount]}),s.jsxs(Ct,{open:m&&(n==null?void 0:n.originalDate)===j.originalDate,onOpenChange:u,children:[s.jsx(Jr,{asChild:!0,children:s.jsxs(B,{variant:"outline",size:"sm",className:"max-w-fit sm:w-auto",onClick:()=>{r(j),i(""),d(""),u(!0)},children:[s.jsx(Y2,{className:"h-4 w-4 mr-2 sm:mr-2"}),"Move Date"]})}),s.jsxs(St,{children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Move Class Date"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{children:"Current Date"}),s.jsx("p",{className:"text-sm font-medium",children:n&&b(n.effectiveDate)}),n&&n.hasBookings&&s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx(cm,{className:"h-4 w-4 text-orange-500"}),s.jsxs("span",{className:"text-sm text-orange-600",children:[n.bookingCount," existing booking(s) will be moved"]})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"newDate",children:"New Date"}),s.jsx(me,{id:"newDate",type:"date",value:a,onChange:S=>i(S.target.value),min:new Date().toISOString().split("T")[0]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"reason",children:"Reason for Date Change (Optional)"}),s.jsx(Is,{id:"reason",placeholder:"Explain why you're moving this class date. This will be included in the notification emails to help your clients understand the change.",value:c,onChange:S=>d(S.target.value),rows:3,className:"mt-1"})]}),n&&n.hasBookings&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"notifyClients",checked:o,onCheckedChange:S=>l(S)}),s.jsx(V,{htmlFor:"notifyClients",className:"text-sm",children:"Send email notifications to affected clients"})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsxs(B,{variant:"outline",onClick:()=>{u(!1),r(null),i(""),d("")},children:[s.jsx(ja,{className:"h-4 w-4 mr-2"}),"Cancel"]}),s.jsxs(B,{onClick:x,disabled:!a||g.isPending,children:[s.jsx(bn,{className:"h-4 w-4 mr-2"}),g.isPending?"Moving...":"Move Date"]})]})]})]})]})]})]},N)})})})})}function x1e({termSingular:e,termPlural:t}){const[n,r]=f.useState(!1),[a,i]=f.useState("apple_mac"),[o,l]=f.useState(!1),{toast:c}=Yt(),{data:d,isLoading:m,error:u,refetch:h}=Ue({queryKey:["/api/calendar/uuid"],retry:1,staleTime:0,queryFn:async()=>{const g=localStorage.getItem("auth_token"),x=await fetch("/api/calendar/uuid",{headers:{Authorization:`Bearer ${g}`,"Content-Type":"application/json"}});if(!x.ok)throw new Error("Failed to fetch calendar UUID");return x.json()}}),p=d!=null&&d.calendarUuid?`${window.location.origin}/calendar/${d.calendarUuid}.ics`+(o?"?hideEmpty=true":""):"",v=async()=>{try{await navigator.clipboard.writeText(p),r(!0),c({title:"Copied!",description:"Calendar URL copied to clipboard"}),setTimeout(()=>r(!1),2e3)}catch{c({title:"Failed to copy",description:"Please copy the URL manually",variant:"destructive"})}},y=()=>{window.open(p,"_blank")};return m?s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ls,{className:"h-5 w-5 text-slate-400"}
726),s.jsx("span",{className:"text-slate-600",children:"Loading calendar sync..."})]})})}):u?s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2 text-red-600",children:[s.jsx(cm,{className:"h-5 w-5"}),s.jsx("span",{children:"Failed to load calendar sync"})]}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>h(),className:"text-red-600 border-red-600 hover:bg-red-50",children:"Retry"})]})})}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-blue-50 rounded-lg",children:[s.jsx(Ls,{className:"h-5 w-5 text-blue-600"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm font-medium text-blue-900",children:"Sync to Calendar"}),s.jsxs("p",{className:"text-xs text-blue-700",children:["Subscribe to this URL in your calendar app to automatically sync your ",e.toLowerCase()," schedule"]})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{checked:o,onCheckedChange:l}),s.jsx(V,{children:"Exclude unbooked classes"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:space-x-2 w-full",children:[s.jsx(me,{value:p,readOnly:!0,className:"mb-2 sm:mb-0 w-full sm:w-auto flex-1 bg-slate-50",placeholder:"Loading calendar URL..."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full sm:w-auto",children:[s.jsxs(B,{variant:"outline",size:"sm",onClick:v,className:"w-full sm:w-auto shrink-0",children:[s.jsx(pr,{className:"h-4 w-4 mr-1"}),n?"Copied!":"Copy"]}),s.jsxs(B,{variant:"outline",size:"sm",onClick:y,className:"w-full sm:w-auto shrink-0",children:[s.jsx(Lr,{className:"h-4 w-4 mr-1"}),"Open"]})]})]}),s.jsxs("div",{className:"text-xs text-slate-600 space-y-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium mb-2",children:"How to use:"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{children:"1. Copy the URL above"}),s.jsx("p",{children:"2. Select your calendar app below for specific instructions:"}),s.jsxs(Bt,{value:a,onValueChange:i,children:[s.jsx($t,{className:"w-48",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"apple_mac",children:"Apple Mac Calendar"}),s.jsx(ce,{value:"apple_iphone",children:"iPhone Calendar"}),s.jsx(ce,{value:"google",children:"Google Calendar"}),s.jsx(ce,{value:"other",children:"Other Calendars"})]})]})]})]}),s.jsxs("div",{className:"bg-slate-50 p-3 rounded-lg",children:[a==="apple_mac"&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"font-medium",children:"Apple Mac Calendar Instructions:"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-2",children:[s.jsx("li",{children:"Open Apple Calendar"}),s.jsxs("li",{children:["Click ",s.jsx("strong",{children:"File"})," →"," ",s.jsx("strong",{children:"New Calendar Subscription"})]}),s.jsx("li",{children:"Paste the calendar URL"}),s.jsxs("li",{children:["Click ",s.jsx("strong",{children:"Subscribe"})]}),s.jsxs("li",{children:["Choose update frequency and click ",s.jsx("strong",{children:"OK"})]})]})]}),a==="apple_iphone"&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"font-medium",children:"iPhone Calendar Instructions:"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-2",children:[s.jsxs("li",{children:["Open ",s.jsx("strong",{children:"Settings"})]}),s.jsxs("li",{children:["Find ",s.jsx("strong",{children:"Calendar"})]}),s.jsxs("li",{children:["Tap ",s.jsx("strong",{children:"Accounts"})]}),s.jsxs("li",{children:["Tap ",s.jsx("strong",{children:"Add Account"})]}),s.jsxs("li",{children:["Tap ",s.jsx("strong",{children:"Other"})]}),s.jsxs("li",{children:["Tap ",s.jsx("strong",{children:"Add Subscribed Calendar"})]}),s.jsx("li",{children:"Enter the calendar URL"}),s.jsxs("li",{children:["Tap ",s.jsx("strong",{children:"Next"})," and then ",s.jsx("strong",{children:"Save"})]})]})]}),a==="google"&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"font-medium",children:"Google Calendar Instructions:"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-2",children:[s.jsx("li",{children:"Open Google Calendar"}),s.jsxs("li",{children:["Click the ",s.jsx("strong",{children:"+"}),' button next to "Other calendars"']}),s.jsxs("li",{children:["Select ",s.jsx("strong",{children:"From URL"})]}),s.jsx("li",{children:"Paste the calendar URL"}),s.jsxs("li",{children:["Click ",s.jsx("strong",{children:"Add calendar"})]})]}),s.jsxs("p",{className:"text-xs text-slate-500 mt-2",children:[s.jsx("strong",{children:"Note:"})," This feature is not available on the Google Calendar mobile app. Please use the web interface at calendar.google.com"]})]}),a==="other"&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"font-medium",children:"General Instructions:"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-2",children:[s.jsx("li",{children:"Open your calendar app (Outlook, Thunderbird, etc.)"}),s.jsx("li",{children:'Look for "Add Calendar", "Subscribe to Calendar", or "Import Calendar" option'}),s.jsx("li",{children:'Choose "From URL" or "Subscribe" option'}),s.jsx("li",{children:"Paste the calendar URL"}),s.jsx("li",{children:"Save or subscribe to complete the setup"})]})]})]}),s.jsxs("p",{className:"text-slate-500",children:[s.jsx("strong",{children:"Note:"})," The calendar updates automatically when you make changes to your ",t.toLowerCase()," schedule. Some calendar apps may take a few minutes to refresh."]})]})]})]})}function g1e({service:e,instructorId:t,currency:n,onSuccess:r,onCancel:a}){const[i,o]=f.useState({name:"",description:"",instructorName:"",location:"",duration:60,gapBetweenSessions:15,price:"",onboardingFormId:null,isActive:!0,allowCashPayments:!1,excludedDates:"",customInfo:""}),[l,c]=f.useState([]),[d,m]=f.useState(!1),[u,h]=f.useState(!1),[p,v]=f.useState(""),[y,g]=f.useState(!1),[x,b]=f.useState([]),[w,j]=f.useState([]),[N,C]=f.useState({hoursBeforeClass:24,sendEmail:!0,sendSms:!1}),{toast:P}=Yt(),S=R=>
726{if(R<24)return`${R} hour${R===1?"":"s"} before`;const Y=Math.floor(R/24),M=R%24;return M===0?`${Y} day${Y===1?"":"s"} before`:`${Y} day${Y===1?"":"s"} ${M} hour${M===1?"":"s"} before`},{data:E}=Ue({queryKey:["instructor-names",t],queryFn:async()=>(await Pe("GET","/api/services/instructor-names")).json(),enabled:!!t});let T=[];E!=null&&E.names?T=E.names:Array.isArray(E)&&(T=E.map(R=>R.instructorName).filter(Boolean));const z=[...new Set(T.map(R=>R.toLowerCase()))].map(R=>T.find(Y=>Y.toLowerCase()===R)).filter(Boolean),{data:O=[]}=Ue({queryKey:["/api/memberships"],enabled:!!t}),{data:D}=Ue({queryKey:[`/api/services/${e==null?void 0:e.id}/memberships`],enabled:!!(e!=null&&e.id)});f.useEffect(()=>{if(D!==void 0)if(Array.isArray(D)&&D.length>0){const R=D.map(Y=>({id:Y.membershipId,memberPrice:Y.memberPrice||""}));b(R)}else b([])},[D]),f.useEffect(()=>{var R;if(e){o({name:e.name||"",description:e.description||"",instructorName:e.instructorName||"",location:e.location||"",duration:e.duration||60,gapBetweenSessions:e.gapBetweenSessions??15,price:((R=e.price)==null?void 0:R.toString())||"",onboardingFormId:e.onboardingFormId,isActive:e.isActive??!0,allowCashPayments:e.allowCashPayments||!1,excludedDates:e.excludedDates||"",customInfo:e.customInfo||""});try{const Y=JSON.parse(e.availabilitySchedule);c(Array.isArray(Y)?Y:[])}catch{c([])}}},[e]),f.useEffect(()=>{!e&&z.length===1&&!i.instructorName&&o(R=>({...R,instructorName:z[0]}))},[e,z,i.instructorName]),f.useEffect(()=>{if(!(e!=null&&e.id)){j([]);return}let R=!1;return(async()=>{try{const Y=await Pe("GET",`/api/services/service/${e.id}/reminders`);if(!Y.ok)return;const M=await Y.json();!R&&Array.isArray(M)&&j(M)}catch{R||j([])}})(),()=>{R=!0}},[e==null?void 0:e.id]);const k=xt({mutationFn:async R=>{const Y=e?`/api/services/${e.id}`:"/api/services";return(await Pe(e?"PUT":"POST",Y,R)).json()},onSuccess:()=>{P({title:"Success",description:e?"Service updated successfully":"Service created successfully"}),r()},onError:R=>{P({title:"Error",description:R.message||"Failed to save service",variant:"destructive"})}}),F=async R=>{R.preventDefault(),m(!0);try{const Y={...i,instructorId:t,availabilitySchedule:JSON.stringify(l),price:parseFloat(i.price)},se=(await k.mutateAsync(Y)).id;console.log(`🔗 Frontend: Updating memberships for service ${se}:`,x);try{const Q=await Pe("PUT",`/api/services/${se}/memberships`,{memberships:x});if(!Q.ok){const te=await Q.json();throw new Error(te.message||"Failed to update memberships")}console.log(`✅ Successfully updated memberships for service ${se}`)}catch(Q){console.error("❌ Error updating memberships:",Q),P({title:"Warning",description:"Service saved but membership associations may not have been updated",variant:"destructive"})}}catch{}finally{m(!1)}},W=()=>{c([...l,{day:1,startTime:"09:00",endTime:"17:00"}])},q=R=>{c(l.filter((Y,M)=>M!==R))},H=(R,Y,M)=>{const se=[...l];se[R]={...se[R],[Y]:M},c(se)},_=async()=>{if(!i.description.trim()){P({title:"Nothing to polish",description:"Please enter a description first",variant:"destructive"});return}v(i.description),h(!0);try{const Y=await(await Pe("POST","/api/polish-text",{text:i.description,type:"service_description"})).json();o(M=>({...M,description:Y.polishedText})),P({title:"Text polished successfully",description:"Your service description has been improved with AI"})}catch{P({title:"Polish failed",description:"Unable to polish text at this time",variant:"destructive"})}finally{h(!1)}},L=()=>{p&&(o(R=>({...R,description:p})),v(""),P({title:"Text restored",description:"Original text has been restored"}))},U=async()=>{if(e!=null&&e.id){if(!N.sendEmail&&!N.sendSms){P({title:"Choose delivery",description:"Enable email and/or SMS for this reminder.",variant:"destructive"});return}try{const R=await Pe("POST",`/api/services/service/${e.id}/reminders`,{hoursBeforeClass:N.hoursBeforeClass,sendEmail:N.sendEmail,sendSms:N.sendSms});if(!R.ok){const M=await R.json().catch(()=>({}));throw new Error(M.message||"Failed to add reminder")}const Y=await R.json();j(M=>[...M,Y]),C({hoursBeforeClass:24,sendEmail:!0,sendSms:!1}),P({title:"Reminder added"})}catch(R){P({title:"Error",description:R.message||"Failed to add reminder",variant:"destructive"})}}},J=async(R,Y,M)=>{const se=w.find(te=>te.id===R);if(!se)return;const Q={...se,[Y]:M};try{const te=await Pe("PUT",`/api/services/service-reminders/${R}`,{hoursBeforeClass:Q.hoursBeforeClass,sendEmail:Q.sendEmail,sendSms:Q.sendSms});if(!te.ok)throw new Error("Update failed");const G=await te.json();j(Z=>Z.map(ie=>ie.id===R?G:ie))}catch{P({title:"Error",description:"Failed to update reminder",variant:"destructive"})}},I=async R=>{try{if(!(await Pe("DELETE",`/api/services/service-reminders/${R}`)).ok)throw new Error("Delete failed");j(M=>M.filter(se=>
726se.id!==R)),P({title:"Reminder removed"})}catch{P({title:"Error",description:"Failed to remove reminder",variant:"destructive"})}},re=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:2,label:"Tuesday"},{value:3,label:"Wednesday"},{value:4,label:"Thursday"},{value:5,label:"Friday"},{value:6,label:"Saturday"}];return s.jsxs("form",{onSubmit:F,className:"space-y-4 sm:space-y-6",children:[s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Basic Information"})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"name",children:"Service Name *"}),s.jsx(me,{id:"name",value:i.name,onChange:R=>o({...i,name:R.target.value}),placeholder:"e.g., Sports Therapy",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"instructorName",children:"Instructor Name *"}),s.jsxs("div",{className:"relative",children:[s.jsx(me,{id:"instructorName",value:i.instructorName,onChange:R=>o({...i,instructorName:R.target.value}),onFocus:()=>g(!0),onBlur:()=>setTimeout(()=>g(!1),150),placeholder:"Your name",required:!0}),y&&z.length>0&&s.jsxs("div",{className:"absolute z-10 w-full mt-1 bg-white border border-gray-300 rounded-md shadow-lg max-h-32 overflow-y-auto",children:[z.filter(R=>R.toLowerCase().includes(i.instructorName.toLowerCase())).map((R,Y)=>s.jsx("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-100 focus:bg-gray-100 focus:outline-none",onClick:()=>{o({...i,instructorName:R}),g(!1)},children:R},Y)),z.filter(R=>R.toLowerCase().includes(i.instructorName.toLowerCase())).length===0&&s.jsx("div",{className:"px-3 py-2 text-sm text-gray-500",children:"No matching suggestions"})]})]}),z.length>0&&s.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:["Previously used: ",z.join(", ")]})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"description",children:"Description"}),s.jsx(Is,{id:"description",value:i.description,onChange:R=>o({...i,description:R.target.value}),placeholder:"Describe your service...",rows:3}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsxs(B,{type:"button",variant:"outline",size:"sm",onClick:_,disabled:u||!i.description.trim(),className:"text-xs",children:[s.jsx(lr,{className:"w-3 h-3 mr-1"}),u?"Polishing...":"Polish this with AI"]}),p&&s.jsxs(B,{type:"button",variant:"ghost",size:"sm",onClick:L,className:"text-xs text-muted-foreground",children:[s.jsx(dm,{className:"w-3 h-3 mr-1"}),"Undo"]})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"location",children:"Location"}),s.jsx(me,{id:"location",value:i.location,onChange:R=>o({...i,location:R.target.value}),placeholder:"e.g., Studio 1, Townville"})]})]})]}),s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Service Details"})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"duration",children:"Duration (minutes) *"}),s.jsx(me,{id:"duration",type:"number",value:i.duration,onChange:R=>o({...i,duration:parseInt(R.target.value)||60}),min:"15",step:"15",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"gapBetweenSessions",children:"Gap Between Sessions (minutes)"}),s.jsx(me,{id:"gapBetweenSessions",type:"number",value:i.gapBetweenSessions,onChange:R=>{const Y=parseInt(R.target.value,10),M=R.target.value===""||Number.isNaN(Y)?15:Math.max(0,Y);o({...i,gapBetweenSessions:M})},min:0,step:1})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"price",children:"Price *"}),s.jsxs("div",{className:"relative",children:[s.jsx("span",{className:"absolute left-3 top-3 text-slate-500",children:mt(n)}),s.jsx(me,{id:"price",type:"number",value:i.price,onChange:R=>o({...i,price:R.target.value}),placeholder:"40.00",step:"0.01",min:"0",className:"pl-8",required:!0})]})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{id:"isActive",checked:i.isActive,onCheckedChange:R=>o({...i,isActive:R})}),s.jsx(V,{htmlFor:"isActive",children:"Service is active and available for booking"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{id:"allowCashPayments",checked:i.allowCashPayments,onCheckedChange:R=>o({...i,allowCashPayments:R})}),s.jsx(V,{htmlFor:"allowCashPayments",children:"Allow cash payments"})]})]})]}),s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Custom information"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Optional text included in booking confirmation emails and client reminder emails for this service."})]}),s.jsxs(Ee,{className:"space-y-2",children:[s.jsx(V,{htmlFor:"serviceCustomInfo",children:"Custom instructions"}),s.jsx(Is,{id:"serviceCustomInfo",value:i.customInfo,onChange:R=>o({...i,customInfo:R.target.value}),placeholder:"e.g. directions, parking, what to bring, video call link",className:"min-h-[96px]"}),s.jsxs("p",{className:"text-xs text-slate-500",children:["You can use tokens like"," ",s.jsx("code",{className:"text-[11px]",children:"{{booking_id}}"}),","," ",s.jsx("code",{className:"text-[11px]",children:"{{booking_date}}"}),","," ",s.jsx("code",{className:"text-[11px]",children:"{{amount}}"}),","," ",s.jsx("code",{className:"text-[11px]",children:"{{class_name}}"})," or"," ",s.jsx("code",{className:"text-[11px]",children:"{{service_name}}"}),","," ",s.jsx("code",{className:"text-[11px]",children:"{{client_name}}"}),","," ",s.jsx("code",{className:"text-[11px]",children:"{{client_firstname}}"}),","," ",s.jsx("code",{className:"text-[11px]",children:"{{client_email}}"}),"."]})]})]}),e!=null&&e.id?s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Reminders"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Automatic email or SMS reminders before each booked appointment. Custom instructions above are included in these reminder emails when set."})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Af,{className:"h-5 w-5 text-blue-600"}),s.jsx("h3",{className:"font-medium",children:"Client reminders"})]}),w.length===0&&s.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-800",children:[s.jsx("strong",{children:"No reminders are set for this service."})," Clients will not receive reminder emails or SMS until you add at least one below."]}),w.length>0&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("h4",{className:"text-sm font-medium text-slate-700",children:"Active reminders"}),w.map(R=>s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 p-3 bg-white border rounded-lg",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Af,{className:"h-4 w-4 text-blue-500 shrink-0"}),s.jsx("span",{className:"font-medium text-slate-900",children:S(R.hoursBeforeClass)})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Xt,{id:`svc-email-${R.id}`,checked:!!R.sendEmail,onCheckedChange:Y=>J(R.id,"sendEmail",!!Y)}),s.jsxs("label",{htmlFor:`svc-email-${R.id}`,className:"text-sm cursor-pointer flex items-center gap-1",children:[s.jsx(_n,{className:"h-3 w-3"}),"Email"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Xt,{id:`svc-sms-${R.id}`,checked:!!R.sendSms,onCheckedChange:Y=>J(R.id,"sendSms",!!Y)}),s.jsxs("label",{htmlFor:`svc-sms-${R.id}`,className:"text-sm cursor-pointer flex items-center gap-1",children:[s.jsx(fw,{className:"h-3 w-3"}),"SMS"]})]})]})]}
726),s.jsx(B,{type:"button",variant:"ghost",size:"sm",onClick:()=>I(R.id),className:"text-red-600 hover:text-red-700 hover:bg-red-50 self-start sm:self-auto",children:s.jsx(ln,{className:"h-4 w-4"})})]},R.id))]}),s.jsxs("div",{className:`border-t pt-4 ${w.length===0?"rounded-lg border-2 border-dashed border-slate-300 bg-slate-50/50 p-4 -mx-1":""}`,children:[s.jsx("h4",{className:"text-sm font-medium text-slate-700 mb-3",children:w.length===0?"Add your first reminder":"Add another reminder"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{children:"Send reminder"}),s.jsxs(Bt,{value:N.hoursBeforeClass.toString(),onValueChange:R=>C(Y=>({...Y,hoursBeforeClass:parseInt(R,10)})),children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"1",children:"1 hour before"}),s.jsx(ce,{value:"2",children:"2 hours before"}),s.jsx(ce,{value:"4",children:"4 hours before"}),s.jsx(ce,{value:"6",children:"6 hours before"}),s.jsx(ce,{value:"12",children:"12 hours before"}),s.jsx(ce,{value:"24",children:"1 day before"}),s.jsx(ce,{value:"48",children:"2 days before"}),s.jsx(ce,{value:"72",children:"3 days before"}),s.jsx(ce,{value:"168",children:"1 week before"})]})]})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Delivery"}),s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"svcNewEmail",checked:N.sendEmail,onCheckedChange:R=>C(Y=>({...Y,sendEmail:R}))}),s.jsxs(V,{htmlFor:"svcNewEmail",className:"text-sm flex items-center gap-1",children:[s.jsx(_n,{className:"h-3 w-3"}),"Email"]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:"svcNewSms",checked:N.sendSms,onCheckedChange:R=>C(Y=>({...Y,sendSms:R}))}),s.jsxs(V,{htmlFor:"svcNewSms",className:"text-sm flex items-center gap-1",children:[s.jsx(fw,{className:"h-3 w-3"}),"SMS"]})]})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsx(B,{type:"button",onClick:U,disabled:!N.sendEmail&&!N.sendSms,className:"w-full",children:"Add reminder"})})]})]})]})]}):null,s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Availability Schedule"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Define when you're available for this service"})]}),s.jsxs(Ee,{className:"space-y-4",children:[l.length===0?s.jsxs("div",{className:"text-center py-8 text-slate-500",children:[s.jsx(ei,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),s.jsx("p",{children:"No availability set"}),s.jsx("p",{className:"text-sm",children:"Add time slots when you're available for this service"})]}):s.jsx("div",{className:"space-y-3",children:l.map((R,Y)=>s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 p-3 border rounded-lg",children:[s.jsxs(Bt,{value:R.day.toString(),onValueChange:M=>H(Y,"day",parseInt(M)),children:[s.jsx($t,{className:"w-full sm:w-32",children:s.jsx(Lt,{})}),s.jsx(It,{children:re.map(M=>s.jsx(ce,{value:M.value.toString(),children:M.label},M.value))})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx(me,{type:"time",value:R.startTime,onChange:M=>H(Y,"startTime",M.target.value),className:"flex-1 sm:w-24"}),s.jsx("span",{className:"text-slate-500 text-sm whitespace-nowrap",children:"to"}),s.jsx(me,{type:"time",value:R.endTime,onChange:M=>H(Y,"endTime",M.target.value),className:"flex-1 sm:w-24"})]}),s.jsx(B,{type:"button",variant:"ghost",size:"sm",onClick:()=>q(Y),className:"text-red-600 hover:text-red-700 self-start sm:self-auto",children:s.jsx(ln,{className:"h-4 w-4"})})]},Y))}),s.jsxs(B,{type:"button",variant:"outline",onClick:W,className:"w-full",children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Add Time Slot"]})]})]}),s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Excluded Dates"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Dates when this service is not available (one date per line)"})]}),s.jsx(Ee,{children:s.jsx(Is,{value:i.excludedDates,onChange:R=>o({...i,excludedDates:R.target.value}),placeholder:`2024-12-25
7272024-12-26
7282025-01-01`,rows:4})})]}),s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Membership Access"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Select which memberships can access this service and set special pricing"})]}),s.jsx(Ee,{className:"space-y-4",children:s.jsx("div",{className:"space-y-3",children:O&&O.length>0?s.jsxs("div",{className:"space-y-3",children:[s.jsx(V,{className:"text-sm text-slate-600",children:"Select which memberships can access this service and set special pricing:"}),O.map(R=>{const Y=x.find(se=>se.id===R.id),M=!!Y;return s.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:`membership-${R.id}`,checked:M,onCheckedChange:se=>{b(se?Q=>[...Q,{id:R.id,memberPrice:""}]:Q=>Q.filter(te=>te.id!==R.id))}}),s.jsx(V,{htmlFor:`membership-${R.id}`,className:"text-sm font-medium",children:R.name}),s.jsxs("span",{className:"text-xs text-slate-500",children:["(",mt(n),R.price,"/",R.billingFrequency,")"]})]}),M&&s.jsxs("div",{className:"ml-6 flex items-center space-x-2",children:[s.jsx(V,{htmlFor:`price-${R.id}`,className:"text-xs text-slate-600",children:"Member price (optional):"}),s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx("span",{className:"text-sm",children:mt(n)}),s.jsx(me,{id:`price-${R.id}`,type:"number",step:"0.01",min:"0",placeholder:"Free access",value:(Y==null?void 0:Y.memberPrice)||"",onChange:se=>{b(Q=>Q.map(te=>te.id===R.id?{...te,memberPrice:se.target.value}:te))},className:"w-24 h-8"})]}),s.jsx("span",{className:"text-xs text-slate-500",children:"(Leave empty for free access)"})]})]},R.id)}),x.length>0&&s.jsxs("div",{className:"mt-2 p-2 bg-blue-50 rounded text-sm text-blue-700",children:[x.length," membership",x.length>
7281?"s":""," selected"]})]}):s.jsx("p",{className:"text-sm text-slate-500",children:"No memberships available. Create memberships in the Memberships tab to enable member pricing."})})})]}),s.jsxs("div",{className:"flex justify-end space-x-3 pt-4 border-t",children:[s.jsx(B,{type:"button",variant:"outline",onClick:a,children:"Cancel"}),s.jsx(B,{type:"submit",disabled:d||l.length===0,children:d?"Saving...":e?"Update Service":"Create Service"})]})]})}function y1e({instructorId:e,currency:t,subdomain:n}){const[r,a]=f.useState(null),[i,o]=f.useState(!1),[l,c]=f.useState(null),[d,m]=f.useState(null),[u,h]=f.useState(!1),[p,v]=f.useState(""),{toast:y}=Yt(),g=jn(),{data:x,isLoading:b,error:w}=Ue({queryKey:[`/api/services/service/${d==null?void 0:d.id}/private-link-token`],enabled:!!(d!=null&&d.id)&&u,queryFn:async()=>{const k=await Pe("GET",`/api/services/service/${d.id}/private-link-token`);if(!k.ok){const F=await k.json();throw new Error(F.message||"Failed to generate private link token")}return k.json()}});he.useEffect(()=>{if(x!=null&&x.token&&n){const k=`${window.location.origin}/classes/${n}?serviceToken=${encodeURIComponent(x.token)}`;v(k)}else u||v("")},[x==null?void 0:x.token,n,u]);const{data:j=[],isLoading:N}=Ue({queryKey:[`/api/services/admin/${e}`],enabled:!!e}),C=xt({mutationFn:async k=>(await Pe("DELETE",`/api/services/${k}`)).json(),onSuccess:()=>{y({title:"Success",description:"Service deleted successfully"}),g.invalidateQueries({queryKey:[`/api/services/admin/${e}`]})},onError:k=>{y({title:"Error",description:k.message,variant:"destructive"})}}),P=k=>{c(k)},S=()=>{l&&(C.mutate(l.id),c(null))},E=(k,F)=>{F.stopPropagation(),m(k),v(""),h(!0)},T=k=>{h(k),k||(m(null),v(""))},z=()=>{p&&(navigator.clipboard.writeText(p),y({title:"Link copied",description:"Private service link has been copied to clipboard."}))},O=k=>{if(k<60)return`${k} mins`;const F=Math.floor(k/60),W=k%60;return W===0?`${F} hour${F>1?"s":""}`:`${F}h ${W}m`},D=k=>{try{const F=JSON.parse(k);if(Array.isArray(F)){const W=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return F.map(q=>`${W[q.day]||`Day ${q.day}`} ${q.startTime}-${q.endTime}`).join(", ")}}catch{return"Custom schedule"}return"Custom schedule"};return N?s.jsx("div",{className:"text-center py-8",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full mx-auto"})}):s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Service Management"}),s.jsxs("div",{className:"flex space-x-2",children:[s.jsxs(B,{onClick:()=>o(!0),className:"hidden lg:flex",children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Create Service"]}),s.jsx(B,{onClick:()=>o(!0),size:"sm",className:"lg:hidden h-9 w-9 p-0",title:"Create Service",children:s.jsx(Gs,{className:"h-4 w-4"})})]})]}),s.jsx(Ce,{className:"border-0 md:border",children:s.jsx(Ee,{className:"p-0",children:j.length===0?s.jsxs("div",{className:"text-center py-8 px-6",children:[s.jsxs("div",{className:"text-slate-500 mb-6",children:[s.jsx(Ls,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),s.jsx("p",{className:"text-lg mb-3",children:"No services yet"}),s.jsxs("div",{className:"max-w-md mx-auto text-sm space-y-2",children:[s.jsx("p",{children:"Services are personal, one-on-one offerings like:"}),s.jsxs("ul",{className:"text-left list-disc list-inside space-y-1 text-slate-600",children:[s.jsx("li",{children:"Massage therapy"}),s.jsx("li",{children:"Personal training"}),s.jsx("li",{children:"Consultations"}),s.jsx("li",{children:"Private lessons"})]}),s.jsx("p",{className:"mt-3",children:"Unlike classes, services allow customers to book specific time slots that work for them, and you set your own availability schedule."})]})]}),s.jsxs(B,{onClick:()=>o(!0),children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Create Your First Service"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"hidden lg:block",children:s.jsx("div",{className:"overflow-x-auto max-h-[32rem] overflow-y-auto",children:s.jsxs(qd,{children:[s.jsx(Wd,{children:s.jsxs(Ra,{className:"border-b border-slate-200",children:[s.jsx(Es,{children:"Service Name"}),s.jsx(Es,{children:"Duration"}),s.jsx(Es,{children:"Price"}),s.jsx(Es,{children:"Availability"}),s.jsx(Es,{children:"Status"}),s.jsx(Es,{children:"Actions"})]})}),s.jsx(Hd,{children:j.map(k=>s.jsxs(Ra,{children:[s.jsx(Ds,{children:s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-slate-900",children:k.name}),k.description&&s.jsx("div",{className:"text-sm text-slate-500",children:k.description.length>180?`${k.description.substring(0,180)}...`:k.description})]})}),s.jsx(Ds,{children:s.jsxs("div",{className:"flex items-center text-sm",children:[s.jsx(ei,{className:"h-4 w-4 mr-1 text-slate-400"}),O(k.duration)]})}),s.jsx(Ds,{children:s.jsxs("div",{className:"flex items-center text-sm",children:[mt(t),k.price]})}),s.jsx(Ds,{children:s.jsx("div",{className:"text-sm text-slate-600 max-w-xs",children:D(k.availabilitySchedule)})}),s.jsx(Ds,{children:s.jsx(Je,{variant:k.isActive?"default":"secondary",children:k.isActive?"Active":"Inactive"})}),s.jsx(Ds,{children:s.jsxs("div",{className:"flex space-x-2",children:[s.jsx(B,{size:"sm",variant:"ghost",onClick:F=>E(k,F),title:"Private Link",children:s.jsx(Tf,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"ghost",onClick:()=>a(k),children:s.jsx(Ur,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"ghost",onClick:()=>P(k),className:"text-red-600 hover:text-red-700",children:s.jsx(ln,{className:"h-4 w-4"})})]})})]},k.id))})]})})}),s.jsx("div",{className:"lg:hidden space-y-4 max-h-[32rem] overflow-y-auto",children:j.map(k=>s.jsx(Ce,{className:"relative",children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"font-medium text-slate-900 text-sm",children:k.name}),k.description&&s.jsx("div",{className:"text-xs text-slate-500 mt-1 line-clamp-2",children:k.description})]}),s.jsx(Je,{variant:k.isActive?"default":"secondary",className:"ml-2",children:k.isActive?"Active":"Inactive"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center text-xs text-slate-600",children:[s.jsx(ei,{className:"h-3 w-3 mr-2 text-slate-400"}),s.jsx("span",{children:O(k.duration)})]}),s.jsx("div",{className:"flex items-center text-xs text-slate-600",children:s.jsxs("span",{className:"font-medium",children:[mt(t),k.price]})}),k.location&&s.jsxs("div",{className:"flex items-center text-xs text-slate-600",children:[s.jsx(si,{className:"h-3 w-3 mr-2 text-slate-400"}),s.jsx("span",{children:k.location})]})]}),s.jsxs("div",{className:"text-xs",children:[s.jsx("div",{className:"font-medium text-slate-500 mb-1",children:"Availability"}),s.jsx("div",{className:"text-slate-600",children:D(k.availabilitySchedule)})]}),s.jsxs("div",{className:"flex space-x-2 pt-2",children:[s.jsx(B,{size:"sm",variant:"outline",onClick:F=>E(k,F),className:"text-xs",title:"Private Link",children:s.jsx(Tf,{className:"h-3 w-3"})}),s.jsxs(B,{size:"sm",variant:"outline",onClick:()=>a(k),className:"flex-1 text-xs",children:[s.jsx(Ur,{className:"h-3 w-3 mr-1"}),"Edit"]}),s.jsx(B,{size:"sm",variant:"outline",onClick:()=>P(k),className:"text-red-600 hover:text-red-700 hover:border-red-300 text-xs",children:s.jsx(ln,{className:"h-3 w-3"})})]})]})})},k.id))})]})})}),(i||r)&&s.jsx(Ct,{open:i||!!r,onOpenChange:()=>{o(!1),a(null)},children:s.jsxs(St,{className:"max-w-4xl max-h-[90vh] overflow-y-auto p-4 sm:p-6",children:[s.jsx(kt,{children:s.jsx(Pt,{children:r?"Edit Service":"Create New Service"})}),s.jsx(g1e,{service:r,instructorId:e,currency:t,onSuccess:()=>{o(!1),a(null),g.invalidateQueries({queryKey:[`/api/services/admin/${e}`]})},onCancel:()=>{o(!1),a(null)}})]})}),s.jsx(Ct,{open:u,onOpenChange:T,children:s.jsxs(St,{children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Private Service Booking Link"}),s.jsxs(yn,{children:['Share this link so clients can book "',d==null?void 0:d.name,'" directly. The link works even if the service is inactive on your public page.']})]}),b?s.jsxs("div",{className:"flex items-center gap-2 py-4 text-slate-500",children:[s.jsx("div",{className:"animate-spin h-4 w-4 border-2 border-primary border-t-transparent roun
728ded-full"}),s.jsx("span",{children:"Generating private link token..."})]}):w?s.jsxs("div",{className:"py-4 text-red-600 text-sm",children:["Error: ",w.message||"Failed to generate private link token"]}):n?p?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(me,{readOnly:!0,value:p,className:"font-mono text-sm"}),s.jsx(B,{variant:"outline",size:"icon",onClick:z,title:"Copy link",children:s.jsx(pr,{className:"h-4 w-4"})})]}),s.jsxs(B,{onClick:z,className:"w-full",children:[s.jsx(pr,{className:"h-4 w-4 mr-2"}),"Copy Link"]})]}):null:s.jsx("div",{className:"py-4 text-amber-600 text-sm",children:"Instructor subdomain is not configured. Please set a subdomain in your profile settings to generate private links."}),s.jsx(B,{variant:"outline",onClick:()=>T(!1),children:"Close"})]})}),s.jsx(Zi,{open:!!l,onOpenChange:()=>c(null),children:s.jsxs(bi,{children:[s.jsxs(wi,{children:[s.jsx(Ni,{children:"Delete Service"}),s.jsxs(Ci,{children:['Are you sure you want to delete "',l==null?void 0:l.name,'"? This action cannot be undone. Any existing bookings for this service will be cancelled.']})]}),s.jsxs(ji,{children:[s.jsx(to,{children:"Cancel"}),s.jsx(eo,{onClick:S,className:"bg-red-600 hover:bg-red-700",disabled:C.isPending,children:C.isPending?"Deleting...":"Delete"})]})]})})]})}const v1e=()=>({id:`general-${Date.now()}`,name:"General Admission",description:"",price_minor:2500,capacity:100,pay_on_door:!1});function tl(e){return e.paymentProvider==="manual"}function xE(e){return tl(e)&&e.paymentStatus==="paid"&&e.totalMinor===0}function v3(e){return tl(e)&&e.paymentStatus==="refunded"?"Removed":xE(e)?"Guest":e.paymentStatus==="owed"?"Owed":e.paymentStatus}function b1e({instructorId:e,currency:t,subdomain:n,eventsPageTitle:r,eventsPageLogoUrl:a,eventsPageDescription:i,logoUrl:o,onEventsPageSetupSave:l,onEventsPageLogoChanged:c,onBookerClick:d}){var ft;const[m,u]=f.useState(!1),[h,p]=f.useState(null),[v,y]=f.useState(null),[g,x]=f.useState(""),[b,w]=f.useState(null),[j,N]=f.useState(!1),[C,P]=f.useState(r??""),[S,E]=f.useState(i??""),[T,z]=f.useState(!1),[O,D]=f.useState(!1),[k,F]=f.useState(!1),W=f.useRef(null),{toast:q}=Yt(),H=jn(),_=a&&a.trim()?a:o&&o.trim()?o:null,L=_!=null&&_.startsWith("http")?_:_?`${typeof window<"u"?window.location.origin:""}${_}`:null,U=!!(a&&a.trim());f.useEffect(()=>{P(r??"")},[r]),f.useEffect(()=>{E(i??"")},[i]),f.useEffect(()=>{N(!1)},[v]);const J=mt(t||"GBP"),{data:I=[],isLoading:re}=Ue({queryKey:["/api/events"],enabled:!!e,queryFn:async()=>{const be=await Pe("GET","/api/events");if(!be.ok)throw new Error("Failed to fetch events");return be.json()}}),{data:R}=Ue({queryKey:["/api/events",v],enabled:!!v,queryFn:async()=>{const be=await Pe("GET",`/api/events/${v}`);if(!be.ok)throw new Error("Failed to fetch event");return be.json()}}),{data:Y=[],isLoading:M}=Ue({queryKey:["/api/events",v,"orders"],enabled:!!v,queryFn:async()=>{const be=await Pe("GET",`/api/events/${v}/orders`);if(!be.ok)throw new Error("Failed to fetch orders");return be.json()}}),se=g.trim().toLowerCase(),Q=se?Y.filter(be=>(be.buyerName||"").toLowerCase().includes(se)||(be.buyerEmail||"").toLowerCase().includes(se)||(be.bookingInfoResponse||"").toLowerCase().includes(se)):Y,te=xt({mutationFn:async({id:be})=>{const Fe=await Pe("POST",`/api/events/orders/${be}/cancel-refund`);if(!Fe.ok){const ze=await Fe.json().catch(()=>({}));throw new Error(ze.message||"Failed to cancel and refund")}return await Fe.json()},onSuccess:(be,Fe)=>{q({title:Fe.manual?"Removed from event":"Order cancelled",description:Fe.manual?"They're off the list and the ticket has been released.":"Refund processed and tickets released."}),w(null),H.invalidateQueries({queryKey:["/api/events",v,"orders"]}),H.invalidateQueries({queryKey:["/api/events",v]}),H.invalidateQueries({queryKey:["/api/events"]})},onError:be=>{q({title:"Error",description:be.message,variant:"destructive"})}}),G=xt({mutationFn:async be=>{const Fe=await Pe("POST",`/api/events/orders/${be}/mark-paid`);if(!Fe.ok){const _e=await Fe.json().catch(()=>({}));throw new Error(_e.message||"Failed to mark as paid")}return Fe.json()},onSuccess:()=>{q({title:"Order updated",description:"Order marked as paid."}),H.invalidateQueries({queryKey:["/api/events",v,"orders"]}),H.invalidateQueries({queryKey:["/api/events",v]}),H.invalidateQueries({queryKey:["/api/events"]})},onError:be=>{q({title:"Error",description:be.message,variant:"destructive"})}}),Z=xt({mutationFn:async({_imageFile:be,...Fe})=>{const _e=await Pe("POST","/api/events",Fe);if(!_e.ok){const ze=await _e.json();throw new Error(ze.message||"Failed to create event")}return _e.json()},onSuccess:async(be,Fe)=>{const _e=Fe._imageFile;if(_e)try{const ze=await Pe("POST",`/api/events/${be.id}/image/upload-url`,{});if(!ze.ok)throw new Error("Failed to get upload URL");const{uploadURL:ue}=await ze.json();if(!(await fetch(ue,{method:"PUT",headers:{"Content-Type":_e.type},body:_e})).ok)throw new Error("Failed to upload image");await Pe("PUT",`/api/events/${be.id}/image`,{imageURL:ue})}catch(ze){q({title:"Event created",description:"Image upload failed: "+(ze.message||"unknown"),variant:"destructive"})}q({title:"Event created",description:"Your event is ready. Set status to Published to sell tickets."}),H.invalidateQueries({queryKey:["/api/events"]}),H.invalidateQueries({queryKey:["/api/events/public",e]}),u(!1)},onError:be=>q({title:"Error",description:be.message,variant:"destructive"})}),ie=xt({mutationFn:async({id:be,_imageFile:Fe,..._e})=>{const ze=await Pe("PATCH",`/api/events/${be}`,_e);if(!ze.ok){const ue=await ze.json();throw new Error(ue.message||"Failed to update event")}return ze.json()},onSuccess:async(be,Fe)=>{const _e=Fe._imageFile;if(_e)try{const ze=await Pe("POST",`/api/events/${be.id}/image/upload-url`,{});if(!ze.ok)throw new Error("Failed to get upload URL");const{uploadURL:ue}=await ze.json();if(!(await fetch(ue,{method:"PUT",headers:{"Content-Type":_e.type},body:_e})).ok)throw new Error("Failed to upload image");await Pe("PUT",`/api/events/${be.id}/image`,{imageURL:ue})}catch(ze){q({title:"Event updated",description:"Image upload failed: "+(ze.message||"unknown"),variant:"destructive"})}q({title:"Event updated"}),H.invalidateQueries({queryKey:["/api/events"]}),v&&H.invalidateQueries({queryKey:["/api/events",v]}),H.invalidateQueries({queryKey:["/api/events/public",e]}),p(null)},onError:be=>q({title:"Error",description:be.message,variant:"destructive"})}),A=async()=>
728{if(v)try{const be=await Pe("GET",`/api/events/${v}/orders/export`);if(!be.ok){const Me=await be.json().catch(()=>({}));throw new Error(Me.message||"Export failed")}const Fe=await be.text(),_e=new Blob([Fe],{type:"text/csv"}),ze=URL.createObjectURL(_e),ue=document.createElement("a");ue.href=ze,ue.download=`event-${v}-orders-${new Date().toISOString().split("T")[0]}.csv`,document.body.appendChild(ue),ue.click(),document.body.removeChild(ue),URL.revokeObjectURL(ze),q({title:"Export complete",description:"CSV download started."})}catch(be){q({title:"Export failed",description:be.message||"Could not export orders.",variant:"destructive"})}};if(re)return s.jsx("div",{className:"p-6 text-center text-slate-500",children:"Loading events..."});const ge=[...I].sort((be,Fe)=>!be.startsAt&&!Fe.startsAt?0:be.startsAt?Fe.startsAt?new Date(Fe.startsAt).getTime()-new Date(be.startsAt).getTime():-1:1),je=be=>`${S5(be.startsAt)} – ${be.title}`,ke=n?`${typeof window<"u"?window.location.origin:""}/events/${n}`:null,Ie=async()=>{if(l){z(!0);try{await l({eventsPageTitle:C,eventsPageDescription:S}),q({title:"Saved",description:"Events page setup updated."})}catch(be){q({title:"Error",description:be.message||"Failed to save",variant:"destructive"})}finally{z(!1)}}},$e=async be=>{var _e;const Fe=(_e=be.target.files)==null?void 0:_e[0];if(!Fe||!Fe.type.startsWith("image/")){q({title:"Invalid file",description:"Please choose an image (JPEG, PNG, WebP).",variant:"destructive"});return}D(!0),be.target.value="";try{const ze=await Pe("POST","/api/objects/upload",{});if(!ze.ok)throw new Error("Failed to get upload URL");const{uploadURL:ue}=await ze.json();if(!(await fetch(ue,{method:"PUT",headers:{"Content-Type":Fe.type},body:Fe})).ok)throw new Error("Failed to upload image");const pt=await Pe("PUT","/api/instructor/events-page-logo",{logoURL:ue});if(!pt.ok){const de=await pt.json().catch(()=>({}));throw new Error(de.error||"Failed to set logo")}q({title:"Saved",description:"Events page logo updated."}),c==null||c()}catch(ze){q({title:"Error",description:ze.message||"Failed to upload logo",variant:"destructive"})}finally{D(!1)}},qe=async()=>{F(!0);try{await Pe("PATCH","/api/instructor/settings",{eventsPageLogoUrl:null}),q({title:"Saved",description:"Events page will now use your main logo."}),c==null||c()}catch(be){q({title:"Error",description:be.message||"Failed to clear logo",variant:"destructive"})}finally{F(!1)}};return s.jsxs("div",{className:"space-y-6",children:[n!=null&&s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{className:"text-base",children:"Events page setup"}),s.jsx(Ys,{children:"Optional title and description for your dedicated events page. If left blank, your business name and main description are used."})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{className:"text-sm text-slate-700",children:"Events page logo"}),s.jsx("p",{className:"text-xs text-slate-500 mt-0.5 mb-2",children:"If not set, your main logo from settings is used."}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[L&&s.jsx("img",{src:L,alt:"Events page logo",className:"h-12 w-12 object-contain rounded border border-slate-200 bg-white"}),!L&&s.jsx("div",{className:"h-12 w-12 rounded border border-slate-200 bg-slate-100 flex items-center justify-center",children:s.jsx(Y9,{className:"h-6 w-6 text-slate-400"})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("input",{ref:W,type:"file",accept:"image/jpeg,image/png,image/webp",className:"sr-only",onChange:$e,disabled:O}),s.jsxs(B,{type:"button",size:"sm",variant:"outline",className:"gap-2",onClick:()=>{var be;return(be=W.current)==null?void 0:be.click()},disabled:O,children:[s.jsx(id,{className:"h-4 w-4"}),O?"Uploading…":"Upload logo"]}),U&&s.jsx(B,{type:"button",size:"sm",variant:"ghost",onClick:qe,disabled:k,children:k?"Clearing…":"Use main logo"})]})]})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm text-slate-700",children:"Events page title"}),s.jsx(me,{value:C,onChange:be=>P(be.target.value),placeholder:"e.g. Workshops & Events",className:"mt-1"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Shown in place of your business name on the events page when set."})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm text-slate-700",children:"Events page description"}),s.jsx(Is,{value:S,onChange:be=>E(be.target.value),placeholder:"e.g. Workshops and one-off events – book your spot below.",rows:2,className:"mt-1"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"If left blank, your main business description is used."}),l&&s.jsx(B,{size:"sm",className:"mt-2",onClick:Ie,disabled:T,children:T?"Saving…":"Save"})]}),ke&&s.jsxs("div",{children:[s.jsxs(V,{className:"text-sm text-slate-700 flex items-center gap-1",children:[s.jsx(vM,{className:"h-3.5 w-3.5"}),"Your events page"]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[s.jsxs("a",{href:ke,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-sky-600 hover:underline flex items-center gap-1",children:[ke,s.jsx(Lr,{className:"h-3.5 w-3.5"})]}),s.jsx(B,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(ke),q({title:"Copied",description:"Events page link copied to clipboard."})},children:"Copy link"})]})]})]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Events & ticket sales"}),s.jsxs(B,{onClick:()=>u(!0),children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Create event"]})]}),I.length===0?s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6 text-center text-slate-500",children:"No events yet. Create one to sell tickets."})}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[s.jsx(V,{className:"text-sm font-medium text-slate-700 shrink-0",children:"Event"}),s.jsxs(Bt,{value:(v==null?void 0:v.toString())??"",onValueChange:be=>y(be?parseInt(be,10):null),children:[s.jsx($t,{className:"w-full sm:max-w-md",children:s.jsx(Lt,{placeholder:"Select an event"})}),s.jsx(It,{children:ge.map(be=>s.jsx(ce,{value:be.id.toString(),children:je(be)},be.id))})]})]}),v&&R&&s.jsxs(s.Fragment,{children:[s.jsx(Ce,{children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold text-slate-900",children:R.title}),s.jsxs("p",{className:"text-sm text-slate-500 flex items-center gap-2 mt-1",children:[s.jsx(Ls,{className:"h-3 w-3 shrink-0"}),S5(R.startsAt),R.location&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mx-1",children:"·"}),s.jsx(si,{className:"h-3 w-3 shrink-0"}),R.location]})]}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:(ft=R.ticketTypes)==null?void 0:ft.map(be=>s.jsxs(Je,{variant:"outline",className:"text-xs",children:[be.name," ",be.sold??0,"/",be.capacity??0]},be.id))}),n&&R.status==="published"&&s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[s.jsxs("span",{className:"text-xs text-slate-500 flex items-center gap-1",children:[s.jsx(vM,{className:"h-3 w-3"}),"Link to this event:"]}),s.jsxs("a",{href:`${typeof window<"u"?window.location.origin:""}/events/${n}/${R.id}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-sky-600 hover:underline",children:["/events/",n,"/",R.id]}),s.jsx(B,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>{const be=`${window.location.origin}/events/${n}/${R.id}`;navigator.clipboard.writeText(be),q({title:"Copied",description:"Event link copied."})},children:"Copy"})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(Je,{variant:R.status==="published"?"default":"secondary",children:R.status}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>p(R),children:"Edit"}),s.jsxs(B,{variant:"outline",size:"sm",onClick:A,children:[s.jsx(Li,{className:"h-4 w-4 mr-1"}),"Export CSV"]})]})]})})}),s.jsxs(Ce,{children:[s.jsxs(gt,{className:"sm:flex-row sm:items-start sm:justify-between gap-3 space-y-0",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Nt,{className:"text-base",children:"Orders"}),s.jsx(Ys,{children:"Everyone on the list for this event, including guests you add. Click a name to view their details."})]}
728),R.status!=="cancelled"&&s.jsxs(B,{size:"sm",className:"shrink-0",onClick:()=>N(!0),children:[s.jsx(Gs,{className:"h-4 w-4 mr-1"}),"Add booking"]})]}),s.jsx(Ee,{className:"p-0",children:M?s.jsx("div",{className:"p-6 text-center text-slate-500",children:"Loading orders..."}):Y.length===0?s.jsx("div",{className:"p-6 text-center text-slate-500",children:"No one on the list yet. Add a booking to put a guest or a cash payment on it."}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"px-4 pt-2 pb-2 flex items-center gap-2",children:[s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx(Eh,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),s.jsx(me,{placeholder:"Search by customer name or email",value:g,onChange:be=>x(be.target.value),className:"pl-8 h-9"})]}),g.trim()&&s.jsxs("span",{className:"text-sm text-slate-500",children:[Q.length," of ",Y.length]})]}),s.jsx("div",{className:"overflow-y-auto max-h-[24rem]",children:Q.length===0?s.jsx("div",{className:"p-4 text-center text-slate-500 text-sm",children:"No orders match your search."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"block md:hidden space-y-3 px-4 pb-4",children:Q.map(be=>{var Fe,_e;return s.jsx(Ce,{className:"p-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between items-start gap-2",children:[s.jsxs("div",{className:d?"cursor-pointer hover:opacity-80 transition-opacity":void 0,onClick:()=>d==null?void 0:d(be.buyerEmail,be.clientId),title:d?"View client details":void 0,children:[s.jsx("p",{className:"font-medium text-slate-900",children:be.buyerName||"—"}),s.jsx("p",{className:"text-sm text-slate-500",children:be.buyerEmail})]}),s.jsx(Je,{variant:xE(be)?"outline":be.paymentStatus==="paid"?"default":"secondary",children:v3(be)})]}),s.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-sm text-slate-600",children:[s.jsx("span",{children:((_e=(Fe=R.ticketTypes)==null?void 0:Fe.find(ze=>ze.id===be.ticketTypeId))==null?void 0:_e.name)||be.ticketTypeId}),s.jsxs("span",{children:["Qty ",be.quantity]}),s.jsxs("span",{children:[J,(be.totalMinor/100).toFixed(2)]}),s.jsx("span",{children:new Date(be.createdAt).toLocaleDateString()}),be.couponCode&&s.jsxs("span",{children:["Code ",be.couponCode]})]}),(R==null?void 0:R.bookingInfoFieldEnabled)&&s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"text-slate-500",children:"Info: "}),s.jsx(w3,{text:be.bookingInfoResponse})]}),be.paymentStatus==="paid"&&!tl(be)&&s.jsxs(B,{variant:"outline",size:"sm",className:"w-full text-destructive border-destructive/50 hover:bg-destructive/10",onClick:()=>w(be),disabled:te.isPending,children:[s.jsx(jM,{className:"h-4 w-4 mr-2"}),"Cancel & refund"]}),tl(be)&&(be.paymentStatus==="paid"||be.paymentStatus==="owed")&&s.jsxs(B,{variant:"outline",size:"sm",className:"w-full text-destructive border-destructive/50 hover:bg-destructive/10",onClick:()=>w(be),disabled:te.isPending,children:[s.jsx(ln,{className:"h-4 w-4 mr-2"}),"Remove"]}),be.paymentStatus==="owed"&&s.jsx(B,{variant:"outline",size:"sm",className:"w-full",onClick:()=>G.mutate(be.id),disabled:G.isPending,children:"Mark paid"})]})},be.id)})}),s.jsx("div",{className:"hidden md:block overflow-x-auto",children:s.jsxs(qd,{children:[s.jsx(Wd,{children:s.jsxs(Ra,{children:[s.jsx(Es,{children:"Ticket type"}),s.jsx(Es,{children:"Buyer"}),(R==null?void 0:R.bookingInfoFieldEnabled)&&s.jsx(Es,{children:"Info"}),s.jsx(Es,{children:"Qty"}),s.jsx(Es,{children:"Total"}),s.jsx(Es,{children:"Status"}),s.jsx(Es,{children:"Date"}),s.jsx(Es,{className:"w-[140px]",children:"Actions"})]})}),s.jsx(Hd,{children:Q.map(be=>{var Fe,_e;return s.jsxs(Ra,{children:[s.jsx(Ds,{children:((_e=(Fe=R.ticketTypes)==null?void 0:Fe.find(ze=>ze.id===be.ticketTypeId))==null?void 0:_e.name)||be.ticketTypeId}),s.jsx(Ds,{children:s.jsxs("div",{className:d?"cursor-pointer hover:opacity-80 transition-opacity":void 0,onClick:()=>d==null?void 0:d(be.buyerEmail,be.clientId),title:d?"View client details":void 0,children:[s.jsx("div",{className:d?"font-medium text-primary":void 0,children:be.buyerName||"—"}),s.jsx("div",{className:"text-xs text-slate-500",children:be.buyerEmail})]})}),(R==null?void 0:R.bookingInfoFieldEnabled)&&s.jsx(Ds,{children:s.jsx(w3,{text:be.bookingInfoResponse})}),s.jsx(Ds,{children:be.quantity}),s.jsxs(Ds,{children:[s.jsxs("div",{children:[J,(be.totalMinor/100).toFixed(2)]}),be.couponCode&&s.jsxs("div",{className:"text-xs text-slate-500",children:["Code ",be.couponCode]})]}),s.jsx(Ds,{children:s.jsx(Je,{variant:xE(be)?"outline":be.paymentStatus==="paid"?"default":"secondary",children:v3(be)})}),s.jsx(Ds,{className:"text-sm text-slate-500",children:new Date(be.createdAt).toLocaleDateString()}),s.jsx(Ds,{children:s.jsxs("div",{className:"flex flex-col items-start gap-1",children:[be.paymentStatus==="paid"&&!tl(be)&&s.jsxs(B,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>w(be),disabled:te.isPending,children:[s.jsx(jM,{className:"h-4 w-4 mr-1"}),"Cancel & refund"]}),tl(be)&&(be.paymentStatus==="paid"||be.paymentStatus==="owed")&&s.jsxs(B,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>w(be),disabled:te.isPending,children:[s.jsx(ln,{className:"h-4 w-4 mr-1"}),"Remove"]}),be.paymentStatus==="owed"&&s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>G.mutate(be.id),disabled:G.isPending,children:"Mark paid"})]})})]},be.id)})})]})})]})})]})})]})]}),v&&!R&&s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6 text-center text-slate-500",children:"Loading event…"})}),!v&&I.length>0&&s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6 text-center text-slate-500",children:"Select an event above to view orders."})})]}),s.jsx(j1e,{open:m,onOpenChange:u,currency:t,onSubmit:(be,Fe)=>Z.mutate({...be,_imageFile:Fe}),isSubmitting:Z.isPending}),h&&s.jsx(N1e,{event:h,open:!!h,onOpenChange:be=>!be&&p(null),currency:t,onSubmit:(be,Fe)=>ie.mutate({id:h.id,...be,_imageFile:Fe}),isSubmitting:ie.isPending}),R&&s.jsx(w1e,{open:j,onOpenChange:N,event:R,currencySymbol:J}),s.jsx(Zi,{open:!!b,onOpenChange:be=>!be&&w(null),children:s.jsxs(bi,{children:[s.jsxs(wi,{children:[s.jsx(Ni,{children:b&&tl(b)?"Remove from this event?":"Cancel order and refund?"}),s.jsx(Ci,{children:b&&tl(b)?s.jsxs(s.Fragment,{children:["Remove ",b.buyerName||b.buyerEmail," from the list",b.totalMinor>0?". This was added manually, so no card refund will be sent.":"."," ","Their ticket will be released. This cannot be undone."]}):b?s.jsxs(s.Fragment,{children:["This will refund ",b.buyerName||b.buyerEmail," (",J,(b.totalMinor/100).toFixed(2),") and release ",b.quantity," ticket",b.quantity!==1?"s":""," back to availability. This cannot be undone."]}):null})]}),s.jsxs(ji,{children:[s.jsx(to,{children:"Keep order"}),s.jsx(eo,{onClick:()=>b&&te.mutate({id:b.id,manual:tl(b)}),disabled:te.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:te.isPending?"Processing…":b&&tl(b)?"Remove":"Cancel order & refund"})]})]})})]})}function w1e({open:e,onOpenChange:t,event:n,currencySymbol:r}){var k;const{toast:a}=Yt(),i=jn(),[o,l]=f.useState(""),[c,d]=f.useState(""),[m,u]=f.useState(""),[h,p]=f.useState("1"),[v,y]=f.useState("guest"),[g,x]=f.useState(""),[b,w]=f.useState(!1),{data:j=[]}=Ue({queryKey:["/api/clients"],enabled:e});f.useEffect(()=>{var F,W;e&&(l(""),d(""),u(((W=(F=n.ticketTypes)==null?void 0:F[0])==null?void 0:W.id)||""),p("1"),y("guest"),x(""),w(!1))},[e,n.id]);const N=(k=n.ticketTypes)==null?void 0:k.find(F=>F.id===m),C=parseInt(h,10),P=Number.isInteger(C)&&C>=1&&C<=100,S=P?C:0,E=v==="guest"?0:((N==null?void 0:N.price_minor)??0)*(P?C:0),T=N==null?void 0:N.remaining,z=F=>{d(F);const W=j.find(q=>(q.email||"").toLowerCase()===F.trim().toLowerCase());W!=null&&W.name&&l(W.name)},O=xt({mutationFn:async()=>{const F=await Pe("POST",`/api/events/${n.id}/orders/manual`,{buyerName:o.trim(),buyerEmail:c.trim(),ticketTypeId:m,quantity:C,paymentMode:v,bookingInfoResponse:g.trim()||void 0,sendConfirmationEmail
728:b});if(!F.ok){const W=await F.json().catch(()=>({}));throw new Error(W.message||"Failed to add booking")}return F.json()},onSuccess:()=>{const F=o.trim();a({title:"Added to event",description:b?`${F} is on the list and has been emailed their ticket.`:`${F} is on the list.`}),i.invalidateQueries({queryKey:["/api/events",n.id,"orders"]}),i.invalidateQueries({queryKey:["/api/events",n.id]}),i.invalidateQueries({queryKey:["/api/events"]}),t(!1)},onError:F=>{a({title:"Couldn't add booking",description:F.message,variant:"destructive"})}}),D=!!o.trim()&&!!c.trim()&&!!m&&P;return s.jsx(Ct,{open:e,onOpenChange:t,children:s.jsxs(St,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Add booking"}),s.jsxs(yn,{children:["Put someone on the list for ",n.title,". A guest is free and still counts toward ticket numbers."]})]}),s.jsxs("form",{className:"space-y-4",onSubmit:F=>{F.preventDefault(),!(!D||O.isPending)&&O.mutate()},children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(V,{htmlFor:"event-manual-email",children:"Email"}),s.jsx(me,{id:"event-manual-email",type:"email",required:!0,autoComplete:"off",list:"event-manual-client-emails",value:c,onChange:F=>z(F.target.value),placeholder:"[email protected]"}),s.jsx("datalist",{id:"event-manual-client-emails",children:j.map(F=>s.jsx("option",{value:F.email,children:F.name||F.email},F.id))})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(V,{htmlFor:"event-manual-name",children:"Name"}),s.jsx(me,{id:"event-manual-name",required:!0,value:o,onChange:F=>l(F.target.value),placeholder:"Full name"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(V,{children:"Ticket type"}),s.jsxs(Bt,{value:m,onValueChange:u,children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"Choose a ticket type"})}),s.jsx(It,{children:(n.ticketTypes||[]).map(F=>s.jsxs(ce,{value:F.id,children:[F.name," · ",r,(F.price_minor/100).toFixed(2),typeof F.remaining=="number"?` · ${F.remaining} left`:""]},F.id))})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(V,{htmlFor:"event-manual-qty",children:"Quantity"}),s.jsx(me,{id:"event-manual-qty",type:"number",min:1,max:100,value:h,onChange:F=>p(F.target.value)})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(V,{children:"How to record it"}),s.jsxs(Bt,{value:v,onValueChange:F=>y(F),children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"guest",children:"Guest — free, on the list"}),s.jsx(ce,{value:"paid",children:"Paid — ticket price already collected"}),s.jsx(ce,{value:"owed",children:"Owed — they still need to pay"})]})]}),s.jsx("p",{className:"text-xs text-slate-500",children:v==="guest"?"Recorded as a free guest.":P?v==="owed"?`Recorded as ${r}${(E/100).toFixed(2)} still to pay.`:`Recorded as ${r}${(E/100).toFixed(2)} already paid.`:"Enter a quantity from 1 to 100."}),N&&typeof T=="number"&&P&&C>T&&s.jsx("p",{className:"text-sm text-amber-700",children:T===0?"This ticket type is full. You can still add them; it will go over capacity.":`Only ${T} left. Adding ${S} will take this ticket type over capacity.`})]}),n.bookingInfoFieldEnabled&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(V,{htmlFor:"event-manual-info",children:n.bookingInfoFieldLabel||"Booking info"}),s.jsx(Is,{id:"event-manual-info",value:g,onChange:F=>x(F.target.value),rows:3,placeholder:"Optional"})]}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Xt,{id:"event-manual-email-ticket",checked:b,onCheckedChange:F=>w(F===!0)}),s.jsx(V,{htmlFor:"event-manual-email-ticket",className:"text-sm font-normal leading-snug cursor-pointer",children:"Email them their ticket"})]}),s.jsxs(Er,{children:[s.jsx(B,{type:"button",variant:"outline",onClick:()=>t(!1),disabled:O.isPending,children:"Cancel"}),s.jsx(B,{type:"submit",disabled:!D||O.isPending,children:O.isPending?"Adding…":"Add to event"})]})]})]})})}const b3=44;function w3({text:e}){const[t,n]=f.useState(!1),r=(e||"").trim();if(!r)return s.jsx("span",{className:"text-slate-400",children:"—"});if(r.length<=b3)return s.jsx("span",{className:"text-sm text-slate-700 whitespace-pre-wrap break-words",children:r});const a=`${r.slice(0,b3)}…`;return s.jsx("button",{type:"button",className:"text-left text-sm text-sky-800 hover:underline underline-offset-2 whitespace-pre-wrap break-words max-w-[16rem]",onClick:()=>n(i=>!i),children:t?r:a})}function j1e({open:e,onOpenChange:t,currency:n,onSubmit:r,isSubmitting:a}){const[i,o]=f.useState(""),[l,c]=f.useState(""),[d,m]=f.useState(""),[u,h]=f.useState(null),[p,v]=f.useState(!1),[y,g]=f.useState(""),[x,b]=f.useState(""),[w,j]=f.useState([v1e()]),[N,C]=f.useState(10),[P,S]=f.useState("draft"),[E,T]=f.useState(!0),[z,O]=f.useState(!1),[D,k]=f.useState(""),[F,W]=f.useState(!1),[q,H]=f.useState(""),_=mt(n||"GBP"),{data:L=[]}=Ue({queryKey:["/api/onboarding-forms"],enabled:e});f.useEffect(()=>{e||h(null)},[e]);const U=()=>{j(R=>[...R,{id:`type-${Date.now()}`,name:"",description:"",price_minor:0,capacity:50,pay_on_door:!1}])},J=(R,Y,M)=>
728{j(se=>{const Q=[...se];return Q[R][Y]=M,Q})},I=R=>{w.length<=1||j(Y=>Y.filter((M,se)=>se!==R))},re=R=>{R.preventDefault(),!(!i.trim()||!w.every(M=>M.id&&M.name&&M.price_minor>=0&&M.capacity>0))&&(!p&&!y.trim()||z&&!D.trim()||F&&!q||r({title:i.trim(),description:l.trim()||void 0,location:d.trim()||void 0,startsAt:p?null:y||new Date().toISOString().slice(0,16),endsAt:p?null:x||void 0,ticketTypes:w,currency:n||"GBP",maxPerOrder:N,status:P,showOnMainBookingPage:E,bookingInfoFieldEnabled:z,bookingInfoFieldLabel:z?D.trim():null,requireOnboardingForm:F,onboardingFormId:F?parseInt(q,10):null},u??void 0))};return s.jsx(Ct,{open:e,onOpenChange:t,children:s.jsxs(St,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Create event"})}),s.jsxs("form",{onSubmit:re,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{children:"Title *"}),s.jsx(me,{value:i,onChange:R=>o(R.target.value),placeholder:"Event title",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Cover image"}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(me,{type:"file",accept:"image/jpeg,image/png,image/webp",onChange:R=>{var Y;return h(((Y=R.target.files)==null?void 0:Y[0])??null)},className:"max-w-xs"}),u&&s.jsx("span",{className:"text-sm text-slate-500",children:u.name})]}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Shown on the booking page. JPEG, PNG or WebP."})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Description"}),s.jsx(Is,{value:l,onChange:R=>c(R.target.value),placeholder:"Optional",rows:2})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Location"}),s.jsx(me,{value:d,onChange:R=>m(R.target.value),placeholder:"Venue or address"})]}),s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("input",{type:"checkbox",id:"create-date-tbc",checked:p,onChange:R=>v(R.target.checked),className:"rounded border-slate-300"}),s.jsx(V,{htmlFor:"create-date-tbc",className:"text-sm font-normal cursor-pointer",children:'Date TBC (To Be Confirmed) – show event as "TBC" so you can announce it before the date is set'})]}),!p&&s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{children:"Starts at *"}),s.jsx(me,{type:"datetime-local",value:y,onChange:R=>g(R.target.value),required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Ends at"}),s.jsx(me,{type:"datetime-local",value:x,onChange:R=>b(R.target.value)})]})]}),p&&s.jsx("p",{className:"text-sm text-slate-500",children:'This event will be shown with "TBC" in place of the date, and a "Register interest" button instead of "Buy tickets". You can set the date and ticket types later by editing the event.'}),!p&&s.jsxs("div",{children:[s.jsx(V,{children:"Ticket types *"}),s.jsx("p",{className:"text-xs text-slate-500 mb-2",children:"Id (e.g. general), name, price in £, capacity."}),w.map((R,Y)=>s.jsxs("div",{className:"relative flex flex-wrap gap-2 items-end mb-2 p-2 border rounded",children:[s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx(V,{className:"text-xs text-slate-500",children:"Id"}),s.jsx(me,{placeholder:"e.g. general",value:R.id,onChange:M=>J(Y,"id",M.target.value),className:"w-24"})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx(V,{className:"text-xs text-slate-500",children:"Name"}),s.jsx(me,{placeholder:"e.g. General Admission",value:R.name,onChange:M=>J(Y,"name",M.target.value),className:"w-36"})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(V,{className:"text-xs text-slate-500",children:["Price (",_,")"]}),s.jsx(me,{type:"number",step:"0.01",min:"0",placeholder:"25.00",value:R.price_minor===0?"0":R.price_minor?R.price_minor/100:"",onChange:M=>J(Y,"price_minor",Math.round((parseFloat(M.target.value)||0)*100)),className:"w-20"})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx(V,{className:"text-xs text-slate-500",children:"Capacity"}),s.jsx(me,{type:"number",min:"1",placeholder:"100",value:R.capacity||"",onChange:M=>J(Y,"capacity",parseInt(M.target.value,10)||0),className:"w-20"})]}),s.jsxs("div",{className:"flex flex-col gap-1 flex-shrink-0",children:[s.jsx(V,{className:"text-xs text-slate-500",children:"Method"}),s.jsxs(Bt,{value:R.pay_on_door?"pay_on_door":"stripe",onValueChange:M=>J(Y,"pay_on_door",M==="pay_on_door"),children:[s.jsx($t,{className:"w-[7.5rem] h-10",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"stripe",children:"Stripe"}),s.jsx(ce,{value:"pay_on_door",children:"Pay on door"})]})]})]}
728),s.jsx(B,{type:"button",variant:"ghost",size:"icon",onClick:M=>{M.preventDefault(),M.stopPropagation(),w.length>1&&I(Y)},disabled:w.length<=1,className:"absolute top-0 right-0 h-9 w-9 text-slate-500 hover:text-destructive",title:"Remove ticket type","aria-label":"Remove ticket type",children:s.jsx(ln,{className:"h-4 w-4"})})]},Y)),s.jsxs(B,{type:"button",variant:"outline",size:"sm",onClick:U,children:[s.jsx(Gs,{className:"h-4 w-4 mr-1"})," Add ticket type"]})]}),s.jsxs("div",{className:"flex gap-4 items-center",children:[!p&&s.jsxs("div",{children:[s.jsx(V,{children:"Max tickets per order"}),s.jsx(me,{type:"number",min:1,max:100,value:N,onChange:R=>C(parseInt(R.target.value,10)||10),className:"w-24"})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Status"}),s.jsxs(Bt,{value:P,onValueChange:R=>S(R),children:[s.jsx($t,{className:"w-32",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"draft",children:"Draft"}),s.jsx(ce,{value:"published",children:"Published"})]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"create-show-main",checked:E,onChange:R=>T(R.target.checked),className:"rounded border-slate-300"}),s.jsx(V,{htmlFor:"create-show-main",className:"text-sm font-normal cursor-pointer",children:"Show on main booking page (classes page). If off, event only appears on your Events page."})]}),s.jsxs("div",{className:"border border-slate-200 rounded-lg p-4 space-y-3 bg-slate-50/50",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"create-booking-info-field",checked:z,onChange:R=>O(R.target.checked),className:"rounded border-slate-300"}),s.jsx(V,{htmlFor:"create-booking-info-field",className:"text-sm font-normal cursor-pointer",children:"Ask bookers for extra information (shown on checkout and on Register interest)"})]}),z&&s.jsxs("div",{children:[s.jsx(V,{htmlFor:"create-booking-info-label",children:"Question / label *"}),s.jsx(me,{id:"create-booking-info-label",value:D,onChange:R=>k(R.target.value),placeholder:"e.g. Dietary requirements, access needs, emergency contact…",className:"mt-1",maxLength:200}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Shown above the text box on ticket checkout and when people register interest in Date TBC events. Answering is optional."})]})]}),s.jsxs("div",{className:"border border-slate-200 rounded-lg p-4 space-y-3 bg-slate-50/50",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"create-require-onboarding-form",checked:F,onChange:R=>W(R.target.checked),className:"rounded border-slate-300"}),s.jsx(V,{htmlFor:"create-require-onboarding-form",className:"text-sm font-normal cursor-pointer",children:"Require an onboarding / waiver form at checkout"})]}),F&&s.jsxs("div",{children:[s.jsx(V,{htmlFor:"create-onboarding-form",children:"Form *"}),s.jsxs(Bt,{value:q||void 0,onValueChange:H,children:[s.jsx($t,{id:"create-onboarding-form",className:"mt-1",children:s.jsx(Lt,{placeholder:L.length?"Select a form":"No forms yet — create one in Forms"})}),s.jsx(It,{children:L.map(R=>s.jsx(ce,{value:R.id.toString(),children:R.name},R.id))})]}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Uses the same forms as classes. Customers who already completed this form in the last 12 months will not be asked again."})]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(B,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),s.jsx(B,{type:"submit",disabled:a,children:a?"Creating…":"Create event"})]})]})]})})}function N1e({event:e,open:t,onOpenChange:n,currency:r,onSubmit:a,isSubmitting:i}){const[o,l]=f.useState(e.title),[c,d]=f.useState(e.description||""),[m,u]=f.useState(e.location||""),[h,p]=f.useState(null),[v,y]=f.useState(!e.startsAt),[g,x]=f.useState(e.startsAt?e.startsAt.slice(0,16):""),[b,w]=f.useState(e.endsAt?e.endsAt.slice(0,16):""),[j,N]=f.useState((e.ticketTypes||[]).map(M=>({id:M.id,name:M.name,description:M.description,price_minor:M.price_minor,capacity:M.capacity,pay_on_door:!!M.pay_on_door}))),[C,P]=f.useState(e.maxPerOrder??10),[S,E]=f.useState(e.status||"draft"),[T,z]=f.useState(e.showOnMainBookingPage!==!1),[O,D]=f.useState(!!e.bookingInfoFieldEnabled),[k,F]=f.useState(e.bookingInfoFieldLabel||""),[W,q]=f.useState(!!e.requireOnboardingForm),[H,_]=f.useState(e.onboardingFormId?String(e.onboardingFormId):""),L=mt(r||"GBP"),{data:U=[]}=Ue({queryKey:["/api/onboarding-forms"],enabled:t});f.useEffect(()=>{t&&(D(!!e.bookingInfoFieldEnabled),F(e.bookingInfoFieldLabel||""),q(!!e.requireOnboardingForm),_(e.onboardingFormId?String(e.onboardingFormId):""))},[t,e.id,e.bookingInfoFieldEnabled,e.bookingInfoFieldLabel,e.requireOnboardingForm,e.onboardingFormId]);const J=()=>{N(M=>[...M,{id:`type-${Date.now()}`,name:"",description:"",price_minor:0,capacity:50,pay_on_door:!1}])},I=(M,se,Q)=>{N(te=>{const G=[...te];return G[M][se]=Q,G})},re=M=>{j.length<=1||N(se=>se.filter((Q,te)=>te!==M))},R=M=>{M.preventDefault(),o.trim()&&(!v&&!g.trim()||O&&!k.trim()||W&&!H||a({title:o.trim(),description:c.trim()||null,location:m.trim()||null,startsAt:v?null:g,endsAt:v?null:b||null,ticketTypes:j,maxPerOrder:C,status:S,showOnMainBookingPage:T,bookingInfoFieldEnabled:O,bookingInfoFieldLabel:O?k.trim():null,requireOnboardingForm:W,onboardingFormId:W?parseInt(H,10):null},h??void 0))},Y=e.imageUrl?e.imageUrl.startsWith("http")?e.imageUrl:`${window.location.origin}${e.imageUrl}`:null;return s.jsx(Ct,{open:t,onOpenChange:n,children:s.jsxs(St,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Edit event"})}),s.jsxs("form",{onSubmit:R,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{children:"Title *"}),s.jsx(me,{value:o,onChange:M=>l(M.target.value),required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Cover image"}),Y?s.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[s.jsx("img",{src:Y,alt:e.title,className:"h-24 w-40 object-cover rounded border border-slate-200"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(me,{type:"file",accept:"image/jpeg,image/png,image/webp",onChange:M=>{var se;return p(((se=M.target.files)==null?void 0:se[0])??null)},className:"max-w-xs"}),h&&s.jsxs("span",{className:"text-sm text-slate-500",children:[h.name," 
728(will replace current)"]})]})]}):s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(me,{type:"file",accept:"image/jpeg,image/png,image/webp",onChange:M=>{var se;return p(((se=M.target.files)==null?void 0:se[0])??null)},className:"max-w-xs"}),h&&s.jsx("span",{className:"text-sm text-slate-500",children:h.name})]}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Shown on the booking page. JPEG, PNG or WebP."})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Description"}),s.jsx(Is,{value:c,onChange:M=>d(M.target.value),rows:2})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Location"}),s.jsx(me,{value:m,onChange:M=>u(M.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("input",{type:"checkbox",id:"edit-date-tbc",checked:v,onChange:M=>y(M.target.checked),className:"rounded border-slate-300"}),s.jsx(V,{htmlFor:"edit-date-tbc",className:"text-sm font-normal cursor-pointer",children:"Date TBC (To Be Confirmed)"})]}),!v&&s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{children:"Starts at *"}),s.jsx(me,{type:"datetime-local",value:g,onChange:M=>x(M.target.value),required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Ends at"}),s.jsx(me,{type:"datetime-local",value:b,onChange:M=>w(M.target.value)})]})]}),v&&s.jsx("p",{className:"text-sm text-slate-500",children:'This event will be shown with "TBC" in place of the date, and a "Register interest" button instead of "Buy tickets".'}),!v&&s.jsxs("div",{children:[s.jsx(V,{children:"Ticket types"}),s.jsx("p",{className:"text-xs text-slate-500 mb-2",children:"Id, name, price in £, capacity."}),j.map((M,se)=>s.jsxs("div",{className:"relative flex flex-wrap gap-2 items-end mb-2 p-2 border rounded",children:[s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx(V,{className:"text-xs text-slate-500",children:"Id"}),s.jsx(me,{placeholder:"e.g. general",value:M.id,onChange:Q=>I(se,"id",Q.target.value),className:"w-24"})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx(V,{className:"text-xs text-slate-500",children:"Name"}),s.jsx(me,{placeholder:"e.g. General Admission",value:M.name,onChange:Q=>I(se,"name",Q.target.value),className:"w-36"})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(V,{className:"text-xs text-slate-500",children:["Price (",L,")"]}),s.jsx(me,{type:"number",step:"0.01",min:"0",placeholder:"25.00",value:M.price_minor===0?"0":M.price_minor?M.price_minor/100:"",onChange:Q=>I(se,"price_minor",Math.round((parseFloat(Q.target.value)||0)*100)),className:"w-20"})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx(V,{className:"text-xs text-slate-500",children:"Capacity"}),s.jsx(me,{type:"number",min:"1",placeholder:"100",value:M.capacity||"",onChange:Q=>I(se,"capacity",parseInt(Q.target.value,10)||0),className:"w-20"})]}),s.jsxs("div",{className:"flex flex-col gap-1 flex-shrink-0",children:[s.jsx(V,{className:"text-xs text-slate-500",children:"Method"}),s.jsxs(Bt,{value:M.pay_on_door?"pay_on_door":"stripe",onValueChange:Q=>I(se,"pay_on_door",Q==="pay_on_door"),children:[s.jsx($t,{className:"w-[7.5rem] h-10",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"stripe",children:"Stripe"}),s.jsx(ce,{value:"pay_on_door",children:"Pay on door"})]})]})]}),s.jsx(B,{type:"button",variant:"ghost",size:"icon",onClick:Q=>{Q.preventDefault(),Q.stopPropagation(),j.length>1&&re(se)},disabled:j.length<=1,className:"absolute top-0 right-0 h-9 w-9 text-slate-500 hover:text-destructive",title:"Remove ticket type","aria-label":"Remove ticket type",children:s.jsx(ln,{className:"h-4 w-4"})})]},se)),s.jsxs(B,{type:"button",variant:"outline",size:"sm",onClick:J,children:[s.jsx(Gs,{className:"h-4 w-4 mr-1"})," Add ticket type"]})]}),s.jsxs("div",{className:"flex gap-4 items-center",children:[!v&&s.jsxs("div",{children:[s.jsx(V,{children:"Max per order"}),s.jsx(me,{type:"number",min:1,max:100,value:C,onChange:M=>P(parseInt(M.target.value,10)||10),className:"w-24"})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Status"}),s.jsxs(Bt,{value:S,onValueChange:M=>E(M),children:[s.jsx($t,{className:"w-32",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"draft",children:"Draft"}),s.jsx(ce,{value:"published",children:"Published"})]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"edit-show-main",checked:T,onChange:M=>z(M.target.checked),className:"rounded border-slate-300"}),s.jsx(V,{htmlFor:"edit-show-main",className:"text-sm font-normal cursor-pointer",children:"Show on main booking page (classes page). If off, event only appears on your Events page."})]}),s.jsxs("div",{className:"border border-slate-200 rounded-lg p-4 space-y-3 bg-slate-50/50",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"edit-booking-info-field",checked:O,onChange:M=>D(M.target.checked),className:"rounded border-slate-300"}),s.jsx(V,{htmlFor:"edit-booking-info-field",className:"text-sm font-normal cursor-pointer",children:"Ask bookers for extra information (shown on checkout and on Register interest)"})]}),O&&s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-booking-info-label",children:"Question / label *"}),s.jsx(me,{id:"edit-booking-info-label",value:k,onChange:M=>F(M.target.value),placeholder:"e.g. Dietary requirements, access needs…",className:"mt-1",maxLength:200}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Shown above the text box on ticket checkout and when people register interest in Date TBC events. Answering is optional."})]})]}),s.jsxs("div",{className:"border border-slate-200 rounded-lg p-4 space-y-3 bg-slate-50/50",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"edit-require-onboarding-form",checked:W,onChange:M=>q(M.target.checked),className:"rounded border-slate-300"}),s.jsx(V,{htmlFor:"edit-require-onboarding-form",className:"text-sm font-normal cursor-pointer",children:"Require an onboarding / waiver form at checkout"})]}),W&&s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-onboarding-form",children:"Form *"}),s.jsxs(Bt,{value:H||void 0,onValueChange:_,children:[s.jsx($t,{id:"edit-onboarding-form",className:"mt-1",children:s.jsx(Lt,{placeholder:U.length?"Select a form":"No forms yet — create one in Forms"})}),s.jsx(It,{children:U.map(M=>s.jsx(ce,{value:M.id.toString(),children:M.name},M.id))})]}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Uses the same forms as classes. Customers who already completed this form in the last 12 months will not be asked again."})]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(B,{t
728ype:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),s.jsx(B,{type:"submit",disabled:i,children:i?"Saving…":"Save"})]})]})]})})}function C1e({classId:e}){const{toast:t}=Yt(),{data:n=[],isLoading:r,refetch:a}=Ue({queryKey:[`/api/instructor/waitlist/${e}`],queryFn:async()=>{const o=await Pe("GET",`/api/instructor/waitlist/${e}`);if(!o.ok)throw new Error("Failed to fetch waitlist");return o.json()}}),i=xt({mutationFn:async o=>{const l=await Pe("DELETE",`/api/instructor/waitlist/${o}`);if(!l.ok)throw new Error("Failed to delete waitlist entry");return l.json()},onSuccess:()=>{t({title:"Success",description:"Removed from waitlist"}),a()},onError:o=>{t({title:"Error",description:o.message||"Failed to remove from waitlist",variant:"destructive"})}});return r?s.jsx("div",{className:"p-4",children:"Loading waitlist..."}):n.length===0?s.jsxs("div",{className:"p-8 text-center text-slate-500",children:[s.jsx(G2,{className:"h-12 w-12 mx-auto mb-4 text-slate-300"}),s.jsx("p",{children:"No one is on the waitlist for this class yet."})]}):s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"hidden lg:block overflow-x-auto",children:s.jsxs(qd,{children:[s.jsx(Wd,{children:s.jsxs(Ra,{children:[s.jsx(Es,{children:"Name"}),s.jsx(Es,{children:"Email"}),s.jsx(Es,{children:"Phone"}),s.jsx(Es,{children:"Date"}),s.jsx(Es,{children:"Time"}),s.jsx(Es,{children:"Entered On"}),s.jsx(Es,{children:"Status"}),s.jsx(Es,{children:"Actions"})]})}),s.jsx(Hd,{children:n.map(o=>s.jsxs(Ra,{children:[s.jsx(Ds,{children:o.name}),s.jsx(Ds,{children:o.emailAddress}),s.jsx(Ds,{children:o.phoneNumber||"-"}),s.jsx(Ds,{children:new Date(o.classDate+"T00:00:00").toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}),s.jsx(Ds,{children:o.classTime}),s.jsx(Ds,{children:new Date(o.whenAdded).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}),s.jsx(Ds,{children:o.notifiedAt?s.jsxs(Je,{variant:"outline",className:"text-xs",children:["Notified ",new Date(o.notifiedAt).toLocaleDateString()]}):o.notificationScheduledFor?s.jsx(Je,{variant:"secondary",className:"text-xs",children:"Scheduled"}):s.jsx(Je,{variant:"default",className:"text-xs",children:"Waiting"})}),s.jsx(Ds,{children:s.jsx(B,{size:"sm",variant:"destructive",onClick:()=>i.mutate(o.id),disabled:i.isPending,children:s.jsx(ln,{className:"h-4 w-4"})})})]},o.id))})]})}),s.jsx("div",{className:"lg:hidden space-y-4",children:n.map(o=>s.jsx(Ce,{children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold",children:o.name}),s.jsx("p",{className:"text-sm text-slate-500",children:o.emailAddress}),o.phoneNumber&&s.jsx("p",{className:"text-sm text-slate-500",children:o.phoneNumber})]}),s.jsx(B,{size:"sm",variant:"destructive",onClick:()=>i.mutate(o.id),disabled:i.isPending,children:s.jsx(ln,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"text-sm text-slate-600 space-y-1",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Date:"})," ",new Date(o.classDate+"T00:00:00").toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})]}),s.jsxs("p",{children:[s.jsx("strong",{children:"Time:"})," ",o.classTime]}),s.jsxs("p",{children:[s.jsx("strong",{children:"Entered:"})," ",new Date(o.whenAdded).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})]})]}),s.jsx("div",{children:o.notifiedAt?s.jsxs(Je,{variant:"outline",className:"text-xs",children:["Notified ",new Date(o.notifiedAt).toLocaleDateString()]}):o.notificationScheduledFor?s.jsx(Je,{variant:"secondary",className:"text-xs",children:"Scheduled"}):s.jsx(Je,{variant:"default",className:"text-xs",children:"Waiting"})})]})})},o.id))})]})}function S1e({currentInstructor:e,onShowCreateClass:t,onShowAIClassGenerator:n,hideRevenue:r=!1,showTestReminderButtons:a=!1}){const[i,o]=f.useState(!1),[l,c]=f.useState(!1),[d,m]=f.useState(null),[u,h]=f.useState(null),[p,v]=f.useState(!1),[y,g]=f.useState(!1),[x,b]=f.useState(null),[w,j]=f.useState(!1),[N,C]=f.useState(null),[P,S]=f.useState(null),[E,T]=f.useState(!0),[z,O]=f.useState(null),[D,k]=f.useState(null),[F,W]=f.useState(null),[q,H]=f.useState(null),_=$=>{const pe={...$,name:`${$.name} (Copy)`,isActive:!0};delete pe.id,delete pe.createdAt,delete pe.parentClassId,O(pe)},[L,U]=f.useState(""),[J,I]=f.useState("name"),[re,R]=f.useState("asc"),[Y,M]=f.useState(!1),[se,Q]=f.useState(""),[te,G]=f.useState(!1),[Z,ie]=f.useState(""),[A,ge]=f.useState(""),[je,ke]=f.useState(""),[Ie,$e]=f.useState(""),[qe,ft]=f.useState(null),[be,Fe]=f.useState("classes"),[_e,ze]=f.useState(!1),{toast:ue}=Yt(),Me=jn(),pt=xt({mutationFn:async $=>{const pe=await Pe("DELETE",`/api/classes/${$}`),ye=await pe.json().catch(()=>({}));if(!pe.ok)throw new Error(ye.message||"Failed to delete class");return ye},onSuccess:()=>{ue({title:"Success",description:"Class deleted successfully"}),Me.invalidateQueries({queryKey:["/api/admin/classes"]}
728),Me.invalidateQueries({queryKey:["/api/stats"]})},onError:$=>{ue({title:"Error",description:$.message,variant:"destructive"})}}),de=xt({mutationFn:async $=>{const pe=await Pe("POST",`/api/classes/${$}/archive`),ye=await pe.json().catch(()=>({}));if(!pe.ok)throw new Error(ye.message||"Failed to archive class");return ye},onSuccess:()=>{ue({title:"Archived",description:`${(e==null?void 0:e.terminologySingular)||"Class"} archived. It is hidden from your main list and from public booking.`}),Me.invalidateQueries({queryKey:["/api/admin/classes"]}),Me.invalidateQueries({queryKey:["/api/stats"]})},onError:$=>{ue({title:"Error",description:$.message,variant:"destructive"})}}),fe=xt({mutationFn:async $=>{const pe=await Pe("POST",`/api/classes/${$}/restore`),ye=await pe.json().catch(()=>({}));if(!pe.ok)throw new Error(ye.message||"Failed to restore class");return ye},onSuccess:()=>{ue({title:"Restored",description:`${(e==null?void 0:e.terminologySingular)||"Class"} is back in your main list.`}),Me.invalidateQueries({queryKey:["/api/admin/classes"]}),Me.invalidateQueries({queryKey:["/api/stats"]})},onError:$=>{ue({title:"Error",description:$.message,variant:"destructive"})}}),le=xt({mutationFn:async $=>(await Pe("DELETE",`/api/clients/${$}`)).json(),onSuccess:()=>{ue({title:"Success",description:"Client deleted successfully"}),Me.invalidateQueries({queryKey:["/api/clients"]}),Me.invalidateQueries({queryKey:["/api/clients/tags"]})},onError:$=>{ue({title:"Error",description:$.message,variant:"destructive"})}}),Ke=xt({mutationFn:async({clientId:$,data:pe})=>{console.log("🔄 Updating client:",$,pe);const ye=await Pe("PATCH",`/api/clients/${$}`,pe);if(console.log("📡 Update response status:",ye.status),!ye.ok){let Be;try{Be=await ye.json()}catch{throw new Error(`HTTP ${ye.status}: ${ye.statusText}`)}throw console.error("❌ Update error:",Be),new Error(Be.message||"Failed to update client")}try{const Be=await ye.text();if(console.log("📄 Raw response text:",Be),!Be)return console.log("✅ Empty response, treating as success"),{success:!0};const Ze=JSON.parse(Be);return console.log("✅ Update successful:",Ze),Ze}catch(Be){return console.error("❌ JSON parsing error:",Be),console.log("⚠️ JSON parse failed but server returned 200, treating as success"),{success:!0}}},onSuccess:$=>{console.log("🎉 Update mutation success:",$),Me.invalidateQueries({queryKey:["/api/clients"]}),Me.invalidateQueries({queryKey:["/api/clients/tags"]}),Me.invalidateQueries({queryKey:["/api/bookings"]}),Me.refetchQueries({queryKey:["/api/clients"]}),h(null),m(null),ue({title:"Success",description:"Client updated successfully"})},onError:$=>{console.error("💥 Update mutation error:",$),ue({title:"Error",description:$.message,variant:"destructive"})}}),We=xt({mutationFn:async({clientId:$,formId:pe})=>{const ye=await Pe("POST","/api/admin/request-client-form-update",{clientId:$,formId:pe});if(!ye.ok){const Be=await ye.json();throw new Error(Be.message||"Failed to send form update request")}return ye.json()}}),{data:vt=[],refetch:Zt}=Ue({queryKey:[`/api/clients/${d==null?void 0:d.id}/achievements`],enabled:!!(d!=null&&d.id)}),{data:Ht=[]}=Ue({queryKey:["/api/achievements/all"],enabled:!!(e!=null&&e.id)}),Tt=xt({mutationFn:async({clientId:$,data:pe})=>{const ye=await Pe("POST",`/api/clients/${$}/achievements`,pe);if(!ye.ok){const Be=await ye.json();throw new Error(Be.message||"Failed to create achievement")}return ye.json()},onSuccess:()=>{Me.invalidateQueries({queryKey:[`/api/clients/${d==null?void 0:d.id}/achievements`]}),j(!1),b(null),ue({title:"Success",description:"Achievement created successfully"})},onError:$=>{ue({title:"Error",description:$.message,variant:"destructive"})}}),Ot=xt({mutationFn:async({achievementId:$,data:pe})=>{const ye=await Pe("PATCH",`/api/achievements/${$}`,pe);if(!ye.ok){const Be=await ye.json();throw new Error(Be.message||"Failed to update achievement")}return ye.json()},onSuccess:()=>{Me.invalidateQueries({queryKey:[`/api/clients/${d==null?void 0:d.id}/achievements`]}),b(null),j(!1),ue({title:"Success",description:"Achievement updated successfully"})},onError:$=>{ue({title:"Error",description:$.message,variant:"destructive"})}}),Ft=xt({mutationFn:async $=>{const pe=await Pe("DELETE",`/api/achievements/${$}`);if(!pe.ok){const ye=await pe.json();throw new Error(ye.message||"Failed to delete achievement")}return pe.json()},onSuccess:()=>{Me.invalidateQueries({queryKey:[`/api/clients/${d==null?void 0:d.id}/achievements`]}),ue({title:"Success",description:"Achievement deleted successfully"})},onError:$=>{ue({title:"Error",description:$.message,variant:"destructive"})}}),is=xt({mutationFn:async({sourceClientId:$,targetClientId:pe,deleteSourceClient:ye})=>{const Be=await Pe("POST","/api/clients/merge",{sourceClientId:$,targetClientId:pe,deleteSourceClient:ye});if(!Be.ok){const Ze=await Be.json();throw new Error(Ze.message||"Failed to merge clients")}return Be.json()},onSuccess:$=>{Me.invalidateQueries({queryKey:["/api/clients"]}),Me.invalidateQueries({queryKey:["/api/clients/tags"]}),Me.invalidateQueries({queryKey:["/api/bookings"]}),Me.refetchQueries({queryKey:["/api/clients"]}),v(!1),h(null),m(P),S(null);const pe=[];$.mergedBookings!=null&&$.mergedBookings>0&&pe.push(`${$.mergedBookings} booking(s)`),$.mergedAchievements!=null&&$.mergedAchievements>0&&pe.push(`${$.mergedAchievements} achievement(s)`),$.mergedBundles!=null&&$.mergedBundles>0&&pe.push(`${$.mergedBundles} bundle(s)`),$.mergedMemberSubscriptions!=null&&$.mergedMemberSubscriptions>0&&pe.push(`${$.mergedMemberSubscriptions} membership(s)`),$.mergedFormCompletions!=null&&$.mergedFormCompletions>0&&pe.push(`${$.mergedFormCompletions} form completion(s)`);const ye=pe.length?` (${pe.join(", ")})`:"";ue({title:"Success",description:$.deleteSourceClient?`Clients merged successfully${ye}. Duplicate removed.`:`Data transferred${ye}. Duplicate client kept.`})},onError:$=>{ue({title:"Error",description:$.message,variant:"destructive"})}}),Cs=($,pe)=>{confirm(`Are you sure you want to delete "${pe}"? This action cannot be undone. Note: You can only delete clients who have never made any bookings.`)&&le.mutate($)}
728,Ne=$=>{h({...$})},rt=$=>{if(u){if($.email!==u.email){const pe=nn.find(ye=>ye.email===$.email&&ye.id!==u.id);if(pe){S(pe),v(!0);return}}Ke.mutate({clientId:u.id,data:{name:$.name||null,email:$.email,phone:$.phone||null,tags:$.tags||null}})}},ht=()=>{!u||!P||is.mutate({sourceClientId:u.id,targetClientId:P.id,deleteSourceClient:E})},{data:Mt=[],isLoading:Qt}=Ue({queryKey:["/api/admin/classes",_e],enabled:!!(e!=null&&e.id),staleTime:0,queryFn:async()=>{const $=_e?"?archived=1":"";console.log("🔑 AdminDashboard classes query - Making request");const ye=await(await Pe("GET",`/api/admin/classes${$}`)).json();return console.log("🔑 AdminDashboard classes query - Received data:",ye),ye}}),ts=f.useMemo(()=>{const $=new Map;for(const pe of Mt){if(!pe.parentClassId)continue;const ye=$.get(pe.parentClassId)??[];ye.push(pe),$.set(pe.parentClassId,ye)}return $},[Mt]),Js=f.useMemo(()=>Mt.filter($=>!$.parentClassId),[Mt]),{data:xn=[],isLoading:Xs}=Ue({queryKey:["/api/admin/bookings"]}),{data:nn=[],isLoading:Vt,refetch:Te}=Ue({queryKey:["/api/clients"]}),at=async($,pe="This member may not be in the client list yet. Try refreshing the page.",ye)=>{const Be=$.toLowerCase(),Ze=ls=>ls.find(ae=>ae.email.toLowerCase()===Be)||(ye?ls.find(ae=>ae.id===ye):void 0);let es=Ze(nn);if(es){m(es);return}const{data:Ns}=await Te();if(es=Ze(Ns??[]),es){m(es);return}ue({title:"Client not found",description:pe,variant:"destructive"})},{data:ss=[]}=Ue({queryKey:["/api/coupons/bundles/purchases"],enabled:!!(e!=null&&e.id)});f.useEffect(()=>{ss.length>0&&(console.log("📊 Bundle purchases loaded:",ss.length,"bundles"),console.log("📊 Sample bundle purchase:",ss[0]))},[ss]),f.useEffect(()=>{const $=new URLSearchParams(window.location.search),pe=$.get("clientId");if(pe&&nn.length>0){const ye=parseInt(pe),Be=nn.find(Ze=>Ze.id===ye);if(Be&&!d){m(Be),$.delete("clientId");const Ze=window.location.pathname+($.toString()?`?${$.toString()}`:"");window.history.replaceState({},"",Ze)}}},[nn,d]),f.useEffect(()=>{be==="memberships"&&(e!=null&&e.id)&&Me.invalidateQueries({queryKey:["/api/clients"]})},[be,e==null?void 0:e.id,Me]);const{data:ps=[],isLoading:bs}=Ue({queryKey:["/api/admin/member-subscriptions"],enabled:!!(e!=null&&e.id)&&be==="memberships",staleTime:5*60*1e3}),{data:Ss=[],isLoading:xs}=Ue({queryKey:["/api/admin/memberships"],enabled:!!(e!=null&&e.id)&&be==="memberships",staleTime:5*60*1e3}),{data:hs=[]}=Ue({queryKey:["/api/onboarding-forms"],enabled:!!(e!=null&&e.id),staleTime:5*60*1e3});console.log("onbvoardingForms",hs),xt({mutationFn:async $=>(await Pe("DELETE",`/api/bookings/${$}`)).json(),onSuccess:()=>{Me.invalidateQueries({queryKey:["/api/bookings"]}),Me.invalidateQueries({queryKey:["/api/stats"]}),Me.invalidateQueries({queryKey:["/api/classes"]}),ue({title:"Booking deleted successfully"})}});const gs=$=>["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][$],Os=$=>{const[pe,ye]=$.split(":"),Be=parseInt(pe),Ze=Be===0?12:Be>12?Be-12:Be,es=Be>=12?"PM":"AM";return`${Ze}:${ye} ${es}`},cs=$=>{var es,Ns;const pe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ye=(es=$.instructorName)==null?void 0:es.trim(),Be=ls=>ye?`${ls} · ${ye}`:ls;if((Ns=$.startTime)!=null&&Ns.startsWith("{"))try{const ls=JSON.parse($.startTime);if(ls&&typeof ls=="object"&&!Array.isArray(ls)){const ae=Object.keys(ls).map(Re=>{const Le=pe[parseInt(Re,10)],Ye=ls[Re];return Le&&typeof Ye=="string"?`${Le} ${Os(Ye)}`:null}).filter(Boolean).join(", ");if(ae)return Be(ae)}}catch{}const Ze=pe[$.dayOfWeek]||gs($.dayOfWeek);return Be(`${Ze} ${Os($.startTime||"")}`)},Tr=$=>{switch($.toLowerCase()){case"pilates":return"bg-primary";case"hiit":case"bootcamp":return"bg-secondary";case"yoga":return"bg-accent";default:return"bg-slate-400"}},rr=$=>new Date($).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),xe=$=>{const pe=typeof $=="string"?parseFloat($):$;return`${mt((e==null?void 0:e.currency)||"GBP")}${pe.toFixed(2)}`},He=$=>{var Le;const pe=xn.filter(Ye=>Ye.clientId===$.id),ye=pe.reduce((Ye,Ve)=>Ye+parseFloat(Ve.amount||"0"),0),Be=(Le=$.email)==null?void 0:Le.toLowerCase().trim(),es=ss.filter(Ye=>{var ys;return((ys=Ye.emailLock)==null?void 0:ys.toLowerCase().trim())===Be}).reduce((Ye,Ve)=>{let nt=0;return Ve.actualPrice!==null&&Ve.actualPrice!==void 0?nt=parseFloat(String(Ve.actualPrice)):Ve.paidAmount!==null&&Ve.paidAmount!==void 0?nt=parseFloat(String(Ve.paidAmount)):Ve.discountValue!==null&&Ve.discountValue!==void 0&&(nt=parseFloat(String(Ve.discountValue))),Ye+nt},0),ls=ps.filter(Ye=>{var Fs;const nt=((Fs=Ye.email)==null?void 0:Fs.toLowerCase().trim())===Be,ys=Ye.clientId===$.id;return nt||ys}).reduce((Ye,Ve)=>Ve.totalPaid!==null&&Ve.totalPaid!==void 0?Ye+parseFloat(String(Ve.totalPaid)):Ye,0),ae=ye+es+ls,Re=pe.sort((Ye,Ve)=>new Date(Ve.createdAt||0).getTime()-new Date(Ye.createdAt||0).getTime())[0];return{totalBookings:pe.length,totalSpent:ae,lastActive:Re?rr(Re.createdAt||new Date):"Never"}},tt=$=>{var pe;return((pe=$.memberships)==null?void 0:pe.filter(ye=>ye.status==="active"))||[]},Jt=f.useMemo(()=>{let $=nn;if(L){const pe=L.toLowerCase();if(pe.startsWith("tag:")){const ye=pe.substring(4).trim();
728ye?$=nn.filter(Be=>Be.tags&&Be.tags.toLowerCase().includes(ye)):$=nn.filter(Be=>Be.tags&&Be.tags.trim().length>0)}else if(pe.startsWith("achievement:")){const ye=pe.substring(12).trim();if(ye){const Be=new Set(Ht.filter(Ze=>Ze.name.toLowerCase().includes(ye)).map(Ze=>Ze.clientId));$=nn.filter(Ze=>Be.has(Ze.id))}else{const Be=new Set(Ht.map(Ze=>Ze.clientId));$=nn.filter(Ze=>Be.has(Ze.id))}}else $=nn.filter(ye=>ye.email.toLowerCase().includes(pe)||ye.name&&ye.name.toLowerCase().includes(pe)||ye.phone&&ye.phone.toLowerCase().includes(pe)||ye.tags&&ye.tags.toLowerCase().includes(pe))}return $.sort((pe,ye)=>{let Be=0;if(J==="name"){const Ze=pe.name||pe.email,es=ye.name||ye.email;Be=Ze.localeCompare(es)}else J==="email"?Be=pe.email.localeCompare(ye.email):J==="date"&&(Be=new Date(pe.createdAt||0).getTime()-new Date(ye.createdAt||0).getTime());return re==="desc"?-Be:Be}),$},[nn,L,J,re,Ht]),ds=xt({mutationFn:async $=>{const pe=await Pe("POST","/api/clients/import",{csvData:$});if(!pe.ok){const ye=await pe.json();throw new Error(ye.message||"Failed to import clients")}return pe.json()},onSuccess:$=>{ue({title:"Import successful",description:$.message}),M(!1),Q(""),Me.invalidateQueries({queryKey:["/api/clients"]}),Me.invalidateQueries({queryKey:["/api/clients/tags"]})},onError:$=>{ue({title:"Import failed",description:$.message||"Failed to import clients",variant:"destructive"})}}),zs=xt({mutationFn:async $=>{const pe=[$.firstName,$.surname].filter(Boolean).join(" ")||null,ye=await Pe("POST","/api/clients",{email:$.email,name:pe,phone:$.phone||null});if(!ye.ok){const Be=await ye.json();throw new Error(Be.message||"Failed to create client")}return ye.json()},onSuccess:($,pe)=>{ue({title:"Client added",description:pe.formId?"Client added. Sending onboarding form email…":"Client has been successfully added."}),G(!1),ie(""),ge(""),ke(""),$e(""),ft(null),Me.invalidateQueries({queryKey:["/api/clients"]}),Me.invalidateQueries({queryKey:["/api/clients/tags"]}),$!=null&&$.id&&pe.formId&&We.mutate({clientId:$.id,formId:pe.formId},{onSuccess:()=>{ue({title:"Onboarding form sent",description:"The client will receive an email with a link to complete the form."})},onError:ye=>{ue({title:"Form email could not be sent",description:ye.message||"Client was added but the form link could not be sent.",variant:"destructive"})}})},onError:$=>{ue({title:"Failed to add client",description:$.message||"Failed to create client",variant:"destructive"})}}),De=(e==null?void 0:e.requiresSubscription)&&(e==null?void 0:e.trialEndsAt)&&new Date(e.trialEndsAt)<new Date&&(e==null?void 0:e.subscriptionStatus)!=="active";if(console.log("🔍 Trial status check:",{requiresSubscription:e==null?void 0:e.requiresSubscription,trialEndsAt:e==null?void 0:e.trialEndsAt,trialExpired:e!=null&&e.trialEndsAt?new Date(e.trialEndsAt)<new Date:!1,subscriptionStatus:e==null?void 0:e.subscriptionStatus,isTrialExpired:De}),De)return s.jsx("div",{className:"bg-slate-50 flex justify-center p-4",children:s.jsx(Ce,{className:"w-full max-w-md mt-8",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"w-16 h-16 bg-orange-100 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx("span",{className:"text-2xl",children:"⏰"})}),s.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Trial Expired"}),s.jsx("p",{className:"text-slate-600",children:"Your 30-day free trial has ended. Subscribe to continue accessing your admin dashboard and manage your classes."})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(B,{onClick:()=>window.location.href="/profile",className:"w-full",children:"Subscribe Now - £15/month"}),s.jsx(B,{onClick:()=>{localStorage.clear(),window.location.href="/"},variant:"outline",className:"w-full",children:"Logout"})]})]})})});const we=()=>{const $=new Set;Jt.forEach(ae=>{if(ae.onboardingData)try{const Re=typeof ae.onboardingData=="string"?JSON.parse(ae.onboardingData):ae.onboardingData;Object.keys(Re).forEach(Le=>{Re[Le]!==null&&Re[Le]!==void 0&&$.add(Le)})}catch{console.warn("Failed to parse onboarding data for client:",ae.email)}});const pe=Array.from($).sort(),ye=Jt.map(ae=>{const Re=He(ae);let Le={};if(ae.onboardingData)try{const nt=typeof ae.onboardingData=="str
728ing"?JSON.parse(ae.onboardingData):ae.onboardingData;pe.forEach(ys=>{const Fs=nt[ys];Fs==null?Le[ys]="":typeof Fs=="object"?Le[ys]=JSON.stringify(Fs):Le[ys]=String(Fs)})}catch{console.warn("Failed to parse onboarding data for client:",ae.email),pe.forEach(ys=>{Le[ys]=""})}else pe.forEach(nt=>{Le[nt]=""});const Ve=Ht.filter(nt=>nt.clientId===ae.id).sort((nt,ys)=>new Date(ys.achievementDate).getTime()-new Date(nt.achievementDate).getTime()).map(nt=>`${nt.name} (${rr(nt.achievementDate)})`).join("; ");return{Name:ae.name||"",Email:ae.email,Phone:ae.phone||"","Emergency Contact":ae.emergencyContactName||"","Emergency Phone":ae.emergencyContactPhone||"",Tags:ae.tags||"",Achievements:Ve||"","Marketing Consent":ae.marketingConsent?"Yes":"No","Total Bookings":Re.totalBookings,"Total Spent":`£${Re.totalSpent.toFixed(2)}`,"Member Since":rr(ae.createdAt||new Date),"Last Active":Re.lastActive,...Le}}),Be=ae=>ae==null?'""':`"${String(ae).replace(/"/g,'""')}"`,Ze=[Object.keys(ye[0]||{}).map(Be).join(","),...ye.map(ae=>Object.values(ae).map(Be).join(","))].join(`
729`),es=new Blob([Ze],{type:"text/csv"}),Ns=window.URL.createObjectURL(es),ls=document.createElement("a");ls.href=Ns,ls.download=`clients-export-${new Date().toISOString().split("T")[0]}.csv`,document.body.appendChild(ls),ls.click(),document.body.removeChild(ls),window.URL.revokeObjectURL(Ns),ue({title:"Export successful",description:`Exported ${Jt.length} clients to CSV`})},ot=($,pe)=>{const ye=[["Client Name","Achievement Name","Achieved Date"],[pe||"Unknown",$.name,rr($.achievementDate)]],Be=Le=>Le==null?'""':`"${String(Le).replace(/"/g,'""')}"`,Ze=ye.map(Le=>Le.map(Be).join(",")).join(`
730`),es=new Blob([Ze],{type:"text/csv"}),Ns=window.URL.createObjectURL(es),ls=document.createElement("a"),ae=(pe||"client").replace(/[^a-z0-9]/gi,"_").toLowerCase(),Re=$.name.replace(/[^a-z0-9]/gi,"_").toLowerCase();ls.download=`certificate-${ae}-${Re}-${new Date().toISOString().split("T")[0]}.csv`,ls.href=Ns,document.body.appendChild(ls),ls.click(),document.body.removeChild(ls),window.URL.revokeObjectURL(Ns),ue({title:"Export successful",description:`Exported achievement data for ${$.name}`})},_t=$=>{var Be;const pe=(Be=$.target.files)==null?void 0:Be[0];if(!pe)return;const ye=new FileReader;ye.onload=Ze=>{var Ns;const es=(Ns=Ze.target)==null?void 0:Ns.result;Q(es)},ye.readAsText(pe)},K=Array.isArray(e==null?void 0:e.featureFlags)&&e.featureFlags.includes("events")&&!r;return s.jsxs(s.Fragment,{children:[s.jsxs(Ce,{children:[s.jsxs(sc,{value:be,onValueChange:Fe,className:"w-full",children:[s.jsxs("div",{className:"border-b border-slate-200",children:[s.jsx("div",{className:"hidden lg:block",children:s.jsxs(Hi,{className:`grid w-full ${K?"grid-cols-6":"grid-cols-5"} bg-transparent h-auto p-0`,children:[s.jsx(Ts,{value:"classes",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-sm",children:(e==null?void 0:e.terminologyPlural)||"Classes"}),s.jsx(Ts,{value:"services",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-sm",children:"Services"}),s.jsx(Ts,{value:"bookings",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-sm",children:"Bookings"}),s.jsx(Ts,{value:"clients",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-sm",children:"Clients"}),s.jsx(Ts,{value:"memberships",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-sm",children:"Memberships"}),K&&s.jsx(Ts,{value:"events",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-sm",children:"Events"})]})}),s.jsx("div",{className:"lg:hidden overflow-x-auto",children:s.jsxs(Hi,{className:"inline-flex w-auto min-w-full bg-transparent h-auto p-0",children:[s.jsx(Ts,{value:"classes",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent roun
730ded-none py-4 text-xs whitespace-nowrap flex-shrink-0",children:"Classes"}),s.jsx(Ts,{value:"services",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-xs whitespace-nowrap flex-shrink-0",children:"Services"}),s.jsx(Ts,{value:"bookings",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-xs whitespace-nowrap flex-shrink-0",children:"Bookings"}),s.jsx(Ts,{value:"clients",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-xs whitespace-nowrap flex-shrink-0",children:"Clients"}),s.jsx(Ts,{value:"memberships",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-xs whitespace-nowrap flex-shrink-0",children:"Memberships"}),K&&s.jsx(Ts,{value:"events",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-xs whitespace-nowrap flex-shrink-0",children:"Events"})]})})]}),s.jsxs(on,{value:"classes",className:"p-4 md:p-6",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:_e?`Archived ${e.terminologyPlural||"classes"}`:`${e.terminologySingular} Management`}),_e&&s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Restore a class to show it in your main list again, or delete it if it has no bookings."})]}),s.jsxs("div",{className:"flex space-x-2",children:[s.jsxs(B,{onClick:n,className:"hidden lg:flex",variant:"secondary",children:[s.jsx(lr,{className:"h-4 w-4 mr-2"}),"Create ",(e==null?void 0:e.terminologySingular)||"Class"," with AI"]}),s.jsxs(B,{onClick:t,className:"hidden lg:flex",children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Create ",(e==null?void 0:e.terminologySingular)||"Class"]}),s.jsx(B,{onClick:n,size:"sm",className:"lg:hidden h-9 w-9 p-0",title:`Create ${(e==null?void 0:e.terminologySingular)||"Class"} with AI`,variant:"secondary",children:s.jsx(lr,{className:"h-4 w-4"})}),s.jsx(B,{onClick:t,size:"sm",className:"lg:hidden h-9 w-9 p-0",title:"Create Class",children:s.jsx(Gs,{className:"h-4 w-4"})})]})]}),Qt?s.jsx("div",{className:"text-center py-8",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full mx-auto"})}):s.jsx(Ce,{className:"border-0 md:border",children:s.jsx(Ee,{className:"p-0",children:Js.length===0?s.jsx("div",{className:"py-12 px-4 text-center text-slate-500 text-sm",children:_e?`No archived ${(e==null?void 0:e.terminologyPlural)||"classes"}.`:`No ${(e==null?void 0:e.terminologyPlural)||"classes"} yet. Create one using the buttons above.`}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"hidden lg:block",children:s.jsx("div",{className:"overflow-x-auto max-h-[32rem] overflow-y-auto",children:s.jsxs(qd,{children:[s.jsx(Wd,{children:s.jsxs(Ra,{className:"border-b border-slate-200",children:[s.jsxs(Es,{children:[e.terminologySingular," Name"]}),s.jsx(Es,{children:"Schedule"}),s.jsx(Es,{children:"Capacity"}),s.jsx(Es,{children:"Price"}),s.jsx(Es,{children:"Visibility"}),s.jsx(Es,{children:"Actions"})]})}),s.jsx(Hd,{children:Js.map($=>s.jsxs(Ra,{children:[s.jsx(Ds,{children:s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-slate-900",children:$.name}),s.jsx("div",{className:"text-sm text-slate-500",children:$.description&&$.description.length>180?`${$.description.substring(0,180)}...`:$.description})]})}),s.jsx(Ds,{children:(()=>{const pe=ts.get($.id)??[];if(pe.length>0)return s.jsx("div",{className:"text-sm text-slate-900 space-y-0.5",children:[$,...pe].map(Be=>s.jsx("div",{children:cs(Be)},Be.id))});let ye=!1;try{$.startTime.startsWith("{")&&(JSON.parse($.startTime),ye=!0)}catch{}if(ye)try{const Be=JSON.parse($.startTime),Ze=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],es=Object.keys(Be).map(Ns=>
730Ze[parseInt(Ns)]).filter(Boolean);return s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-slate-900 font-medium",children:"Multiple Days"}),s.jsx("div",{className:"text-sm text-slate-500",children:es.join(", ")}),s.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"Various times"})]})}catch{return s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-slate-900",children:"Dynamic Schedule"}),s.jsx("div",{className:"text-sm text-slate-500",children:"Various times"})]})}else return s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-slate-900",children:gs($.dayOfWeek)}),s.jsxs("div",{className:"text-sm text-slate-500",children:[Os($.startTime)," - ",Os(String(Math.floor((parseInt($.startTime.split(":")[0])*60+parseInt($.startTime.split(":")[1])+$.duration)/60)).padStart(2,"0")+":"+String((parseInt($.startTime.split(":")[0])*60+parseInt($.startTime.split(":")[1])+$.duration)%60).padStart(2,"0"))]})]})})()}),s.jsxs(Ds,{children:[$.maxCapacity," people"]}),s.jsx(Ds,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[$.allowSingleBooking===!1&&$.hasPackages?s.jsx("span",{className:"text-slate-700",children:"Package"}):s.jsxs(s.Fragment,{children:[s.jsx("span",{children:$.singlePrice!=null&&$.singlePrice!==""?`${mt((e==null?void 0:e.currency)||"GBP")}${$.singlePrice}`:`${mt((e==null?void 0:e.currency)||"GBP")}0.00`}),$.package4Price&&s.jsxs("span",{className:"text-slate-500 text-xs",children:[" ","/ ",mt((e==null?void 0:e.currency)||"GBP"),$.package4Price," (4-pack)"]})]}),$.allowSingleBooking!==!1&&$.hasPackages&&s.jsx(Je,{variant:"secondary",className:"text-[10px] px-1.5 py-0 w-fit mt-0.5",children:"Package"})]})}),s.jsx(Ds,{children:s.jsx("div",{className:"space-y-1",children:$.isActive&&$.showOnInstructorPage!==!1?s.jsx(Je,{variant:"default",className:"text-xs px-1.5 py-0 h-5 text-[10px] min-w-[60px] flex items-center justify-center",children:"Everywhere"}):$.isActive?s.jsx(Je,{variant:"default",className:"text-xs px-1.5 py-0 h-5 text-[10px] min-w-[60px] flex items-center justify-center",children:"Public"}):$.showOnInstructorPage!==!1?s.jsx(Je,{variant:"default",className:"text-xs px-1.5 py-0 h-5 text-[10px] min-w-[60px] flex items-center justify-center",children:"My Page"}):s.jsx(Je,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5 text-[10px] min-w-[60px] flex items-center justify-center",children:"Hidden"})})}),s.jsx(Ds,{children:s.jsxs("div",{className:"flex space-x-2",children:[s.jsx(B,{size:"sm",variant:"ghost",onClick:()=>O($),children:s.jsx(Ur,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"ghost",onClick:()=>_($),title:"Duplicate Class",children:s.jsx(pr,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"ghost",onClick:()=>k($),title:"Private Links",children:s.jsx(Tf,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"ghost",onClick:()=>W($),title:"Manage Dates",children:s.jsx(Ls,{className:"h-4 w-4"})}),$.waitlistEnabled&&s.jsx(B,{size:"sm",variant:"ghost",onClick:()=>H($),title:"View Waitlist",children:s.jsx(G2,{className:"h-4 w-4"})}),_e?s.jsxs(s.Fragment,{children:[s.jsx(B,{size:"sm",variant:"ghost",onClick:()=>fe.mutate($.id),disabled:de.isPending||fe.isPending||pt.isPending,title:"Restore",children:s.jsx(dm,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"ghost",className:"text-red-600 hover:text-red-700",onClick:()=>pt.mutate($.id),disabled:de.isPending||fe.isPending||pt.isPending,title:"Delete permanently",children:s.jsx(ln,{className:"h-4 w-4"})})]}):s.jsx(B,{size:"sm",variant:"ghost",className:"text-red-600 hover:text-red-700",onClick:()=>de.mutate($.id),disabled:de.isPending||fe.isPending,title:"Archive",children:s.jsx(gM,{className:"h-4 w-4"})})]})})]},$.id))})]})})}),s.jsx("div",{className:"lg:hidden space-y-4 max-h-[32rem] overflow-y-auto",children:Js.map($=>s.jsx(Ce,{className:"relative",children:s.jsxs(Ee,{className:"p-4",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:`w-3 h-3 rounded-full ${Tr($.classType)}`}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"font-medium text-slate-900 text-sm",children:$.name}),s.jsx("div",{className:"flex gap-1 mt-1",children:$.isActive&&$.showOnInstructorPage!==!1?s.jsx(Je,{variant:"default",className:"text-xs",children:"Everywhere"}):$.isActive?s.jsx(Je,{variant:"default",className:"text-xs",children:"Public"}):$.showOnInstructorPage!==!1?s.jsx(Je,{variant:"default",className:"text-xs",children:"My Page"}):s.jsx(Je,{variant:"secondary",className:"text-xs",children:"Hidden"})})]})]}),s.jsx("div",{className:"text-xs text-slate-500",children:$.description&&$.description.length>80?`${$.description.substring(0,80)}...`:$.description}),s.jsxs("div",{className:"flex justify-between text-xs",children:[s.jsx("div",{children:(()=>{const pe=ts.get($.id)??[];if(pe.length>0)return s.jsx("div",{className:"text-slate-900 space-y-0.5",children:[$,...pe].map(Be=>s.jsx("div",{children:cs(Be)},Be.id))});let ye=!1;try{$.startTime.startsWith("{")&&(JSON.parse($.startTime),ye=!0)}catch{}if(ye)try{const Be=JSON.parse($.startTime),Ze=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],es=Object.keys(Be).map(Ns=>
730Ze[parseInt(Ns)]).filter(Boolean);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-slate-900 font-medium",children:"Multiple Days"}),s.jsx("div",{className:"text-slate-500",children:es.join(", ")})]})}catch{return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-slate-900 font-medium",children:"Dynamic"}),s.jsx("div",{className:"text-slate-500",children:"Various times"})]})}else return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-slate-900 font-medium",children:gs($.dayOfWeek)}),s.jsxs("div",{className:"text-slate-500",children:[Os($.startTime)," - ",Os(String(Math.floor((parseInt($.startTime.split(":")[0])*60+parseInt($.startTime.split(":")[1])+$.duration)/60)).padStart(2,"0")+":"+String((parseInt($.startTime.split(":")[0])*60+parseInt($.startTime.split(":")[1])+$.duration)%60).padStart(2,"0"))]})]})})()}),s.jsxs("div",{className:"text-right",children:[s.jsxs("div",{className:"text-slate-900 font-medium",children:[$.maxCapacity," people"]}),s.jsx("div",{className:"text-slate-500",children:"Max capacity"})]})]}),s.jsxs("div",{className:"text-xs flex flex-col gap-0.5",children:[$.allowSingleBooking===!1&&$.hasPackages?s.jsx("div",{className:"text-slate-900 font-medium",children:"Package"}):s.jsx("div",{className:"text-slate-900 font-medium",children:$.singlePrice!=null&&$.singlePrice!==""?`${mt((e==null?void 0:e.currency)||"GBP")}${$.singlePrice}`:`${mt((e==null?void 0:e.currency)||"GBP")}0.00`}),$.allowSingleBooking!==!1&&$.hasPackages&&s.jsx(Je,{variant:"secondary",className:"text-[10px] px-1.5 py-0 w-fit",children:"Package"})]})]}),s.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center space-x-1",children:[s.jsx(B,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",onClick:()=>O($),title:"Edit Class",children:s.jsx(Ur,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",onClick:()=>_($),title:"Duplicate Class",children:s.jsx(pr,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",onClick:()=>k($),title:"Private Links",children:s.jsx(Tf,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",onClick:()=>W($),title:"Manage Dates",children:s.jsx(Ls,{className:"h-4 w-4"})}),$.waitlistEnabled&&s.jsx(B,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",onClick:()=>H($),title:"View Waitlist",children:s.jsx(G2,{className:"h-4 w-4"})}),_e?s.jsxs(s.Fragment,{children:[s.jsx(B,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",onClick:()=>fe.mutate($.id),disabled:de.isPending||fe.isPending||pt.isPending,title:"Restore",children:s.jsx(dm,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",onClick:()=>pt.mutate($.id),disabled:de.isPending||fe.isPending||pt.isPending,title:"Delete permanently",children:s.jsx(ln,{className:"h-4 w-4"})})]}):s.jsx(B,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",onClick:()=>de.mutate($.id),disabled:de.isPending||fe.isPending,title:"Archive",children:s.jsx(gM,{className:"h-4 w-4"})})]})]})},$.id))})]})})}),!Qt&&s.jsx("div",{className:"mt-4 text-center",children:s.jsx("button",{type:"button",className:"text-sm text-primary hover:underline",onClick:()=>ze($=>!$),children:_e?`Back to active ${(e==null?void 0:e.terminologyPlural)||"classes"}`:`View archived ${(e==null?void 0:e.terminologyPlural)||"classes"}`})}),s.jsx(Ce,{className:"mt-6",children:s.jsxs(Ee,{className:"p-4 md:p-6",children:[s.jsxs("div",{className:"mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2 cursor-pointer select-none",onClick:()=>o($=>!$),children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 flex items-center",children:"Get Embed Code"}),i?s.jsx(vi,{className:"h-5 w-5 text-slate-500 transition-transform duration-200"}):s.jsx(Ji,{className:"h-5 w-5 text-slate-500 transition-transform duration-200"})]}),s.jsx("p",{className:"text-sm text-slate-600 mt-1",children:"Embed your live calendar on your own website. "})]}),i&&s.jsxs("div",{children:[s.jsxs("p",{className:"text-sm text-slate-600 mt-1",children:["Put this code in your website's ",s.jsx("code",{className:"bg-slate-100 rounded p-1 text-xs font-mono break-all select-all",children:"<head>"})," section:"]}),s.jsx("div",{className:"bg-slate-100 rounded p-3 text-xs font-mono break-all select-all mb-4 mt-2",children:`<link rel="stylesheet" href="https://classta.co/css/embed-styles.css">
731<script src="https://classta.co/js/embed-helper.min.js"><\/script>`}),s.jsx("p",{className:"text-sm text-slate-600 mt-1",children:"The
731n add this code to your website where you want the calendar to appear:"}),s.jsx("div",{className:"bg-slate-100 rounded p-3 text-xs font-mono break-all select-all mt-2",children:`<iframe src="https://classta.co/embed/${(e==null?void 0:e.subdomain)||""}" style="width:100%; min-width:320px; border:none; background:transparent;" allow="payment" allowtransparency="true" loading="lazy" title="Class Booking Calendar"></iframe>`}),s.jsxs("p",{className:"text-sm text-slate-500 mt-2 italic",children:["Optional: Add ",s.jsx("code",{className:"bg-slate-100 rounded px-1 text-xs",children:"height:800px"})," to the style attribute if you want a specific height."]}),s.jsxs("div",{className:"mt-4 p-3 bg-amber-50 border border-amber-200 rounded-lg",children:[s.jsx("p",{className:"text-sm font-medium text-amber-900 mb-1",children:"Apple Pay & one-click payments in embeds"}),s.jsxs("p",{className:"text-xs text-amber-800",children:["When the calendar is embedded on your own website, checkout runs inside this iframe (the ",s.jsx("code",{className:"bg-amber-100 px-1 rounded",children:'allow="payment"'})," above is required for Apple Pay in Safari 17+). For Apple Pay to work, both ",s.jsx("strong",{children:"classta.co"})," and ",s.jsx("strong",{children:"your website domain"})," must be registered as payment method domains in your Stripe account. In Stripe Dashboard go to Settings → Payment methods → Domains and add both. ",s.jsx("a",{href:"https://docs.stripe.com/payments/payment-methods/pmd-registration",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Stripe docs"}),"."]})]}),s.jsxs("div",{className:"mt-4 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:[s.jsx("p",{className:"text-sm font-medium text-blue-900 mb-2",children:"Customize which sections appear in your embed"}),s.jsxs("p",{className:"text-xs text-blue-800 mb-2",children:["Add ",s.jsx("code",{className:"bg-blue-100 px-1 rounded",children:"?show="})," to the embed URL to control which sections are displayed:"]}),s.jsxs("ul",{className:"text-xs text-blue-800 space-y-1 ml-4 list-disc",children:[s.jsxs("li",{children:[s.jsx("code",{className:"bg-blue-100 px-1 rounded",children:"?show=classes"})," - Show only the calendar"]}),s.jsxs("li",{children:[s.jsx("code",{className:"bg-blue-100 px-1 rounded",children:"?show=bundles"})," - Show only class bundles"]}),s.jsxs("li",{children:[s.jsx("code",{className:"bg-blue-100 px-1 rounded",children:"?show=services"})," - Show only services"]}),s.jsxs("li",{children:[s.jsx("code",{className:"bg-blue-100 px-1 rounded",children:"?show=memberships"})," - Show only memberships"]}),s.jsxs("li",{children:[s.jsx("code",{className:"bg-blue-100 px-1 rounded",children:"?show=classes,bundles"})," - Show calendar and bundles"]}),s.jsxs("li",{children:[s.jsx("code",{className:"bg-blue-100 px-1 rounded",children:"?show=all"})," or no parameter - Show all sections (default)"]})]}),s.jsxs("p",{className:"text-xs text-blue-800 mt-2",children:[s.jsx("strong",{children:"Example:"})," ",s.jsx("code",{className:"bg-blue-100 px-1 rounded",children:`https://classta.co/embed/${(e==null?void 0:e.subdomain)||"your-subdomain"}?show=classes,services`})]})]})]})]})}),s.jsx(Ce,{className:"mt-6",children:s.jsxs(Ee,{className:"p-4 md:p-6",children:[s.jsxs("div",{className:"mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2 cursor-pointer select-none",onClick:()=>c($=>
731!$),children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 flex items-center",children:"Calendar Sync"}),l?s.jsx(vi,{className:"h-5 w-5 text-slate-500 transition-transform duration-200"}):s.jsx(Ji,{className:"h-5 w-5 text-slate-500 transition-transform duration-200"})]}),s.jsxs("p",{className:"text-sm text-slate-600 mb-4",children:["Subscribe to your ",((e==null?void 0:e.terminologySingular)||"class").toLowerCase()," schedule in any calendar app"]})]}),l&&s.jsx("div",{children:s.jsx(x1e,{termSingular:(e==null?void 0:e.terminologySingular)||"Class",termPlural:(e==null?void 0:e.terminologyPlural)||"Classes"})})]})})]}),s.jsx(on,{value:"bookings",className:"p-4 md:p-6",children:s.jsx(Vve,{termSingular:(e==null?void 0:e.terminologySingular)||"Class",termPlural:(e==null?void 0:e.terminologyPlural)||"Classes",currency:(e==null?void 0:e.currency)||"GBP",onClientClick:$=>{const pe=nn.find(ye=>ye.id===$.id)??$;m(pe)},hideRevenue:r,showTestReminderButtons:a})}),s.jsx(on,{value:"services",className:"p-4 md:p-6",children:s.jsx(y1e,{instructorId:e==null?void 0:e.id,currency:(e==null?void 0:e.currency)||"GBP",subdomain:e==null?void 0:e.subdomain})}),K&&s.jsxs(on,{value:"events",className:"p-4 md:p-6",children:[s.jsxs("div",{className:"mb-4 rounded-lg border border-sky-200 bg-sky-50 p-3 text-sm text-slate-700",children:[s.jsx("span",{className:"mr-1","aria-hidden":!0,children:"ℹ️"}),"Classta Events are designed for simple ticket sales."," ",s.jsx("a",{href:"https://help.classta.co/article/557-classta-events-simple-ticket-sales-for-workshops-and-one-off-events",target:"_blank",rel:"noopener noreferrer",className:"font-medium text-sky-700 underline hover:text-sky-800",children:"Learn what Events can do"})]}),s.jsx(b1e,{instructorId:e==null?void 0:e.id,currency:(e==null?void 0:e.currency)||"GBP",subdomain:e==null?void 0:e.subdomain,eventsPageTitle:e==null?void 0:e.eventsPageTitle,eventsPageLogoUrl:e==null?void 0:e.eventsPageLogoUrl,eventsPageDescription:e==null?void 0:e.eventsPageDescription,logoUrl:e==null?void 0:e.logoUrl,onBookerClick:($,pe)=>at($,"This booker may not have a client record yet. Records are created when they complete a required form or book a class.",pe),onEventsPageSetupSave:async({eventsPageTitle:$,eventsPageDescription:pe})=>{await Pe("PATCH","/api/instructor/settings",{eventsPageTitle:$,eventsPageDescription:pe}),Me.invalidateQueries({queryKey:[`/api/instructors/${e==null?void 0:e.id}`]})},onEventsPageLogoChanged:()=>{Me.invalidateQueries({queryKey:[`/api/instructors/${e==null?void 0:e.id}`]})}})]}),s.jsxs(on,{value:"clients",className:"p-4 md:p-6",children:[s.jsxs("div",{className:"hidden lg:flex justify-between items-center mb-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Client Management"}),s.jsxs("div",{className:"flex space-x-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Eh,{className:"absolute left-3 top-3 h-4 w-4 text-slate-400"}),s.jsx(me,{placeholder:"Search clients...",className:"pl-10 w-64",value:L,onChange:$=>U($.target.value)})]}),s.jsxs(Bt,{value:`${J}-${re}`,onValueChange:$=>{const[pe,ye]=$.split("-");I(pe),R(ye)},children:[s.jsx($t,{className:"w-48",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"name-asc",children:"Name (A-Z)"}),s.jsx(ce,{value:"name-desc",children:"Name (Z-A)"}),s.jsx(ce,{value:"email-asc",children:"Email (A-Z)"}),s.jsx(ce,{value:"email-desc",children:"Email (Z-A)"}),s.jsx(ce,{value:"date-desc",children:"Newest First"}),s.jsx(ce,{value:"date-asc",children:"Oldest First"})]})]}),s.jsxs(B,{variant:"outline",className:"flex items-center space-x-2",onClick:()=>G(!0),children:[s.jsx(Gs,{className:"h-4 w-4"}),s.jsx("span",{children:"Add"})]}),s.jsxs(B,{variant:"outline",className:"flex items-center space-x-2",onClick:()=>M(!0),children:[s.jsx(id,{className:"h-4 w-4"}),s.jsx("span",{children:"Import"})]}),s.jsxs(B,{variant:"outline",className:"flex items-center space-x-2",onClick:we,children:[s.jsx(Li,{className:"h-4 w-4"}),s.jsx("span",{children:"Export List"})]})]})]}),s.jsxs("div",{className:"hidden md:block lg:hidden space-y-4 mb-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Client Management"}),s.jsxs("div",{className:"flex flex-wrap gap-3",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(E
731h,{className:"absolute left-3 top-3 h-4 w-4 text-slate-400"}),s.jsx(me,{placeholder:"Search clients...",className:"pl-10 w-full",value:L,onChange:$=>U($.target.value)})]}),s.jsxs(Bt,{value:`${J}-${re}`,onValueChange:$=>{const[pe,ye]=$.split("-");I(pe),R(ye)},children:[s.jsx($t,{className:"w-48",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"name-asc",children:"Name (A-Z)"}),s.jsx(ce,{value:"name-desc",children:"Name (Z-A)"}),s.jsx(ce,{value:"email-asc",children:"Email (A-Z)"}),s.jsx(ce,{value:"email-desc",children:"Email (Z-A)"}),s.jsx(ce,{value:"date-desc",children:"Newest First"}),s.jsx(ce,{value:"date-asc",children:"Oldest First"})]})]}),s.jsxs(B,{variant:"outline",className:"flex items-center space-x-2",onClick:()=>G(!0),children:[s.jsx(Gs,{className:"h-4 w-4"}),s.jsx("span",{children:"Add"})]}),s.jsxs(B,{variant:"outline",className:"flex items-center space-x-2",onClick:()=>M(!0),children:[s.jsx(id,{className:"h-4 w-4"}),s.jsx("span",{children:"Import"})]}),s.jsxs(B,{variant:"outline",className:"flex items-center space-x-2",onClick:we,children:[s.jsx(Li,{className:"h-4 w-4"}),s.jsx("span",{children:"Export List"})]})]})]}),s.jsxs("div",{className:"md:hidden space-y-4 mb-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Client Management"}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Eh,{className:"absolute left-3 top-3 h-4 w-4 text-slate-400"}),s.jsx(me,{placeholder:"Search clients...",className:"pl-10 w-full",value:L,onChange:$=>U($.target.value)})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(Bt,{value:`${J}-${re}`,onValueChange:$=>{const[pe,ye]=$.split("-");I(pe),R(ye)},children:[s.jsx($t,{className:"flex-1 min-w-0",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"name-asc",children:"Name (A-Z)"}),s.jsx(ce,{value:"name-desc",children:"Name (Z-A)"}),s.jsx(ce,{value:"email-asc",children:"Email (A-Z)"}),s.jsx(ce,{value:"email-desc",children:"Email (Z-A)"}),s.jsx(ce,{value:"date-desc",children:"Newest First"}),s.jsx(ce,{value:"date-asc",children:"Oldest First"})]})]}),s.jsx(B,{variant:"outline",size:"sm",className:"h-9 w-9 p-0 flex-shrink-0",onClick:()=>G(!0),title:"Add Client",children:s.jsx(Gs,{className:"h-4 w-4"})}),s.jsx(B,{variant:"outline",size:"sm",className:"h-9 w-9 p-0 flex-shrink-0",onClick:()=>M(!0),title:"Import",children:s.jsx(id,{className:"h-4 w-4"})}),s.jsx(B,{variant:"outline",size:"sm",className:"h-9 w-9 p-0 flex-shrink-0",onClick:we,title:"Export List",children:s.jsx(Li,{className:"h-4 w-4"})})]})]})]}),s.jsx("div",{className:"w-full",children:s.jsx("div",{children:s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-0",children:[s.jsx("div",{className:"p-4 border-b border-slate-200",children:s.jsx("h4",{className:"font-semibold text-slate-900",children:"Client Directory"})}),Vt?s.jsx("div",{className:"p-8 text-center",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full mx-auto"})}):s.jsx("div",{className:"divide-y divide-slate-200 max-h-[32rem] overflow-y-auto",children:Jt.length===0?s.jsx("div",{className:"p-8 text-center text-slate-500",children:L?"No clients match your search":"No clients found"}):Jt.map($=>{const pe=He($);return s.jsxs("div",{className:"p-4 hover:bg-slate-50 cursor-pointer relative",onClick:()=>m($),children:[s.jsxs("div",{className:"hidden md:flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[$.profilePictureUrl?s.jsx("div",{className:"h-12 w-8 flex-shrink-0 rounded overflow-hidden bg-slate-200",children:s.jsx("img",{src:$.profilePictureUrl,alt:$.name||$.email,className:"w-full h-full object-cover"})}):s.jsx("div",{className:"h-12 w-8 flex-shrink-0 rounded bg-slate-200 flex items-center justify-center",children:s.jsx(Dr,{className:"h-5 w-5 text-slate-600"})}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-slate-900",children:$.name&&$.name.trim()?`${$.name} - ${$.email}`:$.email}),s.jsxs("div",{className:"text-sm text-slate-500 flex items-center space-x-2",children:[s.jsxs("span",{children:[pe.totalBookings," classes booked • Last active: ",pe.lastActive]}),s.jsxs("span",{className:`px-2 py-0.5 text-xs rounded-full ${$.marketingConsent?"bg-green-100 text-green-800":"bg-gray-100 text-gray-600"}`,children:["Marketing: ",$.marketingConsent?"Yes":"No"]}),$.tags&&s.jsx(s.Fragment,{children:$.tags.split(",").map((ye,Be)=>{const Ze=ye.trim();return Ze?s.jsx(Je,{variant:"outline",className:"text-xs",children:Ze},Be):null})}),tt($).length>0&&s.jsxs(s.Fragment,{children:[tt($).map(ye=>s.jsx(Je,{variant:"secondary",className:"text-xs bg-purple-100 text-purple-800",children:ye.membershipName||`Membership ${ye.membershipId}`},ye.id)),s.jsx(B,{variant:"ghost",size:"sm",onClick:ye=>{ye.stopPropagation(),console.log("Manage resources for",$.email)},className:"h-6 w-6 p-0 text-purple-600 hover:text-purple-700",title:"Manage member resources",children:s.jsx(Ff,{className:"h-3 w-3"})})]})]})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[!r&&s.jsxs("div",{className:"text-right space-y-1",children:[s.jsx("div",{className:"text-sm font-medium text-slate-900",children:xe(pe.totalSpent)}
731),s.jsx("div",{className:"text-xs text-slate-500",children:"Total spent"}),$.balance!==void 0&&$.balance!==null&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:`text-sm font-medium ${parseFloat($.balance.toString())<0?"text-red-600":parseFloat($.balance.toString())>0?"text-green-600":"text-slate-900"}`,children:xe(parseFloat($.balance.toString()))}),s.jsx("div",{className:"text-xs text-slate-500",children:"Balance"})]})]}),pe.totalBookings===0&&s.jsx(B,{variant:"ghost",size:"sm",onClick:ye=>{ye.stopPropagation(),Cs($.id,$.name||$.email)},className:"text-red-600 hover:text-red-700",children:s.jsx(ln,{className:"h-4 w-4"})})]})]}),s.jsxs("div",{className:"md:hidden",children:[pe.totalBookings===0&&s.jsx(B,{variant:"ghost",size:"sm",onClick:ye=>{ye.stopPropagation(),Cs($.id,$.name||$.email)},className:"absolute top-2 right-2 text-red-600 hover:text-red-700 h-8 w-8 p-0 z-10",children:s.jsx(ln,{className:"h-4 w-4"})}),s.jsxs("div",{className:"pr-10 flex items-start gap-3",children:[$.profilePictureUrl?s.jsx("div",{className:"h-12 w-8 flex-shrink-0 rounded overflow-hidden bg-slate-200",children:s.jsx("img",{src:$.profilePictureUrl,alt:$.name||$.email,className:"w-full h-full object-cover"})}):s.jsx("div",{className:"h-12 w-8 flex-shrink-0 rounded bg-slate-200 flex items-center justify-center",children:s.jsx(Dr,{className:"h-5 w-5 text-slate-600"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[$.name&&$.name.trim()&&s.jsx("div",{className:"font-medium text-slate-900 text-sm leading-tight mb-1",children:$.name}),s.jsx("div",{className:"text-sm text-slate-600 break-all mt-0.5",children:$.email}),s.jsxs("div",{className:"text-sm text-slate-500 mt-1",children:[pe.totalBookings," classes booked • Last active: ",pe.lastActive]}),!r&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-baseline space-x-1 mt-2",children:[s.jsx("span",{className:"text-sm font-medium text-slate-900",children:xe(pe.totalSpent)}),s.jsx("span",{className:"text-xs text-slate-500",children:"Total spent"})]}),$.balance!==void 0&&$.balance!==null&&s.jsxs("div",{className:"flex items-baseline space-x-1 mt-1",children:[s.jsx("span",{className:`text-sm font-medium ${parseFloat($.balance.toString())<0?"text-red-600":parseFloat($.balance.toString())>0?"text-green-600":"text-slate-900"}`,children:xe(parseFloat($.balance.toString()))}),s.jsx("span",{className:"text-xs text-slate-500",children:"Balance"})]})]}),s.jsxs("div",{className:"mt-1 space-y-1",children:[s.jsx("div",{children:s.jsxs("span",{className:`px-2 py-0.5 text-xs rounded-full ${$.marketingConsent?"bg-green-100 text-green-800":"bg-gray-100 text-gray-600"}`,children:["Marketing: ",$.marketingConsent?"Yes":"No"]})}),$.tags&&s.jsx("div",{className:"flex flex-wrap gap-1",children:$.tags.split(",").map((ye,Be)=>{const Ze=ye.trim();return Ze?s.jsx(Je,{variant:"outline",className:"text-xs",children:Ze},Be):null})}),tt($).length>0&&s.jsxs("div",{className:"flex flex-wrap gap-1",children:[tt($).map(ye=>s.jsx(Je,{variant:"secondary",className:"text-xs bg-purple-100 text-purple-800",children:ye.membershipName||`Membership ${ye.membershipId}`},ye.id)),s.jsx(B,{variant:"ghost",size:"sm",onClick:ye=>{ye.stopPropagation(),console.log("Manage resources for",$.email)},className:"h-6 w-6 p-0 text-purple-600 hover:text-purple-700",title:"Manage member resources",children:s.jsx(Ff,{className:"h-3 w-3"})})]})]})]})]})]})]},$.id)})})]})})})})]}),s.jsx(on,{value:"memberships",className:"p-4 md:p-6",children:s.jsx(f1e,{instructorCurrency:(e==null?void 0:e.currency)||"GBP",onMemberClick:$=>at($)})})]}),z&&s.jsx(qV,{editingClass:z,onClose:()=>O(null)}),D&&s.jsx(Ct,{open:!!D,onOpenChange:()=>k(null),children:s.jsxs(St,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[s.jsx(kt,{children:s.jsxs(Pt,{children:["Private Booking Links - ",D.name]})}),s.jsx(Zve,{classId:D.id,className:D.name})]})}),s.jsx(Zi,{open:y,onOpenChange:$=>{g($),$||C(null)},children:s.jsxs(bi,{children:[s.jsxs(wi,{children:[s.jsx(Ni,{children:"Request Client Information Update"}),s.jsxs(Ci,{children:["This will send an email to ",s.jsx("strong",{children:d==null?void 0:d.email})," with a secure link to update their information.",s.jsx("br",{}),s.jsx("br",{}),s.jsxs("div",{className:"my-4",children:[s.jsx(V,{htmlFor:"form-select",className:"text-sm font-medium",children:"Select Form to Send:"}),s.jsxs(Bt,{value:(N==null?void 0:N.toString())||"",onValueChange:$=>C($?parseInt($):null),children:[s.jsx($t,{className:"w-full mt-1",children:s.jsx(Lt,{placeholder:"Choose a form..."})}),s.jsx(It,{children:hs.map($=>s.jsxs(ce,{value:$.id.toString(),children:[$.name," ",!$.isActive&&"(Inactive)"]},$.id))})]})]}),"The email will include:",s.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[s.jsx("li",{children:"A secure link that expires in 7 days"}),s.jsx("li",{children:"Access to update their contact details and form data"}),s.jsx("li",{children:"Pre-populated form with their current information"})]}),s.jsx("br",{}),"Do you want to send this email request to the client?"]})]}),s.jsxs(ji,{children:[s.jsx(to,{children:"Cancel"}),s.jsx(eo,{onClick:()=>{d&&N&&(We.mutate({clientId:d.id,formId:N}),g(!1),C(null))},disabled:We.isPending||!N,className:"bg-blue-600 hover:bg-blue-700 disabled:opacity-50",children:We.isPending?"Sending...":"Send Email"})]})]})}),F&&s.jsx(Ct,{open:!!F,onOpenChange:()=>W(null),children:s.jsxs(St,{className:"max-w-4xl max-h-[80vh] overflow-y-auto p-4 sm:p-6",children:[s.jsx(kt,{children:s.jsxs(Pt,{children:["Manage Class Dates - ",F.name]})}),s.jsx(p1e,{classId:F.id,className:F.name})]})}),q&&s.jsx(Ct,{open:!!q,onOpenChange:()=>H(null),children:s.jsxs(St,{className:"max-w-4xl max-h-[80vh] overflow-y-auto p-0 sm:p-6",children:[s.jsx(kt,{className:"px-4 sm:px-6 pt-4 sm:pt-0",children:s.jsxs(Pt,{children:["Waitlist - ",q.name]})}),s.jsx("div",{className:"px-4 sm:px-6 pb-4 sm:pb-6",children:s.jsx(C1e,{classId:q.id})})]})})]}),d&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onClick:$=>{$.target===$.currentTarget&&(m(null),h(null))},children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full mx-4 max-h-[90vh] overflow-y-auto",onClick:$=>$.stopPropagation(),children:[s.jsx("div",{className:"p-6 border-b",children:s.jsx("div",{className:"flex justify-between items-center",children:s.jsxs("div",{className:"relative w-full",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold text-slate-900",children:"Client Details"}),s.jsx("p",{className:"text-slate-600",children:d.email}),d.phone&&s.jsxs("p",{className:"text-slate-600 font-medium",children:["📞 ",d.phone]}),s.jsx("div",{className:"mt-2",children:s.jsxs("span",{className:`px-3 py-1 text-sm rounded-full ${d.marketingConsent?"bg-green-100 text-green-800":"bg-gray-100 text-gray-600"}`,children:["Marketing Consent: ",d.marketingConsent?"Yes":"No"]})})]}),s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>{m(null),h(null)},className:"absolute top-0 right-0 mt-1 mr-1 z-10","aria-label":"Close",children:"✕"}),s.jsx("div",{className:"flex items-center space-x-2 mt-4 md:mt-0 md:absolute md:top-0 md:right-12",children:s.jsx("div",{className:"flex flex-col md:flex-row md:items-center gap-2 w-full md:w-auto",children:!u&&s.jsxs(s.Fragment,{children:[s.jsx(B,{variant:"outline",size:"sm",onClick:()=>Ne(d),className:"w-full md:w-auto",children:"Edit Client"}),s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>g(!0),disabled:We.isPending,className:"bg-blue-50 hover:bg-blue-100 text-blue-600 border-blue-200 w-full md:w-auto",children:[s.jsx(_n,{className:"h-4 w-4 mr-2"}),"Request Update"]})]})})})]})})}),s.jsx("div",{className:"p-6 space-y-6",children:u&&u.id===d.id?s.jsxs("div",{children:[s.jsx("h4",{className:"text-lg font-medium text-slate-900 mb-4",children:"Edit Client Information"}),s.jsx(k1e,{client:u,onSave:rt,onCancel:()=>h(null),isLoading:Ke.isPending})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-lg font-medium text-slate-900 mb-4",children:"Profile Picture"}),s.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[d.profilePictureUrl?s.jsx("div",{className:"h-24 w-16 flex-shrink-0 rounded overflow-hidden bg-slate-200",children:s.jsx("img",{src:d.profilePictureUrl,alt:d.name||d.email,className:"w-full h-full object-cover"})}):s.jsx("div",{className:"h-24 w-16 flex-shrink-0 rounded bg-slate-200 flex items-center justify-center",children:s.jsx(Dr,{className:"h-10 w-10 text-slate-600"})}),s.jsx("div",{className:"flex gap-2",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(zV,{onUpload:async $=>{const pe=localStorage.getItem("auth_token"),ye=await fetch(`/api/clients/${d.id}/profile-picture/upload-url`,{method:"POST",headers:{Authorization:`Bearer ${pe}`,"Content-Type":"application/json"}});if(!ye.ok){const ae=await ye.json();throw new Error(ae.message||"Failed to get upload URL")}const{uploadURL:Be}=await ye.json();if(!(await fetch(Be,{method:"PUT",headers:{"Content-Type":$.type},body:$})).ok)throw new Error("Failed to upload image to storage");const es=await fetch(`/api/clients/${d.id}/profile-picture`,{method:"POST",headers:{Authorization:`Bearer ${pe}`,"Content-Type":"application/json"},body:JSON.stringify({profilePictureUrl:Be})});if(!es.ok){const ae=await es.json();throw new Error(ae.message||"Failed to update profile picture")}Me.invalidateQueries({queryKey:["/api/clients"]}),Me.invalidateQueries({queryKey:["/api/clients/tags"]}),ue({title:"Success!",description:"Profile picture uploaded successfully."});const ls=(await Me.fetchQuery({queryKey:["/api/clients"]})).find(ae=>ae.id===d.id);ls&&m(ls)},buttonClassName:"w-fit gap-2",children:[s.jsx(id,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:d.profilePictureUrl?"Change Picture":"Upload Picture"})]}),d.profilePictureUrl&&s.jsxs(B,{variant:"outline",size:"sm",className:"w-fit gap-2",onClick:async()=>{try{const $=d.profilePictureUrl,pe=await fetch($);if(!pe.ok)throw new Error("Failed to fetch image");const ye=await pe.blob(),Be=window.URL.createObjectURL(ye),Ze=document.createElement("a");Ze.href=Be,Ze.download=`profile-picture-${d.id}.jpg`,document.body.appendChild(Ze),Ze.click(),window.URL.revokeObjectURL(Be),document.body.removeChild(Ze),ue({title:"Downloaded",description:"Profile picture downloaded successfully."})}catch($){console.error("Download error:",$),ue({title:"Download Error",description:$.message||"Failed to download profile picture.",variant:"destructive"})}},children:[s.jsx(Li,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Download"})]})]})})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Photos will be cropped to passport photo format (2:3 ratio) for membership cards. Maximum file size: 5MB."})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-lg font-medium text-slate-900 mb-4",children:"Basic Information"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"bg-slate-50 p-4 rounded-lg",children:[s.jsx("h5",{className:"font-medium text-slate-900 mb-2",children:"Name"}),s.jsx("p",{className:"text-slate-700",children:d.name||"Not provided"})]}),s.jsxs("div",{className:"bg-slate-50 p-4 rounded-lg",children:[s.jsx("h5",{className:"font-medium text-slate-900 mb-2",children:"Email"}),s.jsx("p",{className:"text-slate-700",children:d.email})]}),s.jsxs("div",{className:"bg-slate-50 p-4 rounded-lg",children:[s.jsx("h5",{className:"font-medium text-slate-900 mb-2",children:"Phone"}),s.jsx("p",{className:"text-slate-700",children:d.phone||"Not provided"})]}),s.jsxs("div",{className:"bg-slate-50 p-4 rounded-lg",children:[s.jsx("h5",{className:"font-medium text-slate-900 mb-2",children:"Member Since"}),s.jsx("p",{className:"text-slate-700",children:rr(d.createdAt||new Date)})]}),d.emergencyContactName&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"bg-slate-50 p-4 rounded-lg",children:[s.jsx("h5",{className:"font-medium text-slate-900 mb-2",children:"Emergency Contact"}),s.jsx("p",{className:"text-slate-700",children:d.emergencyContactName})]}),s.jsxs("div",{className:"bg-slate-50 p-4 rounded-lg",children:[s.jsx("h5",{className:"font-medium text-slate-900 mb-2",children:"Emergency Phone"}),s.jsx("p",{className:"text-slate-700",children:d.emergencyContactPhone})]})]})]})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-lg font-medium text-slate-900 mb-4",children:"Active Memberships"}),(()=>{var pe;const $=((pe=d.memberships)==null?void 0:pe.filter(ye=>ye.status==="active"))||[];return $.length===0?s.jsx("p",{className:"text-slate-500 text-center py-4",children:"No active memberships"}):s.jsx("div",{className:"space-y-2",children:$.map(ye=>{const Be=Ss.find(Ze=>Ze.id===ye.membershipId);return s.jsxs("div",{className:"flex justify-between items-center p-3 bg-slate-50 rounded",children:[s.jsx("div",{children:s.jsx("span",{className:"font-medium text-slate-900",children:ye.membershipName||(Be==null?void 0:Be.name)||`Membership #${ye.membershipId}`})}),s.jsx("div",{className:"text-right",children:ye.currentPeriodEnd&&s.jsxs("span",{className:"text-sm text-slate-600",children:[h1(ye.stripeSubscriptionId)?"Renews":"Expires",":"," ",new Date(ye.currentPeriodEnd).toLocaleDateString()]})})]},ye.id)})})})()]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-lg font-medium text-slate-900 mb-4",children:"Recent Bookings"}),s.jsxs("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:[xn.filter($=>$.clientId===d.id).slice(0,5).map($=>{var pe,ye;return s.jsxs("div",{className:"flex justify-between items-center p-3 bg-slate-50 rounded",children:[s.jsx("span",{className:"font-medium text-slate-900",children:$.bookingType==="service"?((pe=$.service)==null?void 0:pe.name)||"Service":((ye
731=$.class)==null?void 0:ye.name)||"Class"}),s.jsx("span",{className:"text-slate-600",children:rr($.classDate)})]},$.id)}),xn.filter($=>$.clientId===d.id).length===0&&s.jsx("p",{className:"text-slate-500 text-center py-4",children:"No bookings yet"})]})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("h4",{className:"text-lg font-medium text-slate-900",children:"Achievements"}),s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>{b(null),j(!0)},children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Add Achievement"]})]}),w&&s.jsxs("div",{className:"mb-4 p-4 border border-slate-200 rounded-lg bg-slate-50",children:[s.jsx("h5",{className:"font-medium text-slate-900 mb-3",children:x?"Edit Achievement":"New Achievement"}),s.jsx(P1e,{achievement:x,onSubmit:$=>{x?Ot.mutate({achievementId:x.id,data:$}):Tt.mutate({clientId:d.id,data:$})},onCancel:()=>{j(!1),b(null)},isLoading:Tt.isPending||Ot.isPending})]}),s.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:vt.length===0?s.jsx("p",{className:"text-slate-500 text-center py-4",children:"No achievements recorded"}):[...vt].sort(($,pe)=>new Date(pe.achievementDate).getTime()-new Date($.achievementDate).getTime()).map($=>s.jsxs("div",{className:"flex justify-between items-start p-3 bg-slate-50 rounded",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("span",{className:"font-medium text-slate-900",children:$.name}),s.jsx("span",{className:"text-sm text-slate-600",children:rr($.achievementDate)})]}),$.description&&s.jsx("p",{className:"text-sm text-slate-600",children:$.description})]}),s.jsxs("div",{className:"flex gap-2 ml-4",children:[s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>ot($,d.name||d.email),title:"Export for certificate",children:s.jsx(Li,{className:"h-4 w-4"})}),s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>{b($),j(!0)},children:s.jsx(Ore,{className:"h-4 w-4"})}),s.jsxs(Zi,{children:[s.jsx(dO,{asChild:!0,children:s.jsx(B,{variant:"ghost",size:"sm",children:s.jsx(ln,{className:"h-4 w-4 text-red-600"})})}),s.jsxs(bi,{children:[s.jsxs(wi,{children:[s.jsx(Ni,{children:"Delete Achievement"}),s.jsx(Ci,{children:"Are you sure you want to delete this achievement? This action cannot be undone."})]}),s.jsxs(ji,{children:[s.jsx(to,{children:"Cancel"}),s.jsx(eo,{onClick:()=>Ft.mutate($.id),className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})]})]})]},$.id))})]}),d.onboardingData&&typeof d.onboardingData=="object"?s.jsxs("div",{children:[s.jsx("h4",{className:"text-lg font-medium text-slate-900 mb-4",children:"Onboarding Forms"}),(()=>{const $=d.onboardingData;if(Array.isArray($.formCompletions)&&$.formCompletions.length>0)return s.jsx("div",{className:"space-y-6",children:$.formCompletions.map((ye,Be)=>{const Ze=hs.find(Le=>Le.id===ye.formId),es=ye.formData||{},Ns=ye.completedAt?new Date(ye.completedAt).toLocaleDateString():"Unknown",ls=Le=>{if(Ze&&Ze.questions)try{const Ve=JSON.parse(Ze.questions).find(nt=>nt.id===Le);if(Ve&&Ve.label)return Ve.label}catch(Ye){console.warn("Failed to parse form questions:",Ye)}return/^\d+$/.test(Le)?`Field ${Le}`:Le.replace(/([A-Z])/g," $1").replace(/_/g," ").split(" ").map(Ye=>Ye.charAt(0).toUpperCase()+Ye.slice(1)).join(" ")},ae=Le=>typeof Le=="boolean"?Le?"Yes":"No":Array.isArray(Le)?Le.join(", "):Le.toString(),Re=Object.entries(es).filter(([Le])=>Le!=="formId"&&Le!=="completedAt"&&Le!=="formCompletions");return s.jsxs("div",{className:"border border-slate-200 rounded-lg p-4 bg-slate-50",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h5",{className:"font-semibold text-slate-900",children:(Ze==null?void 0:Ze.name)||`Form ${ye.formId}`}),s.jsxs(Je,{variant:"secondary",className:"text-xs",children:["Completed: ",Ns]})]}),Re.length>0?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Re.map(([Le,Ye])=>!Ye||Ye===""||typeof Ye=="boolean"&&!Ye?null:s.jsxs("div",{className:"bg-white p-3 rounded",children:[s.jsx("h6",{className:"text-sm font-medium text-slate-700 mb-1",children:ls(Le)}),s.jsx("p",{className:"text-sm text-slate-900",children:ae(Ye)})]},Le))}):s.jsx("p",{className:"text-sm text-slate-500 italic",children:"No form fields completed"})]},Be)})});const pe=$.formId;if(pe){const ye=hs.find(ls=>ls.id===pe),Be=$.completedAt?new Date($.completedAt).toLocaleDateString():"Unknown",Ze=ls=>{if(ye&&ye.questions)try{const Re=JSON.parse(ye.questions).find(Le=>Le.id===ls);if(Re&&Re.label)return Re.label}catch(ae){console.warn("Failed to parse form questions:",ae)}return/^\d+$/.test(ls)?`Field ${ls}`:ls.replace(/([A-Z])/g," $1").replace(/_/g," ").split(" ").map(ae=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(" ")},es=ls=>typeof ls=="boolean"?ls?"Yes":"No":Array.isArray(ls)?ls.join(", "):l
731s.toString(),Ns=Object.entries($).filter(([ls])=>ls!=="formId"&&ls!=="completedAt"&&ls!=="formCompletions");return s.jsxs("div",{className:"border border-slate-200 rounded-lg p-4 bg-slate-50",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h5",{className:"font-semibold text-slate-900",children:(ye==null?void 0:ye.name)||`Form ${pe}`}),s.jsxs(Je,{variant:"secondary",className:"text-xs",children:["Completed: ",Be]})]}),Ns.length>0?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Ns.map(([ls,ae])=>!ae||ae===""||typeof ae=="boolean"&&!ae?null:s.jsxs("div",{className:"bg-white p-3 rounded",children:[s.jsx("h6",{className:"text-sm font-medium text-slate-700 mb-1",children:Ze(ls)}),s.jsx("p",{className:"text-sm text-slate-900",children:es(ae)})]},ls))}):s.jsx("p",{className:"text-sm text-slate-500 italic",children:"No form fields completed"})]})}return s.jsx("div",{children:s.jsx("p",{className:"text-slate-500 text-center py-8",children:"No health assessment data available"})})})()]}):s.jsxs("div",{children:[s.jsx("h4",{className:"text-lg font-medium text-slate-900 mb-4",children:"Onboarding Forms"}),s.jsx("p",{className:"text-slate-500 text-center py-8",children:"No forms data available"})]})]})})]})}),s.jsx(Ct,{open:p,onOpenChange:$=>{v($),$||T(!0)},children:s.jsxs(St,{children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Email Already Exists"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{children:"The email address you entered already belongs to another client:"}),s.jsxs("div",{className:"bg-slate-50 p-3 rounded",children:[s.jsx("strong",{children:(P==null?void 0:P.name)||"Unnamed Client"}),s.jsx("br",{}),s.jsx("span",{className:"text-slate-600",children:P==null?void 0:P.email}),s.jsx("br",{}),s.jsxs("span",{className:"text-sm text-slate-500",children:[P&&He(P).totalBookings," bookings •",P&&xe(He(P).totalSpent)," total spent"]})]}),s.jsxs("p",{children:["Transfer all data from ",s.jsx("strong",{children:(u==null?void 0:u.name)||(u==null?void 0:u.email)})," into this existing client? This will:"]}),s.jsxs("ul",{className:"list-disc list-inside text-sm text-slate-600 space-y-1",children:[s.jsx("li",{children:"Transfer all bookings, achievements, event tickets, and balance"}),s.jsx("li",{children:"Transfer session bundles and memberships (duplicate memberships are removed)"}),s.jsx("li",{children:"Merge form completions (onboarding responses) into the existing client"}),s.jsx("li",{children:"Keep the existing client's name and details"})]}),s.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[s.jsx(Xt,{id:"delete-source-after-merge",checked:E,onCheckedChange:$=>T($===!0)}),s.jsx(V,{htmlFor:"delete-source-after-merge",className:"text-sm font-normal cursor-pointer",children:"Delete the duplicate client after transferring (recommended)"})]}),s.jsx("p",{className:"text-xs text-slate-500",children:"If you leave this unchecked, the duplicate client will remain with no bookings or data so you can delete it manually later."}),s.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[s.jsx(B,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),s.jsx(B,{onClick:ht,disabled:is.isPending,children:is.isPending?"Merging...":"Merge Clients"})]})]})]})}),s.jsx(Ct,{open:Y,onOpenChange:M,children:s.jsxs(St,{className:"max-w-2xl",children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Import Clients"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-sm text-slate-600",children:["Import clients from a CSV file or paste CSV data. Format: ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"email,firstname,surname,phone"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"import-file",children:"Upload CSV File"}),s.jsx(me,{id:"import-file",type:"file",accept:".csv,text/csv",onChange:_t,className:"cursor-pointer"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"import-csv-data",children:"Or Paste CSV Data"}),s.jsx(Is,{id:"import-csv-data",value:se,onChange:$=>Q($.target.value),placeholder:`email,firstname,surname,phone
732[email protected],John,Doe,1234567890
733[email protected],Jane,Smith,0987654321`,rows:8,className:"font-mono text-sm"})]}),s.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[s.jsx(B,{variant:"outline",onClick:()=>{M(!1),Q("")},disabled:ds.isPending,children:"Cancel"}),s.jsx(B,{onClick:()=>ds.mutate(se),disabled:ds.isPending||!se.trim(),children:ds.isPending?"Importing...":"Import Clients"})]})]})]})}),s.jsx(Ct,{open:te,onOpenChange:G,children:s.jsxs(St,{children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Add Client"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"add-client-email",children:"Email Address *"}),s.jsx(me,{id:"add-client-email",type:"email",value:Z,onChange:$=>ie($.target.value),placeholder:"[email protected]",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"add-client-firstname",children:"First Name"}),s.jsx(me,{id:"add-client-firstname",type:"text",value:A,onChange:$=>ge($.target.value),placeholder:"John"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"add-client-surname",children:"Surname"}),s.jsx(me,{id:"add-client-surname",type:"text",value:je,onChange:$=>ke($.target.value),placeholder:"Doe"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"add-client-phone",children:"Phone Number"}),s.jsx(me,{id:"add-client-phone",type:"tel",value:Ie,onChange:$=>$e($.target.value),placeholder:"1234567890"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"add-client-form",children:"Optional: Form to send (onboarding)"}),s.jsxs(Bt,{value:qe!==null?qe.toString():"none",onValueChange:$=>ft($==="none"?null:parseInt($,10)),children:[s.jsx($t,{id:"add-client-form",children:s.jsx(Lt,{placeholder:"None – don't send a form"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"none",children:"None – don't send a form"}),hs.map($=>s.jsxs(ce,{value:$.id.toString(),children:[$.name," ",$.isActive===!1&&"(Inactive)"]},$.id))]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Sends the client an email with a secure link to complete the form after they're added."})]}),s.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[s.jsx(B,{variant:"outline",onClick:()=>{G(!1),ie(""),ge(""),ke(""),$e(""),ft(null)},disabled:zs.isPending,children:"Cancel"}),s.jsx(B,{onClick:()=>
733{if(!Z.trim()){ue({title:"Email required",description:"Please enter an email address",variant:"destructive"});return}zs.mutate({email:Z.trim(),firstName:A.trim(),surname:je.trim(),phone:Ie.trim(),formId:qe??void 0})},disabled:zs.isPending||!Z.trim(),children:zs.isPending?"Adding...":"Add Client"})]})]})]})})]})}function k1e({client:e,onSave:t,onCancel:n,isLoading:r}){const[a,i]=f.useState(e.name||""),[o,l]=f.useState(e.email),[c,d]=f.useState(e.phone||""),[m,u]=f.useState(e.tags||""),h=p=>{p.preventDefault(),o.trim()&&t({name:a.trim(),email:o.trim(),phone:c.trim(),tags:m||""})};return s.jsx("div",{className:"w-full max-w-md mx-auto bg-white p-6 rounded-lg",children:s.jsxs("form",{onSubmit:h,className:"space-y-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"edit-name",className:"text-sm font-medium text-slate-700",children:"Name"}),s.jsx(me,{id:"edit-name",value:a,onChange:p=>i(p.target.value),placeholder:"Client name",className:"w-full"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"edit-email",className:"text-sm font-medium text-slate-700",children:"Email Address *"}),s.jsx(me,{id:"edit-email",type:"email",value:o,onChange:p=>l(p.target.value),placeholder:"[email protected]",className:"w-full",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"edit-phone",className:"text-sm font-medium text-slate-700",children:"Phone"}),s.jsx(me,{id:"edit-phone",type:"tel",value:c,onChange:p=>d(p.target.value),placeholder:"Phone number",className:"w-full"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"edit-tags",className:"text-sm font-medium text-slate-700",children:"Tags"}),s.jsx(wV,{value:m,onChange:u,placeholder:"Type tags separated by commas (e.g., club name, location)..."}),s.jsx("p",{className:"text-xs text-slate-500",children:"Tags help you group clients (e.g., by club or location). Previously used tags will appear as suggestions."})]}),s.jsxs("div",{className:"flex justify-end space-x-3 pt-4 border-t border-slate-200",children:[s.jsx(B,{type:"button",variant:"outline",onClick:n,disabled:r,className:"px-4 py-2",children:"Cancel"}),s.jsx(B,{type:"submit",disabled:r||!o.trim(),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white",children:r?"Saving...":"Save Changes"})]})]})})}function P1e({achievement:e,onSubmit:t,onCancel:n,isLoading:r}){const[a,i]=f.useState(e!=null&&e.achievementDate?new Date(e.achievementDate).toISOString().split("T")[0]:new Date().toISOString().split("T")[0]),[o,l]=f.useState((e==null?void 0:e.name)||""),[c,d]=f.useState((e==null?void 0:e.description)||""),m=u=>{u.preventDefault(),!(!o.trim()||!a)&&t({achievementDate:a,name:o.trim(),description:c.trim()||void 0})};return s.jsxs("form",{onSubmit:m,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"achievement-date",className:"text-sm font-medium text-slate-700",children:"Achievement Date *"}),s.jsx(me,{id:"achievement-date",type:"date",value:a,onChange:u=>i(u.target.value),className:"w-full",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"achievement-name",className:"text-sm font-medium text-slate-700",children:"Name *"}),s.jsx(me,{id:"achievement-name",value:o,onChange:u=>l(u.target.value),placeholder:"e.g., Black Belt, Level 3 Certification",className:"w-full",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"achievement-description",className:"text-sm font-medium text-slate-700",children:"Description (Optional)"}),s.jsx(Is,{id:"achievement-description",value:c,onChange:u=>d(u.target.value),placeholder:"Additional notes or details about this achievement",className:"w-full",rows:3})]}),s.jsxs("div",{className:"flex justify-end space-x-3 pt-2",children:[s.jsx(B,{type:"button",variant:"outline",onClick:n,disabled:r,size:"sm",children:"Cancel"}),s.jsx(B,{type:"submit",disabled:r||!o.trim()||!a,size:"sm",className:"bg-blue-600 hover:bg-blue-700 text-white",children:r?"Saving...":e?"Update":"Create"})]})]})}function E1e({isOpen:e,onClose:t,termSingular:n}){const{toast:r}=Yt(),[a,i]=f.useState("");console.log("termSingular:",n);const o=xt({mutationFn:async d=>await Pe("POST","/api/ai-generate-class",{description:d}),onSuccess:d=>{const m=d.message||`Your ${n} has been created with visibility on public and client pages disabled for your review. You can edit and enable it when ready.`;r({title:`${n} Created Successfully! ✨`,description:m}),Ms.invalidateQueries({queryKey:["/api/classes"]}
733),Ms.invalidateQueries({queryKey:["/api/admin/classes"]}),Ms.invalidateQueries({queryKey:["/api/stats"]}),i(""),t()},onError:d=>{console.error("Error generating class:",d),r({title:"Error",description:d.message||`Failed to generate ${n}. Please try again.`,variant:"destructive"})}}),l=()=>{if(!a.trim()){r({title:"Description Required",description:`Please describe your ${n.toLowerCase()} before generating.`,variant:"destructive"});return}o.mutate(a.trim())},c=()=>{o.isPending||(i(""),t())};return s.jsx(Ct,{open:e,onOpenChange:c,children:s.jsxs(St,{className:"max-w-2xl",children:[s.jsxs(kt,{children:[s.jsxs(Pt,{className:"flex items-center gap-2",children:[s.jsx(lr,{className:"h-5 w-5 text-purple-600"}),"Create ",n," with AI"]}),s.jsxs(yn,{children:["Describe your ",n.toLowerCase()," in natural language and let AI create it for you. Include details like ",n.toLowerCase," type, schedule, location, pricing, and any special information."]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"text-sm font-medium text-gray-700 mb-2 block",children:[n," Description"]}),s.jsx(Is,{value:a,onChange:d=>i(d.target.value),placeholder:"Example: I want to run a beginner yoga class every Tuesday at 7pm for £15, max 12 people, at my studio on Main Street. It's a gentle flow class perfect for beginners who want to improve flexibility and reduce stress.",rows:6,className:"resize-none",disabled:o.isPending}),s.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"💡 Be as detailed as possible - include class type, days/times, location, pricing, capacity, and any special requirements."})]}),s.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[s.jsx("h4",{className:"text-sm font-semibold text-blue-900 mb-2",children:"What AI can detect:"}),s.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[s.jsxs("li",{children:["• ",n," name, type, and description"]}),s.jsx("li",{children:"• Schedule (days of week, times, frequency)"}),s.jsx("li",{children:"• Location and capacity"}),s.jsx("li",{children:"• Pricing and booking options"}),s.jsx("li",{children:"• Duration and special requirements"})]})]})]}),s.jsxs(Er,{children:[s.jsx(B,{type:"button",variant:"outline",onClick:c,disabled:o.isPending,children:"Cancel"}),s.jsx(B,{onClick:l,disabled:o.isPending||!a.trim(),className:"bg-purple-600 hover:bg-purple-700",children:o.isPending?s.jsxs(s.Fragment,{children:[s.jsx(Qr,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating Class..."]}):s.jsxs(s.Fragment,{children:[s.jsx(lr,{className:"mr-2 h-4 w-4"}),"Generate Class"]})})]})]})})}function D1e({isOpen:e,onClose:t,formName:n,existingFormId:r,saveAsNew:a=!1}){const[i,o]=f.useState(n),[l,c]=f.useState(!1),{toast:d}=Yt(),m=[{id:"health_conditions",type:"textarea",label:"Do you have any health conditions or injuries we should be aware of?",required:!0,placeholder:"Please describe any relevant health information..."},{id:"fitness_level",type:"select",label:"How would you describe your current fitness level?",required:!0,options:["Beginner","Intermediate","Advanced"]}],[u,h]=f.useState(r?[]:m),{data:p,isLoading:v}=Ue({queryKey:[`/api/onboarding-forms/${r}`],enabled:!!r&&e});f.useEffect(()=>{if(console.log("useEffect triggered. existingForm:",p,"existingFormId:",r),p&&p.questions){console.log("Loading form from database:",p),console.log("Questions from database:",p.questions),console.log("Questions type:",typeof p.questions);let N=p.questions;if(typeof p.questions=="string")try{N=JSON.parse(p.questions),console.log("Successfully parsed questions:",N)}catch(C){console.error("Error parsing questions:",C),N=[]}h(N.map(C=>({...C,required:C.type==="info"?!1:!!C.required}))),o(a?n||p.name:p.name||n)}else r?console.log("Waiting for form data to load..."):(console.log("Using default form fields for new form"),h(m))},[p,n,r,a]);const y=()=>{const N={id:`field_${Date.now()}`,type:"text",label:"New Question",required:!1};h([...u,N])},g=(N,C)=>{const P=u.map((S,E)=>E===N?{...S,...C,required:(C.type??S.type)==="info"?!1:C.required??S.required}:S);h(P)},x=N=>{h(u.filter((C,P)=>P!==N))},b=(N,C)=>{C<0||C>=u.length||h(P=>{const S=[...P],[E]=S.splice(N,1);return S.splice(C,0,E),S})},w=xt({mutationFn:async()=>{const N={name:i,fields:u};return r&&!a&&(N.id=r),await Pe("POST","/api/onboarding-forms",N)},onSuccess:()=>{d({title:"Form Saved Successfully",description:a?"A new form was created from your copy and is ready to assign to classes.":"Your health asse
733ssment form has been saved and is ready to use with your classes."}),Ms.invalidateQueries({queryKey:["/api/onboarding-forms"]}),r&&!a&&Ms.invalidateQueries({queryKey:[`/api/onboarding-forms/${r}`]}),t()},onError:N=>{d({title:"Error Saving Form",description:"There was a problem saving your form. Please try again.",variant:"destructive"})}}),j=()=>s.jsxs("div",{className:"space-y-6 max-h-[60vh] overflow-y-auto",children:[s.jsxs("div",{className:"text-center border-b pb-4",children:[s.jsx("h2",{className:"text-xl font-bold text-slate-900",children:i}),s.jsx("p",{className:"text-sm text-slate-600 mt-2",children:"Please complete this form before your first session"})]}),u.map((N,C)=>{var P,S;return s.jsxs("div",{children:[N.type==="info"&&s.jsxs("div",{className:"p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[s.jsx("h4",{className:"font-semibold text-slate-900 mb-2",children:N.label}),s.jsx("div",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:N.content||""})]}),N.type==="single-checkbox"&&s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(Xt,{className:"mt-1"}),s.jsxs(V,{className:"text-sm leading-relaxed cursor-pointer",children:[N.label," ",N.required&&s.jsx("span",{className:"text-red-500",children:"*"})]})]}),N.type!=="info"&&N.type!=="single-checkbox"&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs(V,{className:"text-sm font-medium",children:[N.label," ",N.required&&s.jsx("span",{className:"text-red-500",children:"*"})]}),N.type==="text"&&s.jsx(me,{placeholder:N.placeholder,className:"w-full"}),N.type==="date"&&s.jsx(me,{type:"date",className:"w-full"}),N.type==="textarea"&&s.jsx(Is,{placeholder:N.placeholder,className:"w-full",rows:3}),N.type==="select"&&s.jsxs(Bt,{children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"Please select..."})}),s.jsx(It,{children:(P=N.options)==null?void 0:P.map((E,T)=>s.jsx(ce,{value:E,children:E},T))})]}),N.type==="radio"&&s.jsx("div",{className:"space-y-2",children:(S=N.options)==null?void 0:S.map((E,T)=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",name:N.id,className:"w-4 h-4"}),s.jsx("label",{className:"text-sm",children:E})]},T))}),N.type==="checkbox"&&N.options&&s.jsx("div",{className:"space-y-2",children:N.options.map((E,T)=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{}),s.jsx("label",{className:"text-sm",children:E})]},T))})]})]},N.id)}),s.jsx("div",{className:"pt-4 border-t",children:s.jsx(B,{className:"w-full",children:"Submit"})})]});return l?s.jsx(Ct,{open:e,onOpenChange:()=>c(!1),children:s.jsxs(St,{className:"max-w-2xl",children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Form Preview"})}),s.jsx(j,{}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx(B,{variant:"outline",onClick:()=>c(!1),children:"Back to Editor"}),s.jsx(B,{onClick:t,children:"Close Preview"})]})]})}):s.jsx(Ct,{open:e,onOpenChange:t,children:s.jsxs(St,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Edit Health Assessment Form"})}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"formTitle",children:"Form Title"}),s.jsx(me,{id:"formTitle",value:i,onChange:N=>o(N.target.value),className:"mt-1"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("h3",{className:"text-lg font-semibold",children:["Form Questions (",u.length,")"]}),s.jsxs("div",{className:"flex space-x-2",children:[s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>c(!0),children:[s.jsx(wa,{className:"h-4 w-4 mr-2"}),"Preview"]}),s.jsxs(B,{size:"sm",onClick:y,children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Add Question"]})]})]}),u.map((N,C)=>{var P;return s.jsxs(Ce,{className:"p-4",children:[s.jsxs("div",{className:"flex justify-between items-start mb-4",children:[s.jsxs("span",{className:"text-sm text-slate-500",children:["Question ",C+1]}),s.jsxs("div",{className:"flex space-x-1",children:[s.jsx(B,{variant:"outline",size:"sm",onClick:()=>b(C,C-1),disabled:C===0,className:"h-8 w-8 p-0",children:s.jsx(ON,{className:"h-4 w-4"})}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>b(C,C+1),disabled:C===u.length-1,className:"h-8 w-8 p-0",children:s.jsx(vi,{className:"h-4 w-4"})}),s.jsx(B,{variant:"destructive",size:"sm",onClick:()=>x(C),className:"h-8 w-8 p-0",children:s.jsx(ln,{className:"h-4 w-4"})})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{children:"Question Text"}),s.jsx(me,{value:N.label,onChange:S=>g(C,{label:S.target.value})})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Question Type"}),s.jsxs(Bt,{value:N.type,onValueChange:S=>g(C,{type:S,...S==="info"?{required:!1}:{}}),children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"text",children:"Short Text"}),s.jsx(ce,{value:"textarea",children:"Long Text"}),s.jsx(ce,{value:"select",children:"Dropdown"}),s.jsx(ce,{value:"radio",children:"Multiple Choice (Single Selection)"}),s.jsx(ce,{value:"checkbox",children:"Multiple Choice (Multiple Selection)"}),s.jsx(ce,{value:"single-checkbox",children:"Single Checkbox"}),s.jsx(ce,{value:"date",children:"Date"}),s.jsx(ce,{value:"info",children:"Information Only"})]})]})]}),N.type!=="info"&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{checked:N.required,onCheckedChange:S=>g(C,{required:S})}),s.jsx(V,{children:"Required"})]}),N.placeholder!==void 0&&s.jsxs("div",{className:"md:col-span-2",children:[s.jsx(V,{children:"Placeholder Text"}),s.jsx(me,{value:N.placeholder,onChange:S=>g(C,{placeholder:S.target.value}),placeholder:"Helpful text for the user..."})]}),(N.type==="select"||N.type==="radio"||N.type==="checkbox")&&s.jsxs("div",{className:"md:col-span-2",children:[s.jsx(V,{children:"Options (one per line)"}),s.jsx("textarea",{className:"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background 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",value:N.optionsText||((P=N.options)==null?void 0:P.join(`
734`))||"",onChange:S=>{g(C,{optionsText:S.target.value})},onBlur:S=>{const E=S.target.value.split(`
735`).filter(T=>T.trim()!=="");g(C,{options:E,optionsText:S.target.value})},placeholder:`Option 1
736Option 2
737Option 3`,rows:3})]}),N.type==="info"&&s.jsxs("div",{className:"md:col-span-2",children:[s.jsx(V,{children:"Content"}),s.jsx("textarea",{className:"flex min-h-[120px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background 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",value:N.content||"",onChange:S=>g(C,{content:S.target.value}),placeholder:"Enter the information content to display to users (supports multiple lines)",rows:4})]})]})]},N.id)})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3",children:[s.jsx(B,{variant:"outline",onClick:t,children:"Cancel"}),s.jsxs(B,{onClick:()=>w.mutate(),disabled:w.isPending,children:[s.jsx(J9,{className:"h-4 w-4 mr-2"}),w.isPending?"Saving...":"Save Form"]})]})]})})}function A1e({instructorId:e,instructor:t,onModeChange:n}){var b;const{toast:r}=Yt(),a=jn(),[i,o]=f.useState(!0);f.useEffect(()=>
737{if(new URLSearchParams(window.location.search).get("stripe_setup")==="complete"){const j=new URL(window.location.href);j.searchParams.delete("stripe_setup"),window.history.replaceState({},"",j.toString()),a.invalidateQueries({queryKey:[`/api/instructors/${e}`]}),a.invalidateQueries({queryKey:[`/api/stripe-connect/dual-account-status/${e}`]}),setTimeout(()=>{a.invalidateQueries({queryKey:[`/api/instructors/${e}`]}),a.invalidateQueries({queryKey:[`/api/stripe-connect/dual-account-status/${e}`]})},1e3),r({title:"Stripe Connect Setup Complete",description:"Your account has been successfully connected to Stripe."})}},[e,a,r]),f.useEffect(()=>{e&&i&&a.invalidateQueries({queryKey:[`/api/stripe-connect/dual-account-status/${e}`]})},[e,i,a]);const{data:l,isLoading:c}=Ue({queryKey:[`/api/stripe-connect/dual-account-status/${e}`],queryFn:async()=>(await Pe("GET",`/api/stripe-connect/dual-account-status/${e}`)).json(),enabled:!!e&&i,staleTime:0,gcTime:0}),d=xt({mutationFn:async()=>(await Pe("POST","/api/stripe-connect/create-standard-account",{instructorId:e})).json(),onSuccess:w=>{if(w.oauthUrl)r({title:"Redirecting to Stripe",description:"Taking you to Standard Connect setup..."}),window.location.href=w.oauthUrl;else throw new Error("No OAuth URL received")},onError:w=>{r({title:"Error",description:w.message||"Failed to create Standard Connect account",variant:"destructive"})}}),u=(()=>{const w=t.stripeConnectAccountId&&t.stripeAccountStatus;if(c&&!w)return{status:"Loading...",color:"secondary",description:"Checking account status"};const j=(l==null?void 0:l.connected)||w,N=(l==null?void 0:l.stripeAccountStatus)||t.stripeAccountStatus;if(!j)return{status:"Not Connected",color:"secondary",description:"Stripe Connect is not set up yet"};switch(N){case"active":return{status:"Active",color:"default",description:"Your Stripe account is fully active and can accept payments"};case"pending":case"pending_verification":return{status:"Pending Verification",color:"secondary",description:"Your account is being reviewed by Stripe"};case"restricted":return{status:"Restricted",color:"destructive",description:"Your account needs additional information"};default:return{status:"Unknown",color:"secondary",description:"Account status unknown"}}})(),h=!!((b=l==null?void 0:l.stripeDashboardUrl)!=null&&b.includes("/test/")),p=typeof(t==null?void 0:t.stripeSecretKey)=="string"&&t.stripeSecretKey.startsWith("sk_live"),v=!!(l!=null&&l.connected)&&h&&p,y=t.stripePublicKey&&t.stripeSecretKey,g=w=>{o(w),n==null||n(w)},x=()=>{a.invalidateQueries({queryKey:[`/api/instructors/${e}`]}),a.invalidateQueries({queryKey:[`/api/stripe-connect/dual-account-status/${e}`]}),r({title:"Status Refreshed",description:"Checking for account status updates..."})};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h4",{className:"font-medium text-slate-900",children:"Payment Processing Setup"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{checked:!i,onCheckedChange:w=>g(!w)}),s.jsx("span",{className:"text-sm text-slate-600",children:"Use Stripe API Keys"})]})]}),i?s.jsx(Ce,{className:"border-blue-200 bg-blue-50",children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(ti,{className:"w-5 h-5 text-blue-600 mt-1"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("h5",{className:"font-medium text-blue-900",children:"Stripe Connect (Recommended)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(B,{variant:"ghost",size:"sm",onClick:x,className:"h-7 w-7 p-0",title:"Refresh status",children:s.jsx(Of,{className:"h-3 w-3"})}),s.jsxs(Je,{variant:u.color,children:[c?s.jsx(Qr,{className:"w-3 h-3 animate-spin mr-1"}):l!=null&&l.connected?s.jsx(qt,{className:"w-3 h-3 mr-1"}):s.jsx(cm,{className:"w-3 h-3 mr-1"}),u.status]})]})]}),s.jsx("p",{className:"text-sm text-blue-700 mb-3",children:u.description}),l!=null&&l.connected?s.jsx("div",{className:"space-y-2",children:l.stripeAccountStatus==="active"?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center text-sm text-green-700",children:[s.jsx(qt,{className:"w-4 h-4 mr-2"}),"Ready to accept payments!"]}),v&&s.jsx("div",{className:"text-xs text-amber-800 bg-amber-50 border border-amber-200 rounded p-2",children:"Connected Stripe account appears to be in test mode while your API key configuration looks live. This can route payments through a different Stripe mode than expected."}),l.stripeDashboardUrl?s.jsx(B,{asChild:!0,variant:"outline",size:"sm",children:s.jsxs("a",{href:l.stripeDashboardUrl,target:"_blank",rel:"noopener noreferrer",children:[s.jsx(Lr,{className:"w-4 h-4 mr-2"}),"Stripe Dashboard"]})}):s.jsxs(B,{onClick:()=>d.mutate(),variant:"outline",size:"sm",children:[s.jsx(Lr,{className:"w-4 h-4 mr-2"}),"Stripe Dashboard"]})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-sm text-yellow-700",children:"⚠️ Account setup not yet complete - please finish onboarding in Stripe."}),s.jsxs(B,{onClick:()=>d.mutate(),variant:"outline",size:"sm",children:[s.jsx(Lr,{className:"w-4 h-4 mr-2"}),"Continue Stripe Setup"]})]})}):s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"text-sm text-blue-700",children:[s.jsx("p",{className:"mb-2",children:"Connect an existing Stripe account or create a new one during onboarding."}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[s.jsx("li",{children:"Funds paid out directly to your bank"}),s.jsx("li",{children:"Keep full access to the Stripe dashboard"}),s.jsx("li",{children:"No manual API key management"}),s.jsx("li",{children:"Stripe handles compliance and security"})]})]}),s.jsx(B,{onClick:()=>d.mutate(),disabled:d.isPending,className:"w-full",children:d.isPending?s.jsxs(s.Fragment,{children:[s.jsx(Qr,{className:"w-4 h-4 animate-spin mr-2"}),"Redirecting to Stripe..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Lr,{className:"w-4 h-4 mr-2"}),"Set up Stripe Connect"]})})]})]})]})})}):s.jsx("div",{className:"p-4 bg-amber-50 border border-amber-200 rounded-lg",children:s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(cm,{className:"w-5 h-5 text-amber-600 mt-0.5"}),s.jsxs("div",{children:[s.jsx("h5",{className:"font-medium text-amber-900 mb
737-1",children:"Using Manual API Keys"}),s.jsx("p",{className:"text-sm text-amber-700",children:`You've chosen to use your own Stripe API keys. Please configure them in the "Stripe API Keys (Advanced)" section below.`}),y&&s.jsxs("div",{className:"mt-2 flex items-center text-sm text-green-700",children:[s.jsx(qt,{className:"w-4 h-4 mr-1"}),"API keys are configured"]})]})]})})]})}function T1e({instructorId:e}){const{toast:t}=Yt(),n=jn(),[r,a]=f.useState(""),[i,o]=f.useState("sandbox"),{data:l}=Ue({queryKey:["/api/gocardless/status",e],queryFn:async()=>(await Pe("GET","/api/gocardless/status")).json(),enabled:!!e}),c=xt({mutationFn:async()=>(await Pe("POST","/api/gocardless/connect",{accessToken:r,environment:i})).json(),onSuccess:()=>{a(""),n.invalidateQueries({queryKey:["/api/gocardless/status"]}),t({title:"GoCardless connected",description:"You can now match subscriptions to memberships."})},onError:m=>{t({title:"Could not connect",description:m.message,variant:"destructive"})}}),d=xt({mutationFn:async()=>(await Pe("POST","/api/gocardless/disconnect")).json(),onSuccess:m=>{n.invalidateQueries({queryKey:["/api/gocardless/status"]}),t({title:"GoCardless disconnected",description:m.message})},onError:m=>{t({title:"Could not disconnect",description:m.message,variant:"destructive"})}});return s.jsxs("div",{className:"space-y-4 border-t pt-6",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"font-medium text-slate-900",children:"GoCardless membership sync"}),s.jsxs("p",{className:"text-sm text-slate-500 mt-1",children:["Sync your GoCardless direct debit subscriptions to Classta memberships."," ",s.jsx("a",{href:"https://help.classta.co/article/576-sync-gocardless-direct-debit-subscriptions-to-classta-memberships",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Help"})]})]}),l!=null&&l.connected?s.jsxs("div",{className:"space-y-3 rounded-lg bg-slate-50 p-4",children:[s.jsxs("p",{className:"text-sm text-slate-700",children:["Connected (",l.environment,") with token ",l.tokenHint,".",l.lastSyncedAt?` Last sync ${new Date(l.lastSyncedAt).toLocaleString()}.`:" Not synced yet."]}),s.jsx("p",{className:"text-sm text-slate-500",children:"Match subscription groups to memberships on the Memberships page, then use Save and sync."}),s.jsx(B,{variant:"outline",onClick:()=>d.mutate(),disabled:d.isPending,children:"Disconnect GoCardless"})]}):s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx(V,{children:"Environment"}),s.jsxs(Bt,{value:i,onValueChange:m=>o(m),children:[s.jsx($t,{className:"mt-1",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"sandbox",children:"Sandbox (testing)"}),s.jsx(ce,{value:"live",children:"Live"})]})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"gocardlessAccessToken",children:"Read-only access token"}),s.jsx(me,{id:"gocardlessAccessToken",type:"password",className:"mt-1",value:r,onChange:m=>a(m.target.value),placeholder:"Paste the token from GoCardless",autoComplete:"off"}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"In GoCardless, open Developers, then Access tokens, and create a read-only token. Use a sandbox token while testing."})]}),s.jsx(B,{onClick:()=>c.mutate(),disabled:c.isPending||!r.trim(),children:c.isPending?"Checking token…":"Connect GoCardless"})]})]})}function j3(e){e=e.replace("#","");const t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,r=parseInt(e.substr(4,2),16)/255,a=Math.max(t,n,r),i=Math.min(t,n,r);let o=0,l=0;const c=(a+i)/2;if(a!==i){const d=a-i;switch(l=c>.5?d/(2-a-i):d/(a+i),a){case t:o=(n-r)/d+(n<r?6:0);break;case n:o=(r-t)/d+2;break;case r:o=(t-n)/d+4;break}o/=6}return`${Math.round(o*360)} ${Math.round(l*100)}% ${Math.round(c*100)}%`}function N3(e){e=e.replace("#","");const t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,r=parseInt(e.substr(4,2),16)/255,a=o=>o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4);return .2126*a(t)+.7152*a(n)+.0722*a(r)>.5?"218 18% 9%":"355 7% 97%"}const O1e=f.memo(({onSuccess:e,onError:t})=>s.jsx(oO,{onSuccess:e,onError:t,text:"Sign in with Google",apiEndpoint:"/api/instructor/google-login"}));function F1e({instructor:e}){const[t,n]=f.useState(""),[r,a]=f.useState("friendly"),[i,o]=f.useState(!1),[l,c]=f.useState(""),{toast:d}=Yt(),m=Array.isArray(e==null?void 0:e.featureFlags)&&e.featureFlags.includes("events"),{data:u=[]}=Ue({queryKey:["/api/admin/classes"],enabled:!!(e!=null&&e.id)}),{data:h=[]}=Ue({queryKey:["/api/admin/services"],enabled:!!(e!=null&&e.id)}),{data:p=[]}=Ue({queryKey:["/api/events"],enabled:!!(e!=null&&e.id)&&m,queryFn:async()=>{const N=await Pe("GET","/api/events");if(!N.ok)throw new Error("Failed to fetch events");return N.json()}}),v=[{value:"friendly",label:"Friendly"},{value:"bold",label:"Bold"},{value:"fun",label:"Fun"},{value:"professional",label:"Professional"}],y=async()=>
737{if(!t){d({title:"Select an item",description:m?"Please select a class, service, or event to promote":"Please select a class or service to promote",variant:"destructive"});return}o(!0);try{const N=t.startsWith("service-"),C=t.startsWith("event-"),P=t.replace(/^(class|service|event)-/,""),S=C?{eventId:parseInt(P,10),tone:r}:N?{serviceId:parseInt(P,10),tone:r}:{classId:parseInt(P,10),tone:r},T=await(await Pe("POST","/api/admin/generate-social-post",S)).json();c(T.post)}catch(N){d({title:"Error",description:N.message||"Failed to generate post",variant:"destructive"})}finally{o(!1)}},g=()=>{navigator.clipboard.writeText(l),d({title:"Copied!",description:"Post copied to clipboard"})},x=t.startsWith("class-")?u.find(N=>N.id===parseInt(t.replace("class-",""),10)):null,b=t.startsWith("event-")?p.find(N=>N.id===parseInt(t.replace("event-",""),10)):null,w=t.startsWith("service-")?h.find(N=>N.id===parseInt(t.replace("service-",""),10)):null,j=N=>["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][N]||"Unknown";return s.jsx(Ce,{className:"mt-6",children:s.jsxs(Ee,{className:"p-4 md:p-6",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"text-xl font-semibold text-slate-900",children:"Promote"}),s.jsx("p",{className:"text-sm text-slate-600 mt-1",children:m?"Generate AI-powered social media posts for your classes, services, and events":"Generate AI-powered social media posts for your classes and services"})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"promote-select",children:m?"Select class, service, or event":"Select class or service"}),s.jsxs(Bt,{value:t,onValueChange:n,children:[s.jsx($t,{id:"promote-select",children:s.jsx(Lt,{placeholder:m?"Choose a class, service, or event to promote":"Choose a class or service to promote"})}),s.jsxs(It,{children:[u.map(N=>s.jsx(ce,{value:`class-${N.id}`,children:m?`Class: ${N.name} (${N.classType})`:`${N.name} (${N.classType})`},`class-${N.id}`)),h.map(N=>s.jsxs(ce,{value:`service-${N.id}`,children:["Service: ",N.name]},`service-${N.id}`)),m&&p.map(N=>s.jsxs(ce,{value:`event-${N.id}`,children:["Event: ",N.title]},`event-${N.id}`))]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"tone-select",children:"Tone"}),s.jsxs(Bt,{value:r,onValueChange:a,children:[s.jsx($t,{id:"tone-select",children:s.jsx(Lt,{placeholder:"Select tone"})}),s.jsx(It,{children:v.map(N=>s.jsx(ce,{value:N.value,children:N.label},N.value))})]})]})]}),s.jsx("div",{className:"flex justify-center",children:s.jsx(B,{onClick:y,disabled:!t||i,className:"w-full md:w-auto",children:i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Generating..."]}):s.jsxs(s.Fragment,{children:[s.jsx(lr,{className:"h-4 w-4 mr-2"}),"Generate Social Media Post"]})})}),l&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-slate-50 p-4 rounded-lg",children:[s.jsxs("div",{className:"flex items-start justify-between mb-3",children:[s.jsx("h4",{className:"font-medium text-slate-900",children:"Generated Post"}),s.jsxs(B,{variant:"outline",size:"sm",onClick:g,className:"flex items-center space-x-1",children:[s.jsx(pr,{className:"h-4 w-4"}),s.jsx("span",{children:"Copy"})]})]}),s.jsx("p",{className:"text-slate-700 whitespace-pre-wrap",children:l})]}),x&&s.jsxs("div",{className:"text-sm text-slate-600 bg-blue-50 p-3 rounded-lg",children:[s.jsx("strong",{children:"Class Details:"})," ",x.name," • ",x.classType," •"," ",j(x.dayOfWeek)," at ",x.startTime," •"," ",x.location||"Location TBD"]}),b&&s.jsxs("div",{className:"text-sm text-slate-600 bg-blue-50 p-3 rounded-lg",children:[s.jsx("strong",{children:"Event Details:"})," ",b.title," •"," ",Ud(b.startsAt)," ","• ",b.location||"Location TBD"]}),w&&s.jsxs("div",{className:"text-sm text-slate-600 bg-blue-50 p-3 rounded-lg",children:[s.jsx("strong",{children:"Service Details:"})," ",w.name," •"," ",w.duration," mins • ",w.location||"Location TBD"]})]})]})]})})}function _1e({isOpen:e,onClose:t,onFormCreated:n}){const{toast:r}=Yt(),[a,i]=f.useState(""),[o,l]=f.useState(""),[c,d]=f.useState([]),[m,u]=f.useState(""),[h,p]=f.useState(!1),[v,y]=f.useState(!1),g=f.useRef(null);f.useEffect(()=>{e&&(i(""),l(""),d([]),u(""),p(!1),y(!1))},[e]),f.useEffect(()=>{c.length>0&&g.current&&window.innerWidth<768&&setTimeout(()=>{var P;(P=g.current)==null||P.scrollIntoView({behavior:"smooth",block:"start"})},100)},[c.length]);const x=xt({mutationFn:async C=>(await Pe("POST","/api/ai-generate-form",C)).json(),onSuccess:C=>{d(C.questions),u(C.formName),p(!1),r({title:"Form Generated",description:"AI has generated your form questions. Review and create."})},onError:C=>{p(!1),r({title:"Generation Failed",description:C.message||"Failed to generate form",variant:"destructive"})}}),b=xt({mutationFn:async C=>{const P={name:C.name,fields:C.questions};return(await Pe("POST","/api/onboarding-forms",P)).json()},onSuccess:C=>{y(!1),Ms.invalidateQueries({queryKey:["/api/onboarding-forms"]}
737),r({title:"Form Created",description:"Your AI-generated form has been created successfully."}),n(m,C.id)},onError:C=>{y(!1),r({title:"Creation Failed",description:C.message||"Failed to create form",variant:"destructive"})}}),w=()=>{if(!a.trim()){r({title:"Description Required",description:"Please describe what information you want to collect.",variant:"destructive"});return}p(!0),x.mutate({description:a,businessType:o})},j=()=>{if(!m.trim()||c.length===0){r({title:"Form Not Ready",description:"Please generate questions first.",variant:"destructive"});return}y(!0),b.mutate({name:m,questions:c})},N=()=>{i(""),l(""),d([]),u(""),p(!1),y(!1),t()};return s.jsx(Ct,{open:e,onOpenChange:N,children:s.jsxs(St,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(kt,{children:[s.jsxs(Pt,{className:"flex items-center space-x-2",children:[s.jsx(lr,{className:"w-3 h-3 mr-1"}),s.jsx("span",{children:"AI Form Creator"})]}),s.jsx(yn,{children:"Describe what information you want to collect, and AI will generate appropriate form questions."})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"businessType",children:"Business Type (optional)"}),s.jsxs(Bt,{value:o,onValueChange:l,children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"Select your business type"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"yoga",children:"Yoga Studio"}),s.jsx(ce,{value:"pilates",children:"Pilates Studio"}),s.jsx(ce,{value:"fitness",children:"Fitness Training"}),s.jsx(ce,{value:"dance",children:"Dance Classes"}),s.jsx(ce,{value:"martial-arts",children:"Martial Arts"}),s.jsx(ce,{value:"wellness",children:"Wellness & Therapy"}),s.jsx(ce,{value:"sports",children:"Sports Coaching"}),s.jsx(ce,{value:"other",children:"Other"})]})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"description",children:"Form Description"}),s.jsx(Is,{id:"description",value:a,onChange:C=>i(C.target.value),placeholder:"Describe what information you want to collect from clients. For example: 'I need to know about clients' injuries, fitness experience, and health conditions before they attend yoga classes.'",rows:4,className:"mt-1"}),s.jsx("div",{className:"mt-2 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:s.jsxs("p",{className:"text-sm text-blue-800",children:[s.jsx("strong",{children:"💡 Tips:"})," List the specific fields you want to include (e.g., medical history, fitness level, allergies, emergency contact). Be specific about the type of questions - multiple choice, text areas, or yes/no questions work best."]})})]}),s.jsx(B,{onClick:w,disabled:h||!a.trim(),className:"w-full",children:h?"Generating...":"Generate Form Questions"})]}),c.length>0&&s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{className:"border-t pt-4",ref:g,children:[s.jsx("h4",{className:"font-medium text-slate-900 mb-3",children:"Generated Form Preview"}),s.jsxs("div",{className:"mb-4",children:[s.jsx(V,{htmlFor:"formName",children:"Form Name"}),s.jsx(me,{id:"formName",value:m,onChange:C=>u(C.target.value),className:"mt-1"})]}),s.jsx("div",{className:"space-y-3 max-h-60 overflow-y-auto",children:c.map((C,P)=>s.jsx("div",{className:"p-3 border rounded-lg bg-slate-50",children:s.jsx("div",{className:"flex justify-between items-start",children:s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"font-medium text-sm",children:C.label}),s.jsxs("p",{className:"text-xs text-slate-600 mt-1",children:["Type: ",C.type," ",C.required&&"• Required"]}),C.options&&s.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:["Options: ",C.options.join(", ")]})]})})},P))}),s.jsxs("div",{className:"mt-4 space-y-2",children:[s.jsx("div",{className:"p-3 bg-green-50 border border-green-200 rounded-lg",children:s.jsxs("p",{className:"text-sm text-green-800",children:[s.jsx("strong",{children:"✅ Smart filtering applied:"})," Name, email, and phone fields have been automatically skipped since these are collected during the booking process."]})}),s.jsx("div",{className:"p-3 bg-blue-50 border border-blue-200 rounded-lg",children:s.jsxs("p",{className:"text-sm text-blue-800",children:[s.jsx("strong",{children:"Ready to create:"})," This form will be created with ",c.length," questions. You can edit individual questions after creation in the form editor."]})}),s.jsx(B,{onClick:j,disabled:v||!m.trim()||c.length===0,className:"w-full mt-4",children:v?"Creating Form...":"Create Form & Continue Editing"})]})]})})]}),s.jsx(Er,{children:s.jsx(B,{variant:"outline",onClick:t,children:"Cancel"})})]})})}function ek(){var n4,r4,a4,i4,o4,l4,c4,d4,u4,m4,h4,f4,p4,x4,g4,y4,v4,b4,w4,j4,N4,C4,S4,k4,P4,E4,D4,A4,T4,O4,F4,_4,M4;const{toast:e}=Yt(),[t,n]=f.useState(!1),[r,a]=f.useState(!1),[i,o]=f.useState(!1),[l,c]=f.useState(!1),[d,m]=f.useState(!1),[u,h]=f.useState(""),[p,v]=f.useState(),[y,g]=f.useState(!1),[x,b]=f.useState(null),[w,j]=f.useState(null),[N,C]=f.useState(!1),[P,S]=f.useState(!1),[E,T]=f.useState(!1),[z,O]=f.useState(null),[D,k]=f.useState(!0),[F,W]=f.useState(!1),[q,H]=f.useState(""),[_,L]=f.useState(""),[U,J]=f.useState("this-month"),[I,re]=f.useState(""),[R,Y]=f.useState(""),[M,se]=f.useState(!1),[,Q]=cn(),te=typeof window<"u"&&new URLSearchParams(window.location.search).get("testreminders")==="1";f.useEffect(()=>{const ee=document.createElement("script");ee.id="helpscout-beacon-bootstrap",ee.type="text/javascript",ee.async=!0,ee.innerHTML='!function(e,t,n){function a(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,a){e.Beacon.readyQueue.push({method:t,options:n,data:a})},n.readyQueue=[],"complete"===t.readyState)return a();e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}(window,document,window.Beacon||function(){});';const Se=document.createElement("script");return Se.id="helpscout-beacon-init",Se.type="text/javascript",Se.innerHTML="window.Beacon('init', '7cf187a2-7bae-4b8b-a27b-a5e49d2c7999');",document.body.appendChild(ee),document.body.appendChild(Se),()=>{document.body.contains(ee)&&document.body.removeChild(ee),document.body.contains(Se)&&document.body.removeChild(Se);const oe=window.Beacon;if(oe)try{oe("destroy")}catch{}}},[]);const G=()=>{const ee=new Date,Se=new Date(ee.getFullYear(),ee.getMonth(),ee.getDate());switch(U){case"today":return{start:Se,end:new Date(Se.getTime()+24*60*60*1e3)};case"this-week":const oe=new Date(Se);oe.setDate(Se.getDate()-Se.getDay());const lt=new Date(oe);return lt.setDate(oe.getDate()+7),{start:oe,end:lt};case"last-week":const Wt=new Date(Se);Wt.setDate(Se.getDate()-Se.getDay()-7);const As=new Date(Wt);return As.setDate(Wt.getDate()+7),{start:Wt,end:As};case"this-month":const Gt=new Date(ee.getFullYear(),ee.getMonth(),1),On=new Date(ee.getFullYear(),ee.getMonth()+1,
7371);return{start:Gt,end:On};case"last-month":const an=new Date(ee.getFullYear(),ee.getMonth()-1,1),Nn=new Date(ee.getFullYear(),ee.getMonth(),1);return{start:an,end:Nn};case"last-30-days":return{start:new Date(ee.getTime()-30*24*60*60*1e3),end:ee};case"this-year":const Jn=new Date(ee.getFullYear(),0,1),ur=new Date(ee.getFullYear()+1,0,1);return{start:Jn,end:ur};case"last-year":const qs=new Date(ee.getFullYear()-1,0,1),mn=new Date(ee.getFullYear(),0,1);return{start:qs,end:mn};case"last-90-days":const Ln=new Date(Se);return Ln.setDate(Se.getDate()-90),{start:Ln,end:new Date(Se.getTime()+24*60*60*1e3)};case"custom":return I&&R?{start:new Date(I),end:new Date(new Date(R).getTime()+24*60*60*1e3)}:null;default:return null}},[Z,ie]=f.useState(!1),[A,ge]=f.useState(null),{accessLevel:je}=iO(A==null?void 0:A.id),ke=je==="bookings_only",[Ie,$e]=f.useState(""),[qe,ft]=f.useState(""),[be,Fe]=f.useState(!1),[_e,ze]=f.useState(""),[ue,Me]=f.useState(!1),[pt,de]=f.useState(!1);f.useEffect(()=>{const ee=new URLSearchParams(window.location.search),Se=ee.get("login"),oe=ee.get("email"),lt=ee.get("message");Se?($e(decodeURIComponent(Se)),de(!0)):oe&&($e(decodeURIComponent(oe)),lt==="email_verified"?(localStorage.getItem("signup_conversion_tracked")||(window.fbq&&window.fbq("track","CompleteRegistration"),window.gtag&&window.gtag("event","conversion",{send_to:"AW-17123389975/7yj6CKS7y5MbEJfkiOU_"}),window.gtag&&window.gtag("event","instructor_signup",{event_category:"engagement",event_label:"signup",value:1}),window.clicky&&window.clicky.goal&&window.clicky.goal(1550),window.uetq&&(window.uetq=window.uetq||[],window.uetq.push("event","verified_signup",{})),localStorage.setItem("signup_conversion_tracked","1")),e({title:"Email Verified!",description:"Your email has been verified successfully. Please log in with your password."})):lt==="already_verified"&&e({title:"Already Verified",description:"Your email is already verified. You can log in now."}))},[]);const fe=ee=>{const Se=Date.now()+864e5,oe={instructor:ee,expires:Se};localStorage.setItem("admin_session",JSON.stringify(oe)),console.log("Session saved to localStorage")},le=()=>{try{const ee=localStorage.getItem("admin_session");if(!ee)return null;const Se=JSON.parse(ee);return Date.now()>Se.expires?(localStorage.removeItem("admin_session"),null):Se.instructor}catch(ee){return console.error("Error reading session:",ee),localStorage.removeItem("admin_session"),null}},Ke=()=>{localStorage.removeItem("admin_session")};f.useEffect(()=>{console.log("Checking for existing session...");const ee=le(),Se=localStorage.getItem("auth_token");console.log("Session data found:",ee?"YES":"NO"),console.log("JWT token found:",Se?"YES":"NO"),console.log("🔍 Session instructor ID:",ee==null?void 0:ee.id),console.log("🔍 Session instructor email:",ee==null?void 0:ee.email),ee&&Se?(console.log("Session restored for:",ee.email,"ID:",ee.id),ge(ee),ie(!0),Ms.clear(),typeof window<"u"&&typeof window.Beacon=="function"&&window.Beacon("identify",{email:ee.email,name:ee.instructorName})):ee&&!Se&&(console.log("Clearing stale session without JWT token"),Ke())},[]);const[We,vt]=f.useState("dashboard"),[Zt,Ht]=f.useState(void 0),[Tt,Ot]=f.useState(void 0),[Ft,is]=f.useState(void 0),[Cs,Ne]=f.useState(void 0),[rt,ht]=f.useState(void 0),[Mt,Qt]=f.useState(""),[ts,Js]=f.useState(""),[xn,Xs]=f.useState("#3B82F6"),[nn,Vt]=f.useState("#10B981"),[Te,at]=f.useState(""),[ss,ps]=f.useState(""),[bs,Ss]=f.useState(""),[xs,hs]=f.useState(""),[gs,Os]=f.useState(""),[cs,Tr]=f.useState(null),[rr,xe]=f.useState(""),[He,tt]=f.useState(""),[Jt,ds]=f.useState("sandbox"),[zs,De]=f.useState(""),[we,ot]=f.useState([]),[_t,zt]=f.useState(""),[K,$]=f.useState(""),[pe,ye]=f.useState(""),[Be,Ze]=f.useState(!1),[es,Ns]=f.useState(!1),[ls,ae]=f.useState(""),[Re,Le]=f.useState(""),[Ye,Ve]=f.useState("Classes"),[nt,ys]=f.useState("Class"),[Fs,dn]=f.useState("Classes"),[rn,ar]=f.useState(""),[gr,js]=f.useState(!1),Cn=[{singular:"Class",plural:"Classes"},{singular:"Session",plural:"Sessions"},{singular:"Event",plural:"Events"}];function Ho(ee){return Cn.find(Se=>Se.plural===ee)||Cn[0]}const[en,Mn]=f.useState(!1),[yr,Qn]=f.useState(null),{data:Ae}=Ue({queryKey:[`/api/instructors/${A==null?void 0:A.id}`],enabled:!!(A!=null&&A.id),staleTime:0,cacheTime:0,refetchOnWindowFocus:!0,queryFn:async()=>{console.log("🔍 Requesting instructor profile for ID:",A==null?void 0:A.id),console.log("🔍 Current instructor object:",A);const Se=await(await Pe("GET",`/api/instructors/${A==null?void 0:A.id}`)).json();return console.log("🔍 Received instructor profile:",Se),Se}}),{data:ri=[]}=Ue({queryKey:["/api/admin/classes"],enabled:!!(A!=null&&A.id)}),{data:Tl=[]}=Ue({queryKey:["/api/onboarding-forms"],enabled:!!(A!=null&&A.id),staleTime:5*60*1e3,gcTime:10*60*1e3});function Zd({onSuccess:ee,onError:Se,toast:oe,setLocation:lt}){f.useRef(null);const[Wt,As]=f.useState(!1),[Gt,On]=f.useState(!1);f.useEffect(()=>{let Nn="https://classta.co/auth/apple/callback";(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.endsWith(".ngrok.io"))&&(Nn="https://untied3.eu.ngrok.io/auth/apple/callback");const Bn=()=>{window.AppleID.auth.init({clientId:"com.classta.login",scope:"name email",redirectURI:Nn,usePopup:!0}),As(!0)};if(window.AppleID)Bn();else{const qs=document.createElement("script");qs.src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",qs.async=!0,qs.onload=Bn,document.body.appendChild(qs)}const Jn=async qs=>{var mn,Ln;On(!1),console.log("[AppleIDSignInOnSuccess] Event fired",qs);try{const Sn=(Ln=(mn=qs.detail)==null?void 0:mn.authorization)==null?void 0:Ln.id_token;console.log("[AppleIDSignInOnSuccess] id_token:",Sn);const st=await fetch("/api/instructor/apple-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id_token:Sn})});if(!st.ok)throw new Error("Apple signup failed");const _s=await st.json();console.log("[AppleIDSignInOnSuccess] Instructor data:",_s),localStorage.removeItem("admin_session"),localStorage.removeItem("auth_token"),_s.token&&localStorage.setItem("auth_token",_s.token);const wt=Date.now()+24*60*60*1e3,fs={instructor:_s,expires:wt};localStorage.setItem("admin_session",JSON.stringify(fs)),Zs("instructor_signup","engagement","signup",1),typeof window<"u"&&window.clicky&&window.clicky.goal(1550),typeof window<"u"&&window.fbq&&window.fbq("track","CompleteRegistration"),typeof window<"u"&&window.gtag&&window.gtag("event","conversion",{send_to:"AW-17123389975/7yj6CKS7y5MbEJfkiOU_"}),window.uetq&&(window.uetq=window.uetq||[],window.uetq.push("event","verified_signup",{}
737)),console.log("logged in"),ge(fs),ie(!0),fe(fs),typeof window<"u"&&typeof window.Beacon=="function"&&window.Beacon("identify",{email:_s.email,name:_s.instructorName})}catch(Sn){console.error("[AppleIDSignInOnSuccess] Error:",Sn),oe({title:"Apple Sign-In Error",description:"Failed to load Apple Sign-In. Please try the manual signup form below.",variant:"destructive"}),Se(Sn)}},ur=qs=>{var _s;On(!1),console.log("[AppleIDSignInOnFailure] Event fired",qs);const mn=(qs==null?void 0:qs.error)||((_s=qs==null?void 0:qs.detail)==null?void 0:_s.error)||(qs==null?void 0:qs.detail),Ln=mn==null?void 0:mn.code,Sn=(mn==null?void 0:mn.message)||(mn==null?void 0:mn.error)||"";if(Ln===1001||Ln==="1001"||String(Ln)==="1001"||(Sn==null?void 0:Sn.toLowerCase().includes("cancel"))||(Sn==null?void 0:Sn.toLowerCase().includes("cancelled"))||(Sn==null?void 0:Sn.toLowerCase().includes("user cancelled"))||!mn&&!Ln&&!Sn||mn&&typeof mn=="object"&&Object.keys(mn).length===0){console.log("[AppleIDSignInOnFailure] User cancelled Apple sign-in - ignoring");return}oe({title:"Apple Sign-In Error",description:"Apple sign-in failed. Please try again or use another method.",variant:"destructive"}),Se(qs)};return document.addEventListener("AppleIDSignInOnSuccess",Jn),document.addEventListener("AppleIDSignInOnFailure",ur),()=>{document.removeEventListener("AppleIDSignInOnSuccess",Jn),document.removeEventListener("AppleIDSignInOnFailure",ur)}},[Se,lt,oe]);const an=()=>{if(console.log("[AppleSignIn] Apple button clicked"),!window.AppleID||!window.AppleID.auth){console.warn("[AppleSign
737In] window.AppleID.auth not available");return}On(!0),setTimeout(()=>{try{window.AppleID.auth.signIn()}catch(Nn){On(!1),oe({title:"Apple Sign-In Error",description:"Failed to start Apple sign-in. Please try again.",variant:"destructive"}),Se(Nn)}},100)};return Wt?s.jsx("div",{className:"w-full flex justify-center",children:s.jsx("button",{type:"button",onClick:an,disabled:Gt,className:`flex items-center justify-center gap-2 border border-slate-200 rounded-lg py-3 px-4 font-medium text-base mb-2 h-12 transition-colors ${Gt?"bg-slate-100 text-slate-500 cursor-not-allowed":"bg-white hover:bg-slate-50 text-slate-800"}`,style:{minWidth:0,maxWidth:280,width:280,minHeight:48,height:48,borderRadius:8,boxSizing:"border-box"},"aria-label":Gt?"Loading...":"Sign in with Apple",children:Gt?s.jsxs(s.Fragment,{children:[s.jsx(Qr,{className:"w-4 h-4 animate-spin"}),s.jsx("span",{children:"Loading..."})]}):s.jsxs(s.Fragment,{children:[s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"currentColor",className:"mr-2",children:s.jsx("path",{d:"M16.365 10.88c-.02-2.06 1.68-3.04 1.76-3.09-0.96-1.4-2.45-1.6-2.98-1.62-1.27-.13-2.48.74-3.13.74-.65 0-1.65-.72-2.72-.7-1.4.02-2.7.82-3.42 2.08-1.46 2.54-.37 6.3 1.04 8.36.7 1.01 1.53 2.14 2.62 2.1 1.06-.04 1.46-.68 2.74-.68 1.28 0 1.64.68 2.74.66 1.13-.02 1.84-1.03 2.53-2.04.8-1.17 1.13-2.3 1.15-2.36-.03-.01-2.2-.84-2.22-3.33zm-2.6-6.1c.58-.7.97-1.68.86-2.66-.83.03-1.83.55-2.42 1.25-.53.62-.99 1.61-.82 2.56.97.08 1.8-.39 2.38-1.15z"})}),"Sign in with Apple"]})})}):s.jsx("div",{className:"w-full flex justify-center",children:s.jsxs("div",{className:"flex items-center justify-center gap-2 border border-slate-200 rounded-lg py-3 px-4 bg-slate-50 text-slate-400 font-medium text-base mb-2 h-12 opacity-50 cursor-not-allowed",style:{minWidth:0,maxWidth:280,width:280,minHeight:48,height:48,borderRadius:8,boxSizing:"border-box"},children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-slate-300 border-t-transparent rounded-full mr-2"}),"Loading Apple Sign In..."]})})}const _m=ee=>{if(!(ee!=null&&ee.requiresSubscription))return!1;let Se;if(ee!=null&&ee.trialEndsAt)Se=new Date(ee.trialEndsAt);else if(ee!=null&&ee.createdAt)Se=new Date(ee.createdAt),Se.setDate(Se.getDate()+30);else return!0;return new Date>Se},QX=ee=>{let Se;if(ee!=null&&ee.trialEndsAt)Se=new Date(ee.trialEndsAt);else if(ee!=null&&ee.createdAt)Se=new Date(ee.createdAt),Se.setDate(Se.getDate()+30);else return 0;const oe=new Date,lt=Se.getTime()-oe.getTime(),Wt=Math.ceil(lt/(1e3*60*60*24));return Math.max(0,Wt)},JX=ee=>{if(!ee)return!1;const Se=ee.toLowerCase();return["past_due","incomplete","incomplete_expired","unpaid","canceled"].includes(Se)},XX=async()=>{if(!(Ae!=null&&Ae.email)){e({title:"Missing email",description:"We could not find your email to open the billing portal.",variant:"destructive"});return}js(!0);try{const ee=await Pe("POST","/api/manage-subscription",{instructorEmail:Ae.email}),Se=await ee.json();if(ee.ok&&Se.url){window.location.href=Se.url;return}throw new Error((Se==null?void 0:Se.message)||"Unable to open billing portal")}catch(ee){e({title:"Portal unavailable",description:(ee==null?void 0:ee.message)||"Please try again shortly.",variant:"destructive"})}finally{js(!1)}};f.useEffect(()=>{var ee;if(Ae){console.log("Fresh instructor data loaded:",Ae);const Se=(ee=Ae.subscriptionStatus)==null?void 0:ee.toLowerCase(),oe=["canceled","unpaid","incomplete_expired"];if(_m(Ae)&&(!Se||oe.includes(Se))){window.location.href="/profile";return}Xs(Ae.primaryColor||"#3B82F6"),Vt(Ae.secondaryColor||"#10B981"),at((Ae==null?void 0:Ae.heroColor)??""),ps((Ae==null?void 0:Ae.heroGradientStyle)??""),Ss((Ae==null?void 0:Ae.heroTextColor)??"");const Wt=document.documentElement;if(Ae.primaryColor){const an=Cv(Ae.primaryColor);Wt.style.setProperty("--primary",j3(an)),Wt.style.setProperty("--primary-foreground",N3(an))}if(Ae.secondaryColor){const an=j3(Ae.secondaryColor);Wt.style.setProperty("--secondary",an);const Nn=N3(Ae.secondaryColor);Wt.style.setProperty("--secondary-foreground",Nn)}Zt===void 0&&Ht(Ae.businessName||""),Tt===void 0&&Ot(Ae.instructorName||""),Ft===void 0&&is(Ae.description||""),Cs===void 0&&Ne(Ae.tagline||""),rt===void 0&&ht(Ae.headline||"");const As=Ae.terminologyPlural||"Classes",Gt=Ho(As);Ve(Gt.plural),ys(Gt.singular),dn(Gt.plural),Js(Ae.logoUrl||""),hs(Ae.stripePublicKey||""),Os(Ae.stripeSecretKey||""),tt(Ae.paypalClientSecret||""),$(Ae.currency||""),ye(Ae.timezone||"");const On=Array.isArray(Ae.freeTrialExcludedEmails)?Ae.freeTrialExcludedEmails:[];ar(On.join(`
738`)),Mn(!!Ae.pushSubscription),Qn(Ae.pushSubscription||null)}},[Ae]);const[ZX,XF]=f.useState(!1);f.useEffect(()=>{if(Z){const ee=setTimeout(()=>XF(!0),200);return()=>clearTimeout(ee)}
738else XF(!1)},[Z]);const{data:Kt}=Ue({queryKey:["/api/stats",U,I,R],enabled:ZX,staleTime:5*60*1e3,gcTime:10*60*1e3,queryFn:async()=>{const ee=G();let Se="/api/stats";if(ee){const Wt=new URLSearchParams({startDate:ee.start.toISOString(),endDate:ee.end.toISOString()});Se+=`?${Wt.toString()}`,console.log("Fetching stats with URL:",Se),console.log("Date range:",ee)}else console.log("Fetching all-time stats");const lt=await(await Pe("GET",Se)).json();return console.log("Stats response:",lt),lt}}),eZ=(Kt==null?void 0:Kt.totalBookings)!==void 0&&Kt.totalBookings<10,{data:Lv}=Ue({queryKey:["/api/stats","all-time"],enabled:eZ,staleTime:5*60*1e3,gcTime:10*60*1e3,queryFn:async()=>{const Se=await(await Pe("GET","/api/stats")).json();return console.log("All-time stats fetched (current period has < 10 bookings):",Se),Se}}),Rp=xt({mutationFn:async()=>{const ee=Ho(Ye),Se=Gt=>!!Gt&&Gt.endsWith("***"),oe=gs&&!Se(gs),lt=He&&!Se(He),Wt={businessName:Zt??(A==null?void 0:A.businessName)??"",instructorName:Tt??(A==null?void 0:A.instructorName)??"",description:Ft??(A==null?void 0:A.description)??"",tagline:Cs??(A==null?void 0:A.tagline)??"",headline:rt??(A==null?void 0:A.headline)??"",logoUrl:ts||(A==null?void 0:A.logoUrl),primaryColor:xn||(A==null?void 0:A.primaryColor),secondaryColor:nn||(A==null?void 0:A.secondaryColor),heroColor:Te||(A==null?void 0:A.heroColor)||null,heroGradientStyle:ss||(A==null?void 0:A.heroGradientStyle)||null,heroTextColor:bs||(A==null?void 0:A.heroTextColor)||null,stripePublicKey:xs||(A==null?void 0:A.stripePublicKey),paypalEnabled:cs!==null?cs:A==null?void 0:A.paypalEnabled,paypalClientId:rr||(A==null?void 0:A.paypalClientId),paypalEnvironment:Jt||(A==null?void 0:A.paypalEnvironment),currency:K||(A==null?void 0:A.currency),timezone:pe||(A==null?void 0:A.timezone),pushSubscription:en?yr:null,terminologySingular:ee.singular,terminologyPlural:ee.plural,webhookUrl:zs||(A==null?void 0:A.webhookUrl)||null,webhookEvents:we.length?we:(A==null?void 0:A.webhookEvents)||[],..._t?{webhookSecret:_t}:{}};return oe&&(Wt.stripeSecretKey=gs),lt&&(Wt.paypalClientSecret=He),(await Pe("PATCH",`/api/instructors/${A==null?void 0:A.id}`,Wt)).json()},onSuccess:ee=>{console.log("Settings saved successfully:",ee),Ms.invalidateQueries({queryKey:[`/api/instructors/${A==null?void 0:A.id}`]}),Ms.refetchQueries({queryKey:[`/api/instructors/${A==null?void 0:A.id}`]}),ge(ee),Ht(void 0),Ot(void 0),is(void 0),Ne(void 0),ht(void 0),Js(""),Xs(ee.primaryColor||"#3B82F6"),Vt(ee.secondaryColor||"#10B981"),at((ee==null?void 0:ee.heroColor)??""),ps((ee==null?void 0:ee.heroGradientStyle)??""),Ss((ee==null?void 0:ee.heroTextColor)??""),hs(""),Os(""),$(""),ye(""),e({title:"Settings Saved",description:"Your branding settings have been updated successfully."})},onError:ee=>{console.error("Save error:",ee),e({title:"Error",description:"Failed to save settings. Please try again.",variant:"destructive"})}}),Uv=()=>{const ee=Zt??(Ae==null?void 0:Ae.businessName)??(A==null?void 0:A.businessName)??"",Se=Tt??(Ae==null?void 0:Ae.instructorName)??(A==null?void 0:A.instructorName)??"",oe=rt??(Ae==null?void 0:Ae.headline)??(A==null?void 0:A.headline)??"",lt=ee.trim(),Wt=Se.trim(),As=oe.trim();if(!lt){e({title:"Business name required",description:"Please enter your business name before saving.",variant:"destructive"});return}if(!Wt){e({title:"Instructor name required",description:"Please enter your name before saving.",variant:"destructive"});return}if(!As){e({title:"Headline required",description:"Please enter a booking page headline before saving.",variant:"destructive"});return}if(lt.length>60){e({title:"Validation Error",description:"Business name cannot be longer than 60 characters",variant:"destructive"});return}if(Wt.length>50){e({title:"Validation Error",description:"Instructor name cannot be longer than 50 characters",variant:"destructive"});return}console.log("Save button clicked, calling mutation..."),Rp.mutate()},tZ=xt({mutationFn:async ee=>{const Se=Zt??(Ae==null?void 0:Ae.businessName)??(A==null?void 0:A.businessName)??"",oe=Tt??(Ae==null?void 0:Ae.instructorName)??(A==null?void 0:A.instructorName)??"";return(await(await Pe("POST","/api/polish-text",{text:ee,type:"business_description",context:{businessName:Se,instructorName:oe}}
738)).json()).polishedText},onSuccess:ee=>{is(ee),Ze(!1),e({title:"Text Enhanced",description:"Your business description has been polished with AI"})},onError:ee=>{Ze(!1),e({title:"Enhancement Failed",description:ee.message||"Failed to enhance text",variant:"destructive"})}}),sZ=xt({mutationFn:async ee=>{const Se=Zt??(Ae==null?void 0:Ae.businessName)??(A==null?void 0:A.businessName)??"",oe=Tt??(Ae==null?void 0:Ae.instructorName)??(A==null?void 0:A.instructorName)??"",lt=Ft??(Ae==null?void 0:Ae.description)??(A==null?void 0:A.description)??"";return(await(await Pe("POST","/api/polish-text",{text:ee,type:"tagline",context:{businessName:Se,instructorName:oe,businessDescription:lt}})).json()).polishedText},onSuccess:ee=>{Ne(ee),Ns(!1),e({title:"Text Enhanced",description:"Your tagline has been polished with AI"})},onError:ee=>{Ns(!1),e({title:"Enhancement Failed",description:ee.message||"Failed to enhance text",variant:"destructive"})}}),un=xt({mutationFn:async ee=>{console.log("🔔 Mutation called with settings:",ee),console.log("🔔 Instructor ID:",A==null?void 0:A.id);const oe=await(await Pe("PATCH",`/api/instructors/${A==null?void 0:A.id}`,ee)).json();return console.log("🔔 Mutation response:",oe),oe},onSuccess:ee=>{console.log("🔄 Contact settings updated successfully:",ee),e({title:"Settings updated",description:"Contact settings have been updated successfully."}),ge(ee),Array.isArray(ee==null?void 0:ee.freeTrialExcludedEmails)&&ar(ee.freeTrialExcludedEmails.join(`
739`)),Ms.invalidateQueries({queryKey:[`/api/instructors/${A==null?void 0:A.id}`]}),Ms.invalidateQueries({queryKey:[`/api/instructor/by-subdomain/${ee==null?void 0:ee.subdomain}`]}),Ms.refetchQueries({queryKey:[`/api/instructors/${A==null?void 0:A.id}`]}),Ms.refetchQueries({queryKey:[`/api/instructor/by-subdomain/${ee==null?void 0:ee.subdomain}`]})},onError:()=>{e({title:"Error",description:"Failed to update settings",variant:"destructive"})}}),zv=xt({mutationFn:async ee=>{const Se=await Pe("PATCH",`/api/instructors/${A==null?void 0:A.id}/subdomain`,{subdomain:ee});if(!Se.ok){const oe=await Se.json();throw new Error(oe.message||"Failed to update booking path")}return Se.json()},onSuccess:ee=>{e({title:"Success",description:"Your booking path has been updated successfully."}),ge(ee),W(!1),H(""),L(""),Ms.invalidateQueries({queryKey:[`/api/instructors/${A==null?void 0:A.id}`]}),Ms.invalidateQueries({queryKey:[`/api/instructor/by-subdomain/${ee==null?void 0:ee.subdomain}`]})},onError:ee=>{L(ee.message||"Failed to update booking path")}}),nZ=()=>{var ee;if(!q.trim()){L("Please enter a booking path");return}if(q.length<3){L("Path must be at least 3 characters long");return}if(q===((ee=Ae||A)==null?void 0:ee.subdomain)){L("This is already your current booking path");return}zv.mutate(q)},rZ=async()=>{if(!("serviceWorker"in navigator))throw new Error("Service workers are not supported in this browser.");let Se=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!Se)throw new Error("VAPID public key not set.");return Se.toJSON()},aZ=async ee=>{if(Mn(ee),ee)try{if(await Notification.requestPermission()!=="granted"){e({title:"Permission denied",description:"Push notifications permission was not granted.",variant:"destructive"}),Mn(!1);return}const oe=await rZ();Qn(oe),e({title:"Push notifications enabled!",description:'Click "Save Settings" to store your notification preferences.'})}catch(Se){console.error("Error enabling notifications:",Se),e({title:"Error enabling notifications",description:(Se==null?void 0:Se.message)||"Failed to enable push notifications.",variant:"destructive"}),Mn(!1),Qn(null)}else{try{if("serviceWorker"in navigator){const oe=await(await navigator.serviceWorker.ready).pushManager.getSubscription();oe&&await oe.unsubscribe()}}catch(Se){console.error("Error unsubscribing:",Se)}Qn(null),e({title:"Push notifications disabled",description:'Click "Save Settings" to update your preferences.'})}},iZ=()=>{const ee=Ft!==void 0?Ft:(Ae==null?void 0:Ae.description)||(A==null?void 0:A.description)||"";if(!ee.trim()){e({title:"No text to enhance",description:"Please enter a business description first",variant:"destructive"});return}ae(ee),Ze(!0),tZ.mutate(ee)},oZ=()=>
739{const ee=Cs??(Ae==null?void 0:Ae.tagline)??(A==null?void 0:A.tagline)??"";if(!ee.trim()){e({title:"No text to enhance",description:"Please enter a tagline first",variant:"destructive"});return}Le(ee),Ns(!0),sZ.mutate(ee)},lZ=()=>{ls&&(is(ls),ae(""),e({title:"Changes Reverted",description:"Business description restored to original text"}))},cZ=()=>{Re&&(Ne(Re),Le(""),e({title:"Changes Reverted",description:"Tagline restored to original text"}))},dZ=async ee=>{ee.preventDefault(),ze(""),Me(!0),localStorage.removeItem("admin_session"),localStorage.removeItem("user_data");try{console.log("Attempting login with:",{email:Ie,password:"***"});const Se=await fetch("/api/instructor/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:Ie,password:qe})});if(console.log("Response status:",Se.status),Se.ok)try{const oe=await Se.json();console.log("Login successful, received data:",oe);const{instructor:lt,token:Wt}=oe;Ms.clear(),ge(lt),ie(!0),localStorage.setItem("auth_token",Wt),fe(lt),typeof window<"u"&&typeof window.Beacon=="function"&&window.Beacon("identify",{email:lt.email,name:lt.instructorName})}catch(oe){console.error("JSON parse error:",oe);const lt=await Se.text();console.log("Raw response:",lt),ze("Invalid response from server")}else{const oe=await Se.text();console.log("Login failed:",Se.status,oe),ze("Invalid email or password")}}catch(Se){console.error("Login error:",Se),ze("Login failed. Please try again.")}finally{Me(!1)}},ZF=()=>{ie(!1),ge(null),$e(""),ft(""),localStorage.removeItem("admin_session"),localStorage.removeItem("user_data"),localStorage.removeItem("auth_token"),localStorage.clear(),mZ()&&window.flutter_inappwebview&&(console.log("Sending logout message to Flutter app"),window.flutter_inappwebview.callHandler("flutterHandler","logout")),Ke(),vt("dashboard")},uZ=async(ee,Se)=>{if(confirm(`Are you sure you want to delete "${Se}"?
740
741This form will only be deleted if it's not currently used by any classes. This action cannot be undone.`))try{const oe=await fetch(`/api/onboarding-forms/${ee}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("auth_token")}`}});if(!oe.ok){const lt=await oe.json();throw new Error(lt.message||"Failed to delete form")}await Ms.invalidateQueries({queryKey:["/api/onboarding-forms"]}),await Ms.refetchQueries({queryKey:["/api/onboarding-forms"]}),e({title:"Form deleted",description:`"${Se}" has been successfully deleted.`})}catch(oe){e({title:"Delete failed",description:oe.message||"Failed to delete form. Please try again.",variant:"destructive"})}};f.useEffect(()=>{Ae&&"paypalEnabled"in Ae&&(console.log("🔥 Initializing PayPal fields with fresh instructor data:",{paypalEnabled:Ae.paypalEnabled,paypalClientId:Ae.paypalClientId,paypalClientSecret:Ae.paypalClientSecret,payp
741alEnvironment:Ae.paypalEnvironment}),Tr(Ae.paypalEnabled??!1),xe(Ae.paypalClientId||""),tt(Ae.paypalClientSecret||""),ds(Ae.paypalEnvironment||"sandbox"),De(Ae.webhookUrl||""),ot(Array.isArray(Ae.webhookEvents)?Ae.webhookEvents:[]),zt(""))},[Ae]);const e4=f.useCallback(ee=>{console.log("🔐 ADMIN GOOGLE LOGIN - Success:",ee),ee.token&&(localStorage.setItem("auth_token",ee.token),console.log("💾 ADMIN GOOGLE LOGIN - JWT token stored")),ge(ee),ie(!0),fe(ee),Ms.clear(),typeof window<"u"&&typeof window.Beacon=="function"&&window.Beacon("identify",{email:ee.email,name:ee.instructorName}),e({title:"Login Successful",description:`Welcome back, ${ee.instructorName}!`})},[]),t4=f.useCallback(ee=>{console.error("🔐 ADMIN GOOGLE LOGIN - Error:",ee),ze("Google login failed. Please try again or use your password."),e({title:"Login Failed",description:"There was an error with Google Sign-In. Please try again.",variant:"destructive"})},[]);f.useCallback(ee=>{console.error("🔐 ADMIN GOOGLE LOGIN - Error:",ee),ze("Facebook login failed. Please try again or use your password."),e({title:"Login Failed",description:"There was an error with Facebook Sign-In. Please try again.",variant:"destructive"})},[]),f.useCallback(ee=>{console.error("🔐 ADMIN GOOGLE LOGIN - Error:",ee),ze("Apple login failed. Please try again or use your password."),e({title:"Login Failed",description:"There was an error with Apple Sign-In. Please try again.",variant:"destructive"})},[]);function s4(){return/twa/.test(navigator.userAgent.toLowerCase())||window.navigator.standalone&&/android/i.test(navigator.userAgent)?!0:window.matchMedia("(display-mode: standalone)").matches&&/android/i.test(navigator.userAgent)}function mZ(){return window.flutter_inappwebview!==void 0}if(!Z){let ee=!1;try{ee=!0}catch{}return s4()&&(ee=!1),s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:s.jsx(Ce,{className:"w-full max-w-md",children:s.jsxs(Ee,{className:"p-8 flex flex-col items-center justify-center",children:[s.jsxs("div",{className:"text-center mb-6",children:[s.jsx(jd,{className:"h-12 w-12 text-primary mx-auto mb-4"}),s.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"Admin Access"}),s.jsx("p",{className:"text-slate-600 mt-2",children:"Enter password to access the admin dashboard"})]}),s.jsxs("form",{onSubmit:dZ,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",children:"Instructor Email"}),s.jsx(me,{id:"email",type:"email",value:Ie,onChange:Se=>$e(Se.target.value),placeholder:"[email protected]",className:"mt-1",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"password",children:"Password"}),s.jsxs("div",{className:"relative mt-1",children:[s.jsx(me,{id:"password",type:be?"text":"password",value:qe,onChange:Se=>ft(Se.target.value),placeholder:"Your password",className:"pr-10",required:!0}),s.jsx("button",{type:"button","aria-label":be?"Hide password":"Show password",onClick:()=>Fe(Se=>!Se),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 focus:outline-none",tabIndex:0,children:be?s.jsx(uc,{className:"h-4 w-4"}):s.jsx(wa,{className:"h-4 w-4"})})]}),_e&&s.jsx("p",{className:"text-red-500 text-sm mt-2",children:_e})]}),s.jsx(B,{type:"submit",className:"w-full",disabled:ue,children:ue?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Logging in..."]}):"Access Dashboard"}),s.jsxs("div",{className:"relative my-6",children:[s.jsx("div",{className:"absolute inset-0 flex items-center",children:s.jsx("span",{className:"w-full border-t"})}),s.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:s.jsx("span",{className:"bg-white px-2 text-muted-foreground",children:"Or continue with"})})]}),s.jsxs("div",{className:"flex flex-col items-center gap-3 w-full",children:[s.jsx(O1e,{onSuccess:e4,onError:t4}),ee&&s.jsx(Zd,{onSuccess:()=>{},onError:()=>{},toast:e,setLocation:Q}),ee&&s.jsx(lO,{onSuccess:e4,onError:t4})]}),s.jsxs("div",{className:"text-center mt-4 space-y-2",children:[s.jsx(B,{t
741ype:"button",variant:"link",className:"text-sm text-slate-600 hover:text-slate-800 block mx-auto",onClick:()=>window.location.href="/forgot-password",children:"Forgot Password?"}),s.jsxs("div",{className:"text-sm text-slate-600",children:["Don't have an account?"," ",s.jsx(B,{type:"button",variant:"link",className:"text-sm text-primary hover:text-primary/80 p-0 h-auto font-medium underline",onClick:()=>window.location.href="/instructor-signup",children:"Sign up here"})]})]})]}),s.jsx("div",{className:"mt-6 text-center",children:s.jsx(B,{variant:"ghost",onClick:()=>window.location.href="/",children:"← Back to Client Page"})})]})})})}function hZ({setShowCreateCouponDialog:ee,setEditingCoupon:Se}){const[oe,lt]=f.useState(!1),[Wt,As]=f.useState(null),[Gt,On]=f.useState(null),[an,Nn]=f.useState(""),[Bn,Jn]=f.useState(null),[ur,qs]=f.useState(""),[mn,Ln]=f.useState(0),[Sn,st]=f.useState(null),[_s,wt]=f.useState(!0),[fs,vn]=f.useState(""),{data:ra=[],isLoading:kc,refetch:Vo}=Ue({queryKey:["/api/coupons"]}),Un=Ae||A,Ps=!Ae&&!!(A!=null&&A.id),{data:kn,isLoading:Wr,error:Ca}=Ue({queryKey:[`/api/coupons/bundles/${Wt==null?void 0:Wt.id}/private-link-token`],enabled:!!(Wt!=null&&Wt.id),queryFn:async()=>{const Et=await Pe("GET",`/api/coupons/bundles/${Wt.id}/private-link-token`);if(!Et.ok){const $n=await Et.json();throw new Error($n.message||"Failed to generate private link token")}return Et.json()}});f.useEffect(()=>{if(kn!=null&&kn.token&&Un)if(On(kn.token),Un.subdomain){const Et=`${window.location.origin}/classes/${Un.subdomain}/bundles?token=${kn.token}`;Nn(Et)}else Nn(""),console.warn("Instructor does not have a subdomain configured")},[kn,Un]);const Mm=ra.filter(Et=>{const $n=Et.bundleType==="session_bundle"&&Et.isMaster,ai=Et.bundleType==="discount";return $n||ai}),{data:vC=[]}=Ue({queryKey:["/api/clients"],enabled:!!Bn}),bC=xt({mutationFn:async({bundleId:Et,customerEmail:$n,customerName:ai,sessionCount:kZ,sendEmailToClient:PZ,emailCustomMessage:wC})=>{const jC=await Pe("POST",`/api/coupons/bundles/${Et}/give`,{customerEmail:$n.trim().toLowerCase(),customerName:ai||void 0,sessionCount:kZ,sendEmailToClient:PZ,emailCustomMessage:(wC==null?void 0:wC.trim())||void 0});if(!jC.ok){const EZ=await jC.json();throw new Error(EZ.message||"Failed to give bundle")}return jC.json()},onSuccess:(Et,$n)=>{$n.sendEmailToClient?e({title:"Bundle given",description:"The client will receive an email with their bundle details."}):e({title:"Bundle given",description:Et.bundleCode?`No email was sent. Bundle code: ${Et.bundleCode} — share it with your client directly.`:"No email was sent. Copy the bundle code from your promotions list if needed."}),Ms.invalidateQueries({queryKey:["/api/coupons"]}),Ms.invalidateQueries({queryKey:["/api/clients"]}),Jn(null),qs(""),st(null),wt(!0),vn("")},onError:Et=>{st(Et.message)}}),bZ=xt({mutationFn:async Et=>{const $n=await fetch(`/api/coupons/${Et}`,{method:"DELETE"});if(!$n.ok){const ai=await $n.json();throw new Error(ai.message||"Failed to delete coupon")}return $n.json()},onSuccess:()=>{e({title:"Success",description:"Coupon deleted successfully"}),Vo()},onError:Et=>{e({title:"Error",description:Et.message,variant:"destructive"})}}),wZ=(Et,$n)=>{confirm(`Are you sure you want to delete the coupon "${$n}"? This action cannot be undone.`)&&bZ.mutate(Et)},jZ=Et=>{navigator.clipboard.writeText(Et),e({title:"Copied!",description:"Coupon code copied to clipboard"})},NZ=(Et,$n)=>{$n.stopPropagation(),As(Et),Nn(""),On(null),lt(!0)},CZ=()=>{an&&(navigator.clipboard.writeText(an),e({title:"Link copied",description:"Private bundle link has been copied to clipboard."}))},SZ=Et=>{lt(Et),Et||(As(null),Nn(""),On(null))};return kc?s.jsx("div",{children:"Loading promotions..."}):Mm.length===0?s.jsxs("div",{className:"text-center py-8",children:[s.jsx(bM,{className:"h-12 w-12 text-slate-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-medium text-slate-900 mb-2",children:"No promotions yet"}),s.jsx("p",{className:"text-slate-600 mb-4",children:"Create your first coupon or bundle to offer discounts to your clients."}),s.jsxs(B,{onClick:()=>ee(!0),children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Create Your First Promotion"]})]}):s.jsxs("div",{className:"space-y-4",children:[Mm.map(Et=>{const $n=Et.bundleType==="session_bundle"&&Et.isMaster;return Et.bundleType,s.jsxs("div",{className:`border rounded-lg p-4 ${$n?"hover:bg-slate-50 cursor-pointer":""}`,onClick:$n?()=>{e({title:"Bundle Details",description:"Bundle details view coming soon"})}:void 0,children:[s.jsxs("div",{className:"flex items-start justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center space-x-4 flex-1 min-w-0",children:[s.jsx("div",{className:`p-2 rounded-lg flex-shrink-0 ${$n?"bg-purple-100":Et.discountType==="percentage"?"bg-green-100":"bg-blue-100"}`,children:$n?s.jsx(zx,{className:"h-5 w-5 text-purple-600"}):Et.discountType==="percentage"?s.jsx(bM,{className:"h-5 w-5 text-green-600"}):s.jsx(wM,{className:"h-5 w-5 text-blue-600"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"flex items-center space-x-2",children:$n?s.jsx("h4",{className:"font-medium text-slate-900 truncate",children:Et.name}):s.jsxs(s.Fragment,{children:[s.jsx("h4",{className:"font-medium text-slate-900 truncate",children:Et.code}),s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>jZ(Et.code),className:"h-6 w-6 p-0 flex-shrink-0",children:s.jsx(pr,{className:"h-3 w-3"})})]})}),s.jsx("div",{className:"text-sm text-slate-600",children:$n?s.jsxs(s.Fragment,{children:[mt((Un==null?void 0:Un.currency)||"GBP"),typeof Et.discountValue=="number"?Et.discountValue.toFixed(2):Et.discountValue," • ",Et.sessionCount," sessions",Et.allowGiftSharing?" • Gift-enabled (locks to first redeemer)":"",Et.de
741scription&&s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:Et.description})]}):s.jsxs(s.Fragment,{children:[Et.discountType==="percentage"||Et.discountType==="percent"?`${Et.discountValue}% off`:Et.discountType==="fixed_price"?`Set price to ${mt((Un==null?void 0:Un.currency)||"GBP")}${Et.discountValue}${Et.applyMode==="each_class"?" per class":""}`:`${mt((Un==null?void 0:Un.currency)||"GBP")}${Et.discountValue} off${Et.applyMode==="each_class"?" per class":""}`,(Et.maxUses??Et.usageLimit)&&` • Limited to ${Et.maxUses??Et.usageLimit} uses`,Et.timesUsed>0&&` • Used ${Et.timesUsed} times`,Et.applicableEventMode==="all"&&" • Events",Et.applicableEventMode==="selected"&&" • Selected events",Et.description&&s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:Et.description})]})})]})]}),s.jsxs("div",{className:"flex-shrink-0 ml-4",children:[$n&&s.jsx(Je,{variant:"outline",className:"bg-purple-50 text-purple-700 border-purple-200",children:"Bundle Template"}),!$n&&s.jsx(Je,{variant:Et.isActive?"default":"secondary",children:Et.isActive?"Active":"Inactive"})]})]}),s.jsxs("div",{className:"flex items-center justify-end space-x-2 pt-2 border-t border-slate-100",children:[s.jsx(B,{variant:"ghost",size:"sm",onClick:ai=>{ai.stopPropagation(),Se(Et),ee(!0)},className:"text-blue-600 hover:text-blue-700",children:s.jsx(Ur,{className:"h-4 w-4"})}),$n&&s.jsx(B,{variant:"ghost",size:"sm",onClick:ai=>{ai.stopPropagation(),Jn(Et),Ln(Math.max(1,Et.sessionCount||1)),qs(""),st(null),wt(!0),vn("")},className:"text-green-600 hover:text-green-700",title:"Give to client",children:s.jsx(Nre,{className:"h-4 w-4"})}),$n&&s.jsx(B,{variant:"ghost",size:"sm",onClick:ai=>NZ(Et,ai),className:"text-purple-600 hover:text-purple-700",title:"Private Link",children:s.jsx(Tf,{className:"h-4 w-4"})}),s.jsx(B,{variant:"ghost",size:"sm",onClick:ai=>{ai.stopPropagation(),wZ(Et.id,$n?Et.name:Et.code)},className:"text-red-600 hover:text-red-700",children:s.jsx(ln,{className:"h-4 w-4"})})]})]},Et.id)}),s.jsx(Ct,{open:oe,onOpenChange:SZ,children:s.jsxs(St,{children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Private Bundle Purchase Link"}),s.jsx(yn,{children:"Share this link to allow someone to purchase this bundle even if it's hidden from your public page."})]}),Ps?s.jsxs("div",{className:"flex items-center justify-center py-4",children:[s.jsx(Qr,{className:"h-4 w-4 animate-spin mr-2"}),s.jsx("span",{children:"Loading instructor information..."})]}):Wr?s.jsxs("div",{className:"flex items-center justify-center py-4",children:[s.jsx(Qr,{className:"h-4 w-4 animate-spin mr-2"}),s.jsx("span",{children:"Generating private link token..."})]}):Ca?s.jsxs("div",{className:"text-sm text-red-600 py-4",children:["Error: ",Ca.message||"Failed to generate private link token"]}):kn!=null&&kn.token&&!(Un!=null&&Un.subdomain)?s.jsx("div",{className:"text-sm text-red-600 py-4",children:"Error: Instructor subdomain is not configured. Please set a subdomain in your profile settings to generate private links."}):an?s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(me,{readOnly:!0,value:an,className:"font-mono text-sm"}),s.jsxs(B,{variant:"outline",size:"sm",onClick:CZ,children:[s.jsx(pr,{className:"h-4 w-4 mr-2"}),"Copy"]})]})}):s.jsx("div",{className:"text-sm text-muted-foreground py-4",children:Un?"Preparing link...":"Loading instructor information..."}),s.jsx(Er,{children:s.jsx(B,{variant:"outline",onClick:()=>lt(!1),children:"Close"})})]})}),s.jsx(Ct,{open:!!Bn,onOpenChange:Et=>{Et||(Jn(null),st(null),wt(!0),vn(""))},children:s.jsxs(St,{className:"sm:max-w-md",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Give bundle to client"}),s.jsx(yn,{children:"Create a bundle for a client without payment (for example, they bought it elsewhere). Choose whether to email them the bundle code and instructions, or turn that off if you prefer to share the code yourself."})]}),Bn&&s.jsxs("div",{className:"space-y-4 pt-2",children:[s.jsxs("p",{className:"text-sm text-slate-600",children:["Bundle: ",s.jsx("strong",{children:Bn.name})," (max ",Bn.sessionCount," sessions)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"give-bundle-email",children:"Client email"}
741),s.jsx(me,{id:"give-bundle-email",type:"email",value:ur,onChange:Et=>{qs(Et.target.value),st(null)},placeholder:"[email protected]",list:"give-bundle-email-list",autoComplete:"off"}),s.jsx("datalist",{id:"give-bundle-email-list",children:vC.map(Et=>s.jsx("option",{value:Et.email||"",children:Et.name?`${Et.name} (${Et.email})`:Et.email},Et.id))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"give-bundle-sessions",children:"Sessions"}),s.jsx(me,{id:"give-bundle-sessions",type:"number",min:1,max:Bn.sessionCount||1,value:mn,onChange:Et=>Ln(Math.min(Bn.sessionCount||1,Math.max(1,parseInt(Et.target.value,10)||1)))}),s.jsxs("p",{className:"text-xs text-slate-500",children:["1 to ",Bn.sessionCount," (e.g. reduce if they used some sessions elsewhere)"]})]}),s.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-slate-200 px-3 py-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(V,{htmlFor:"give-bundle-send-email",className:"text-sm font-medium",children:"Email client bundle details"}),s.jsx("p",{className:"text-xs text-slate-500",children:"Sends their bundle code and how to use it. Turn off if you will email them directly."})]}),s.jsx(Rs,{id:"give-bundle-send-email",checked:_s,onCheckedChange:wt})]}),_s&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"give-bundle-custom-message",children:"Optional message in email"}),s.jsx(Is,{id:"give-bundle-custom-message",value:fs,onChange:Et=>vn(Et.target.value),placeholder:"Add a short personal note (shown in the email to your client)",rows:4,maxLength:2e3,className:"resize-y min-h-[96px]"}),s.jsx("p",{className:"text-xs text-slate-500",children:"If you add text here, it appears in the email above the bundle code. Leave blank for the standard email only."})]}),Sn&&s.jsx("p",{className:"text-sm text-red-600",children:Sn}),s.jsxs(Er,{children:[s.jsx(B,{variant:"outline",onClick:()=>{Jn(null),st(null),wt(!0),vn("")},children:"Cancel"}),s.jsx(B,{disabled:!ur.trim()||bC.isPending,onClick:()=>{bC.mutate({bundleId:Bn.id,customerEmail:ur.trim(),sessionCount:mn,sendEmailToClient:_s,emailCustomMessage:fs.trim()||void 0})},children:bC.isPending?s.jsxs(s.Fragment,{children:[s.jsx(Qr,{className:"h-4 w-4 animate-spin mr-2"}),_s?"Sending…":"Creating…"]}):_s?"Give bundle & email client":"Give bundle"})]})]})]})})]})}function fZ({setEditingBundleSessionCount:ee,setShowEditBundleDialog:Se}){const[oe,lt]=f.useState(""),[Wt,As]=f.useState(!1),[Gt,On]=f.useState(null),{data:an=[],isLoading:Nn,refetch:Bn}=Ue({queryKey:["/api/coupons"]}),Jn=an.filter(wt=>wt.bundleType==="session_bundle"&&!wt.isMaster),{data:ur=[]}=Ue({queryKey:["/api/clients"],enabled:Jn.length>0}),qs=new Map;ur.forEach(wt=>
741{wt.email&&wt.name&&qs.set(wt.email.toLowerCase().trim(),wt.name)});const mn=Jn.filter(wt=>{var Un,Ps,kn,Wr;if(!oe.trim())return!0;const fs=oe.toLowerCase(),vn=((Un=wt.emailLock)==null?void 0:Un.toLowerCase())||"",ra=((Ps=wt.code)==null?void 0:Ps.toLowerCase())||"",kc=((kn=wt.name)==null?void 0:kn.toLowerCase())||"",Vo=((Wr=qs.get(vn))==null?void 0:Wr.toLowerCase())||"";return vn.includes(fs)||ra.includes(fs)||kc.includes(fs)||Vo.includes(fs)}),Ln=xt({mutationFn:async wt=>{const fs=await fetch(`/api/coupons/${wt}`,{method:"DELETE"});if(!fs.ok){const vn=await fs.json();throw new Error(vn.message||"Failed to delete bundle")}return fs.json()},onSuccess:()=>{e({title:"Success",description:"Bundle deleted successfully"}),Bn()},onError:wt=>{e({title:"Error",description:wt.message,variant:"destructive"})}}),Sn=(wt,fs)=>{confirm(`Are you sure you want to delete the bundle "${fs}"? This action cannot be undone.`)&&Ln.mutate(wt)},st=wt=>{navigator.clipboard.writeText(wt),e({title:"Copied!",description:"Bundle code copied to clipboard"})};xt({mutationFn:async({bundleId:wt,paidAmount:fs})=>{const vn=await Pe("POST",`/api/coupons/${wt}/mark-paid`,{paidAmount:fs});if(!vn.ok){const ra=await vn.json();throw new Error(ra.message||"Failed to mark bundle as paid")}return vn.json()},onSuccess:async wt=>{var vn,ra;const fs=mt(((vn=Ae||A)==null?void 0:vn.currency)||"GBP");e({title:"Success",description:`Bundle marked as paid. Client balance: ${fs}${((ra=wt.clientBalance)==null?void 0:ra.toFixed(2))||"N/A"}`}),await Promise.all([Ms.invalidateQueries({queryKey:["/api/coupons"]}),Ms.invalidateQueries({queryKey:["/api/clients"]})]),As(!1),On(null)},onError:wt=>{e({title:"Error",description:wt.message,variant:"destructive"})}});const _s=wt=>{On(wt),As(!0)};return Nn?s.jsx("div",{children:"Loading purchased bundles..."}):Jn.length===0?s.jsxs("div",{className:"text-center py-8",children:[s.jsx(zx,{className:"h-12 w-12 text-slate-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-medium text-slate-900 mb-2",children:"No purchased bundles yet"}),s.jsx("p",{className:"text-slate-600",children:"Bundles purchased by customers will appear here."})]}):s.jsxs(s.Fragment,{children:[s.jsx(pZ,{bundle:Gt,open:Wt,onOpenChange:As}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"relative",children:s.jsx(me,{type:"text",placeholder:"Search by customer name, email, bundle code, or bundle name...",value:oe,onChange:wt=>lt(wt.target.value),className:"w-full"})}),oe&&s.jsxs("p",{className:"text-sm text-slate-600",children:["Showing ",mn.length," of ",Jn.length," bundles"]}),mn.length===0?s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-slate-600",children:"No bundles found matching your search."})}):s.jsx("div",{className:"space-y-4",children:mn.map(wt=>{var kn,Wr;const fs=wt.emailLock||"Unknown",vn=qs.get(fs.toLowerCase().trim())||"Unknown",ra=wt.paymentMethod||"stripe",kc=wt.discountValue?typeof wt.discountValue=="number"?wt.discountValue.toFixed(2):wt.discountValue:"0.00",Vo=ra==="cash",Un=wt.paid===!0||wt.paid==="true"||wt.paid===1,Ps=((kn=wt.name)==null?void 0:kn.replace(` - ${wt.code}`,""))||wt.name||"Unknown Bundle";return s.jsxs("div",{className:"border rounded-lg p-4 hover:bg-slate-50",children:[s.jsxs("div",{className:"flex items-start justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center space-x-4 flex-1 min-w-0",children:[s.jsx("div",{className:"p-2 rounded-lg flex-shrink-0 bg-orange-100",children:s.jsx(Dr,{className:"h-5 w-5 text-orange-600"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[s.jsx("h4",{className:"font-medium text-slate-900 truncate",children:wt.code}),s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>st(wt.code),className:"h-6 w-6 p-0 flex-shrink-0",children:s.jsx(pr,{className:"h-3 w-3"})})]}),s.jsxs("div",{className:"text-sm text-slate-600 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("span",{children:[s.jsx("strong",{children:"Customer:"})," ",vn]}),s.jsx("span",{className:"text-slate-400",children:"•"}),s.jsx("span",{className:"text-slate-500",children:fs})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("span",{children:[s.jsx("strong",{children:"Bundle:"})," ",Ps]}),s.jsx("span",{className:"text-slate-400",children:"•"}),s.jsx("span",{children:wt.sessionCount>0?`${wt.sessionCount} sessions left`:"No sessions left"})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("span",{children:[s.jsx("strong",{children:"Payment:"})," "]}),s.jsx(Je,{variant:"outline",className:Vo?"bg-amber-50 text-amber-700 border-amber-200":"bg-green-50 text-green-700 border-green-200",children:Vo?"💵 Cash":"💳 Stripe"}),s.jsx("span",{className:"text-slate-400",children:"•"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Amount:"})," ",mt(((Wr=Ae||A)==null?void 0:Wr.currency)||"GBP"),kc]})]}),wt.createdAt&&s.jsxs("div",{className:"text-xs text-slate-500",children:["Purchased: ",new Date(wt.createdAt).toLocaleDateString("en-GB",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]})]}),s.jsx("div",{className:"flex-shrink-0 ml-4",children:Un?s.jsx(Je,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Paid"}):s.jsx(Je,{variant:"outline",className:"bg-orange-50 text-orange-700 border-orange-200",children:"Purchased"})})]}),s.jsxs("div",{className:"flex items-center justify-end space-x-2 pt-2 border-t border-slate-100",children:[Vo&&!Un&&s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>_s(wt),className:"text-green-600 hover:text-green-700",title:"Mark bundle as paid",children:s.jsx(Ph,{className:"h-4 w-4"})}),s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>{ee(wt),Se(!0)},className:"text-blue-600 hover:text-blue-700",title:"Edit sessions left",children:s.jsx(Ur,{className:"h-4 w-4"})}),s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>Sn(wt.id,wt.code),className:"text-red-600 hover:text-red-700",children:s.jsx(ln,{className:"h-4 w-4"})})]})]},wt.id)})})]})]})}function pZ({bundle:ee,open:Se,onOpenChange:oe}){var mn,Ln,Sn,st,_s;const[lt,Wt]=f.useState(""),{toast:As}=Yt(),Gt=jn();f.useEffect(()=>{if(ee&&Se){const wt=ee.discountValue?typeof ee.discountValue=="number"?ee.discountValue:parseFloat(String(ee.discountValue)):0;Wt(wt.toFixed(2))}},[ee,Se]);const{data:On=[]}=Ue({queryKey:["/api/clients"],enabled:!!ee}),an=ee!=null&&ee.emailLock?On.find(wt=>{var fs;return((fs=wt.email)==null?void 0:fs.toLowerCase().trim())===ee.emailLock.toLowerCase().trim()}):null,Nn=xt({mutationFn:async wt=>{const fs=await Pe("POST",`/api/coupons/${ee==null?void 0:ee.id}/mark-paid`,{paidAmount:wt});if(!fs.ok){const vn=await fs.json();throw new Error(vn.message||"Failed to mark bundle as paid")}return fs.json()},onSuccess:wt=>{var vn,ra;const fs=mt(((vn=Ae||A)==null?void 0:vn.currency)||"GBP");As({title:"Success",description:`Bundle marked as paid. Client balance: ${fs}${((ra=wt.clientBalance)==null?void 0:ra.toFixed(2))||"N/A"}`}),Gt.invalidateQueries({queryKey:["/api/coupons"]}),Gt.invalidateQueries({queryKey:["/api/clients"]}),oe(!1)},onError:wt=>{As({title:"Error",description:wt.message,variant:"destructive"})}}),Bn=wt=>
741{wt.preventDefault();const fs=parseFloat(lt);if(isNaN(fs)||fs<0){As({title:"Invalid amount",description:"Please enter a valid amount",variant:"destructive"});return}Nn.mutate(fs)};if(!ee)return null;const Jn=ee.discountValue?typeof ee.discountValue=="number"?ee.discountValue:parseFloat(String(ee.discountValue)):0,ur=an!=null&&an.balance?parseFloat(an.balance.toString()):0,qs=ur+parseFloat(lt||"0");return s.jsx(Ct,{open:Se,onOpenChange:oe,children:s.jsxs(St,{children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Mark Bundle as Paid"}),s.jsx(yn,{children:"Record payment for this bundle purchase. The client's balance will be updated accordingly."})]}),s.jsxs("form",{onSubmit:Bn,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2 p-4 bg-slate-50 rounded-lg",children:[s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Client:"})," ",(an==null?void 0:an.name)||ee.emailLock||"Unknown"]}),s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Bundle Code:"})," ",ee.code]}),s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Bundle Name:"})," ",((mn=ee.name)==null?void 0:mn.replace(` - ${ee.code}`,""))||ee.name||"Unknown"]}),s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Bundle Price:"})," ",mt(((Ln=Ae||A)==null?void 0:Ln.currency)||"GBP"),Jn.toFixed(2)]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"paidAmount",children:"Amount Paid"}),s.jsx(me,{id:"paidAmount",type:"number",step:"0.01",min:"0",value:lt,onChange:wt=>Wt(wt.target.value),placeholder:Jn.toFixed(2),required:!0}),s.jsx("p",{className:"text-xs text-slate-500",children:"Enter the amount that was paid. This can differ from the bundle price for partial payments or overpayments."})]}),s.jsxs("div",{className:"space-y-2 p-4 bg-slate-50 rounded-lg",children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-slate-600",children:"Current Balance:"}),s.jsxs("span",{className:`font-medium ${ur<0?"text-red-600":ur>0?"text-green-600":"text-slate-900"}`,children:[mt(((Sn=Ae||A)==null?void 0:Sn.currency)||"GBP"),ur.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-slate-600",children:"Payment Amount:"}),s.jsxs("span",{className:"font-medium text-slate-900",children:["+",mt(((st=Ae||A)==null?void 0:st.currency)||"GBP"),parseFloat(lt||"0").toFixed(2)]})]}),s.jsx("div",{className:"border-t border-slate-200 pt-2 mt-2",children:s.jsxs("div",{className:"flex justify-between text-sm font-medium",children:[s.jsx("span",{className:"text-slate-900",children:"New Balance:"}),s.jsxs("span",{className:qs<0?"text-red-600":qs>0?"text-green-600":"text-slate-900",children:[mt(((_s=Ae||A)==null?void 0:_s.currency)||"GBP"),qs.toFixed(2)]})]})})]}),s.jsxs("div",{className:"flex justify-end space-x-2",children:[s.jsx(B,{type:"button",variant:"outline",onClick:()=>oe(!1),disabled:Nn.isPending,children:"Cancel"}),s.jsx(B,{type:"submit",disabled:Nn.isPending,children:Nn.isPending?"Marking as Paid...":"Mark as Paid"})]})]})]})})}function xZ({classes:ee,editingCoupon:Se}){var ur,qs,mn,Ln,Sn;const[oe,lt]=f.useState({code:"",name:"",description:"",bundleType:"discount",discountType:"percentage",discountValue:"",applyMode:"checkout",sessionCount:"6",applicableClassMode:"all",applicableClassIds:[],applicableServiceIds:[],applicableMembershipMode:null,applicableMembershipIds:[],applicableEventMode:null,applicableEventIds:[],membershipDiscountType:"recurring",instructorPrefix:"",expiresAt:"",expiresAfterFirstUse:!1,expiresAfterPurchase:!1,expiresAfterValue:"",expiresAfterUnit:"months",maxUses:"",perUserLimit:"",allowCashPayments:!1,onePurchasePerCustomer:!1,onePerCustomerUntilUsed:!1,sendLastSessionUsedReminder:!1,allowServices:!1,allowGiftSharing:!1,disableEmailLock:!1,isActive:!0});f.useEffect(()=>{var st,_s,wt,fs,vn;Se?(Se.bundleType==="session_bundle"&&Se.isMaster,Se.bundleType,lt({code:Se.code||"",name:Se.name||"",description:Se.description||"",bundleType:Se.bundleType||"discount",discountType:Se.discountType||"percentage",discountValue:((st=Se.discountValue)==null?void 0:st.toString())||"",applyMode:Se.applyMode==="each_class"?"each_class":"checkout",sessionCount:((_s=Se.sessionCount)==null?void 0:_s.toString())||"6",applicableClassMode:Se.applicableClassMode||"all",applicableClassIds:Se.applicableClassIds||[],applicableServiceIds:Se.applicableServiceIds||[],applicableMembershipMode:Se.applicableMembershipMode||null,applicableMembershipIds:Se.applicableMembershipIds||[],applicableEventMode:Se.applicableEventMode||null,applicableEventIds:Se.applicableEventIds||[],membershipDiscountType:Se.membershipDiscountType||"recurring",instructorPrefix:Se.instructorPrefix||"",expiresAt:Se.expiresAt&&!Se.expiresAfterFirstUse&&!Se.expiresAfterPurchase?new Date(Se.expiresAt).toISOString().split("T")[0]:"",expiresAfterFirstUse:Se.expiresAfterFirstUse||!1,expiresAfterPurchase:Se.expiresAfterPurchase||!1,expiresAfterValue:((wt=Se.expiresAfterValue)==null?void 0:wt.toString())||(Se.expiresAfterFirstUse||Se.expiresAfterPurchase?"2"
741:""),expiresAfterUnit:Se.expiresAfterUnit||"months",maxUses:((fs=Se.maxUses??Se.usageLimit)==null?void 0:fs.toString())||"",perUserLimit:((vn=Se.perUserLimit)==null?void 0:vn.toString())||"",allowCashPayments:Se.allowCashPayments||!1,onePurchasePerCustomer:Se.onePurchasePerCustomer??!1,onePerCustomerUntilUsed:Se.onePerCustomerUntilUsed??!1,sendLastSessionUsedReminder:Se.sendLastSessionUsedReminder??!1,allowServices:Se.allowServices||!1,allowGiftSharing:Se.allowGiftSharing||!1,disableEmailLock:Se.disableEmailLock||!1,isActive:Se.isActive!==void 0?Se.isActive:!0})):lt({code:"",name:"",description:"",bundleType:"discount",discountType:"percentage",discountValue:"",applyMode:"checkout",sessionCount:"6",applicableClassMode:"all",applicableClassIds:[],applicableServiceIds:[],applicableMembershipMode:null,applicableMembershipIds:[],applicableEventMode:null,applicableEventIds:[],membershipDiscountType:"recurring",instructorPrefix:"",expiresAt:"",expiresAfterFirstUse:!1,expiresAfterPurchase:!1,expiresAfterValue:"",expiresAfterUnit:"months",maxUses:"",perUserLimit:"",allowCashPayments:!1,onePurchasePerCustomer:!1,onePerCustomerUntilUsed:!1,sendLastSessionUsedReminder:!1,allowServices:!1,allowGiftSharing:!1,disableEmailLock:!1,isActive:!0})},[Se]);const{data:Wt=[]}=Ue({queryKey:[`/api/services/admin/${A==null?void 0:A.id}`],enabled:!!(A!=null&&A.id)&&oe.bundleType==="session_bundle"}),{data:As=[]}=Ue({queryKey:["/api/memberships"],enabled:!!(A!=null&&A.id)}),Gt=Ae||A,On=Array.isArray(Gt==null?void 0:Gt.featureFlags)&&Gt.featureFlags.includes("events"),{data:an=[]}=Ue({queryKey:["/api/events"],enabled:!!(A!=null&&A.id)&&On&&oe.bundleType==="discount",queryFn:async()=>{const st=await Pe("GET","/api/events");if(!st.ok)throw new Error("Failed to fetch events");return st.json()}}),Nn=xt({mutationFn:async st=>(await Pe("POST","/api/coupons",st)).json(),onSuccess:()=>{e({title:"Success",description:"Coupon created successfully"}),g(!1),b(null),lt({code:"",name:"",description:"",bundleType:"discount",discountType:"percentage",discountValue:"",applyMode:"checkout",sessionCount:"6",applicableClassMode:"all",applicableClassIds:[],applicableServiceIds:[],applicableMembershipMode:null,applicableMembershipIds:[],applicableEventMode:null,applicableEventIds:[],membershipDiscountType:"recurring",instructorPrefix:"",expiresAt:"",expiresAfterFirstUse:!1,expiresAfterPurchase:!1,expiresAfterValue:"",expiresAfterUnit:"months",maxUses:"",perUserLimit:"",allowCashPayments:!1,onePurchasePerCustomer:!1,onePerCustomerUntilUsed:!1,sendLastSessionUsedReminder:!1,allowServices:!1,allowGiftSharing:!1,disableEmailLock:!1,isActive:!0}),Ms.invalidateQueries({queryKey:["/api/coupons"]})},onError:st=>{e({title:"Error",description:st.message,variant:"destructive"})}}),Bn=xt({mutationFn:async st=>(await Pe("PUT",`/api/coupons/${Se.id}`,st)).json(),onSuccess:()=>{e({title:"Success",description:"Coupon updated successfully"}),g(!1),b(null),lt({code:"",name:"",description:"",bundleType:"discount",discountType:"percentage",discountValue:"",applyMode:"checkout",sessionCount:"6",applicableClassMode:"all",applicableClassIds:[],applicableServiceIds:[],applicableMembershipMode:null,applicableMembershipIds:[],applicableEventMode:null,applicableEventIds:[],membershipDiscountType:"recurring",instructorPrefix:"",expiresAt:"",expiresAfterFirstUse:!1,expiresAfterPurchase:!1,expiresAfterValue:"",expiresAfterUnit:"months",maxUses:"",perUserLimit:"",allowCashPayments:!1,onePurchasePerCustomer:!1,onePerCustomerUntilUsed:!1,sendLastSessionUsedReminder:!1,allowServices:!1,allowGiftSharing:!1,disableEmailLock:!1,isActive:!0}),Ms.invalidateQueries({queryKey:["/api/coupons"]})},onError:st=>{e({title:"Error",description:st.message,variant:"destructive"})}}),Jn=st=>{if(st.preventDefault(),oe.bundleType==="session_bundle"){if(!oe.name.trim()){e({title:"Error",description:"Bundle name is required",variant:"destructive"});return}if(!oe.instructorPrefix.trim()){e({title:"Error",description:"Instructor prefix is required for bundle codes",variant:"destructive"});return}if(!oe.sessionCount||parseInt(oe.sessionCount)<=0){e({title:"Error",description:"Please enter a valid number of sessions",variant:"destructive"});return}const _s=parseFloat(oe.discountValue);if(oe.discountValue===""||isNaN(_s)||_s<0){e({title:"Error",description:"Please enter a valid bundle price (0 or more)",variant:"destructive"});return}if(oe.expiresAfterFirstUse||oe.expiresAfterPurchase){if(!oe.expiresAfterValue||oe.expiresAfterValue.toString().trim()===""||parseInt(oe.expiresAfterValue.toString().trim(),10)<=0){e({title:"Error",description:"Please enter a valid number for 'Expires in' when using 'Expires after first use' or 'Expires after purchase'",variant:"destructive"});return}if(!oe.expiresAfterUnit){e({title:"Error",description:"Please select a unit (days/weeks/months) for relative expiry settings",variant:"destructive"});return}}const wt={name:oe.name.trim(),description:oe.description.trim(),bundleType:"session_bundle",discountType:"fixed",discountValue:parseFloat(oe.discountValue),sessionCount:parseInt(oe.sessionCount),applicableClassMode:oe.applicableClassMode,applicableClassIds:oe.applicableClassMode==="selected"?oe.applicableClassIds:[],applicableServiceIds:oe.applicableClassMode==="selected"&&oe.allowServices?oe.applicableServiceIds:[],applicableMembershipMode:oe.applicableMembershipMode||null,applicableMembershipIds:oe.applicableMembershipMode==="selected"?oe.applicableMembershipIds:[],membershipDiscountType:oe.applicableMembershipMode==="all"||oe.applicableMembershipMode==="selected"?oe.membershipDiscountType||"recurring":null,instructorPrefix:oe.instructorPrefix.trim().toUpperCase(),expiresAt:oe.expiresAfterFirstUse||oe.expiresAfterPurchase?null:oe.expiresAt?new Date(oe.expiresAt).toISOString():null,expiresAfterFirstUse:oe.expiresAfterFirstUse,expiresAfterPurchase:oe.expiresAfterPurchase,expiresAfterValue:(oe.expiresAfterFirstUse||oe.expiresAfterPurchase)&&oe.expiresAfterValue&&oe.expiresAfterValue.toString().trim()!==""?parseInt(oe.expiresAfterValue.toString().trim(),10):null,expiresAfterUnit:oe.expiresAfterFirstUse||oe.expiresAfterPurchase?oe.expiresAfterUnit:null,allowCashPayments:oe.allowCashPayments||!1,onePurchasePerCustomer:oe.onePurchasePerCustomer??!1,onePerCustomerUntilUsed:oe.onePerCustomerUntilUsed??!1,sendLastSessionUsedReminder:oe.sendLastSessionUsedReminder??!1,allowServices:oe.allowServices||!1,allowGiftSharing:oe.allowGiftSharing||!1,disableEmailLock:oe.disableEmailLock||!1,isActive:oe.isActive};Se?Bn.mutate(wt):Nn.mutate(wt)}else{if(!oe.code.trim()){e({title:"Error",description:"Coupon code is required",variant:"destructive"});return}if(!oe.discountValue||parseFloat(oe.discountValue)<=0){e({title:"Error",description:"Please enter a valid discount value",variant:"destructive"});return}if(oe.applicableEventMode==="selected"&&oe.applicableEventIds.length===0){e({title:"Error",description:"Please select at least one event for this coupon",variant:"destructive"});return}const _s={code:oe.code.toUpperCase().trim(),name:oe.name.trim()||oe.code.toUpperCase().trim(),description:oe.description.trim(),bundleType:"discount",discountType:oe.discountType,discountValue:parseFloat(oe.discountValue),applyMode:(oe.discountType==="fixed"||oe.discountType==="fixed_price")&&oe.applyMode||"checkout",maxUses:oe.maxUses?parseInt(oe.maxUses):null,perUserLimit:oe.perUserLimit?parseInt(oe.perUserLimit):null,expiresAt:oe.expiresAfterFirstUse||oe.expiresAfterPurchase?null:oe.expiresAt?new Date(oe.expiresAt).toISOString():null,expiresAfterFirstUse:oe.expiresAfterFirstUse,expiresAfterPurchase:oe.expiresAfterPurchase,expiresAfterValue:(oe.expiresAfterFirstUse||oe.expiresAfterPurchase)&&oe.expiresAfterValue&&oe.expiresAfterValue.toString().trim()!==""?parseInt(oe.expiresAfterValue.toString().trim(),10):null,expiresAfterUnit:oe.expiresAfterFirstUse||oe.expiresAfterPurchase?oe.expiresAfterUnit:null,applicableMembershipMode:oe.applicableMembershipMode||null,applicableMembershipIds:oe.applicableMembershipMode==="selected"?oe.applicableMembershipIds:[],applicableEventMode:oe.applicableEventMode||null,applicableEventIds:oe.applicableEventMode==="selected"?oe.applicableEventIds:[],membershipDiscountType:oe.applicableMembershipMode==="all"||oe.applicableMembershipMode==="selected"?oe.membershipDiscountType||"recurring":null,isActive:oe.isActive};Se?Bn.mutate(_s):Nn.mutate(_s)}};return s.jsx(Ct,{open:y,onOpenChange:st=>{g(st),st||b(null)},children:s.jsxs(St,{className:"sm:max-w-[600px] max-h-[90vh] overflow-y-auto",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:Se?"Edit Promotion":"Create New Promotion"}),s.jsx(yn,{children:Se?"Update your promotion settings":`Create a discount coupon or session bundle for your ${nt.toLowerCase()}. Clients can use these during class, membership, or event checkout.`})]}),s.jsxs("form",{onSubmit:Jn,className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx(V,{children:"Promotion Type"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-2",children:[s.jsxs("div",{className:`p-4 border-2 rounded-lg transition-colors ${oe.bundleType==="discount"?"border-primary bg-primary/5":"border-gray-200"} ${Se?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-gray-300"}`,onClick:Se?void 0:()=>lt({...oe,bundleType:"discount"}),children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:`w-4 h-4 rounded-full border-2 ${oe.bundleType==="discount"?"border-primary bg-primary":"border-gray-300"}`}),s.jsx("span",{className:"font-medium",children:"Discount Coupon"})]}),s.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"One-time discount code for any booking"})]}),s.jsxs("div",{className:`p-4 border-2 rounded-lg transition-colors ${oe.bundleType==="session_bundle"?"border-primary bg-primary/5":"border-gray-200"} ${Se?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-gray-300"}`,onClick:Se?void 0:()=>lt({...oe,bundleType:"session_bundle"}),children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:`w-4 h-4 rounded-full border-2 ${oe.bundleType==="session_bundle"?"border-primary bg-primary":"border-gray-300"}`}),s.jsx("span",{className:"font-medium",children:"Session Bundle"})]}),s.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Multi-session package with unique code"})]})]}),Se&&s.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Promotion type cannot be changed when editing"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"name",children:"Name"}),s.jsx(me,{id:"name",value:oe.name,onChange:st=>lt({...oe,name:st.target.value}),placeholder:oe.bundleType==="session_bundle"?"e.g., 6 Session Yoga Bundle":"e.g., Welcome Discount",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"description",children:"Description (Optional)"}),s.jsx(Is,{id:"description",value:oe.description,onChange:st=>lt({...oe,description:st.target.value}),placeholder:oe.bundleType==="session_bundle"?"e.g., Save money with our 6 session yoga package":"e.g., Welcome discount for new clients",rows:2})]}),oe.bundleType==="discount"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"couponCode",children:"Coupon Code"}),s.jsx(me,{id:"couponCode",value:oe.code,onChange:st=>lt({...oe,code:st.target.value}),placeholder:"e.g., WELCOME10",className:"uppercase",required:!0})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"discountType",children:"Discount Type"}),s.jsxs(Bt,{value:oe.discountType,onValueChange:st=>lt({...oe,discountType:st}),children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"percentage",children:"Percentage (%)"}),s.jsxs(ce,{value:"fixed",children:["Fixed Amount (",mt(((ur=Ae||A)==null?void 0:ur.currency)||"GBP"),")"]}),s.jsxs(ce,{value:"fixed_price",children:["Set price to (",mt(((qs=Ae||A)==null?void 0:qs.currency)||"GBP"),")"]})]})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"discountValue",children:oe.discountType==="percentage"?"Percentage":oe.discountType==="fixed_price"?`Set price to (${mt(((mn=Ae||A)==null?void 0:mn.currency)||"GBP")})`:`Amount (${mt(((Ln=Ae||A)==null?void 0:Ln.currency)||"GBP")})`}),s.jsx(me,{id:"discountValue",type:"number",min:"0",max:oe.discountType==="percentage"?"100":void 0,step:oe.discountType==="percentage"?"1":"0.01",value:oe.discountValue,onChange:st=>{const _s=st.target.value,wt=oe.discountType==="percentage"&&parseFloat(_s)===100&&oe.membershipDiscountType==="one_time";lt({...oe,discountValue:_s,...wt?{membershipDiscountType:"recurring"}:{}})},placeholder:oe.discountType==="percentage"?"10":oe.discountType==="fixed_price"?"20.00":"5.00",required:!0}),oe.discountType==="fixed_price"&&s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Customers using this code pay exactly this amount, whatever the original price. Useful for fixed deposits."})]})]}),(oe.discountType==="fixed"||oe.discountType==="fixed_price")&&s.jsxs("div",{children:[s.jsx(V,{htmlFor:"applyMode",children:"Apply to"}),s.jsxs(Bt,{value:oe.applyMode||"checkout",onValueChange:st=>lt({...oe,applyMode:st}),children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"checkout",children:"Whole booking (one total)"}),s.jsx(ce,{value:"each_class",children:"Each class / session / ticket"})]})]}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:oe.applyMode==="each_class"?oe.discountType==="fixed_price"?"Sets the price per class, session, or event ticket. When someone books a block or multiple tickets at once, they pay this amount for each one (e.g. £5 × 6 = £30).":"Takes this amount off each class, session, or event ticket. When someone books a block or multiple tickets at once, the discount applies per item.":"The discount applies once to the whole booking or order total, no matter how many classes or tickets are booked."})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"maxUses",children:"Usage Limit (Optional)"}),s.jsx(me,{id:"maxUses",type:"number",min:"1",value:oe.maxUses,onChange:st=>lt({...oe,maxUses:st.target.value}),placeholder:"Leave empty for unlimited use"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"perUserLimit",children:"Per-User Limit (Optional)"}),s.jsx(me,{id:"perUserLimit",type:"number",min:"1",value:oe.perUserLimit,onChange:st=>lt({...oe,perUserLimit:st.target.value}),placeholder:"Leave empty for no per-user limit"}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Maximum number of times each individual client can use this coupon"})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Valid for Memberships"}),s.jsxs("div",{className:"space-y-3 mt-2",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",id:"noMemberships",checked:oe.applicableMembershipMode===null,onChange:()=>lt({...oe,applicableMembershipMode:null,applicableMembershipIds:[]}),className:"w-4 h-4"}),s.jsx(V,{htmlFor:"noMemberships",children:"Not applicable to memberships"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",id:"allMemberships",checked:oe.applicableMembershipMode==="all",onChange:()=>lt({...oe,applicableMembershipMode:"all",applicableMembershipIds:[]}),className:"w-4 h-4"}),s.jsx(V,{htmlFor:"allMemberships",children:"All Memberships"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",id:"selectedMemberships",checked:oe.applicableMembershipMode==="selected",onChange:()=>lt({...oe,applicableMembershipMode:"selected"}),className:"w-4 h-4"}),s.jsx(V,{htmlFor:"selectedMemberships",children:"Selected Memberships Only"})]}),oe.applicableMembershipMode==="selected"&&s.jsxs("div",{className:"ml-6 space-y-2",children:[As==null?void 0:As.map(st=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"checkbox",id:`membership-${st.id}`,checked:oe.applicableMembershipIds.includes(st.id),onChange:_s=>{const wt=_s.target.checked?[...oe.applicableMembershipIds,st.id]:oe.applicableMembershipIds.filter(fs=>fs!==st.id);lt({...oe,applicableMembershipIds:wt})},className:"w-4 h-4"}),s.jsx(V,{htmlFor:`membership-${st.id}`,className:"text-sm",children:st.name})]},st.id)),(As==null?void 0:As.length)===0&&s.jsx("p",{className:"text-sm text-gray-500",children:"No memberships available"})]}),(
741oe.applicableMembershipMode==="all"||oe.applicableMembershipMode==="selected")&&s.jsxs("div",{className:"mt-4 p-3 border border-slate-200 rounded-lg bg-slate-50",children:[s.jsx(V,{className:"text-sm font-medium",children:"Discount Type for Memberships"}),s.jsxs("div",{className:"space-y-2 mt-2",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",id:"membershipDiscountRecurring",checked:oe.membershipDiscountType==="recurring",onChange:()=>lt({...oe,membershipDiscountType:"recurring"}),className:"w-4 h-4"}),s.jsx(V,{htmlFor:"membershipDiscountRecurring",className:"text-sm cursor-pointer",children:"Recurring (applies to all payments)"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",id:"membershipDiscountOneTime",checked:oe.membershipDiscountType==="one_time",onChange:()=>lt({...oe,membershipDiscountType:"one_time"}),disabled:oe.discountType==="percentage"&&parseFloat(oe.discountValue)===100,className:"w-4 h-4 disabled:opacity-50 disabled:cursor-not-allowed"}),s.jsx(V,{htmlFor:"membershipDiscountOneTime",className:`text-sm ${oe.discountType==="percentage"&&parseFloat(oe.discountValue)===100?"text-slate-400 cursor-not-allowed":"cursor-pointer"}`,children:"One-time (applies only to first payment)"})]}),oe.discountType==="percentage"&&parseFloat(oe.discountValue)===100&&s.jsx("p",{className:"text-xs text-amber-600 ml-6 font-medium",children:"100% coupons are recurring only for memberships."}),s.jsx("p",{className:"text-xs text-slate-500 ml-6",children:"Choose whether the discount applies to all subscription payments or only the first payment."})]})]})]})]}),On&&s.jsxs("div",{children:[s.jsx(V,{children:"Valid for Events"}),s.jsxs("div",{className:"space-y-3 mt-2",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",id:"noEvents",checked:oe.applicableEventMode===null,onChange:()=>lt({...oe,applicableEventMode:null,applicableEventIds:[]}),className:"w-4 h-4"}),s.jsx(V,{htmlFor:"noEvents",children:"Not applicable to events"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",id:"allEvents",checked:oe.applicableEventMode==="all",onChange:()=>lt({...oe,applicableEventMode:"all",applicableEventIds:[]}),className:"w-4 h-4"}),s.jsx(V,{htmlFor:"allEvents",children:"All Events"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",id:"selectedEvents",checked:oe.applicableEventMode==="selected",onChange:()=>lt({...oe,applicableEventMode:"selected"}),className:"w-4 h-4"}),s.jsx(V,{htmlFor:"selectedEvents",children:"Selected Events Only"})]}),oe.applicableEventMode==="selected"&&s.jsxs("div",{className:"ml-6 space-y-2",children:[an.map(st=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"checkbox",id:`event-${st.id}`,checked:oe.applicableEventIds.includes(st.id),onChange:_s=>{const wt=_s.target.checked?[...oe.applicableEventIds,st.id]:oe.applicableEventIds.filter(fs=>fs!==st.id);lt({...oe,applicableEventIds:wt})},className:"w-4 h-4"}),s.jsxs(V,{htmlFor:`event-${st.id}`,className:"text-sm",children:[st.title,st.status==="draft"?" (Draft)":"",st.startsAt?` — ${Ud(st.startsAt)}`:""]})]},st.id)),an.length===0&&s.jsx("p",{className:"text-sm text-gray-500",children:"No events available"})]}),s.jsx("p",{className:"text-xs text-slate-500",children:"Clients enter the code at event ticket checkout. Session bundles cannot be used for events."})]})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"sessionCount",children:"Number of Sessions"}),s.jsx(me,{id:"sessionCount",type:"number",min:"1",max:"50",value:oe.sessionCount,onChange:st=>lt({...oe,sessionCount:st.target.value}),placeholder:"6",required:!0})]}),s.jsxs("div",{children:[s.jsxs(V,{htmlFor:"bundlePrice",children:["Bundle Price (",mt(((Sn=Ae||A)==null?void 0:Sn.currency)||"GBP"),")"]}),s.jsx(me,{id:"bundlePrice",type:"number",min:"0",step:"0.01",value:oe.discountValue,onChange:st=>lt({...oe,discountValue:st.target.value}),placeholder:"60.00",required:!0})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"instructorPrefix",children:"Code Prefix (max 6 chars)"}),s.jsx(me,{id:"instructorPrefix",value:oe.instructorPrefix,onChange:st=>lt({...oe,instructorPrefix:st.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"").substring(0,6)}),placeholder:"YOGA",className:"uppercase",maxLength:6,required:!0}),s.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["This will be used to generate unique codes like: ",oe.instructorPrefix||"YOGA","-6X-AB3K9M"]})]}),oe.bundleType==="session_bundle"&&s.jsxs("div",{className:"mt-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"checkbox",id:"allowServices",checked:oe.allowServices,onChange:st=>lt({...oe,allowServices:st.target.checked}),className:"w-4 h-4"}),s.jsx(V,{htmlFor:"allowServices",children:"Allow for Services/Sessions"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1 ml-6",children:"Enable this to allow bundle codes to be used for service bookings (121s)"})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Valid for Classes"}),s.jsxs("div",{className:"space-y-3 mt-2",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",id:"allClasses",checked:oe.applicableClassMode==="all",onChange:()=>lt({...oe,applicableClassMode:"all"}),className:"w-4 h-4"}),s.jsx(V,{htmlFor:"allClasses",children:"All Classes (including future classes)"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",id:"selectedClasses",checked:oe.applicableClassMode==="selected",onChange:()=>lt({...oe,applicableClassMode:"selected"}),className:"w-4 h-4"}),s.jsx(V,{htmlFor:"selectedClasses",children:oe.allowServices?"Selected Classes/Sessions Only":"Selected Classes Only"})]}),oe.applicableClassMode==="selected"&&s.jsxs("div",{className:"ml-6 space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Classes:"}),s.jsx("div",{className:"space-y-2",children:ee.filter(st=>!st.parentClassId).map(st=>
741{const _s=[st.id,...ee.filter(fs=>fs.parentClassId===st.id).map(fs=>fs.id)],wt=_s.some(fs=>oe.applicableClassIds.includes(fs));return s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"checkbox",id:`class-${st.id}`,checked:wt,onChange:fs=>{const vn=fs.target.checked?[...oe.applicableClassIds,st.id]:oe.applicableClassIds.filter(ra=>!_s.includes(ra));lt({...oe,applicableClassIds:vn})},className:"w-4 h-4"}),s.jsxs(V,{htmlFor:`class-${st.id}`,className:"text-sm",children:[st.name," (",st.classType,")"]})]},st.id)})})]}),oe.allowServices&&s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Services/Sessions:"}),s.jsx("div",{className:"space-y-2",children:Wt==null?void 0:Wt.map(st=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"checkbox",id:`service-${st.id}`,checked:oe.applicableServiceIds.includes(st.id),onChange:_s=>{const wt=_s.target.checked?[...oe.applicableServiceIds,st.id]:oe.applicableServiceIds.filter(fs=>fs!==st.id);lt({...oe,applicableServiceIds:wt})},className:"w-4 h-4"}),s.jsxs(V,{htmlFor:`service-${st.id}`,className:"text-sm",children:[st.name," (Service/121)"]})]},`service-${st.id}`))})]})]})]})]})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Expiry Settings (Optional)"}),s.jsxs(Sl,{value:oe.expiresAfterFirstUse?"after_first_use":oe.expiresAfterPurchase?"after_purchase":"fixed_date",onValueChange:st=>{lt(st==="after_first_use"?{...oe,expiresAfterFirstUse:!0,expiresAfterPurchase:!1,expiresAt:"",expiresAfterValue:oe.expiresAfterValue||"2",expiresAfterUnit:oe.expiresAfterUnit||"months"}:st==="after_purchase"?{...oe,expiresAfterFirstUse:!1,expiresAfterPurchase:!0,expiresAt:"",expiresAfterValue:oe.expiresAfterValue||"2",expiresAfterUnit:oe.expiresAfterUnit||"months"}:{...oe,expiresAfterFirstUse:!1,expiresAfterPurchase:!1,expiresAfterValue:"",expiresAfterUnit:"months"})},className:"mt-2",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($r,{value:"fixed_date",id:"fixed_date"}),s.jsx(V,{htmlFor:"fixed_date",className:"font-normal cursor-pointer",children:"Fixed expiry date"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($r,{value:"after_first_use",id:"after_first_use"}),s.jsx(V,{htmlFor:"after_first_use",className:"font-normal cursor-pointer",children:"Expires after first use"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($r,{value:"after_purchase",id:"after_purchase"}),s.jsx(V,{htmlFor:"after_purchase",className:"font-normal cursor-pointer",children:"Expires after purchase"})]})]}),oe.expiresAfterFirstUse||oe.expiresAfterPurchase?s.jsx("div",{className:"mt-4 space-y-4 ml-6",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(V,{htmlFor:"expiresAfterValue",className:"w-24",children:"Expires in"}),s.jsx(me,{id:"expiresAfterValue",type:"number",min:"1",value:oe.expiresAfterValue??"",onChange:st=>lt({...oe,expiresAfterValue:st.target.value}),onBlur:st=>{(!st.target.value||st.target.value.trim()==="")&&lt({...oe,expiresAfterValue:"2"})},placeholder:"2",className:"w-20"}),s.jsxs(Bt,{value:oe.expiresAfterUnit,onValueChange:st=>lt({...oe,expiresAfterUnit:st}),children:[s.jsx($t,{className:"w-32",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"days",children:"Days"}),s.jsx(ce,{value:"weeks",children:"Weeks"}),s.jsx(ce,{value:"months",children:"Months"})]})]})]})}):s.jsx("div",{className:"mt-4",children:s.jsx(me,{id:"expiresAt",type:"date",value:oe.expiresAt,onChange:st=>lt({...oe,expiresAt:st.target.value}),min:new Date().toISOString().split("T")[0]})})]}),oe.bundleType==="session_bundle"&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{id:"allowCashPayments",checked:oe.allowCashPayments||!1,onCheckedChange:st=>lt({...oe,allowCashPayments:st})}),s.jsx(V,{htmlFor:"allowCashPayments",children:"Allow Cash Payments"}),s.jsx("p",{className:"text-sm text-gray-500 ml-2",children:"If enabled, clients can choose to pay with cash when purchasing this bundle"})]}),oe.bundleType==="session_bundle"&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{id:"disableEmailLock",checked:oe.disableEmailLock??!1,onCheckedChange:st=>lt({...oe,disableEmailLock:st,...st?{onePurchasePerCustomer:!1,onePerCustomerUntilUsed:!1}:{}})}),s.jsx(V,{htmlFor:"disableEmailLock",children:"Do not lock bundle to booker email address"}),s.jsx("p",{className:"text-sm text-gray-500 ml-2",children:"By default, bundles lock to one email after first use. Turn this on to keep the bundle unlocked so different email addresses can use the same code."})]}),oe.bundleType==="session_bundle"&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{id:"allowGiftSharing",checked:oe.allowGiftSharing??!1,onCheckedChange:st=>lt({...oe,allowGiftSharing:st})}),s.jsx(V,{htmlFor:"allowGiftSharing",children:"Allow this bundle to be bought as a gift"}),s.jsx("p",{className:"text-sm text-gray-500 ml-2",children:"If enabled, the code can be shared and will lock to the first person who redeems it."})]}),oe.bundleType==="session_bundle"&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{id:"sendLastSessionUsedReminder",checked:oe.sendLastSessionUsedReminder??!1,onCheckedChange:st=>lt({...oe,sendLastSessionUsedReminder:st})}),s.jsx(V,{htmlFor:"sendLastSessionUsedReminder",children:"Send reminder after final booked session"}),s.jsx("p",{className:"text-sm text-gray-500 ml-2",children:"Sends a renew
741al nudge shortly after the end time of their last booked class or session (not when they book ahead). Cancels if they cancel that booking or sessions are added back."})]}),oe.bundleType==="session_bundle"&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{id:"onePurchasePerCustomer",checked:oe.onePurchasePerCustomer??!1,onCheckedChange:st=>lt({...oe,onePurchasePerCustomer:st,...oe.disableEmailLock?{disableEmailLock:!1}:{},...st?{onePerCustomerUntilUsed:!1}:{}})}),s.jsx(V,{htmlFor:"onePurchasePerCustomer",children:"One purchase per customer (same email)"}),s.jsx("p",{className:"text-sm text-gray-500 ml-2",children:"If enabled, each email can only buy this bundle once, even after all sessions are used. Good for intro offers. Turns off the “until used” option below."})]}),oe.bundleType==="session_bundle"&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{id:"onePerCustomerUntilUsed",checked:oe.onePerCustomerUntilUsed??!1,onCheckedChange:st=>lt({...oe,onePerCustomerUntilUsed:st,...oe.disableEmailLock?{disableEmailLock:!1}:{},...st?{onePurchasePerCustomer:!1}:{}})}),s.jsx(V,{htmlFor:"onePerCustomerUntilUsed",children:"Prevent duplicate purchase (one per customer until used or expired)"}),s.jsx("p",{className:"text-sm text-gray-500 ml-2",children:"If enabled, a client cannot buy this bundle again while they still have sessions left on their current one."})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{id:"isActive",checked:oe.isActive,onCheckedChange:st=>lt({...oe,isActive:st})}),s.jsx(V,{htmlFor:"isActive",children:oe.bundleType==="session_bundle"?"Visible on booking page":"Active (clients can use this coupon)"})]}),s.jsxs(Er,{children:[s.jsx(B,{type:"button",variant:"outline",onClick:()=>{g(!1),b(null)},children:"Cancel"}),s.jsx(B,{type:"submit",disabled:Nn.isPending||Bn.isPending,children:Nn.isPending||Bn.isPending?Se?"Updating...":"Creating...":Se?`Update ${oe.bundleType==="session_bundle"?"Bundle":"Coupon"}`:`Create ${oe.bundleType==="session_bundle"?"Bundle":"Coupon"}`})]})]})]})})}function gZ(){const[ee,Se]=f.useState("");he.useEffect(()=>{var Wt;w&&Se(((Wt=w.sessionCount)==null?void 0:Wt.toString())||"0")},[w]);const oe=xt({mutationFn:async Wt=>{const As=await Pe("PATCH",`/api/coupons/${w.id}/sessions`,{sessionCount:Wt});if(!As.ok){const Gt=await As.json();throw new Error(Gt.message||"Failed to update bundle sessions")}return As.json()},onSuccess:()=>{e({title:"Success",description:"Bundle session count updated successfully"}),Ms.invalidateQueries({queryKey:["/api/coupons"]}),C(!1),j(null)},onError:Wt=>{e({title:"Error",description:Wt.message,variant:"destructive"})}}),lt=Wt=>{Wt.preventDefault();const As=parseInt(ee);if(isNaN(As)||As<0){e({title:"Invalid Input",description:"Please enter a valid number of sessions (0 or greater)",variant:"destructive"});return}oe.mutate(As)};return w?s.jsx(Ct,{open:N,onOpenChange:C,children:s.jsxs(St,{children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Edit Bundle Sessions"})}),s.jsxs("form",{onSubmit:lt,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"bundleCode",children:"Bundle Code"}),s.jsx(me,{id:"bundleCode",value:w.code||"",disabled:!0,className:"bg-slate-50"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"bundleName",children:"Bundle Name"}),s.jsx(me,{id:"bundleName",value:w.name||"",disabled:!0,className:"bg-slate-50"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"sessionCount",children:"Sessions Left *"}),s.jsx(me,{id:"sessionCount",type:"number",min:"0",value:ee,onChange:Wt=>Se(Wt.target.value),required:!0}),s.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["Current sessions remaining: ",w.sessionCount||0]})]}),s.jsxs(Er,{children:[s.jsx(B,{type:"button",variant:"outline",onClick:()=>{C(!1),j(null)},children:"Cancel"}),s.jsx(B,{type:"submit",disabled:oe.isPending,children:oe.isPending?"Updating...":"Update Sessions"})]})]})]})}):null}function yZ({onEdit:ee}){const{data:Se=[],isLoading:oe,refetch:lt}=Ue({queryKey:["/api/admin/team-members"]}),Wt=xt({mutationFn:async Gt=>(await Pe("DELETE",`/api/admin/team-members/${Gt}`)).json(),onSuccess:()=>{e({title:"Success",description:"Team member removed successfully"}),lt()},onError:Gt=>{e({title:"Error",description:Gt.message,variant:"destructive"})}}),As=(Gt,On)=>{confirm(`Are you sure you want to remove "${On}" from your team? This action cannot be undone.`)&&Wt.mutate(Gt)};return oe?s.jsx("div",{children:"Loading team members..."}):Se.length===0?s.jsxs("div",{className:"text-center py-8",children:[s.jsx(sr,{className:"h-12 w-12 text-slate-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-medium text-slate-900 mb-2",children:"No team members yet"}),s.jsx("p",{className:"text-slate-600 mb-4",children:"Invite team members to help manage your classes and bookings."}),s.jsxs(B,{onClick:()=>{O(null),T(!0)},children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Invite Your First Team Member"]})]}):s.jsx("div",{className:"space-y-4",children:Se.map(Gt=>{var On,an,Nn;return s.jsx("div",{className:"border rounded-lg p-4 hover:bg-slate-50",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-4 flex-1 min-w-0",children:[s.jsx("div",{className:"p-2 rounded-lg bg-blue-100 flex-shrink-0",children:s.jsx(Dr,{className:"h-5 w-5 text-blue-600"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"flex items-center space-x-2",children:s.jsx("h4",{className:"font-medium text-slate-900 truncate",children:Gt.name||Gt.email})}),s.jsx("div",{className:"text-sm text-slate-500 truncate",children:Gt.email}),s.jsxs("div",{className:"text-sm text-slate-600 mt-1",children:[s.jsx(Je,{variant:Gt.accessLevel==="admin"?"default":"secondary",className:"mr-2",children:Gt.accessLevel==="admin"?"Admin":Gt.accessLevel==="bookings_only"?"Bookings Only":"Read Only"}),Gt.accessLevel==="bookings_only"&&(((On=Gt.allowedClassIds)==null?void 0:On.length)||((an=Gt.allowedServiceIds)==null?void 0:an.length)||((Nn=Gt.allowedMembershipIds)==null?void 0:Nn.length))&&s.jsx("span",{className:"text-xs text-slate-500",children:"(selected)"}),s.jsx(Je,{variant:Gt.status==="active"?"default":"outline",children:Gt.status==="active"?"Active":"Pending Invite"})]})]})]}),s.jsxs("div",{className:"flex items-center space-x-2 flex-shrink-0 ml-4",children:[s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>ee(Gt),className:"text-blue-600 hover:text-blue-700",children:s.jsx(Ur,{className:"h-4 w-4"})}),s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>As(Gt.id,Gt.email),className:"text-red-600 hover:text-red-700",children:s.jsx(ln,{className:"h-4 w-4"})})]})]})},Gt.id)})})}function vZ({editingMember:ee,onClose:Se}){var kc,Vo,Un;const[oe,lt]=f.useState((ee==null?void 0:ee.email)||""),[Wt,As]=f.useState((ee==null?void 0:ee.name)||""),[Gt,On]=f.useState((ee==null?void 0:ee.accessLevel)||"readonly"),[an,Nn]=f.useState(!((kc=ee==null?void 0:ee.allowedClassIds)!=null&&kc.length)&&!((Vo=ee==null?void 0:ee.allowedServiceIds)!=null&&Vo.length)&&!((Un=ee==null?void 0:ee.allowedMembershipIds)!=null&&Un.length)),[Bn,Jn]=f.useState(Array.isArray(ee==null?void 0:ee.allowedClassIds)?ee.allowedClassIds:[]),[ur,qs]=f.useState(Array.isArray(ee==null?void 0:ee.allowedServiceIds)?ee.allowedServiceIds:[]),[mn,Ln]=f.useState(Array.isArray(ee==null?void 0:ee.allowedMembershipIds)?ee.allowedMembershipIds:[]),[Sn,st]=f.useState(!1),{data:_s=[]}=Ue({queryKey:["/api/admin/classes"],enabled:Gt==="bookings_only"}),{data:wt=[]}=Ue({queryKey:["/api/admin/services"],enabled:Gt==="bookings_only"}),{data:fs=[]}=Ue({queryKey:["/api/admin/memberships"],enabled:Gt==="bookings_only"}),vn=xt({mutationFn:async Ps=>{const kn=ee?`/api/admin/team-members/${ee.id}`:"/api/admin/team-members/invite";return(await Pe(ee?"PUT":"POST",kn,Ps)).json()},onSuccess:()=>{e({title:"Success",description:ee?"Team member updated successfully":"Invitation sent successfully"}),Ms.invalidateQueries({queryKey:["/api/admin/team-members"]}),Se()},onError:Ps=>{e({title:"Error",description:Ps.message,variant:"destructive"}),st(!1)}}),ra=async Ps=>{if(Ps.preventDefault(),!oe.trim()){e({title:"Error",description:"Email is required",variant:"destructive"});return}if(st(!0),!Wt.trim()&&!ee){e({title:"Error",description:"Name is required",variant:"destructive"});return}const kn={email:oe.trim(),name:Wt.trim(),accessLevel:Gt};if(Gt==="bookings_only"&&(kn.allowedClassIds=an?[]:Bn,kn.allowedServiceIds=an?[]:ur,kn.allowedMembershipIds=an?null:mn,!an&&Bn.length===0&&ur.length===0&&mn.length===0)){e({title:"Error",description:"Select at least one class, service, or membership for selected access.",variant:"destructive"}),st(!1);return}vn.mutate(kn)};return s.jsx(Ct,{open:!0,onOpenChange:Se,children:s.jsxs(St,{className:"max-h-[90dvh] overflow-y-auto sm:max-w-3xl",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:ee?"Edit Team Member":"Invite Team Member"}),s.jsx(yn,{children:ee?"Update the team member's access level or resend their invitation.":"Invite someone to help manage your classes. They'll receive an email to set up their account."})]}),s.jsxs("form",{onSubmit:ra,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"name",children:"Name"}
741),s.jsx(me,{id:"name",type:"text",value:Wt,onChange:Ps=>As(Ps.target.value),placeholder:"John Doe",required:!0}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"The team member's name for display purposes."})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",children:"Email Address"}),s.jsx(me,{id:"email",type:"email",value:oe,onChange:Ps=>lt(Ps.target.value),placeholder:"[email protected]",required:!0,disabled:!!ee}),ee&&s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Email cannot be changed for existing team members."})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"accessLevel",children:"Access Level"}),s.jsxs(Bt,{value:Gt,onValueChange:Ps=>{On(Ps),Ps!=="bookings_only"&&(Nn(!0),Jn([]),qs([]),Ln([]))},children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"admin",children:"Admin - Full access to create and edit"}),s.jsx(ce,{value:"readonly",children:"Read Only - View only, no editing"}),s.jsx(ce,{value:"bookings_only",children:"Bookings Only - View & check-in only, no revenue"})]})]}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:Gt==="admin"?"Admin members can create classes, manage bookings, and update settings.":Gt==="bookings_only"?"They can view bookings, use class registers, and mark attendance. Revenue and financial details are hidden.":"Read-only members can view classes, bookings, and reports but cannot make changes."})]}),Gt==="bookings_only"&&s.jsxs("div",{className:"space-y-3 rounded-lg border p-4 bg-slate-50",children:[s.jsx(V,{children:"Classes, services & memberships access"}),s.jsxs(Sl,{value:an?"all":"selected",onValueChange:Ps=>{Nn(Ps==="all"),Ps==="all"&&(Jn([]),qs([]),Ln([]))},className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($r,{value:"all",id:"scopeAll"}),s.jsx(V,{htmlFor:"scopeAll",className:"font-normal cursor-pointer",children:"All classes, services & memberships"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($r,{value:"selected",id:"scopeSelected"}),s.jsx(V,{htmlFor:"scopeSelected",className:"font-normal cursor-pointer",children:"Selected only"})]})]}),!an&&s.jsxs("div",{className:"space-y-2 pt-2",children:[s.jsx("p",{className:"text-xs text-slate-500",children:"Tick the items this person can access. An empty list allows all of that type."}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium mb-2 block",children:"Classes"}),s.jsxs("div",{className:"max-h-40 overflow-y-auto border rounded p-2 space-y-1",children:[_s.filter(Ps=>Ps.id!=null&&!Ps.parentClassId).map(Ps=>{const kn=[Ps.id,..._s.filter(Ca=>Ca.parentClassId===Ps.id).map(Ca=>Ca.id)],Wr=kn.some(Ca=>Bn.includes(Ca));return s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:Wr,onChange:Ca=>{Ca.target.checked?Jn(Mm=>[...Mm,Ps.id]):Jn(Mm=>Mm.filter(vC=>!kn.includes(vC)))},className:"rounded"}),s.jsx("span",{className:"text-sm truncate",children:Ps.name})]},Ps.id)}),_s.length===0&&s.jsx("p",{className:"text-sm text-slate-500",children:"No classes"})]})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium mb-2 block",children:"Services"}),s.jsxs("div",{className:"max-h-40 overflow-y-auto border rounded p-2 space-y-1",children:[wt.filter(Ps=>Ps.id!=null).map(Ps=>s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:ur.includes(Ps.id),onChange:kn=>{kn.target.checked?qs(Wr=>[...Wr,Ps.id]):qs(Wr=>Wr.filter(Ca=>Ca!==Ps.id))},className:"rounded"}),s.jsx("span",{className:"text-sm truncate",children:Ps.name})]},Ps.id)),wt.length===0&&s.jsx("p",{className:"text-sm text-slate-500",children:"No services"})]})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium mb-2 block",children:"Memberships"}),s.jsxs("div",{className:"max-h-40 overflow-y-auto border rounded p-2 space-y-1",children:[fs.filter(Ps=>Ps.id!=null).map(Ps=>s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:mn.includes(Ps.id),onChange:kn=>
741{kn.target.checked?Ln(Wr=>[...Wr,Ps.id]):Ln(Wr=>Wr.filter(Ca=>Ca!==Ps.id))},className:"rounded"}),s.jsx("span",{className:"text-sm truncate",children:Ps.name})]},Ps.id)),fs.length===0&&s.jsx("p",{className:"text-sm text-slate-500",children:"No memberships"})]})]})]})]})]}),ee&&ee.status==="pending"&&s.jsx("div",{children:s.jsx(B,{type:"button",variant:"outline",onClick:async()=>{try{await Pe("PUT",`/api/admin/team-members/${ee.id}`,{resendInvite:!0}),e({title:"Success",description:"Invitation email resent successfully"})}catch(Ps){e({title:"Error",description:Ps.message,variant:"destructive"})}},children:"Resend Invitation Email"})}),s.jsxs(Er,{children:[s.jsx(B,{type:"button",variant:"outline",onClick:Se,children:"Cancel"}),s.jsx(B,{type:"submit",disabled:Sn,children:Sn?"Saving...":ee?"Update Team Member":"Send Invitation"})]})]})]})})}return s.jsxs("div",{className:"min-h-screen bg-slate-50",children:[s.jsxs("header",{className:"bg-white shadow-sm border-b border-slate-200",children:[s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsx("div",{className:"flex items-center space-x-2 sm:space-x-4",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ia,{className:"text-primary",size:"md"}),s.jsx("span",{className:"text-lg sm:text-xl font-bold text-slate-900",children:"Classta Admin"})]})}),s.jsxs("div",{className:"flex items-center space-x-1 sm:space-x-4",children:[s.jsx(B,{variant:"outline",size:"sm",className:"hidden sm:inline-flex",onClick:()=>{var Se;const ee=(Se=Ae||A)==null?void 0:Se.subdomain;ee?window.location.hostname.includes("localhost")||window.location.hostname.includes("replit")?window.location.href=`/cal/${ee}`:window.location.href=`https://classta.co/cal/${ee}`:window.location.href="/"},children:"View Client Page"}),s.jsx(B,{variant:"ghost",size:"sm",className:"hidden sm:inline-flex",onClick:ZF,children:"Logout"}),s.jsx(B,{variant:"ghost",size:"sm",className:"sm:hidden px-1",onClick:()=>{const ee=document.getElementById("mobile-menu");ee&&ee.classList.toggle("hidden")},children:s.jsx("svg",{className:"!w-6 !h-6",style:{width:"1.5rem",height:"1.5rem"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),s.jsx("button",{className:"px-1",onClick:()=>{const ee=window.Beacon;ee&&typeof ee=="function"&&(console.log("opening beacon 1"),ee("open"))},children:s.jsx("div",{className:"w-8 h-8 bg-slate-400 rounded-full flex items-center justify-center cursor-pointer hover:bg-slate-500 transition-colors",children:s.jsx("span",{className:"text-white text-lg font-semibold",children:"?"})})}),s.jsx("button",{onClick:()=>window.location.href="/profile",children:s.jsx("div",{className:"w-8 h-8 bg-primary rounded-full flex items-center justify-center cursor-pointer hover:bg-primary/90 transition-colors",children:s.jsx(Dr,{className:"text-primary-foreground text-sm"})})})]})]})}),s.jsx("div",{id:"mobile-menu",className:"hidden sm:hidden bg-white border-t border-slate-200",children:s.jsxs("div",{className:"px-4 py-2 space-y-2",children:[s.jsx(B,{variant:"outline",size:"sm",className:"w-full justify-start",onClick:()=>{const ee=A==null?void 0:A.subdomain;ee?window.location.hostname.includes("localhost")||window.location.hostname.includes("replit")?window.location.href=`/cal/${ee}`:window.location.href=`https://classta.co/cal/${ee}`:window.location.href="/"},children:"View Client Page"}),s.jsx(B,{variant:"ghost",size:"sm",className:"w-full justify-start",onClick:ZF,children:"Logout"})]})})]}),(Ae==null?void 0:Ae.requiresSubscription)&&JX(Ae==null?void 0:Ae.subscriptionStatus)&&s.jsx("div",{className:"bg-amber-50 border-b border-amber-200",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Mr,{className:"h-5 w-5 text-amber-600 mt-0.5"}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-sm font-semibold text-amber-900",children:["We could not collect your subscription payment (status: ",Ae.subscriptionStatus||"unknown",")."]}),s.jsx("p",{className:"text-sm text-amber-800",children:"Please update your payment details to avoid losing access."})]})]}),s.jsx("div",{className:"flex gap-2",children:s.jsx(B,{variant:"outline",size:"sm",disabled:gr,onClick:XX,children:gr?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Qr,{className:"h-4 w-4 animate-spin"}),"Opening portal..."]}):"Update payment details"})})]})}),(Ae==null?void 0:Ae.requiresSubscription)&&!_m(Ae)&&!(Ae!=null&&Ae.stripeSubscriptionId)&&s.jsx("div",{className:"bg-blue-50 border-b border-blue-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-pulse"}),s.jsxs("span",{className:"text-sm font-medium text-blue-900",children:["Free Trial Active - ",QX(Ae)," ","days remaining"]})]}),s.jsx("button",{onClick:()=>window.location.href="/profile",className:"text-sm text-blue-700 hover:text-blue-900 underline",children:"Manage Subscription"})]})})}),s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between mb-4 md:mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold text-slate-900 mb-2",children:(A==null?void 0:A.businessName)||"Admin Dashboard"}),s.jsxs("p",{className:"text-slate-600",children:["Welcome back, ",(A==null?void 0:A.instructorName)||""]})]}),(Kt==null?void 0:Kt.totalClasses)===0&&window.innerWidth<=769&&s.jsxs("div",{className:"mt-4 md:mt-0 flex space-x-3",children:[s.jsxs(B,{variant:"secondary",onClick:()=>a(!0),className:"flex items-center space-x-2",children:[s.jsx(lr,{className:"h-4 w-4"}),s.jsx("span",{children:"Create Class with AI"})]}),s.jsxs(B,{onClick:()=>n(!0),className:"flex items-center space-x-2",children:[s.jsx(Gs,{className:"h-4 w-4"}),s.jsx("span",{children:"Create Class"})]})]})]}),s.jsx("div",{className:"border-b border-slate-200 mb-4 md:mb-6",children:s.jsx("nav",{className:"-mb-px flex space-x-4 md:space-x-8 overflow-x-auto scrollbar-hide",children:!(Ae!=null&&Ae.requiresSubscription&&(Ae!=null&&Ae.trialEndsAt)&&new Date(Ae.trialEndsAt)<new Date&&(Ae==null?void 0:Ae.subscriptionStatus)!=="active")&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>
741vt("dashboard"),className:`py-2 px-2 md:px-1 border-b-2 font-medium text-sm whitespace-nowrap flex-shrink-0 ${We==="dashboard"?"border-primary text-primary":"border-transparent text-slate-500 hover:text-slate-700 hover:border-slate-300"}`,children:"Dashboard"}),s.jsx("button",{onClick:()=>vt("branding"),className:`py-2 px-2 md:px-1 border-b-2 font-medium text-sm whitespace-nowrap flex-shrink-0 ${We==="branding"?"border-primary text-primary":"border-transparent text-slate-500 hover:text-slate-700 hover:border-slate-300"}`,children:"Settings"}),s.jsx("button",{onClick:()=>vt("forms"),className:`py-2 px-2 md:px-1 border-b-2 font-medium text-sm whitespace-nowrap flex-shrink-0 ${We==="forms"?"border-primary text-primary":"border-transparent text-slate-500 hover:text-slate-700 hover:border-slate-300"}`,children:"Forms"}),s.jsx("button",{onClick:()=>vt("coupons"),className:`py-2 px-2 md:px-1 border-b-2 font-medium text-sm whitespace-nowrap flex-shrink-0 ${We==="coupons"?"border-primary text-primary":"border-transparent text-slate-500 hover:text-slate-700 hover:border-slate-300"}`,children:"Promotions"}),s.jsx("button",{onClick:()=>vt("team"),className:`py-2 px-2 md:px-1 border-b-2 font-medium text-sm whitespace-nowrap flex-shrink-0 ${We==="team"?"border-primary text-primary":"border-transparent text-slate-500 hover:text-slate-700 hover:border-slate-300"}`,children:"Team"})]})})}),We==="dashboard"&&s.jsxs("div",{children:[s.jsx("div",{className:"block md:hidden mb-2",children:s.jsxs("button",{className:"w-full flex items-center justify-between bg-white border border-slate-200 rounded-lg px-4 py-3 shadow-sm",onClick:()=>se(ee=>!ee),"aria-expanded":M,"aria-controls":"analytics-content",children:[s.jsxs("div",{className:"flex items-center gap-6",children:[s.jsxs("div",{className:"flex flex-col items-start",children:[s.jsx("span",{className:"text-xs text-slate-500",children:"Bookings"}),s.jsx("span",{className:"font-semibold text-lg text-slate-900",children:(Kt==null?void 0:Kt.totalBookings)??0})]}),!ke&&s.jsxs("div",{className:"flex flex-col items-start",children:[s.jsx("span",{className:"text-xs text-slate-500",children:"Revenue"}),s.jsxs("span",{className:"font-semibold text-lg text-slate-900",children:[mt(((n4=Ae||A)==null?void 0:n4.currency)||"GBP"),((r4=Kt==null?void 0:Kt.totalRevenue)==null?void 0:r4.toFixed(2))??"0.00"]})]}),s.jsxs("div",{className:"flex flex-col items-start",children:[s.jsx("span",{className:"text-xs text-slate-500",children:"Clients"}),s.jsx("span",{className:"font-semibold text-lg text-slate-900",children:(Kt==null?void 0:Kt.uniqueClients)??0})]}),s.jsxs("div",{className:"flex flex-col items-start",children:[s.jsx("span",{className:"text-xs text-slate-500",children:Fs}),s.jsx("span",{className:"font-semibold text-lg text-slate-900",children:(Kt==null?void 0:Kt.totalClasses)??0})]})]}),M?s.jsx(vi,{className:"h-6 w-6 text-slate-500"}):s.jsx(Ji,{className:"h-6 w-6 text-slate-500"})]})}),(M||window.innerWidth>=768)&&s.jsx(Ce,{className:"mb-6",children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(V,{htmlFor:"date-filter",className:"text-sm font-medium",children:"View data for:"}),s.jsxs(Bt,{value:U,onValueChange:J,children:[s.jsx($t,{className:"w-[180px]",children:s.jsx(Lt,{placeholder:"Select period"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"all-time",children:"All Time"}),s.jsx(ce,{value:"today",children:"Today"}),s.jsx(ce,{value:"this-week",children:"This Week"}),s.jsx(ce,{value:"last-week",children:"Last Week"}),s.jsx(ce,{value:"this-month",children:"This Month"}),s.jsx(ce,{value:"last-month",children:"Last Month"}),s.jsx(ce,{value:"this-year",children:"This Year"}),s.jsx(ce,{value:"last-year",children:"Last Year"}),s.jsx(ce,{value:"last-30-days",children:"Last 30 Days"}),s.jsx(ce,{value:"last-90-days",children:"Last 90 Days"}),s.jsx(ce,{value:"custom",children:"Custom Range"})]})]})]}),U==="custom"&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(me,{type:"date",value:I,onChange:ee=>re(ee.target.value),className:"w-auto"}),s.jsx("span",{className:"text-sm text-slate-600",children:"to"}),s.jsx(me,{type:"date",value:R,onChange:ee=>Y(ee.target.value),className:"w-auto"})]}),s.jsx("div",{className:"text-sm text-slate-600",children:U==="all-time"?"Showing all-time data":(()=>{const ee=G();return ee?`${ee.start.toLocaleDateString()} - ${ee.end.toLocaleDateString()}`:"Select a valid date range"})()})]})})}),(M||window.innerWidth>=768)&&s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6 mb-8",children:[s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-slate-600",children:"Total Bookings"}),s.jsx("p",{className:"text-3xl font-bold text-slate-900",children:(Kt==null?void 0:Kt.totalBookings)??0})]}),s.jsx("div",{className:"bg-primary/10 p-3 rounded-lg",children:s.jsx(iT,{className:"text-primary h-6 w-6"})})]}),U!=="all-time"&&(Kt==null?void 0:Kt.trends)&&s.jsxs("div",{className:"mt-4 flex items-center text-sm",children:[((a4=Kt.trends.bookings)==null?void 0:a4.direction)==="up"&&s.jsxs(s.Fragment,{children:[s.jsx(fh,{className:"text-green-600 h-4 w-4 mr-1"}),s.jsxs("span",{className:"text-green-600 font-medium",children:["+",Kt.trends.bookings.value,"%"]})]}),((i4=Kt.trends.bookings)==null?void 0:i4.direction)==="down"&&s.jsxs(s.Fragment,{children:[s.jsx(sS,{className:"text-red-600 h-4 w-4 mr-1"}),s.jsxs("span",{className:"text-red-600 font-medium",children:["-",Kt.trends.bookings.value,"%"]})]}),((o4=Kt.trends.bookings)==null?void 0:o4.direction)==="neutral"&&s.jsxs(s.Fragment,{children:[s.jsx(tS,{className:"text-slate-500 h-4 w-4 mr-1"}),s.jsx("span",{className:"text-slate-500 font-medium",children:"0%"})]})]})]})}),!ke&&s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-slate-600",children:"Revenue"}),s.jsxs("p",{className:"text-3xl font-bold text-slate-900",children:[mt(((l4=Ae||A)==null?void 0:l4.currency)||"GBP"),((c4=Kt==null?void 0:Kt.totalRevenue)==null?void 0:c4.toFixed(2))??"0.00"]})]}),s.jsx("div",{className:"bg-secondary/10 p-3 rounded-lg",children:s.jsx(wM,{className:"text-secondary h-6 w-6"})})]}),U!=="all-time"&&(Kt==null?void 0:Kt.trends)&&s.jsxs("div",{className:"mt-4 flex items-center text-sm",children:[((d4=Kt.trends.revenue)==null?void 0:d4.direction)==="up"&&s.jsxs(s.Fragment,{children:[s.jsx(fh,{className:"text-green-600 h-4 w-4 mr-1"}),s.jsxs("span",{className:"text-green-600 font-medium",children:["+",Kt.trends.revenue.value,"%"]})]}),((u4=Kt.trends.revenue)==null?void 0:u4.direction)==="down"&&s.jsxs(s.Fragment,{children:[s.jsx(sS,{className:"text-red-600 h-4 w-4 mr-1"}),s.jsxs("span",{className:"text-red-600 font-medium",children:["-",Kt.trends.revenue.value,"%"]})]}),((m4=Kt.trends.revenue)==null?void 0:m4.direction)==="neutral"&&s.jsxs(s.Fragment,{children:[s.jsx(tS,{className:"text-slate-500 h-4 w-4 mr-1"}),s.jsx("span",{className:"text-slate-500 font-medium",children:"0%"})]})]})]})}),s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-sm font-medium text-slate-600",children:["Total ",Fs]}),s.jsx("p",{className:"text-3xl font-bold text-slate-900",children:(Kt==null?void 0:Kt.totalClasses)??0})]}),s.jsx("div",{className:"bg-accent/10 p-3 rounded-lg",children:s.jsx(zx,{className:"text-accent h-6 w-6"})})]}),s.jsxs("div",{className:"mt-4 flex items-center text-sm",children:[s.jsx(fh,{className:"text-secondary h-4 w-4 mr-1"}),s.jsx("span",{className:"text-secondary font-medium",children:(Kt==null?void 0:Kt.totalClasses)??0}),s.jsx("span",{className:"text-slate-600 ml-1",children:(h4=Kt==null?void 0:Kt.dateFilter)!=null&&h4.includes("to")?"for period":"total"})]})]})}),s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-slate-600",children:"Unique Clients"}),s.jsx("p",{className:"text-3xl font-bold text-slate-900",children:(Kt==null?void 0:Kt.uniqueClients)??0})]}),s.jsx("div",{className:"bg-purple-100 p-3 rounded-lg",children:s.jsx(sr,{className:"text-purple-600 h-6 w-6"})})]}),U!=="all-time"&&(Kt==null?void 0:Kt.trends)&&s.jsxs("div",{className:"mt-4 flex items-center text-sm",children:[((f4=Kt.trends.clients)==null?void 0:f4.direction)==="up"&&s.jsxs(s.Fragment,{children:[s.jsx(fh,{className:"text-green-600 h-4 w-4 mr-1"}),s.jsxs("span",{className:"text-green-600 font-medium",children:["+",Kt.trends.clients.value,"%"]})]}),((p4=Kt.trends.clients)==null?void 0:p4.direction)==="down"&&s.jsxs(s.Fragment,{children:[s.jsx(sS,{className:"text-red-600 h-4 w-4 mr-1"}),s.jsxs("span",{className:"text-red-600 font-medium",children:["-",Kt.trends.clients.value,"%"]})]}),((x4=Kt.trends.clients)==null?void 0:x4.direction)==="neutral"&&s.jsxs(s.Fragment,{children:[s.jsx(tS,{className:"text-slate-500 h-4 w-4 mr-1"}),s.jsx("span",{className:"text-slate-500 font-medium",children:"0%"})]})]})]})})]}),s.jsx(S1e,{currentInstructor:Ae||A,onShowCreateClass:()=>n(!0),onShowAIClassGenerator:()=>a(!0),hideRevenue:ke,showTestReminderButtons:te}),s.jsx(F1e,{instructor:Ae||A}),(()=>{const ee=(Kt==null?void 0:Kt.totalClasses)??0,Se=((Kt==null?void 0:Kt.totalBookings)??0)>=10?Kt.totalBookings:(Lv==null?void 0:Lv.totalBookings)??(Kt==null?void 0:Kt.totalBookings)??0,oe=Ae==null?void 0:Ae.dismissedReviewCardAt,lt=Ae==null?void 0:Ae.createdAt,Wt=lt?Math.floor((new Date().getTime()-new Date(lt).getTime())/(1e3*60*60*24)):0;console.log("🔍 Review Card Debug - Full Details:",{allTimeStats:Lv,stats:Kt,totalClasses:ee,totalBookings:Se,daysSinceSignup:Wt,dismissedAt:oe,createdAt:lt,freshInstructorData:Ae?"loaded":"not loaded",currentInstructor:A?"loaded":"not loaded",condition1:ee>0,condition2:Se>=10,condition3:Wt>=14,condition4:!oe,shouldShow:ee>0&&Se>=10&&Wt>=14&&!oe});const As=ee>0&&Se>=10&&Wt>=14&&!oe;return console.log("🎯 Review Card shouldShow:",As),As?(console.log("✅ Review Card WILL SHOW!"),s.jsx("div",{className:"mt-12",children:s.jsx("div",{className:"max-w-3xl mx-auto w-full px-2 sm:px-4",children:s.jsxs("div",{className:"bg-white border border-slate-200 rounded-lg shadow-sm p-6 text-center relative",children:[s.jsx("button",{onClick:async()=>{try{(await Pe("POST",`/api/instructors/${A==null?void 0:A.id}/dismiss-review-card`)).ok&&Ms.invalidateQueries({queryKey:[`/api/instructors/${A==null?void 0:A.id}`]})}catch(Gt){console.error("Error dismissing review card:",Gt)}},className:"absolute top-4 right-4 text-slate-400 hover:text-slate-600 transition","aria-label":"Dismiss",children:s.jsx(ja,{className:"h-5 w-5"})}),s.jsxs("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:["You've run ",Se," bookings with Classta 🎉"]}),s.jsx("p",{className:"text-slate-700 mb-4",children:"Love how Classta handles your classes and bookings? Share a short review – it helps us grow and keeps Classta sustainable for small businesses like yours."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center items-center",children:[s.jsx("a",{href:"https://page.famewall.io/classta?utm_source=admin_panel&utm_medium=review_card&utm_campaign=user_reviews",target:"_blank",rel:"noopener noreferrer",onClick:async()=>{try{(await Pe("POST",`/api/instructors/${A==null?void 0:A.id}/dismiss-review-card`)).ok&&Ms.invalidateQueries({queryKey:[`/api/instructors/${A==null?void 0:A.id}`]})}catch(Gt){console.error("Error dismissing review card:",Gt)}},className:"bg-primary inline-block px-6 py-2 text-primary-foreground font-semibold rounded hover:bg-primary/90 transition",children:"Share your experience"}),s.jsx("button",{onClick:async()=>{try{(await Pe("POST",`/api/instructors/${A==null?void 0:A.id}/dismiss-review-card`)).ok&&Ms.invalidateQueries({queryKey:[`/api/instructors/${A==null?void 0:A.id}`]})}catch(Gt){console.error("Error dismissing review card:",Gt)}},className:"text-slate-500 hover:text-slate-700 text-sm underline",children:"Not now"})]})]})})})):(console.log("❌ Review Card NOT showing - conditions not met"),null)})()]}),We==="branding"&&s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-4 md:p-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Business Branding"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"businessName",children:"Business N
741ame"}),s.jsx(me,{id:"businessName",value:Zt??(Ae==null?void 0:Ae.businessName)??(A==null?void 0:A.businessName)??"",onChange:ee=>{ee.target.value.length<=60&&Ht(ee.target.value)},placeholder:"Enter your business name",className:"mt-1"}),s.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:[(Zt??(Ae==null?void 0:Ae.businessName)??(A==null?void 0:A.businessName)??"").length,"/60"]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"instructorName",children:"Your Name"}),s.jsx(me,{id:"instructorName",value:Tt??(Ae==null?void 0:Ae.instructorName)??(A==null?void 0:A.instructorName)??"",onChange:ee=>{ee.target.value.length<=50&&Ot(ee.target.value)},placeholder:"Enter your name",className:"mt-1"}),s.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:[(Tt??(Ae==null?void 0:Ae.instructorName)??(A==null?void 0:A.instructorName)??"").length,"/50"]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mt-6",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"currency",children:"Currency"}),s.jsxs(Bt,{value:K||(Ae==null?void 0:Ae.currency)||(A==null?void 0:A.currency)||"GBP",onValueChange:$,children:[s.jsx($t,{className:"mt-1",children:s.jsx(Lt,{placeholder:"Select currency"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"GBP",children:"GBP (£) - British Pound"}),s.jsx(ce,{value:"USD",children:"USD ($) - US Dollar"}),s.jsx(ce,{value:"EUR",children:"EUR (€) - Euro"}),s.jsx(ce,{value:"AUD",children:"AUD (A$) - Australian Dollar"}),s.jsx(ce,{value:"CAD",children:"CAD (C$) - Canadian Dollar"})]})]}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Currency for class prices and payments"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"timezone",children:"Timezone"}),s.jsxs(Bt,{value:pe||(Ae==null?void 0:Ae.timezone)||(A==null?void 0:A.timezone)||"Europe/London",onValueChange:ye,children:[s.jsx($t,{className:"mt-1",children:s.jsx(Lt,{placeholder:"Select timezone"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"Africa/Cairo",children:"Africa/Cairo"}),s.jsx(ce,{value:"Africa/Casablanca",children:"Africa/Casablanca"}),s.jsx(ce,{value:"Africa/Johannesburg",children:"Africa/Johannesburg"}),s.jsx(ce,{value:"Africa/Lagos",children:"Africa/Lagos"}),s.jsx(ce,{value:"Africa/Nairobi",children:"Africa/Nairobi"}),s.jsx(ce,{value:"America/Argentina/Buenos_Aires",children:"America/Argentina/Buenos_Aires"}),s.jsx(ce,{value:"America/Bogota",children:"America/Bogota"}),s.jsx(ce,{value:"America/Caracas",children:"America/Caracas"}),s.jsx(ce,{value:"America/Chicago",children:"America/Chicago"}),s.jsx(ce,{value:"America/Denver",children:"America/Denver"}),s.jsx(ce,{value:"America/Guatemala",children:"America/Guatemala"}),s.jsx(ce,{value:"America/Halifax",children:"America/Halifax"}),s.jsx(ce,{value:"America/Los_Angeles",children:"America/Los_Angeles"}),s.jsx(ce,{value:"America/Mexico_City",children:"America/Mexico_City"}
741),s.jsx(ce,{value:"America/New_York",children:"America/New_York"}),s.jsx(ce,{value:"America/Panama",children:"America/Panama"}),s.jsx(ce,{value:"America/Santiago",children:"America/Santiago"}),s.jsx(ce,{value:"America/Sao_Paulo",children:"America/Sao_Paulo"}),s.jsx(ce,{value:"America/Toronto",children:"America/Toronto"}),s.jsx(ce,{value:"America/Vancouver",children:"America/Vancouver"}),s.jsx(ce,{value:"Asia/Almaty",children:"Asia/Almaty"}),s.jsx(ce,{value:"Asia/Bangkok",children:"Asia/Bangkok"}),s.jsx(ce,{value:"Asia/Colombo",children:"Asia/Colombo"}),s.jsx(ce,{value:"Asia/Dhaka",children:"Asia/Dhaka"}),s.jsx(ce,{value:"Asia/Dubai",children:"Asia/Dubai"}),s.jsx(ce,{value:"Asia/Ho_Chi_Minh",children:"Asia/Ho_Chi_Minh"}),s.jsx(ce,{value:"Asia/Hong_Kong",children:"Asia/Hong_Kong"}),s.jsx(ce,{value:"Asia/Jakarta",children:"Asia/Jakarta"}),s.jsx(ce,{value:"Asia/Jerusalem",children:"Asia/Jerusalem"}),s.jsx(ce,{value:"Asia/Karachi",children:"Asia/Karachi"}),s.jsx(ce,{value:"Asia/Kathmandu",children:"Asia/Kathmandu"}),s.jsx(ce,{value:"Asia/Kolkata",children:"Asia/Kolkata"}),s.jsx(ce,{value:"Asia/Kuala_Lumpur",children:"Asia/Kuala_Lumpur"}),s.jsx(ce,{value:"Asia/Manila",children:"Asia/Manila"}),s.jsx(ce,{value:"Asia/Phnom_Penh",children:"Asia/Phnom_Penh"}),s.jsx(ce,{value:"Asia/Seoul",children:"Asia/Seoul"}),s.jsx(ce,{value:"Asia/Shanghai",children:"Asia/Shanghai"}),s.jsx(ce,{value:"Asia/Singapore",children:"Asia/Singapore"}),s.jsx(ce,{value:"Asia/Taipei",children:"Asia/Taipei"}),s.jsx(ce,{value:"Asia/Tashkent",children:"Asia/Tashkent"}),s.jsx(ce,{value:"Asia/Tbilisi",children:"Asia/Tbilisi"}),s.jsx(ce,{value:"Asia/Tehran",children:"Asia/Tehran"}),s.jsx(ce,{value:"Asia/Tokyo",children:"Asia/Tokyo"}),s.jsx(ce,{value:"Asia/Ulaanbaatar",children:"Asia/Ulaanbaatar"}),s.jsx(ce,{value:"Asia/Vientiane",children:"Asia/Vientiane"}),s.jsx(ce,{value:"Australia/Adelaide",children:"Australia/Adelaide"}),s.jsx(ce,{value:"Australia/Brisbane",children:"Australia/Brisbane"}),s.jsx(ce,{value:"Australia/Darwin",children:"Australia/Darwin"}),s.jsx(ce,{value:"Australia/Hobart",children:"Australia/Hobart"}),s.jsx(ce,{value:"Australia/Melbourne",children:"Australia/Melbourne"}),s.jsx(ce,{value:"Australia/Perth",children:"Australia/Perth"}),s.jsx(ce,{value:"Australia/Sydney",children:"Australia/Sydney"}),s.jsx(ce,{value:"Europe/Amsterdam",children:"Europe/Amsterdam"}),s.jsx(ce,{value:"Europe/Athens",children:"Europe/Athens"}),s.jsx(ce,{value:"Europe/Belgrade",children:"Europe/Belgrade"}),s.jsx(ce,{value:"Europe/Berlin",children:"Europe/Berlin"}),s.jsx(ce,{value:"Europe/Bratislava",children:"Europe/Bratislava"}),s.jsx(ce,{value:"Europe/Brussels",children:"Europe/Brussels"}),s.jsx(ce,{value:"Europe/Bucharest",children:"Europe/Bucharest"}),s.jsx(ce,{value:"Europe/Budapest",children:"Europe/Budapest"}),s.jsx(ce,{value:"Europe/Copenhagen",children:"Europe/Copenhagen"}),s.jsx(ce,{value:"Europe/Dublin",children:"Europe/Dublin"}),s.jsx(ce,{value:"Europe/Edinburgh",children:"Europe/Edinburgh"}),s.jsx(ce,{value:"Europe/Helsinki",children:"Europe/Helsinki"}),s.jsx(ce,{value:"Europe/Istanbul",children:"Europe/Istanbul"}),s.jsx(ce,{value:"Europe/Kiev",children:"Europe/Kiev"}),s.jsx(ce,{value:"Europe/Lisbon",children:"Europe/Lisbon"}),s.jsx(ce,{value:"Europe/Ljubljana",children:"Europe/Ljubljana"}),s.jsx(ce,{value:"Europe/London",children:"Europe/London"}),s.jsx(ce,{value:"Europe/Luxembourg",children:"Europe/Luxembourg"}),s.jsx(ce,{value:"Europe/Madrid",children:"Europe/Madrid"}),s.jsx(ce,{value:"Europe/Malta",children:"Europe/Malta"}),s.jsx(ce,{value:"Europe/Oslo",children:"Europe/Oslo"}),s.jsx(ce,{value:"Europe/Paris",children:"Europe/Paris"}),s.jsx(ce,{value:"Europe/Podgorica",children:"Europe/Podgorica"}),s.jsx(ce,{value:"Europe/Prague",children:"Europe/Prague"}),s.jsx(ce,{value:"Europe/Riga",children:"Europe/Riga"}),s.jsx(ce,{value:"Europe/Rome",children:"Europe/Rome"}),s.jsx(ce,{value:"Europe/Sarajevo",children:"Europe/Sarajevo"}),s.jsx(ce,{value:"Europe/Skopje",children:"Europe/Skopje"}),s.jsx(ce,{value:"Europe/Sofia",children:"Europe/Sofia"}),s.jsx(ce,{value:"Europe/Stockholm",children:"Europe/Stockholm"}),s.jsx(ce,{value:"Europe/Tallinn",children:"Europe/Tallinn"}),s.jsx(ce,{value:"Europe/Tirane",children:"Europe/Tirane"}),s.jsx(ce,{value:"Europe/Vienna",children:"Europe/Vienna"}),s.jsx(ce,{value:"Europe/Vilnius",children:"Europe/Vilnius"}),s.jsx(ce,{value:"Europe/Warsaw",children:"Europe/Warsaw"}),s.jsx(ce,{value:"Europe/Zagreb",children:"Europe/Zagreb"}),s.jsx(ce,{value:"Europe/Zurich",children:"Europe/Zurich"}),s.jsx(ce,{value:"Pacific/Auckland",children:"Pacific/Auckland"}),s.jsx(ce,{value:"Pacific/Fiji",children:"Pacific/Fiji"}),s.jsx(ce,{value:"Pacific/Guam",children:"Pacific/Guam"}),s.jsx(ce,{value:"Pacific/Honolulu",children:"Pacific/Honolulu"}),s.jsx(ce,{value:"Pacific/Noumea",children:"Pacific/Noumea"}),s.jsx(ce,{value:"Pacific/Port_Moresby",children:"Pacific/Port_Moresby"}),s.jsx(ce,{value:"Pacific/Tahiti",children:"Pacific/Tahiti"}),s.jsx(ce,{value:"Pacific/Tongatapu",children:"Pacific/Tongatapu"})]})]}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Timezone for class schedules and reminders"})]})]}),s.jsxs("div",{className:"mt-6",children:[s.jsx(V,{htmlFor:"description",children:"Business Description"}),s.jsx("textarea",{id:"description",rows:3,maxLength:300,className:"mt-1 w-full px-3 py-2 border border-slate-300 rounded-md",placeholder:"Describe your fitness business for clients...",value:Ft!==void 0?Ft:(Ae==null?void 0:Ae.description)||(A==null?void 0:A.description)||"",onChange:ee=>is(ee.target.value)}),s.jsxs("div",{className:"text-xs text-slate-500 mt-1",children:[(Ft!==void 0?Ft:(Ae==null?void 0:Ae.description)||(A==null?void 0:A.description)||"").length,"/300 characters"]}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsxs(B,{type:"button",variant:"outline",size:"sm",onClick:iZ,disabled:Be||!(Ft!==void 0?Ft:(Ae==null?void 0:Ae.description)||(A==null?void 0:A.description)||"").trim(),className:"text-xs",children:[s.jsx(lr,{className:"w-3 h-3 mr-1"}),Be?"Polishing...":"Polish this with AI"]}),ls&&s.jsxs(B,{type:"button",variant:"ghost",size:"sm",onClick:lZ,className:"text-xs text-muted-foreground",children:[s.jsx(dm,{className:"w-3 h-3 mr-1"}),"Undo"]})]})]}),s.jsxs("div",{className:"mt-6",children:[s.jsx(V,{htmlFor:"headline",children:"Booking Page Headline"}),s.jsx(me,{id:"headline",maxLength:60,value:rt??(Ae==null?void 0:Ae.headline)??(A==null?void 0:A.headline)??"",onChange:ee=>
741ht(ee.target.value),placeholder:"e.g., 'Available Classes'",className:"mt-1"}),s.jsxs("div",{className:"text-xs text-slate-500 mt-1",children:[(rt??(Ae==null?void 0:Ae.headline)??(A==null?void 0:A.headline)??"").length,"/60 characters"]})]}),s.jsxs("div",{className:"mt-6",children:[s.jsx(V,{htmlFor:"tagline",children:"Booking Page Tagline"}),s.jsx(me,{id:"tagline",maxLength:120,value:Cs??(Ae==null?void 0:Ae.tagline)??(A==null?void 0:A.tagline)??"",onChange:ee=>Ne(ee.target.value),placeholder:"e.g., 'Book Trigger Point Pilates sessions to improve your fascia health'",className:"mt-1"}),s.jsxs("div",{className:"text-xs text-slate-500 mt-1",children:[(Cs??(Ae==null?void 0:Ae.tagline)??(A==null?void 0:A.tagline)??"").length,"/120 characters"]}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsxs(B,{type:"button",variant:"outline",size:"sm",onClick:oZ,disabled:es||!(Cs??(Ae==null?void 0:Ae.tagline)??(A==null?void 0:A.tagline)??"").trim(),className:"text-xs",children:[s.jsx(lr,{className:"w-3 h-3 mr-1"}),es?"Polishing...":"Polish this with AI"]}),Re&&s.jsxs(B,{type:"button",variant:"ghost",size:"sm",onClick:cZ,className:"text-xs text-muted-foreground",children:[s.jsx(dm,{className:"w-3 h-3 mr-1"}),"Undo"]})]})]}),s.jsxs("div",{className:"mt-6",children:[s.jsx(V,{children:"Logo"}),s.jsxs("div",{className:"mt-2",children:[(ts||(A==null?void 0:A.logoUrl))&&s.jsxs("div",{className:"mb-4",children:[s.jsx("div",{className:"text-sm text-slate-600 mb-2",children:"Current Logo:"}),s.jsx("img",{src:ts||(A==null?void 0:A.logoUrl),alt:"Current logo",className:"h-20 w-auto object-contain border rounded p-2 bg-white",onError:ee=>{ee.target.style.display="none"}})]}),s.jsx(nO,{maxNumberOfFiles:1,maxFileSize:5*1024*1024,onGetUploadParameters:async ee=>{console.log("Admin: Getting upload parameters for:",ee.name);try{console.log("Admin: Making direct fetch to /api/objects/upload");const Se=localStorage.getItem("auth_token");console.log("Admin: Auth token exists:",!!Se);const oe=await fetch("/api/objects/upload",{method:"POST",headers:{Authorization:`Bearer ${Se}`,"Content-Type":"application/json"}});if(console.log("Admin: Fetch response status:",oe.status),console.log("Admin: Fetch response ok:",oe.ok),!oe.ok){const Wt=await oe.text();throw console.error("Admin: API error response:",Wt),new Error(`Upload API failed: ${oe.status} ${Wt}`)}const lt=await oe.json();if(console.log("Admin: API response data:",lt),!lt.uploadURL)throw new Error(`No uploadURL in response: ${JSON.stringify(lt)}`);return console.log("Admin: Upload URL received:",lt.uploadURL),{method:"PUT",url:lt.uploadURL}}catch(Se){throw console.error("Admin: Complete error details:",{name:Se==null?void 0:Se.name,message:Se==null?void 0:Se.message,stack:Se==null?void 0:Se.stack,error:Se}),Se}},onComplete:async ee=>{if(console.log("Admin: Upload complete, result:",ee),console.log("Admin: Starting onComplete callback"),ee.successful&&ee.successful.length>0){const oe=ee.successful[0].uploadURL;console.log("Admin: Uploaded file URL:",oe),console.log("Admin: About to start try block for logo update");try{console.log("Admin: Updating logo with URL:",oe),console.log("Admin: Making PUT request to /api/instructor/logo");const lt=localStorage.getItem("auth_token"),Wt=await fetch("/api/instructor/logo",{method:"PUT",headers:{Authorization:`Bearer ${lt}`,"Content-Type":"application/json"},body:JSON.stringify({logoURL:oe})});if(console.log("Admin: Logo update fetch response status:",Wt.status),console.log("Admin: Logo update fetch response ok:",Wt.ok),!Wt.ok){const Gt=await Wt.text();throw console.error("Admin: Logo update API error response:",Gt),new Error(`Logo update API failed: ${Wt.status} ${Gt}`)}const As=await Wt.json();if(console.log("Admin: Logo update response:",As),As.success)Js(As.logoUrl),Ms.invalidateQueries({queryKey:["/api/instructor"]}),e({title:"Logo updated successfully!",description:"Your logo has been uploaded and updated."});else throw new Error(As.message||"Logo update failed")}catch(lt){console.error("Admin: Complete logo update error details:",{name:lt==null?void 0:lt.name,message:lt
741==null?void 0:lt.message,stack:lt==null?void 0:lt.stack,error:lt}),e({title:"Error updating logo",description:lt.message||"Failed to update logo. Please try again.",variant:"destructive"})}}else ee.failed&&ee.failed.length>0&&(console.error("Admin: Upload failed:",ee.failed),e({title:"Upload failed",description:"Failed to upload logo. Please try again.",variant:"destructive"}))},buttonClassName:"w-fit",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Gs,{className:"h-4 w-4"}),ts||A!=null&&A.logoUrl?"Change Logo":"Upload Logo"]})}),s.jsxs("div",{className:"mt-4",children:[s.jsx(V,{htmlFor:"logoUrl",className:"text-sm",children:"Or paste URL manually"}),s.jsx(me,{id:"logoUrl",value:ts||(A==null?void 0:A.logoUrl)||"",onChange:ee=>Js(ee.target.value),placeholder:"https://yoursite.com/logo.png",className:"mt-1"})]})]}),s.jsx("p",{className:"text-sm text-slate-500 mt-2",children:"Upload an image file or paste a URL. Recommended size: 200x200px."})]}),s.jsxs("div",{className:"mt-6",children:[s.jsx("h4",{className:"text-md font-medium text-slate-900 mb-4",children:"Brand Colors"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"primaryColor",children:"Primary Color"}),s.jsxs("div",{className:"flex items-center space-x-3 mt-1",children:[s.jsx(me,{type:"color",id:"primaryColor",value:xn||(A==null?void 0:A.primaryColor)||"#3B82F6",onChange:ee=>Xs(ee.target.value),className:"w-16 h-10 p-1 border rounded"}),s.jsx(me,{type:"text",value:xn||(A==null?void 0:A.primaryColor)||"#3B82F6",onChange:ee=>Xs(ee.target.value),placeholder:"#3B82F6",className:"flex-1 font-mono text-sm"})]}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Main brand color for buttons and highlights"}),s.jsx("p",{className:"text-xs text-amber-700 mt-1 bg-amber-50 border border-amber-200 rounded px-2 py-1.5",children:"Very light colours (e.g. #fafafa) that would make text and buttons invisible will be overridden for readability."})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"secondaryColor",children:"Secondary Color"}),s.jsxs("div",{className:"flex items-center space-x-3 mt-1",children:[s.jsx(me,{type:"color",id:"secondaryColor",value:nn||(A==null?void 0:A.secondaryColor)||"#10B981",onChange:ee=>Vt(ee.target.value),className:"w-16 h-10 p-1 border rounded"}),s.jsx(me,{type:"text",value:nn||(A==null?void 0:A.secondaryColor)||"#10B981",onChange:ee=>Vt(ee.target.value),placeholder:"#10B981",className:"flex-1 font-mono text-sm"})]}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Accent color for success states and icons"})]}),s.jsxs("div",{className:"md:col-span-2",children:[s.jsx(V,{htmlFor:"heroColor",children:"Hero section colour (booking page banner)"}),s.jsx("p",{className:"text-sm text-slate-500 mt-1 mb-2",children:"Optional. Controls the colour of the hero banner on your booking page. Leave empty to use primary → secondary gradient."}),s.jsxs("div",{className:"flex items-center space-x-3 mt-1",children:[s.jsx(me,{type:"color",id:"heroColor",value:Te||(A==null?void 0:A.heroColor)||xn||(A==null?void 0:A.primaryColor)||"#3B82F6",onChange:ee=>at(ee.target.value),className:"w-16 h-10 p-1 border rounded"}),s.jsx(me,{type:"text",value:Te||(A==null?void 0:A.heroColor)||"",onChange:ee=>at(ee.target.value),placeholder:"Leave empty for primary/secondary gradient",className:"flex-1 font-mono text-sm"})]}),s.jsx(V,{className:"mt-3 block",children:"Hero gradient style"}),s.jsxs(Bt,{value:ss||(A==null?void 0:A.heroGradientStyle)||"to_bottom_right",onValueChange:ee=>ps(ee==="to_bottom_right"?"":ee),children:[s.jsx($t,{className:"mt-1 w-full max-w-xs",children:s.jsx(Lt,{placeholder:"Diagonal (primary → secondary)"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"to_bottom_right",children:"Diagonal (bottom right)"}),s.jsx(ce,{value:"solid",children:"Solid colour only"}),s.jsx(ce,{value:"to_right",children:"Horizontal (left → right)"}),s.jsx(ce,{value:"to_bottom",children:"Vertical (top → bottom)"})]})]}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"When solid, only the hero colour above is used. Otherwise the gradient goes from hero colour (or primary) to secondary."}),s.jsx(V,{className:"mt-3 block",children:"Hero text colour"}),s.jsx("p",{className:"text-sm text-slate-500 mt-1 mb-2",children:"Optional. Colour for the hero title, description, and outline buttons (My Account, Contact). Leave empty for white title text (best for dark gradients); outline buttons then contrast automatically against the banner."}),s.jsxs("div",{className:"flex items-center space-x-3 mt-1",children:[s.jsx(me,{type:"color",id:"heroTextColor",value:bs||(A==null?void 0:A.heroTextColor)||"#ffffff",onChange:ee=>Ss(ee.target.value),className:"w-16 h-10 p-1 border rounded"}),s.jsx(me,{type:"text",value:bs||(A==null?void 0:A.heroTextColor)||"",onChange:ee=>Ss(ee.target.value),placeholder:"Leave empty for white",className:"flex-1 font-mono text-sm"})]})]})]})]}),s.jsxs("div",{className:"mt-6 p-4 bg-primary/10 rounded-lg",children:[s.jsx("h4",{className:"font-medium text-primary mb-2",children:"Your Client Booking URL"}),s.jsx("p",{className:"text-sm text-slate-600 mb-2",children:"Share this link with your clients to book classes:"}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[s.jsxs("code",{className:"px-3 py-2 bg-white border rounded text-sm font-mono flex-1",children:["classta.co/cal/",((g4=Ae||A)==null?void 0:g4.subdomain)||"your-subdomain"]}),s.jsxs("div",{className:"flex space-x-2",children:[s.jsx(B,{size:"sm",variant:"outline",onClick:()=>{var ee;navigator.clipboard.writeText(`https://classta.co/cal/${(ee=Ae||A)==null?void 0:ee.subdomain}`),e({title:"Copied!",description:"Booking link copied to clipboard"})},children:"Copy Link"}),window.navigator.share&&s.jsx(B,{size:"sm",variant:"outline",onClick:()=>{var ee;navigator.share?navigator.share({title:"Book a class",text:"Book a class with me on Classta!",url:`https://classta.co/cal/${(ee=Ae||A)==null?void 0:ee.subdomain}`}).then(()=>console.log("Successful share")).catch(Se=>console.log("Error sharing",Se)):e({title:"Sharing not supported",description:"Your browser does not support the Web Share API.",variant:"destructive"})},title:"Share link",children:s.jsx(Ff,{className:"h-4 w-4"})}),s.jsxs(Ct,{open:F,onOpenChange:W,children:[s.jsx(Jr,{asChild:!0,children:s.jsx(B,{size:"sm",variant:"outline",children:"Change"})}),s.jsxs(St,{children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Change Booking Path"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded p-3",children:s.jsxs("p",{className:"text-sm text-amber-800",children:[s.jsx("strong",{children:"Warning:"})," Changing your booking path will break any existing links you've shared with clients. Make sure to update all promotional materials."]})}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"newSubdomain",children:"New Booking Path"}),s.jsxs("div",{className:"flex mt-2",children:[s.jsx("span",{className:"inline-flex items-center px-3 rounded-l-md border border-r-0 border-slate-300 bg-slate-50 text-slate-500 text-sm",children:"classta.co/cal/"}),s.jsx(me,{id:"newSubdomain",value:q,onChange:ee=>{const Se=ee.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");H(Se),L("")},placeholder:"your-new-path",className:`rounded-l-none ${_?"border-red-500":""}`})]}),_&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:_})]}),s.jsxs("div",{className:"flex gap-2 pt-4",children:[s.jsx(B,{onClick:nZ,disabled:zv.isPending||!q,className:"flex-1",children:zv.isPending?"Upd
741ating...":"Update Path"}),s.jsx(B,{variant:"outline",onClick:()=>{W(!1),H(""),L("")},disabled:zv.isPending,children:"Cancel"})]})]})]})]})]})]})]}),s.jsx("div",{className:"mt-6",children:s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"contact-link-toggle",className:"text-sm font-medium",children:"Contact Me Link"}),s.jsx("p",{className:"text-sm text-slate-600",children:'Show a "Contact Me" button on your instructor page for clients to send you messages'})]}),s.jsx(Rs,{id:"contact-link-toggle",checked:!!(A!=null&&A.showContactLink),onCheckedChange:ee=>{console.log("🔄 Contact toggle changing from",A==null?void 0:A.showContactLink,"to",ee),un.mutate({showContactLink:ee})},disabled:un.isPending})]})}),s.jsx("div",{className:"mt-6",children:s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"embed-bundle-position",className:"text-sm font-medium",children:"Bundle Position in Embed"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Choose where class bundles appear in your embed: at the top or bottom"})]}),s.jsxs("select",{id:"embed-bundle-position",value:((y4=Ae||A)==null?void 0:y4.embedBundlePosition)||"top",onChange:ee=>{un.mutate({embedBundlePosition:ee.target.value})},disabled:un.isPending,className:"px-3 py-2 border rounded-md text-sm",children:[s.jsx("option",{value:"top",children:"Top"}),s.jsx("option",{value:"bottom",children:"Bottom"})]})]})}),s.jsx("div",{className:"mt-6",children:s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"hide-spots-remaining-toggle",className:"text-sm font-medium",children:"Hide Spots Remaining on Booking Page"}),s.jsx("p",{className:"text-sm text-slate-600",children:'Hide the "spots left" badge that appears on your booking page and embed'})]}),s.jsx(Rs,{id:"hide-spots-remaining-toggle",checked:!!((v4=Ae||A)!=null&&v4.hideSpotsRemaining),onCheckedChange:ee=>{var Se;console.log("🔄 Hide spots remaining toggle changing from",(Se=Ae||A)==null?void 0:Se.hideSpotsRemaining,"to",ee),un.mutate({hideSpotsRemaining:ee})},disabled:un.isPending})]})}),s.jsx("div",{className:"mt-6",children:s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"hide-price-on-calendar-cards-toggle",className:"text-sm font-medium",children:"Hide price section on booking calendar cards"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Hide the pricing section (single class price and packages) that appears under the spots badge on calendar cards on your booking page and embed"})]}),s.jsx(Rs,{id:"hide-price-on-calendar-cards-toggle",checked:!!((b4=Ae||A)!=null&&b4.hidePriceOnCalendarCards),onCheckedChange:ee=>{un.mutate({hidePriceOnCalendarCards:ee})},disabled:un.isPending})]})}),((w4=Ae||A)==null?void 0:w4.subscriptionStatus)==="active"&&s.jsx("div",{className:"mt-6",children:s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"hide-start-teaching-toggle",className:"text-sm font-medium",children:'Hide "Start Teaching" button'}),s.jsx("p",{className:"text-sm text-slate-600",children:'Remove the "Start Teaching" button from the header on your booking page (/classes).'})]}),s.jsx(Rs,{id:"hide-start-teaching-toggle",checked:!!((j4=Ae||A)!=null&&j4.hideStartTeachingButton),onCheckedChange:ee=>{un.mutate({hideStartTeachingButton:ee})},disabled:un.isPending})]})}),s.jsx("div",{className:"mt-6",children:s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1 pr-4",children:[s.jsx(V,{htmlFor:"booking-calendar-view",className:"text-sm font-medium",children:"Default booking calendar view"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Auto opens a weekly calendar when you have classes on every day of the week, and a monthly calendar otherwise. Weekly or Monthly always opens in that view. Visitors can still switch. This also applies to your embed."})]}),s.jsxs("select",{id:"booking-calendar-view",value:((N4=Ae||A)==null?void 0:N4.bookingCalendarView)||"auto",onChange:ee=>{un.mutate({bookingCalendarView:ee.target.value})},disabled:un.isPending,className:"px-3 py-2 border rounded-md text-sm shrink-0",children:[s.jsx("option",{value:"auto",children:"Auto"}),s.jsx("option",{value:"weekly",children:"Weekly"}),s.jsx("option",{value:"monthly",children:"Monthly"})]})]})}),s.jsx("div",{className:"mt-6",children:s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"hide-past-classes-toggle",className:"text-sm font-medium",children:"Hide Past Classes on Booking Page"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Hide unbookable past classes and empty days on your booking page. When disabled, visitors can see your class history."})]}),s.jsx(Rs,{id:"hide-past-classes-toggle",checked:!!((C4=Ae||A)!=null&&C4.hidePastClasses),onCheckedChange:ee=>{var Se;console.log("🔄 Hide past classes toggle changing from",(Se=Ae||A)==null?void 0:Se.hidePastClasses,"to",ee),un.mutate({hidePastClasses:ee})},disabled:un.isPending})]})}),s.jsx("div",{className:"mt-6",children:s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"hide-marketing-consent-toggle",className:"text-sm font-medium",children:"Hide marketing emails checkbox"}),s.jsx("p",{className:"text-sm text-slate-600",children:'Remove the optional "I would like to receive marketing emails…" checkbox from booking. Customers are not asked and are not opted in.'})]}),s.jsx(Rs,{id:"hide-marketing-consent-toggle",checked:!!((S4=Ae||A)!=null&&S4.hideMarketingConsent),onCheckedChange:ee=>{un.mutate({hideMarketingConsent:ee})},disabled:un.isPending})]})}),s.jsx("div",{className:"mt-6",children:s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1 pr-4",children:[s.jsx(V,{htmlFor:"limit-free-trials-per-customer",className:"text-sm font-medium",children:"Allow only one free trial class per customer"}),s.jsx("p",{className:"text-sm text-slate-600",children:"When enabled, a client can only use one free trial across all classes that have the free trial option switched on."})]}),s.jsx(Rs,{id:"limit-free-trials-per-customer",checked:!!((k4=Ae||A)!=null&&k4.limitFreeTrialsPerCustomer),onCheckedChange:ee=>un.mutate({limitFreeTrialsPerCustomer:ee}),disabled:un.isPending})]})}),s.jsx("div",{className:"mt-6",children:s.jsxs("div",{className:"p-4 border rounded-lg space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"free-trial-excluded-emails",className:"text-sm font-medium",children:"Exclude emails from free trial and first-session price"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Paste emails of customers who should not get a free trial or first-session special price (for example regulars who already trained with you elsewhere). One email per line."})]}),s.jsx(Is,{id:"free-trial-excluded-emails",value:rn,onChange:ee=>ar(ee.target.value),placeholder:`[email protected]
742[email protected]`,rows:5,className:"resize-y min-h-[100px] font-mono text-sm"}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("p",{className:"text-xs text-slate-500",children:(()=>{const ee=rn.split(/[\n,;]+/).map(Se=>Se.trim()).filter(Se=>Se.includes("@")).length;return`${ee} email${ee===1?"":"s"} listed`})()}
742),s.jsx(B,{type:"button",size:"sm",onClick:()=>un.mutate({freeTrialExcludedEmails:rn.split(/[\n,;]+/).map(ee=>ee.trim()).filter(ee=>ee.includes("@"))}),disabled:un.isPending,children:un.isPending?"Saving…":"Save excluded emails"})]})]})}),s.jsxs("div",{className:"mt-6 max-w-sm",children:[s.jsx(V,{htmlFor:"terminology",children:"I mainly provide:"}),s.jsxs(Bt,{value:Ye,onValueChange:Ve,children:[s.jsx($t,{className:"mt-1",children:s.jsx(Lt,{placeholder:"Select terminology"})}),s.jsx(It,{children:Cn.map(ee=>s.jsx(ce,{value:ee.plural,children:ee.plural},ee.plural))})]}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"This changes the wording used throughout your bookings"})]}),s.jsx("div",{className:"mt-6",children:s.jsx(B,{className:"w-full md:w-auto",onClick:Uv,children:"Save Branding Settings"})})]})}),s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Payment Settings"}),s.jsxs("div",{className:"space-y-6",children:[s.jsx(A1e,{instructorId:(A==null?void 0:A.id)||0,instructor:Ae||A||{},onModeChange:k}),!D&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h4",{className:"font-medium text-slate-900",children:"Stripe API Keys (Advanced)"}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"stripePublicKey",children:"Stripe Public Key"}),s.jsx(me,{id:"stripePublicKey",value:xs||(A==null?void 0:A.stripePublicKey)||"",onChange:ee=>hs(ee.target.value),placeholder:"pk_test_...",className:"mt-1"}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Your Stripe publishable key (starts with pk_)"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"stripeSecretKey",children:"Stripe Secret Key"}),s.jsx(me,{id:"stripeSecretKey",value:gs||(A==null?void 0:A.stripeSecretKey)||"",onChange:ee=>Os(ee.target.value),placeholder:"sk_test_...",className:"mt-1"}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:(P4=gs||(A==null?void 0:A.stripeSecretKey))!=null&&P4.endsWith("***")?"✓ Key is set. Enter a new key to replace it.":"Your Stripe secret key (starts with sk_)"})]}),s.jsxs("div",{className:"p-4 bg-yellow-50 rounded-lg",children:[s.jsx("h4",{className:"font-medium text-yellow-800 mb-2",children:"Get Your Stripe Keys"}),s.jsxs("p",{className:"text-sm text-yellow-700 mb-2",children:["1. Go to"," ",s.jsx("a",{href:"https://dashboard.stripe.com/apikeys",target:"_blank",className:"underline",children:"dashboard.stripe.com/apikeys"})]}),s.jsx("p",{className:"text-sm text-yellow-700",children:'2. Copy your "Publishable key" and "Secret key" and paste them above'})]})]}),s.jsxs("div",{className:"space-y-4 pt-4 border-t border-slate-200",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h4",{className:"font-medium text-slate-900",children:"PayPal Payment Processing"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{checked:cs!==null?cs:(A==null?void 0:A.paypalEnabled)||!1,onCheckedChange:Tr}),s.jsx("span",{className:"text-sm text-slate-600",children:"Enable PayPal"})]})]}),((cs!==null?cs:A==null?void 0:A.paypalEnabled)||!1)&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"paypalEnvironment",children:"PayPal Environment"}),s.jsxs(Bt,{value:Jt||(A==null?void 0:A.paypalEnvironment)||"sandbox",onValueChange:ds,children:[s.jsx($t,{className:"mt-1",children:s.jsx(Lt,{placeholder:"Select environment"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"sandbox",children:"Sandbox (Testing)"}),s.jsx(ce,{value:"live",children:"Live (Production)"})]})]}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Use Sandbox for testing, Live for real payments"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"paypalClientId",children:"PayPal Client ID"}),s.jsx(me,{id:"paypalClientId",value:rr||(A==null?void 0:A.paypalClientId)||"",onChange:ee=>xe(ee.target.value),placeholder:"AXXLWnJrR1pSSdBMWUGOKRU...",className:"mt-1"}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Your PayPal Client ID from your PayPal Developer account"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"paypalClientSecret",children:"PayPal Client Secret"}),s.jsx(me,{id:"paypalClientSecret",value:He||(A==null?void 0:A.payp
742alClientSecret)||"",onChange:ee=>tt(ee.target.value),placeholder:"EHbIqE0mTZe4LYlm...",className:"mt-1"}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:(E4=He||(A==null?void 0:A.paypalClientSecret))!=null&&E4.endsWith("***")?"✓ Key is set. Enter a new key to replace it.":"Your PayPal Client Secret from your PayPal Developer account"})]}),s.jsxs("div",{className:"p-4 bg-amber-50 border border-amber-200 rounded-lg",children:[s.jsx("h4",{className:"font-medium text-amber-900 mb-2",children:"PayPal Webhook Configuration"}),s.jsx("p",{className:"text-sm text-amber-800 mb-3",children:"Configure this webhook URL in your PayPal Developer Dashboard to ensure bookings complete even if users close their browser during payment."}),A!=null&&A.paypalWebhookId?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-3",children:[s.jsx(V,{className:"text-sm font-medium text-amber-900",children:"Webhook URL"}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx(me,{readOnly:!0,value:`${window.location.origin}/api/webhooks/paypal/${A.paypalWebhookId}`,className:"font-mono text-xs bg-white"}),s.jsx(B,{type:"button",variant:"outline",size:"sm",onClick:()=>{const ee=`${window.location.origin}/api/webhooks/paypal/${A.paypalWebhookId}`;navigator.clipboard.writeText(ee),e({title:"Copied!",description:"Webhook URL copied to clipboard"})},children:"Copy"})]})]}),s.jsxs("div",{className:"text-sm text-amber-800 space-y-2",children:[s.jsx("p",{className:"font-medium",children:"Setup Instructions:"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-2",children:[s.jsx("li",{children:"Go to your PayPal Developer Dashboard"}),s.jsx("li",{children:"Navigate to your app settings"}),s.jsx("li",{children:'Find the "Webhooks" section'}),s.jsx("li",{children:'Click "Add Webhook" and paste the URL above'}),s.jsxs("li",{children:["Select these event types:",s.jsxs("ul",{className:"list-disc list-inside ml-4 mt-1",children:[s.jsx("li",{children:"CHECKOUT.ORDER.APPROVED"}),s.jsx("li",{children:"PAYMENT.CAPTURE.COMPLETED"})]})]}),s.jsx("li",{children:"Save the webhook configuration"})]})]})]}):s.jsx("div",{className:"p-3 bg-amber-100 rounded border border-amber-300",children:s.jsxs("p",{className:"text-sm text-amber-900",children:[s.jsx("strong",{children:"Webhook URL will be generated automatically"})," when you save your PayPal settings with both Client ID and Client Secret configured."]})}),s.jsx("div",{className:"mt-3 pt-3 border-t border-amber-300",children:s.jsxs("p",{className:"text-xs text-amber-700",children:[s.jsx("strong",{children:"Why this matters:"})," If a user closes their browser after approving payment on PayPal, the webhook ensures your booking is still completed automatically."]})})]})]})]})]}),s.jsx("div",{className:"mt-6 space-y-4",children:((cs!==null?cs:A==null?void 0:A.paypalEnabled)||!1)&&s.jsxs("div",{className:"p-4 bg-blue-50 rounded-lg",children:[s.jsx("h4",{className:"font-medium text-blue-800 mb-2",children:"Get Your PayPal Keys"}),s.jsxs("p",{className:"text-sm text-blue-700 mb-2",children:["1. Go to"," ",s.jsx("a",{href:"https://developer.paypal.com/developer/applications/",target:"_blank",className:"underline",children:"developer.paypal.com/developer/applications"})]}),s.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"2. Create or select your app to get your Client ID and Client Secret"}),s.jsx("p",{className:"text-sm text-blue-700",children:'3. Copy your "Client ID" and "Client Secret" and paste them above'})]})}),s.jsx(T1e,{instructorId:(A==null?void 0:A.id)||0}),s.jsx("div",{className:"mt-6",children:s.jsx(B,{className:"w-full md:w-auto",onClick:Uv,children:"Save Payment Settings"})})]})}),s.jsx(bV,{}),s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-2",children:"Outbound webhooks (Zapier, MailerLite, etc.)"}),s.jsx("p",{className:"text-sm text-slate-600 mb-4",children:`When events happen (e.g. a booking is made or a session finishes), Classta can send a POST request to a URL you provide. Use this with Zapier's "Catch Hook" to start email sequences, update CRMs, and more.`}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"webhookUrl",children:"Webhook URL"}),s.jsx(me,{id:"webhookUrl",type:"url",value:zs||(A==null?void 0:A.webhookUrl)||"",onChange:ee=>De(ee.target.value),placeholder:"https://hooks.zapier.com/hooks/catch/...",className:"mt-1"}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:`Paste the URL from Zapier's "Webhooks by Zapier" → "Catch Hook" trigger, or any endpoint that accepts POST with JSON.`})]}),s.jsxs("div",{children:[s.jsx(V,{className:"mb-2 block",children:"Events to send"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:(we.length?we:(A==null?void 0:A.webhookEvents)||[]).includes("booking.created"),onChange:ee=>{const Se=(we.length?we:(A==null?void 0:A.webhookEvents)||[]).filter(
742Boolean),oe=new Set(Se);ee.target.checked?oe.add("booking.created"):oe.delete("booking.created"),ot(Array.from(oe))},className:"rounded border-slate-300"}),s.jsx("span",{className:"text-sm",children:"Booking created"})]}),s.jsxs("p",{className:"text-xs text-slate-500 pl-6",children:["Each booking includes ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"clientName"}),", ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"clientFirstName"}),", and ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"clientSurname"}),"."]}),s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:(we.length?we:(A==null?void 0:A.webhookEvents)||[]).includes("membership.purchased"),onChange:ee=>{const Se=(we.length?we:(A==null?void 0:A.webhookEvents)||[]).filter(Boolean),oe=new Set(Se);ee.target.checked?oe.add("membership.purchased"):oe.delete("membership.purchased"),ot(Array.from(oe))},className:"rounded border-slate-300"}),s.jsx("span",{className:"text-sm",children:"Membership purchased"})]}),s.jsxs("p",{className:"text-xs text-slate-500 pl-6",children:["Includes ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"clientName"}),", ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"clientFirstName"}),", and ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"clientSurname"}),"."]}),s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:(we.length?we:(A==null?void 0:A.webhookEvents)||[]).includes("session.completed"),onChange:ee=>{const Se=(we.length?we:(A==null?void 0:A.webhookEvents)||[]).filter(Boolean),oe=new Set(Se);ee.target.checked?oe.add("session.completed"):oe.delete("session.completed"),ot(Array.from(oe))},className:"rounded border-slate-300"}),s.jsx("span",{className:"text-sm",children:"Session completed"})]}),s.jsxs("p",{className:"text-xs text-slate-500 pl-6",children:["Sent once when a booked class or service is due to finish (not when attendance is marked), with every attendee in a single ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"attendees"})," array. That uses one Zapier task per class, not per person. Each attendee includes ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"clientName"}),", ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"clientFirstName"}),", and ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"clientSurname"}),". To email each person (e.g. MailerLite), add a Looping by Zapier step on ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"attendees"}),". If this Catch Hook also receives other events, add a Zapier Filter so the Zap only continues when ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"event"})," is ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"session.completed"}),"."]})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"webhookSecret",children:"Optional secret (for verification)"}),s.jsx(me,{id:"webhookSecret",type:"password",value:_t,onChange:ee=>zt(ee.target.value),placeholder:A!=null&&A.webhookSecret?"••••••••":"Leave blank to skip signing",className:"mt-1"}),s.jsxs("p",{className:"text-sm text-slate-500 mt-1",children:["If set, we send an ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"X-Classta-Signature"})," header (HMAC-SHA256 of the body) so you can verify requests."]})]}),s.jsxs("div",{className:"p-4 bg-slate-50 border border-slate-200 rounded-lg text-sm text-slate-700",children:[s.jsx("p",{className:"font-medium mb-2",children:"How to use with Zapier"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1",children:[s.jsx("li",{children:'In Zapier, create a new Zap and choose "Webhooks by Zapier" as the trigger.'}),s.jsx("li",{children:'Select "Catch Hook" and copy the webhook URL Zapier gives you.'}),s.jsx("li",{children:'Paste that URL above and enable the events you need (e.g. "Booking created").'}),s.jsxs("li",{children:["Save settings here, then in Zapier test the trigger (make a test booking, or wait until a booked session is due to finish for Session completed). Session completed sends one payload with an ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"attendees"})," array."]}),s.jsxs("li",{children:["Add your action (e.g. MailerLite – add to automation or subscribe to group). For Session completed, loop over ",s.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"attendees"})," if you need one email per person."]})]})]})]}),s.jsx("div",{className:"mt-6",children:s.jsx(B,{className:"w-full md:w-auto",onClick:Uv,disabled:Rp.isPending,children:Rp.isPending?"Saving...":"Save Settings"})})]})}),s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Email Notification Preferences"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"notify-new-bookings",className:"text-sm font-medium",children:"New Bookings"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Notify you when a client makes a new booking."})]}),s.jsx(Rs,{id:"notify-new-bookings",checked:!!((D4=Ae||A)!=null&&D4.notifyEmailNewBookings),onCheckedChange:ee=>un.mutate({notifyEmailNewBookings:ee}),disabled:un.isPending})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"notify-rescheduled-bookings",className:"text-sm font-medium",children:"Rescheduled Bookings"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Notify you when a client reschedules a booking."})]}),s.jsx(Rs,{id:"notify-rescheduled-bookings",checked:!!((A4=Ae||A)!=null&&A4.notifyEmailRescheduledBookings),onCheckedChange:ee=>un.mutate({notifyEmailRescheduledBookings:ee}),disabled:un.isPending})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"notify-cancelled-bookings",className:"text-sm font-medium",children:"Cancelled Bookings"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Preference is saved now; cancellation emails are not yet sent by the platform."})]}),s.jsx(Rs,{id:"notify-cancelled-bookings",checked:!!((T4=Ae||A)!=null&&T4.notifyEmailCancelledBookings),onCheckedChange:ee=>un.mutate({notifyEmailCancelledBookings:ee}),disabled:un.isPending})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"notify-membership-purchases",className:"text-sm font-medium",children:"New Membership Purchases"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Notify you when someone purchases a membership."})]}),s.jsx(Rs,{id:"notify-membership-purchases",checked:!!((O4=Ae||A)!=null&&O4.notifyEmailNewMembershipPurchases),onCheckedChange:ee=>un.mutate({notifyEmailNewMembershipPurchases:ee}),disabled:un.isPending})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"notify-booking-change-requests",className:"text-sm font-medium",children:"Booking Change Requests"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Notify you when clients request a booking change."})]}),s.jsx(Rs,{id:"notify-booking-change-requests",checked:!!((F4=Ae||A)!=null&&F4.notifyEmailBookingChangeRequests),onCheckedChange:ee=>un.mutate({notifyEmailBookingChangeRequests:ee}),disabled:un.isPending})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"notify-bundle-purchases",className:"text-sm font-medium",children:"Bundle Purchases"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Notify you when a bundle or package is purchased."})]}),s.jsx(Rs,{id:"notify-bundle-purchases",checked:!!((_4=Ae||A)!=null&&_4.notifyEmailBundlePurchases),onCheckedChange:ee=>un.mutate({notifyEmailBundlePurchases:ee}),disabled:un.isPending})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"notify-event-orders",className:"text-sm font-medium",children:"Event Ticket Orders"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Notify you when a customer buys event tickets."})]}),s.jsx(Rs,{id:"notify-event-orders",checked:!!((M4=Ae||A)!=null&&M4.notifyEmailEventOrders),onCheckedChange:ee=>un.mutate({notifyEmailEventOrders:ee}),disabled:un.isPending})]})]})]})}),s4()&&s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Push Notifications"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(V,{htmlFor:"push-notifications-toggle",className:"text-sm font-medium",children:"Enable Push Notifications"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Receive push notifications for new bookings and important updates."})]}),s.jsx(Rs,{id:"push-notifications-toggle",checked:en,onCheckedChange:aZ})]}),s.jsx("div",{className:"mt-6",children:s.jsx(B,{className:"w-full md:w-auto",onClick:Uv,disabled:Rp.isPending,children:Rp.isPending?"Saving...":"Save Settings"})})]})]})})]}),We==="coupons"&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Promotions Management"}),s.jsxs(B,{onClick:()=>g(!0),children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Create Promotion"]})]}),s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6",children:s.jsxs(sc,{defaultValue:"promotions",className:"w-full",children:[s.jsxs(Hi,{className:`grid w-full ${ke?"grid-cols-1":"grid-cols-2"}`,children:[s.jsx(Ts,{value:"promotions",children:"Promotions"}),!ke&&s.jsx(Ts,{value:"purchased",children:"Purchased Bundles"})]}),s.jsx(on,{value:"promotions",className:"mt-6",children:s.jsx(hZ,{setShowCreateCouponDialog:g,setEditingCoupon:b})}),!ke&&s.jsx(on,{value:"purchased",className:"mt-6",children:s.jsx(fZ,{setEditingBundleSessionCount:j,setShowEditBundleDialog:C})})]})})}),y&&s.jsx(xZ,{classes:ri||[],editingCoupon:x}),N&&s.jsx(gZ,{})]}),We==="team"&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Team Members"}),s.jsxs(B,{onClick:()=>{O(null),T(!0)},children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Invite Team Member"]})]}),s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6",children:s.jsx(yZ,{onEdit:ee=>{O(ee),T(!0)}})})}),E&&s.jsx(vZ,{editingMember:z,onClose:()=>{T(!1),O(null)}})]}),We==="forms"&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col space-y-4 md:flex-row md:justify-between md:items-center md:space-y-0",children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Onboarding Forms"}),s.jsxs("div",{className:"flex flex-col space-y-2 sm:flex-row sm:space-y-0 sm:space-x-2",children:[s.jsxs(B,{variant:"secondary",onClick:()=>m(!0),className:"flex items-center justify-center space-x-2",children:[s.jsx(lr,{className:"w-3 h-3 mr-1"}),s.jsx("span",{children:"AI Form Creator"})]}),s.jsxs(B,{onClick:()=>{h("New Health Assessment Form"),v(void 0),c(!1),o(!0)},className:"flex items-center justify-center",children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Create Manually"]})]})]}),s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-4 md:p-6",children:[s.jsx("h4",{className:"font-medium text-slate-900 mb-3",children:"Booking Forms"}),s.jsx("p",{className:"text-slate-600 mb-4",children:"Manage forms that clients complete before attending classes. Collect important information — such as PAR-Q, health questionnaires, or any other details — to tailor your sessions and enhance the client experience."}),s.jsx("div",{className:"space-y-3",children:Tl.length===0?s.jsxs("div",{className:"text-center py-8 text-slate-500",children:[s.jsx("p",{children:"No onboarding forms created yet."}),s.jsx("p",{className:"text-sm mt-1",children:'Click "Create Form" to get started.'})]}):Tl.map(ee=>s.jsxs("div",{className:"relative flex items-center justify-between p-4 border border-slate-200 rounded-lg",children:[s.jsxs("div",{children:[s.jsx("h5",{className:"font-medium text-slate-900",children:ee.name}),s.jsx("p",{className:"text-sm text-slate-500",children:ee.description||`Health asse
742ssment form - ${JSON.parse(ee.questions||"[]").length} questions`}),s.jsx("div",{className:"flex items-center space-x-4 mt-2",children:s.jsx("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium bg-green-100 text-green-800 rounded",children:"Active"})})]}),s.jsxs("div",{className:`
743                            flex space-x-2
744                            absolute right-2 bottom-2
745                            md:static md:right-auto md:top-auto
746                            bg-white md:bg-transparent
747                            z-10
748                          `,children:[s.jsx(B,{variant:"outline",size:"sm",onClick:()=>{h(`Copy of ${ee.name}`),v(ee.id),c(!0),o(!0)},children:s.jsx(pr,{className:"h-4 w-4"})}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>{h(ee.name),v(ee.id),c(!1),o(!0)},children:s.jsx(Ur,{className:"h-4 w-4"})}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>uZ(ee.id,ee.name),className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:s.jsx(ln,{className:"h-4 w-4"})})]})]},ee.id))})]})})]}),t&&s.jsx(qV,{onClose:()=>n(!1)}),s.jsx(E1e,{termSingular:nt,isOpen:r,onClose:()=>a(!1)}),i&&s.jsx(D1e,{isOpen:i,onClose:()=>o(!1),formName:u,existingFormId:p,saveAsNew:l}),d&&s.jsx(_1e,{isOpen:d,onClose:()=>m(!1),onFormCreated:(ee,Se)=>{h(ee),v(Se),c(!1),o(!0),m(!1)}}),s.jsx("div",{className:"mt-12 pt-8 border-t border-slate-200",children:s.jsx("div",{className:"text-center",children:s.jsxs("p",{className:"text-slate-600",children:["Need help or don't see what you need?"," ",s.jsx("button",{onClick:()=>S(!0),className:"text-blue-600 hover:text-blue-700 underline",children:"Contact us"})]})})}),s.jsx(kz,{isOpen:P,onClose:()=>S(!1)}),typeof window<"u"&&Id.createPortal(s.jsx("button",{onClick:ee=>{var oe;ee.stopPropagation(),ee.preventDefault(),console.log("[Help Button] Clicked");const Se=window.Beacon;if(Se&&typeof Se=="function")try{const lt=Se("info"),Wt=((oe=lt==null?void 0:lt.status)==null?void 0:oe.isOpened)||!1;console.log("[Help Button] Beacon is open:",Wt),Wt?(console.log("[Help Button] Closing beacon"),Se("close")):(console.log("[Help Button] Opening beacon"),Se("open"))}catch(lt){console.error("[Help Button] Error getting beacon info:",lt),Se("open")}else console.log("[Help Button] Beacon not available")},className:"fixed bottom-0 right-0 z-[9999] bg-primary text-primary-foreground px-3 py-2 rounded-tl-lg shadow-lg hover:bg-primary/90 transition-colors font-medium text-sm","aria-label":"Get help",style:{pointerEvents:"auto",position:"fixed"},children:"Help"}),document.body)]})]})}function M1e({password:e}){const{toast:t}=Yt(),n=jn(),{data:r=[],isLoading:a}=Ue({queryKey:["/api/superadmin/classes"],queryFn:async()=>{console.log("password",e);const m=await fetch("/api/superadmin/classes",{headers:{Authorization:`Master ${e}`}});if(!m.ok)throw new Error("Failed to fetch classes");return m.json()}}),{data:i={}}=Ue({queryKey:["/api/classes/booking-counts",r.map(m=>m.id).join(",")],enabled:r.length>0,queryFn:async()=>{const m=r.map(h=>h.id).join(",");return(await fetch(`/api/classes/booking-counts?ids=${m}`)).json()}});console.log("Booking Counts:",i);const o=xt({mutationFn:async({classId:m,featured:u})=>{const h=await fetch(`/api/superadmin/classes/${m}/featured`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Master ${e}`},body:JSON.stringify({featuredOnLanding:u})});if(!h.ok)throw new Error("Failed to update featured status");return h.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["/api/superadmin/classes"]}),n.invalidateQueries({queryKey:["/api/classes/featured"]}),t({title:"Updated successfully",description:"Class featured status has been updated."})},onError:()=>{t({title:"Error",description:"Failed to update featured status.",variant:"destructive"})}}),l=m=>{o.mutate({classId:m.id,featured:!m.featuredOnLanding})};if(a)return s.jsx("div",{className:"text-center py-8",children:"Loading classes..."});const c=[...r].sort((m,u)=>{if(m.featuredOnLanding&&!u.featuredOnLanding)return-1;if(!m.featuredOnLanding&&u.featuredOnLanding)return 1;const h=(i[u.id]||0)-(i[m.id]||0);return h!==0?h:m.name.localeCompare(u.name)}
748),d=r.filter(m=>m.featuredOnLanding).length;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-medium",children:"All Platform Classes"}),s.jsxs("p",{className:"text-sm text-gray-600",children:[d," of ",r.length," classes featured on landing page"]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(dl,{className:"h-4 w-4 text-yellow-500"}),s.jsx("span",{className:"text-sm text-gray-600",children:"Featured classes appear on the public landing page"})]})]}),s.jsx("div",{className:"border rounded-lg",children:s.jsxs(qd,{children:[s.jsx(Wd,{children:s.jsxs(Ra,{children:[s.jsx(Es,{className:"w-[100px]",children:"Featured"}),s.jsx(Es,{children:"Class Name"}),s.jsx(Es,{children:"Instructor"}),s.jsx(Es,{children:"Price"}),s.jsx(Es,{className:"text-center",children:"Bookings"}),s.jsx(Es,{className:"text-center",children:"Status"})]})}),s.jsx(Hd,{children:c.map(m=>s.jsxs(Ra,{className:m.featuredOnLanding?"bg-yellow-50":"",children:[s.jsx(Ds,{children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Rs,{checked:m.featuredOnLanding||!1,onCheckedChange:()=>l(m),disabled:o.isPending}),m.featuredOnLanding?s.jsx(dl,{className:"h-4 w-4 text-yellow-500"}):s.jsx(Ire,{className:"h-4 w-4 text-gray-300"})]})}),s.jsx(Ds,{children:s.jsxs("div",{children:[s.jsx("div",{className:"font-medium",children:m.name}),m.description&&s.jsx("div",{className:"text-sm text-gray-600 truncate max-w-xs",children:m.description})]})}),s.jsx(Ds,{children:s.jsx("div",{className:"text-sm",children:m.instructorName||"Unknown"})}),s.jsx(Ds,{children:s.jsxs("div",{className:"font-medium",children:[mt("GBP"),m.singlePrice]})}),s.jsx(Ds,{className:"text-center",children:s.jsxs("div",{className:"flex items-center justify-center space-x-1",children:[s.jsx(sr,{className:"h-4 w-4 text-gray-400"}),s.jsx("span",{className:"font-medium",children:i[m.id]||0})]})}),s.jsx(Ds,{className:"text-center",children:s.jsx(Je,{variant:m.isActive?"default":"secondary",children:m.isActive?"Active":"Inactive"})})]},m.id))})]})}),r.length===0&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(wa,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No classes found"}),s.jsx("p",{className:"text-gray-600",children:"No classes have been created on the platform yet."})]})]})}function $1e(e){return new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function I1e(e){return e.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}function R1e({password:e}){const[t,n]=f.useState(!1),[r,a]=f.useState(null),[i,o]=f.useState({title:"",content:"",excerpt:"",author:"",categories:"",status:"draft",publishedAt:""}),[l,c]=f.useState("editor"),{toast:d}=Yt(),{data:m=[],isLoading:u,refetch:h}=Ue({queryKey:["/api/blog/admin/posts"],queryFn:async()=>{const S=await fetch("/api/blog/admin/posts",{headers:{Authorization:`Master ${e}`}});if(!S.ok)throw new Error("Failed to fetch posts");return S.json()}}),p=xt({mutationFn:async S=>{const E=r?`/api/blog/posts/${r.id}`:"/api/blog/posts",z=await fetch(E,{method:r?"PUT":"POST",headers:{Authorization:`Master ${e}`,"Content-Type":"application/json"},body:JSON.stringify(S)});if(!z.ok)throw new Error("Failed to save post");return await z.json()},onSuccess:()=>{d({title:r?"Post Updated":"Post Created",description:`Blog post ${r?"updated":"created"} successfully`}),n(!1),a(null),y(),Ms.invalidateQueries({queryKey:["/api/blog/admin/posts"]}),h()},onError:S=>{d({title:"Save Failed",description:S.message||"Failed to save blog post",variant:"destructive"})}}),v=xt({mutationFn:async S=>{const E=await fetch(`/api/blog/posts/${S}`,{method:"DELETE",headers:{Authorization:`Master ${e}`,"Content-Type":"application/json"}});if(!E.ok)throw new Error("Failed to delete post");return await E.json()},onSuccess:()=>{d({title:"Post Deleted",description:"Blog post deleted successfully"}),h()},onError:S=>{d({title:"Delete Failed",description:S.message||"Failed to delete blog post",variant:"destructive"})}}),y=()=>{o({title:"",content:"",excerpt:"",author:"",categories:"",status:"draft",publishedAt:""})},g=S=>S.replace(/<h1([^>]*)>/gi,'<h1$1 class="!mt-10 !mb-5">').replace(/<h2([^>]*)>/gi,'<h2$1 class="!mt-10 !mb-5">').replace(/<h3([^>]*)>/gi,'<h3$1 class="!mt-8 !mb-4">').replace(/<h4([^>]*)>/gi,'<h4$1 class="!mt-6 !mb-3">').replace(/<p([^>]*)>/gi,(E,T)=>T&&T.includes("class=")?E.replace(/class="([^"]*)"/,'class="$1 !mb-6"'):'<p class="!mb-6"'+(T||"")+">").replace(/<ul([^>]*)>/gi,(E,T)=>T&&T.includes("class=")?E.replace(/class="([^"]*)"/,'class="$1 !mb-6"'):'<ul class="!mb-6"'+(T||"")+">").replace(/<ol([^>]*)>/gi,(E,T)=>T&&T.includes("class=")?E.replace(/class="([^"]*)"/,'class="$1 !mb-6"'):'<ol class="!mb-6"'+(T||"")+">").replace(/<li([^>]*)>/gi,(E,T)=>T&&T.includes("class=")?E.replace(/class="([^"]*)"/,(z,O)=>`class="${O.replace(/mb-\d+/g,"").trim()} mb-2"`.replace(/\s+/g," ")):'<li class="mb-2"'+(T||"")+">"),x=S=>{const E={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return S.replace(/[&<>"']/g,T=>E[T])},b=S=>S.replace(/<pre[^>]*><code[^>]*>([\s\S]*?)<\/code><\/pre>/gi,(E,T)=>{const z=x(T),O=E.match(/<pre[^>]*>
748/),D=E.match(/<code[^>]*>/),k=O?O[0]:"<pre>",F=D?D[0]:"<code>";return`${k}${F}${z}</code></pre>`}),w=S=>{if(!S)return"<p>No content available</p>";try{const E=JSON.parse(S);return j(E)}catch{const E=b(S);return g(E)}},j=S=>S.map(E=>{if(E.type==="paragraph")return`<p class="!mb-6">${N(E.children)}</p>`;if(E.type==="heading-one")return`<h1 class="text-2xl font-bold !mt-10 !mb-5">${N(E.children)}</h1>`;if(E.type==="heading-two")return`<h2 class="text-xl font-semibold !mt-10 !mb-5">${N(E.children)}</h2>`;if(E.type==="link"){const T=N(E.children);return`<a href="${x(E.url)}" class="text-blue-600 underline hover:text-blue-800" target="_blank" rel="noopener noreferrer">${T}</a>`}else{if(E.type==="bulleted-list")return`<ul class="list-disc pl-5 !mb-6">${E.children.map(z=>`<li class="mb-2">${N(z.children)}</li>`).join("")}</ul>`;if(E.type==="numbered-list"){const T=E.children.map(O=>`<li class="mb-2">${N(O.children)}</li>`).join("");return`<ol${E.start&&E.start>1?` start="${E.start}"`:""} class="list-decimal pl-5 !mb-6">${T}</ol>`}else if(E.type==="image"){const T=E.width?`width="${E.width}"`:"",z=`<img src="${x(E.url)}" ${T} style="max-width: 100%; height: auto;" alt="" class="rounded mb-4" />`;return E.linkUrl?`<a href="${x(E.linkUrl)}" target="_blank" rel="noopener noreferrer">${z}</a>`:z}else{if(E.type==="video")return`<iframe src="${x(E.url)}" width="560" height="315" frameborder="0" allowfullscreen style="max-width: 100%;" class="rounded mb-4"></iframe>`;if(E.type==="code-block"){const T=x(E.children.map(O=>O.text||"").join(""));return`<pre style="background-color: #0f172a; color: #f1f5f9; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; margin: 1.5rem 0; max-width: 100%;" class="!bg-slate-900 !text-slate-100 !p-4 !rounded-lg !overflow-x-auto !my-6 !max-w-full"><code${E.language?` class="language-${x(E.language)}"`:""} style="color: #f1f5f9; white-space: pre;">${T}</code></pre>`}}}return""}).join(""),N=S=>S.map(E=>{if(E.type==="link"){const T=N(E.children);return`<a href="${x(E.url)}" class="text-blue-600 underline hover:text-blue-800" target="_blank" rel="noopener noreferrer">${T}</a>`}else{let T=x(E.text||"");return E.bold&&(T=`<strong>${T}</strong>`),E.italic&&(T=`<em>${T}</em>`),E.underline&&(T=`<u>${T}</u>`),T}}).join(""),C=S=>{S?(a(S),o({title:S.title,content:S.content,excerpt:S.excerpt,author:S.author,categories:S.categories.join(", "),status:S.status,publishedAt:S.publishedAt?new Date(S.publishedAt).toISOString().slice(0,16):""})):(a(null),y()),n(!0)},P=()=>{if(!i.title.trim()){d({title:"Title Required",description:"Please enter a post title",variant:"destructive"});return}const S=i.categories.split(",").map(z=>z.trim()).filter(z=>z.length>0),E=r?r.slug:I1e(i.title),T=i.publishedAt?new Date(i.publishedAt).toISOString():i.status==="published"?new Date().toISOString():null;p.mutate({...i,slug:E,categories:S,publishedAt:T})};return u?s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-2 border-primary border-t-transparent rounded-full mx-auto mb-4"}),s.jsx("p",{className:"text-slate-600",children:"Loading blog posts..."})]})})}):s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center space-x-2",children:[s.jsx(uw,{className:"h-5 w-5"}),s.jsx("span",{children:"Blog Management"})]})}),s.jsxs(Ee,{className:"p-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("p",{className:"text-slate-600",children:"Manage your blog posts"}),s.jsx("div",{className:"flex space-x-2",children:s.jsxs(B,{onClick:()=>C(),children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"New Post"]})})]}),m.length===0?s.jsxs("div",{className:"text-center py-12 text-slate-500",children:[s.jsx(uw,{className:"h-12 w-12 mx-auto mb-4 text-slate-300"}),s.jsx("p",{className:"text-lg font-medium mb-2",children:"No blog posts yet"}),s.jsx("p",{className:"text-sm",children:"Create your first post or import from WordPress"})]}):s.jsx("div",{className:"space-y-4",children:m.map(S=>s.jsxs("div",{className:"flex items-center justify-between p-4 border border-slate-200 rounded-lg hover:border-slate-300 transition-colors",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[s.jsx("h3",{className:"font-medium text-slate-900",children:S.title}),s.jsx(Je,{variant:S.status==="published"?"default":"secondary",children:S.status})]}),s.jsx("p",{className:"text-sm text-slate-600 mb-2 line-clamp-2",children:S.excerpt}),s.jsxs("div",{className:"flex items-center space-x-4 text-xs text-slate-500",children:[s.jsxs("span",{children:["By ",S.author]}),s.jsx("span",{children:"•"}),s.jsx("span",{children:$1e(S.publishedAt||S.createdAt)}),S.categories.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"•"}),s.jsx("span",{children:S.categories.join(", ")})]})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[S.status==="published"&&s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>window.open(`/blog/${S.slug}`,"_blank"),children:s.jsx(Lr,{className:"h-4 w-4"})}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>C(S),children:s.jsx(Ur,{className:"h-4 w-4"})}),s.jsx(B,{variant:"outline",size:"sm",onClick:()=>{confirm(`Are you sure you want to delete "${S.title}"?`)&&v.mutate(S.id)},className:"text-red-600 hover:text-red-700",children:s.jsx(ln,{className:"h-4 w-4"})})]})]},S.id))}),s.jsx(Ct,{open:t,onOpenChange:n,children:s.jsxs(St,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:r?"Edit Blog Post":"Create New Blog Post"}),s.jsx(yn,{children:"Write and publish blog posts for your fitness business"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"title",children:"Title"}),s.jsx(me,{id:"title",value:i.title,onChange:S=>o(E=>({...E,title:S.target.value})),placeholder:"Enter post title"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"excerpt",children:"Excerpt"}),s.jsx(Is,{id:"excerpt",value:i.excerpt,onChange:S=>o(E=>({...E,excerpt:S.target.value})),placeholder:"Brief description of the post",rows:2})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"author",children:"Author"}),s.jsx(me,{id:"author",value:i.author,onChange:S=>o(E=>({...E,author:S.target.value})),placeholder:"Author name"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"categories",children:"Categories"}),s.jsx(me,{id:"categories",value:i.categories,onChange:S=>o(E=>({...E,categories:S.target.value})),placeholder:"Fitness, Health, Tips (comma separated)"})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"status",children:"Status"}),s.jsxs(Bt,{value:i.status,onValueChange:S=>o(E=>({...E,status:S})),children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"draft",children:"Draft"}),s.jsx(ce,{value:"published",children:"Published"})]})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"publishedAt",children:"Publish Date & Time"}),s.jsx(me,{id:"publishedAt",type:"datetime-local",value:i.publishedAt,onChange:S=>o(E=>({...E,publishedAt:S.target.value})),placeholder:"Leave empty to use current time when publishing"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:'Leave empty to publish immediately when status is "Published"'})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"content",children:"Content"}),s.jsxs(sc,{value:l,onValueChange:c,className:"mt-2",children:[s.jsxs(Hi,{className:"grid w-full grid-cols-2",children:[s.jsx(Ts,{value:"editor",children:"Editor"}),s.jsx(Ts,{value:"preview",children:"Preview"})]}),s.jsx(on,{value:"editor",className:"flex-1 mt-4",children:s.jsx("div",{className:"h-[500px]",children:s.jsx(pE,{value:i.content,onChange:S=>o(E=>({...E,content:S})),placeholder:"Write your blog post content here... You can add images, videos, and rich formatting."})})}),s.jsx(on,{value:"preview",className:"flex-1 mt-4",children:s.jsxs("div",{className:"h-[500px] overflow-y-auto p-4 border border-slate-200 rounded-lg bg-white",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"text-3xl font-bold text-slate-900 mb-2",children:i.title||"Untitled Post"}),i.excerpt&&s.jsx("p",{className:"text-lg text-slate-600 mb-4",children:i.excerpt}),s.jsxs("div",{className:"flex items-center gap-4 text-sm text-slate-500 mb-6",children:[i.author&&s.jsxs("span",{children:["By ",i.author]}),i.categories&&s.jsx("span",{children:i.categories})]})]}),s.jsx("div",{className:`prose prose-lg max-w-none prose-slate
749                          prose-headings:text-slate-900 prose-headings:font-semibold 
750                          prose-headings:!mt-10 prose-headings:!mb-5 prose-h1:!mt-10 prose-h2:!mt-10 prose-h3:!mt-8
751                          prose-p:text-slate-700 prose-p:leading-relaxed prose-p:!mb-6
752                          prose-a:text-primary prose-a:font-medium hover:prose-a:text-primary/80
753                          prose-strong:text-slate-900 prose-strong:font-semibold
754                          prose-ul:text-slate-700 prose-ol:text-slate-700 prose-ul:!mb-6 prose-ol:!mb-6
755                          prose-li:text-slate-700 prose-li:leading-relaxed prose-li:!mb-2
756                          prose-blockquote:border-primary prose-blockquote:text-slate-600 prose-blockquote:!my-6
757                          prose-code:text-primary prose-code:bg-slate-100 prose-code:px-1 prose-code:py-0.5 prose-code:rounded
758                          prose-pre:!bg-slate-900 prose-pre:!text-slate-100 prose-pre:!p-4 prose-pre:!rounded-lg prose-pre:!overflow-x-auto prose-pre:!my-6
759                          [&>h1]:!mt-10 [&>h1]:!mb-5 [&>h2]:!mt-10 [&>h2]:!mb-5 [&>h3]:!mt-8 [&>h3]:!mb-4
760                          [&>p]:!mb-6 [&>ul]:!mb-6 [&>ol]:!mb-6
761                          [&>pre]:!bg-slate-900 [&>pre]:!text-slate-100 [&>pre]:!p-4 [&>pre]:!rounded-lg [&>pre]:!overflow-x-auto [&>pre]:!my-6
762                          [&>pre>code]:!text-slate-100 [&>pre>code]:!bg-transparent [&>pre>code]:!p-0`,dangerouslySetInnerHTML:{__html:w(i.content)}})]})})]}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Use the tabs above to switch between editing and previewing your content."})]})]}),s.jsxs(Er,{children:[s.jsx(B,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),s.jsx(B,{onClick:P,disabled:p.isPending,children:p.isPending?"Saving...":r?"Update Post":"Create Post"})]})]})})]})]})}var B1e=Array.isArray,ni=B1e,L1e=ni,U1e=Sp,z1e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,q1e=/^\w*$/;function W1e(e,t){if(L1e(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||U1e(e)?!0:q1e.test(e)||!z1e.test(e)||t!=null&&e in Object(t)}var EO=W1e,H1e=wc,V1e=zd,K1e="[object AsyncFunction]",G1e="[object Function]",Y1e="[object GeneratorFunction]",Q1e="[object Proxy]";function J1e(e){if(!V1e(e))return!1;var t=H1e(e);return t==G1e||t==Y1e||t==K1e||t==Q1e}var DO=J1e;const Ks=Qs(DO);var X1e=Dl,Z1e=X1e["__core-js_shared__"],eCe=Z1e,tk=eCe,C3=function(){var e=/[^.]+$/.exec(tk&&tk.keys&&tk.keys.IE_PROTO||"");
vendor: 4,289 bytes, line 762
762return e?"Symbol(src)_1."+e:""}();function tCe(e){return!!C3&&C3 in e}var sCe=tCe,nCe=Function.prototype,rCe=nCe.toString;function aCe(e){if(e!=null){try{return rCe.call(e)}catch{}try{return e+""}catch{}}return""}var rG=aCe,iCe=DO,oCe=sCe,lCe=zd,cCe=rG,dCe=/[\\^$.*+?()[\]{}|]/g,uCe=/^\[object .+?Constructor\]$/,mCe=Function.prototype,hCe=Object.prototype,fCe=mCe.toString,pCe=hCe.hasOwnProperty,xCe=RegExp("^"+fCe.call(pCe).replace(dCe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gCe(e){if(!lCe(e)||oCe(e))return!1;var t=iCe(e)?xCe:uCe;return t.test(cCe(e))}var yCe=gCe;function vCe(e,t){return e==null?void 0:e[t]}var bCe=vCe,wCe=yCe,jCe=bCe;function NCe(e,t){var n=jCe(e,t);return wCe(n)?n:void 0}var Em=NCe,CCe=Em,SCe=CCe(Object,"create"),b1=SCe,S3=b1;function kCe(){this.__data__=S3?S3(null):{},this.size=0}var PCe=kCe;function ECe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var DCe=ECe,ACe=b1,TCe="__lodash_hash_undefined__",OCe=Object.prototype,FCe=OCe.hasOwnProperty;function _Ce(e){var t=this.__data__;if(ACe){var n=t[e];return n===TCe?void 0:n}return FCe.call(t,e)?t[e]:void 0}var MCe=_Ce,$Ce=b1,ICe=Object.prototype,RCe=ICe.hasOwnProperty;function BCe(e){var t=this.__data__;return $Ce?t[e]!==void 0:RCe.call(t,e)}var LCe=BCe,UCe=b1,zCe="__lodash_hash_undefined__";function qCe(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=UCe&&t===void 0?zCe:t,this}var WCe=qCe,HCe=PCe,VCe=DCe,KCe=MCe,GCe=LCe,YCe=WCe;function Pp(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Pp.prototype.clear=HCe;Pp.prototype.delete=VCe;Pp.prototype.get=KCe;Pp.prototype.has=GCe;Pp.prototype.set=YCe;var QCe=Pp;function JCe(){this.__data__=[],this.size=0}var XCe=JCe;function ZCe(e,t){return e===t||e!==e&&t!==t}var AO=ZCe,eSe=AO;function tSe(e,t){for(var n=e.length;n--;)if(eSe(e[n][0],t))return n;return-1}var w1=tSe,sSe=w1,nSe=Array.prototype,rSe=nSe.splice;function aSe(e){var t=this.__data__,n=sSe(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():rSe.call(t,n,1),--this.size,!0}var iSe=aSe,oSe=w1;function lSe(e){var t=this.__data__,n=oSe(t,e);return n<0?void 0:t[n][1]}var cSe=lSe,dSe=w1;function uSe(e){return dSe(this.__data__,e)>-1}var mSe=uSe,hSe=w1;function fSe(e,t){var n=this.__data__,r=hSe(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var pSe=fSe,xSe=XCe,gSe=iSe,ySe=cSe,vSe=mSe,bSe=pSe;function Ep(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ep.prototype.clear=xSe;Ep.prototype.delete=gSe;Ep.prototype.get=ySe;Ep.prototype.has=vSe;Ep.prototype.set=bSe;var j1=Ep,wSe=Em,jSe=Dl,NSe=wSe(jSe,"Map"),TO=NSe,k3=QCe,CSe=j1,SSe=TO;function kSe(){this.size=0,this.__data__={hash:new k3,map:new(SSe||CSe),string:new k3}}var PSe=kSe;function ESe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var DSe=ESe,ASe=DSe;function TSe(e,t){var n=e.__data__;return ASe(t)?n[typeof t=="string"?"string":"hash"]:n.map}var N1=TSe,OSe=N1;function FSe(e){var t=OSe(this,e).delete(e);return this.size-=t?1:0,t}var _Se=FSe,MSe=N1;function $Se(e){return MSe(this,e).get(e)}var ISe=$Se,RSe=N1;function BSe(e){return RSe(this,e).has(e)}var LSe=BSe,USe=N1;function zSe(e,t){var n=USe(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var qSe=zSe,WSe=PSe,HSe=_Se,VSe=ISe,KSe=LSe,GSe=qSe;function Dp(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Dp.prototype.clear=WSe;Dp.prototype.delete=HSe;Dp.prototype.get=VSe;Dp.prototype.has=KSe;Dp.prototype.set=GSe;var OO=Dp,aG=OO,YSe="Expected a function";function FO(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(YSe);var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],i=n.cache;if(i.has(a))return i.get(a);var o=e.apply(this,r);return n.cache=i.set(a,o)||i,o};return n.cache=new(FO.Cache||aG),n}FO.Cache=aG;var iG=FO;const QSe=Qs(iG);var JSe=iG,XSe=500;function ZSe(e){var t=JSe(e,function(r){return n.size===XSe&&n.clear(),r}),n=t.cache;return t}var eke=ZSe,tke=eke,ske=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nke=/\\(\\)?/g,rke=tke(function(e){var t=[];
762return e.charCodeAt(0)===46&&t.push(""),e.replace(ske,function(n,r,a,i){t.push(a?i.replace(nke,"$1"):r||n)}),t}),ake=rke;function ike(e,t){for(var n=-1,r=e==null?0:e.length,a=Array(r);++n<r;)a[n]=t(e[n],n,e);return a}var _O=ike,P3=jv,oke=_O,lke=ni,cke=Sp,E3=P3?P3.prototype:void 0,D3=E3?E3.toString:void 0;function oG(e){if(typeof e=="string")return e;if(lke(e))return oke(e,oG)+"";if(cke(e))return D3?D3.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var dke=oG,uke=dke;function mke(e){return e==null?"":uke(e)}var lG=mke,hke=ni,fke=EO,pke=ake,xke=lG;function gke(e,t){return hke(e)?e:fke(e,t)?[e]:pke(xke(e))}var cG=gke,yke=Sp;function vke(e){if(typeof e=="string"||yke(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var C1=vke,bke=cG,wke=C1;function jke(e,t){t=bke(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[wke(t[n++])];return n&&n==r?e:void 0}var MO=jke,Nke=MO;function Cke(e,t,n){var r=e==null?void 0:Nke(e,t);return r===void 0?n:r}var dG=Cke;const Vi=Qs(dG);function Ske(e){return e==null}var kke=Ske;const tn=Qs(kke);var Pke=wc,Eke=ni,Dke=jc,Ake="[object String]";function Tke(e){return typeof e=="string"||!Eke(e)&&Dke(e)&&Pke(e)==Ake}var Oke=Tke;const vm=Qs(Oke);var uG={exports:{}},Tn={};/**
763 * @license React
764 * react-is.production.min.js
765 *
766 * Copyright (c) Facebook, Inc. and its affiliates.
767 *
768 * This source code is licensed under the MIT license found in the
769 * LICENSE file in the root directory of this source tree.
770 */var $O=Symbol.for("react.element"),IO=Symbol.for("react.portal"),S1=Symbol.for("react.fragment"),k1=Symbol.for("react.strict_mode"),P1=Symbol.for("react.profiler"),E1=Symbol.for("react.provider"),D1=Symbol.for("react.context"),Fke=Symbol.for("react.server_context"),A1=Symbol.for("react.forward_ref"),T1=Symbol.for("react.suspense"),O1=Symbol.for("react.suspense_list"),F1=Symbol.for("react.memo"),_1=Symbol.for("react.lazy"),_ke=Symbol.for("react.offscreen"),mG;mG=Symbol.for("react.module.reference");function no(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case $O:switch(e=e.type,e){case S1:case P1:case k1:case T1:case O1:return e;default:switch(e=e&&e.$$typeof,e){case Fke:case D1:case A1:case _1:case F1:case E1:return e;default:return t}}case IO:return t}}}Tn.ContextConsumer=D1;Tn.ContextProvider=E1;Tn.Element=$O;Tn.ForwardRef=A1;Tn.Fragment=S1;Tn.Lazy=_1;Tn.Memo=F1;Tn.Portal=IO;Tn.Profiler=P1;Tn.StrictMode=k1;Tn.Suspense=T1;Tn.SuspenseList=O1;Tn.isAsyncMode=function(){return!1};Tn.isConcurrentMode=function(){return!1};Tn.isContextConsumer=function(e){return no(e)===D1};Tn.isContextProvider=function(e){return no(e)===E1};Tn.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===$O};Tn.isForwardRef=function(e){return no(e)===A1};Tn.isFragment=function(e){return no(e)===S1};Tn.isLazy=function(e){return no(e)===_1};Tn.isMemo=function(e){return no(e)===F1};Tn.isPortal=function(e){return no(e)===IO};Tn.isProfiler=function(e){return no(e)===P1};Tn.isStrictMode=function(e){return no(e)===k1};Tn.isSuspense=function(e){return no(e)===T1};Tn.isSuspenseList=function(e){return no(e)===O1};Tn.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===S1||e===P1||e===k1||e===T1||e===O1||e===_ke||typeof e=="object"&&e!==null&&(e.$$typeof===_1||e.$$typeof===F1||e.$$typeof===E1||e.$$typeof===D1||e.$$typeof===A1||e.$$typeof===mG||e.getModuleId!==void 0)};Tn.typeOf=no;uG.exports=Tn;var Mke=uG.exports,$ke=wc,Ike=jc,Rke="[object Number]";function Bke(e){return typeof e=="number"||Ike(e)&&$ke(e)==Rke}var hG=Bke;const Lke=Qs(hG);var Uke=hG;function zke(e){return Uke(e)&&e!=+e}var qke=zke;const Pv=Qs(qke);var Fo=function(t){return t===0?0:t>0?1:-1},bu=function(t){return vm(t)&&t.indexOf("%")===t.length-1},Ut=function(t){return Lke(t)&&!Pv(t)},Wke=function(t){return tn(t)},zr=function(t){return Ut(t)||vm(t)},Hke=0,Ev=function(t){var n=++Hke;return"".concat(t||"").concat(n)},bm=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ut(t)&&!vm(t))return r;var i;if(bu(t)){var o=t.indexOf("%");i=n*parseFloat(t.slice(0,o))/100}else i=+t;return Pv(i)&&(i=r),a&&i>n&&(i=n),i},Wc=function(t){if(!t)return null;var n=Object.keys(t);
vendor: 5,203 bytes, line 770
770return n&&n.length?t[n[0]]:null},Vke=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},a=0;a<n;a++)if(!r[t[a]])r[t[a]]=!0;else return!0;return!1},Po=function(t,n){return Ut(t)&&Ut(n)?function(r){return t+r*(n-t)}:function(){return n}};function Ww(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):Vi(r,t))===n})}var Kke=function(t,n){return Ut(t)&&Ut(n)?t-n:vm(t)&&vm(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function Bh(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function gE(e){"@babel/helpers - typeof";return gE=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},gE(e)}var Gke=["viewBox","children"],Yke=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],A3=["points","pathLength"],sk={svg:Gke,polygon:A3,polyline:A3},RO=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onF
770ocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],Hw=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(f.isValidElement(t)&&(r=t.props),!Cp(r))return null;var a={};return Object.keys(r).forEach(function(i){RO.includes(i)&&(a[i]=n||function(o){return r[i](r,o)})}),a},Qke=function(t,n,r){return function(a){return t(n,r,a),null}},Vw=function(t,n,r){if(!Cp(t)||gE(t)!=="object")return null;var a=null;return Object.keys(t).forEach(function(i){var o=t[i];RO.includes(i)&&typeof o=="function"&&(a||(a={}),a[i]=Qke(o,n,r))}),a},Jke=["children"],Xke=["children"];function T3(e,t){if(e==null)return{};var n=Zke(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Zke(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function yE(e){"@babel/helpers - typeof";return yE=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},yE(e)}var O3={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"}
vendor: 4,414 bytes, line 770
770,nc=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},F3=null,nk=null,BO=function e(t){if(t===F3&&Array.isArray(nk))return nk;var n=[];return f.Children.forEach(t,function(r){tn(r)||(Mke.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),nk=n,F3=t,n};function Ki(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(a){return nc(a)}):r=[nc(t)],BO(e).forEach(function(a){var i=Vi(a,"type.displayName")||Vi(a,"type.name");r.indexOf(i)!==-1&&n.push(a)}),n}function di(e,t){var n=Ki(e,t);return n&&n[0]}var _3=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,a=n.height;return!(!Ut(r)||r<=0||!Ut(a)||a<=0)},e2e=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],t2e=function(t){return t&&t.type&&vm(t.type)&&e2e.indexOf(t.type)>=0},s2e=function(t){return t&&yE(t)==="object"&&"clipDot"in t},n2e=function(t,n,r,a){var i,o=(i=sk==null?void 0:sk[a])!==null&&i!==void 0?i:[];return n.startsWith("data-")||!Ks(t)&&(a&&o.includes(n)||Yke.includes(n))||r&&RO.includes(n)},fn=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(f.isValidElement(t)&&(a=t.props),!Cp(a))return null;var i={};return Object.keys(a).forEach(function(o){var l;n2e((l=a)===null||l===void 0?void 0:l[o],o,n,r)&&(i[o]=a[o])}),i},vE=function e(t,n){if(t===n)return!0;var r=f.Children.count(t);if(r!==f.Children.count(n))return!1;if(r===0)return!0;if(r===1)return M3(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var a=0;a<r;a++){var i=t[a],o=n[a];if(Array.isArray(i)||Array.isArray(o)){if(!e(i,o))return!1}else if(!M3(i,o))return!1}return!0},M3=function(t,n){if(tn(t)&&tn(n))return!0;if(!tn(t)&&!tn(n)){var r=t.props||{},a=r.children,i=T3(r,Jke),o=n.props||{},l=o.children,c=T3(o,Xke);return a&&l?Bh(i,c)&&vE(a,l):!a&&!l?Bh(i,c):!1}return!1},$3=function(t,n){var r=[],a={};return BO(t).forEach(function(i,o){if(t2e(i))r.push(i);else if(i){var l=nc(i.type),c=n[l]||{},d=c.handler,m=c.once;if(d&&(!m||!a[l])){var u=d(i,l,o);r.push(u),a[l]=!0}}}),r},r2e=function(t){var n=t&&t.type;return n&&O3[n]?O3[n]:null},a2e=function(t,n){return BO(n).indexOf(t)},i2e=["children","width","height","viewBox","className","style","title","desc"];function bE(){return bE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bE.apply(this,arguments)}function o2e(e,t){if(e==null)return{};var n=l2e(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function l2e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function wE(e){var t=e.children,n=e.width,r=e.height,a=e.viewBox,i=e.className,o=e.style,l=e.title,c=e.desc,d=o2e(e,i2e),m=a||{width:n,height:r,x:0,y:0},u=pn("recharts-surface",i);return he.createElement("svg",bE({},fn(d,!0,"svg"),{className:u,width:n,height:r,style:o,viewBox:"".concat(m.x," ").concat(m.y," ").concat(m.width," ").concat(m.height)}),he.createElement("title",null,l),he.createElement("desc",null,c),t)}var c2e=["children","className"];function jE(){return jE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jE.apply(this,arguments)}function d2e(e,t){if(e==null)return{};var n=u2e(e,t),r,a;
770if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function u2e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var wr=he.forwardRef(function(e,t){var n=e.children,r=e.className,a=d2e(e,c2e),i=pn("recharts-layer",r);return he.createElement("g",jE({className:i},fn(a,!0),{ref:t}),n)}),rc=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),i=2;i<r;i++)a[i-2]=arguments[i]};function m2e(e,t,n){var r=-1,a=e.length;t<0&&(t=-t>a?0:a+t),n=n>a?a:n,n<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(a);++r<a;)i[r]=e[r+t];return i}var h2e=m2e,f2e=h2e;function p2e(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:f2e(e,t,n)}var x2e=p2e,g2e="\\ud800-\\udfff",y2e="\\u0300-\\u036f",v2e="\\ufe20-\\ufe2f",b2e="\\u20d0-\\u20ff",w2e=y2e+v2e+b2e,j2e="\\ufe0e\\ufe0f",N2e="\\u200d",C2e=RegExp("["+N2e+g2e+w2e+j2e+"]");function S2e(e){return C2e.test(e)}var fG=S2e;function k2e(e){return e.split("")}var P2e=k2e,pG="\\ud800-\\udfff",E2e="\\u0300-\\u036f",D2e="\\ufe20-\\ufe2f",A2e="\\u20d0-\\u20ff",T2e=E2e+D2e+A2e,O2e="\\ufe0e\\ufe0f",F2e="["+pG+"]",NE="["+T2e+"]",CE="\\ud83c[\\udffb-\\udfff]",_2e="(?:"+NE+"|"+CE+")",xG="[^"+pG+"]",gG="(?:\\ud83c[\\udde6-\\uddff]){2}",yG="[\\ud800-\\udbff][\\udc00-\\udfff]",M2e="\\u200d",vG=_2e+"?",bG="["+O2e+"]?",$2e="(?:"+M2e+"(?:"+[xG,gG,yG].join("|")+")"+bG+vG+")*",I2e=bG+vG+$2e,R2e="(?:"+[xG+NE+"?",NE,gG,yG,F2e].join("|")+")",B2e=RegExp(CE+"(?="+CE+")|"+R2e+I2e,"g");function L2e(e){return e.match(B2e)||[]}var U2e=L2e,z2e=P2e,q2e=fG,W2e=U2e;function H2e(e){return q2e(e)?W2e(e):z2e(e)}var V2e=H2e,K2e=x2e,G2e=fG,Y2e=V2e,Q2e=lG;function J2e(e){return function(t){t=Q2e(t);var n=G2e(t)?Y2e(t):void 0,r=n?n[0]:t.charAt(0),a=n?K2e(n,1).join(""):t.slice(1);return r[e]()+a}}var X2e=J2e,Z2e=X2e,ePe=Z2e("toUpperCase"),tPe=ePe;const M1=Qs(tPe);function zn(e){return function(){return e}}const wG=Math.cos,Kw=Math.sin,Wo=Math.sqrt,Gw=Math.PI,$1=2*Gw,SE=Math.PI,kE=2*SE,cu=1e-6,sPe=kE-cu;function jG(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function nPe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return jG;const n=10**t;return function(r){this._+=r[0];for(let a=1,i=r.length;a<i;++a)this._+=Math.round(arguments[a]*n)/n+r[a]}}class rPe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?jG:nPe(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,a){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+a}`}bezierCurveTo(t,n,r,a,i,o){this._append`C${+t},${+n},${+r},${+a},${this._x1=+i},${this._y1=+o}`}arcTo(t,n,r,a,i){if(t=+t,n=+n,r=+r,a=+a,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,l=this._y1,c=r-t,d=a-n,m=o-t,u=l-n,h=m*m+u*u;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(h>cu)if(!(Math.abs(u*c-d*m)>cu)||!i)this._append`L${this._x1=t},${this._y1=n}`;else{let p=r-o,v=a-l,y=c*c+d*d,g=p*p+v*v,x=Math.sqrt(y),b=Math.sqrt(h),w=i*Math.tan((SE-Math.acos((y+h-g)/(2*x*b)))/2),j=w/b,N=w/x;Math.abs(j-1)>cu&&this._append`L${t+j*m},${n+j*u}`,this._append`A${i},${i},0,0,${+(u*p>m*v)},${this._x1=t+N*c},${this._y1=n+N*d}`}}arc(t,n,r,a,i,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(a),c=r*Math.sin(a),d=t+l,m=n+c,u=1^o,h=o?a-i:i-a;this._x1===null?this._append`M${d},${m}`:(Math.abs(this._x1-d)>cu||Math.abs(this._y1-m)>cu)&&this._append`L${d},${m}`,r&&(h<0&&(h=h%kE+kE),h>sPe?this._append`A${r},${r},0,1,${u},${t-l},${n-c}A${r},${r},0,1,${u},${this._x1=d},${this._y1=m}`:h>cu&&this._append`A${r},${r},0,${+(h>=SE)},${u},${this._x1=t+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(t,n,r,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+a}h${-r}Z`}toString(){return this._}}function LO(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new rPe(t)}function UO(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function NG(e){this._context=e}NG.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function I1(e){return new NG(e)}function CG(e){return e[0]}function SG(e){return e[1]}function kG(e,t){var n=zn(!0),r=null,a=I1,i=null,o=LO(l);e=typeof e=="function"?e:e===void 0?CG:zn(e),t=typeof t=="function"?t:t===void 0?SG:zn(t);function l(c){var d,m=(c=UO(c)).length,u,h=!1,p;for(r==null&&(i=a(p=o())),d=0;d<=m;++d)!(d<m&&n(u=c[d],d,c))===h&&((h=!h)?i.lineStart():i.lineEnd()),h&&i.point(+e(u,d,c),+t(u,d,c));if(p)return i=null,p+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:zn(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:zn(+c),l):t},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:zn(!!c),l):n},l.curve=function(c){return arguments.length?(a=c,r!=null&&(i=a(r)),l):a},l.context=function(c){return arguments.length?(c==null?r=i=null:i=a(r=c),l):r},l}
vendor: 10,229 bytes, line 770
770function W0(e,t,n){var r=null,a=zn(!0),i=null,o=I1,l=null,c=LO(d);e=typeof e=="function"?e:e===void 0?CG:zn(+e),t=typeof t=="function"?t:zn(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?SG:zn(+n);function d(u){var h,p,v,y=(u=UO(u)).length,g,x=!1,b,w=new Array(y),j=new Array(y);for(i==null&&(l=o(b=c())),h=0;h<=y;++h){if(!(h<y&&a(g=u[h],h,u))===x)if(x=!x)p=h,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),v=h-1;v>=p;--v)l.point(w[v],j[v]);l.lineEnd(),l.areaEnd()}x&&(w[h]=+e(g,h,u),j[h]=+t(g,h,u),l.point(r?+r(g,h,u):w[h],n?+n(g,h,u):j[h]))}if(b)return l=null,b+""||null}function m(){return kG().defined(a).curve(o).context(i)}return d.x=function(u){return arguments.length?(e=typeof u=="function"?u:zn(+u),r=null,d):e},d.x0=function(u){return arguments.length?(e=typeof u=="function"?u:zn(+u),d):e},d.x1=function(u){return arguments.length?(r=u==null?null:typeof u=="function"?u:zn(+u),d):r},d.y=function(u){return arguments.length?(t=typeof u=="function"?u:zn(+u),n=null,d):t},d.y0=function(u){return arguments.length?(t=typeof u=="function"?u:zn(+u),d):t},d.y1=function(u){return arguments.length?(n=u==null?null:typeof u=="function"?u:zn(+u),d):n},d.lineX0=d.lineY0=function(){return m().x(e).y(t)},d.lineY1=function(){return m().x(e).y(n)},d.lineX1=function(){return m().x(r).y(t)},d.defined=function(u){return arguments.length?(a=typeof u=="function"?u:zn(!!u),d):a},d.curve=function(u){return arguments.length?(o=u,i!=null&&(l=o(i)),d):o},d.context=function(u){return arguments.length?(u==null?i=l=null:l=o(i=u),d):i},d}class PG{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function aPe(e){return new PG(e,!0)}function iPe(e){return new PG(e,!1)}const zO={draw(e,t){const n=Wo(t/Gw);e.moveTo(n,0),e.arc(0,0,n,0,$1)}},oPe={draw(e,t){const n=Wo(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},EG=Wo(1/3),lPe=EG*2,cPe={draw(e,t){const n=Wo(t/lPe),r=n*EG;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},dPe={draw(e,t){const n=Wo(t),r=-n/2;e.rect(r,r,n,n)}},uPe=.8908130915292852,DG=Kw(Gw/10)/Kw(7*Gw/10),mPe=Kw($1/10)*DG,hPe=-wG($1/10)*DG,fPe={draw(e,t){const n=Wo(t*uPe),r=mPe*n,a=hPe*n;e.moveTo(0,-n),e.lineTo(r,a);for(let i=1;i<5;++i){const o=$1*i/5,l=wG(o),c=Kw(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*a,c*r+l*a)}e.closePath()}},rk=Wo(3),pPe={draw(e,t){const n=-Wo(t/(rk*3));e.moveTo(0,n*2),e.lineTo(-rk*n,-n),e.lineTo(rk*n,-n),e.closePath()}},Ti=-.5,Oi=Wo(3)/2,PE=1/Wo(12),xPe=(PE/2+1)*3,gPe={draw(e,t){const n=Wo(t/xPe),r=n/2,a=n*PE,i=r,o=n*PE+n,l=-i,c=o;e.moveTo(r,a),e.lineTo(i,o),e.lineTo(l,c),e.lineTo(Ti*r-Oi*a,Oi*r+Ti*a),e.lineTo(Ti*i-Oi*o,Oi*i+Ti*o),e.lineTo(Ti*l-Oi*c,Oi*l+Ti*c),e.lineTo(Ti*r+Oi*a,Ti*a-Oi*r),e.lineTo(Ti*i+Oi*o,Ti*o-Oi*i),e.lineTo(Ti*l+Oi*c,Ti*c-Oi*l),e.closePath()}};function yPe(e,t){let n=null,r=LO(a);e=typeof e=="function"?e:zn(e||zO),t=typeof t=="function"?t:zn(t===void 0?64:+t);function a(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:zn(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:zn(+i),a):t},a.context=function(i){return arguments.length?(n=i??null,a):n},a}function Yw(){}function Qw(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function AG(e){this._context=e}AG.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Qw(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Qw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function vPe(e){return new AG(e)}function TG(e){this._context=e}TG.prototype={areaStart:Yw,areaEnd:Yw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Qw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function bPe(e){return new TG(e)}function OG(e){this._context=e}OG.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Qw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function wPe(e){return new OG(e)}function FG(e){this._context=e}FG.prototype={areaStart:Yw,areaEnd:Yw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function jPe(e){return new FG(e)}function I3(e){return e<0?-1:1}function R3(e,t,n){var r=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(r||a<0&&-0),o=(n-e._y1)/(a||r<0&&-0),l=(i*a+o*r)/(r+a);return(I3(i)+I3(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function B3(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ak(e,t,n){var r=e._x0,a=e._y0,i=e._x1,o=e._y1,l=(i-r)/3;e._context.bezierCurveTo(r+l,a+l*t,i-l,o-l*n,i,o)}function Jw(e){this._context=e}Jw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ak(this,this._t0,B3(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,ak(this,B3(this,n=R3(this,e,t)),n);break;default:ak(this,this._t0,n=R3(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function _G(e){this._context=new MG(e)}(_G.prototype=Object.create(Jw.prototype)).point=function(e,t){Jw.prototype.point.call(this,t,e)};function MG(e){this._context=e}MG.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,a,i){this._context.bezierCurveTo(t,e,r,n,i,a)}};function NPe(e){return new Jw(e)}function CPe(e){return new _G(e)}function $G(e){this._context=e}$G.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=L3(e),a=L3(t),i=0,o=1;o<n;++i,++o)this._context.bezierCurveTo(r[0][i],a[0][i],r[1][i],a[1][i],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function L3(e){var t,n=e.length-1,r,a=new Array(n),i=new Array(n),o=new Array(n);for(a[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)a[t]=1,i[t]=4,o[t]=4*e[t]+2*e[t+1];for(a[n-1]=2,i[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=a[t]/i[t-1],i[t]-=r,o[t]-=r*o[t-1];for(a[n-1]=o[n-1]/i[n-1],t=n-2;t>=0;--t)a[t]=(o[t]-a[t+1])/i[t];for(i[n-1]=(e[n]+a[n-1])/2,t=0;t<n-1;++t)i[t]=2*e[t+1]-a[t+1];return[a,i]}function SPe(e){return new $G(e)}function R1(e,t){this._context=e,this._t=t}R1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;
vendor: 9,151 bytes, lines 770-773
770default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function kPe(e){return new R1(e,.5)}function PPe(e){return new R1(e,0)}function EPe(e){return new R1(e,1)}function Uf(e,t){if((o=e.length)>1)for(var n=1,r,a,i=e[t[0]],o,l=i.length;n<o;++n)for(a=i,i=e[t[n]],r=0;r<l;++r)i[r][1]+=i[r][0]=isNaN(a[r][1])?a[r][0]:a[r][1]}function EE(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function DPe(e,t){return e[t]}function APe(e){const t=[];return t.key=e,t}function TPe(){var e=zn([]),t=EE,n=Uf,r=DPe;function a(i){var o=Array.from(e.apply(this,arguments),APe),l,c=o.length,d=-1,m;for(const u of i)for(l=0,++d;l<c;++l)(o[l][d]=[0,+r(u,o[l].key,d,i)]).data=u;for(l=0,m=UO(t(o));l<c;++l)o[m[l]].index=l;return n(o,m),o}return a.keys=function(i){return arguments.length?(e=typeof i=="function"?i:zn(Array.from(i)),a):e},a.value=function(i){return arguments.length?(r=typeof i=="function"?i:zn(+i),a):r},a.order=function(i){return arguments.length?(t=i==null?EE:typeof i=="function"?i:zn(Array.from(i)),a):t},a.offset=function(i){return arguments.length?(n=i??Uf,a):n},a}function OPe(e,t){if((r=e.length)>0){for(var n,r,a=0,i=e[0].length,o;a<i;++a){for(o=n=0;n<r;++n)o+=e[n][a][1]||0;if(o)for(n=0;n<r;++n)e[n][a][1]/=o}Uf(e,t)}}function FPe(e,t){if((a=e.length)>0){for(var n=0,r=e[t[0]],a,i=r.length;n<i;++n){for(var o=0,l=0;o<a;++o)l+=e[o][n][1]||0;r[n][1]+=r[n][0]=-l/2}Uf(e,t)}}function _Pe(e,t){if(!(!((o=e.length)>0)||!((i=(a=e[t[0]]).length)>0))){for(var n=0,r=1,a,i,o;r<i;++r){for(var l=0,c=0,d=0;l<o;++l){for(var m=e[t[l]],u=m[r][1]||0,h=m[r-1][1]||0,p=(u-h)/2,v=0;v<l;++v){var y=e[t[v]],g=y[r][1]||0,x=y[r-1][1]||0;p+=g-x}c+=u,d+=p*u}a[r-1][1]+=a[r-1][0]=n,c&&(n-=d/c)}a[r-1][1]+=a[r-1][0]=n,Uf(e,t)}}function Hg(e){"@babel/helpers - typeof";return Hg=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},Hg(e)}var MPe=["type","size","sizeType"];function DE(){return DE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},DE.apply(this,arguments)}function U3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function z3(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?U3(Object(n),!0).forEach(function(r){$Pe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U3(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function $Pe(e,t,n){return t=IPe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function IPe(e){var t=RPe(e,"string");return Hg(t)=="symbol"?t:t+""}function RPe(e,t){if(Hg(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Hg(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function BPe(e,t){if(e==null)return{};var n=LPe(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function LPe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var IG={symbolCircle:zO,symbolCross:oPe,symbolDiamond:cPe,symbolSquare:dPe,symbolStar:fPe,symbolTriangle:pPe,symbolWye:gPe},UPe=Math.PI/180,zPe=function(t){var n="symbol".concat(M1(t));return IG[n]||zO},qPe=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*UPe;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},WPe=function(t,n){IG["symbol".concat(M1(t))]=n},qO=function(t){var n=t.type,r=n===void 0?"circle":n,a=t.size,i=a===void 0?64:a,o=t.sizeType,l=o===void 0?"area":o,c=BPe(t,MPe),d=z3(z3({},c),{},{type:r,size:i,sizeType:l}),m=function(){var g=zPe(r),x=yPe().type(g).size(qPe(i,l,r));return x()},u=d.className,h=d.cx,p=d.cy,v=fn(d,!0);return h===+h&&p===+p&&i===+i?he.createElement("path",DE({},v,{className:pn("recharts-symbols",u),transform:"translate(".concat(h,", ").concat(p,")"),d:m()})):null};qO.registerSymbol=WPe;function zf(e){"@babel/helpers - typeof";return zf=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},zf(e)}function AE(){return AE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},AE.apply(this,arguments)}function q3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function HPe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?q3(Object(n),!0).forEach(function(r){Vg(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q3(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function VPe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function KPe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,BG(r.key),r)}}function GPe(e,t,n){return t&&KPe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function YPe(e,t,n){return t=Xw(t),QPe(e,RG()?Reflect.construct(t,n||[],Xw(e).constructor):t.apply(e,n))}function QPe(e,t){if(t&&(zf(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return JPe(e)}function JPe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function RG(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(RG=function(){return!!e})()}function Xw(e){return Xw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Xw(e)}function XPe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&TE(e,t)}function TE(e,t){return TE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},TE(e,t)}function Vg(e,t,n){return t=BG(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BG(e){var t=ZPe(e,"string");return zf(t)=="symbol"?t:t+""}function ZPe(e,t){if(zf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(zf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Fi=32,WO=function(e){function t(){return VPe(this,t),YPe(this,t,arguments)}return XPe(t,e),GPe(t,[{key:"renderIcon",value:function(r){var a=this.props.inactiveColor,i=Fi/2,o=Fi/6,l=Fi/3,c=r.inactive?a:r.color;if(r.type==="plainline")return he.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:i,x2:Fi,y2:i,className:"recharts-legend-icon"});if(r.type==="line")return he.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(i,"h").concat(l,`
771            A`).concat(o,",").concat(o,",0,1,1,").concat(2*l,",").concat(i,`
772            H`).concat(Fi,"M").concat(2*l,",").concat(i,`
773            A`).concat(o,",").concat(o,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(r.type==="rect")return he.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(Fi/8,"h").concat(Fi,"v").concat(Fi*3/4,"h").concat(-Fi,"z"),className:"recharts-legend-icon"});if(he.isValidElement(r.legendIcon)){var d=HPe({},r);return delete d.legendIcon,he.cloneElement(r.legendIcon,d)}return he.createElement(qO,{fill:c,cx:i,cy:i,size:Fi,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,a=this.props,i=a.payload,o=a.iconSize,l=a.layout,c=a.formatter,d=a.inactiveColor,m={x:0,y:0,width:Fi,height:Fi}
773,u={display:l==="horizontal"?"inline-block":"block",marginRight:10},h={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(p,v){var y=p.formatter||c,g=pn(Vg(Vg({"recharts-legend-item":!0},"legend-item-".concat(v),!0),"inactive",p.inactive));if(p.type==="none")return null;var x=Ks(p.value)?null:p.value;rc(!Ks(p.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var b=p.inactive?d:p.color;return he.createElement("li",AE({className:g,style:u,key:"legend-item-".concat(v)},Vw(r.props,p,v)),he.createElement(wE,{width:o,height:o,viewBox:m,style:h},r.renderIcon(p)),he.createElement("span",{className:"recharts-legend-item-text",style:{color:b}},y?y(x,p,v):x))})}},{key:"render",value:function(){var r=this.props,a=r.payload,i=r.layout,o=r.align;if(!a||!a.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return he.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(f.PureComponent);Vg(WO,"displayName","Legend");Vg(WO,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var eEe=j1;function tEe(){this.__data__=new eEe,this.size=0}var sEe=tEe;function nEe(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var rEe=nEe;function aEe(e){return this.__data__.get(e)}var iEe=aEe;function oEe(e){return this.__data__.has(e)}var lEe=oEe,cEe=j1,dEe=TO,uEe=OO,mEe=200;function hEe(e,t){var n=this.__data__;if(n instanceof cEe){var r=n.__data__;if(!dEe||r.length<mEe-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new uEe(r)}return n.set(e,t),this.size=n.size,this}var fEe=hEe,pEe=j1,xEe=sEe,gEe=rEe,yEe=iEe,vEe=lEe,bEe=fEe;function Ap(e){var t=this.__data__=new pEe(e);this.size=t.size}Ap.prototype.clear=xEe;Ap.prototype.delete=gEe;Ap.prototype.get=yEe;Ap.prototype.has=vEe;Ap.prototype.set=bEe;var LG=Ap,wEe="__lodash_hash_undefined__";function jEe(e){return this.__data__.set(e,wEe),this}var NEe=jEe;function CEe(e){return this.__data__.has(e)}var SEe=CEe,kEe=OO,PEe=NEe,EEe=SEe;function Zw(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new kEe;++t<n;)this.add(e[t])}Zw.prototype.add=Zw.prototype.push=PEe;Zw.prototype.has=EEe;var UG=Zw;function DEe(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var zG=DEe;function AEe(e,t){return e.has(t)}var qG=AEe,TEe=UG,OEe=zG,FEe=qG,_Ee=1,MEe=2;function $Ee(e,t,n,r,a,i){var o=n&_Ee,l=e.length,c=t.length;if(l!=c&&!(o&&c>l))return!1;var d=i.get(e),m=i.get(t);if(d&&m)return d==t&&m==e;var u=-1,h=!0,p=n&MEe?new TEe:void 0;for(i.set(e,t),i.set(t,e);++u<l;){var v=e[u],y=t[u];if(r)var g=o?r(y,v,u,t,e,i):r(v,y,u,e,t,i);if(g!==void 0){if(g)continue;h=!1;break}if(p){if(!OEe(t,function(x,b){if(!FEe(p,b)&&(v===x||a(v,x,n,r,i)))return p.push(b)})){h=!1;break}}else if(!(v===y||a(v,y,n,r,i))){h=!1;break}}return i.delete(e),i.delete(t),h}var WG=$Ee,IEe=Dl,REe=IEe.Uint8Array,BEe=REe;function LEe(e){var t=-1,n=Array(e.size);return e.forEach(function(r,a){n[++t]=[a,r]}),n}var UEe=LEe;function zEe(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var HO=zEe,W3=jv,H3=BEe,qEe=AO,WEe=WG,HEe=UEe,VEe=HO,KEe=1,GEe=2,YEe="[object Boolean]",QEe="[object Date]",JEe="[object Error]",XEe="[object Map]",ZEe="[object Number]",eDe="[object RegExp]",tDe="[object Set]",sDe="[object String]",nDe="[object Symbol]",rDe="[object ArrayBuffer]",aDe="[object DataView]",V3=W3?W3.prototype:void 0,ik=V3?V3.valueOf:void 0;function iDe(e,t,n,r,a,i,o){switch(n){case aDe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case rDe:return!(e.byteLength!=t.byteLength||!i(new H3(e),new H3(t)));case YEe:case QEe:case ZEe:return qEe(+e,+t);case JEe:return e.name==t.name&&e.message==t.message;case eDe:case sDe:return e==t+"";case XEe:var l=HEe;case tDe:var c=r&KEe;if(l||(l=VEe),e.size!=t.size&&!c)return!1;var d=o.get(e);if(d)return d==t;r|=GEe,o.set(e,t);var m=WEe(l(e),l(t),r,a,i,o);return o.delete(e),m;case nDe:if(ik)return ik.call(e)==ik.call(t)}return!1}var oDe=iDe;function lDe(e,t){for(var n=-1,r=t.length,a=e.length;++n<r;)e[a+n]=t[n];return e}var HG=lDe,cDe=HG,dDe=ni;function uDe(e,t,n){var r=t(e);return dDe(e)?r:cDe(r,n(e))}var mDe=uDe;function hDe(e,t){for(var n=-1,r=e==null?0:e.length,a=0,i=[];++n<r;){var o=e[n];t(o,n,e)&&(i[a++]=o)}return i}var fDe=hDe;function pDe(){return[]}var xDe=pDe,gDe=fDe,yDe=xDe,vDe=Object.prototype,bDe=vDe.propertyIsEnumerable,K3=Object.getOwnPropertySymbols,wDe=K3?function(e){return e==null?[]:(e=Object(e),gDe(K3(e),function(t){return bDe.call(e,t)}))}:yDe,jDe=wDe;function NDe(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var CDe=NDe,SDe=wc,kDe=jc,PDe="[object Arguments]";function EDe(e){return kDe(e)&&SDe(e)==PDe}var DDe=EDe,G3=DDe,ADe=jc,VG=Object.prototype,TDe=VG.hasOwnProperty,ODe=VG.propertyIsEnumerable,FDe=G3(function(){return arguments}())?G3:function(e){return ADe(e)&&TDe.call(e,"callee")&&!ODe.call(e,"callee")},VO=FDe,ej={exports:{}};function _De(){return!1}var MDe=_De;ej.exports;(function(e,t){var n=Dl,r=MDe,a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,l=o?n.Buffer:void 0,c=l?l.isBuffer:void 0,d=c||r;e.exports=d}
vendor: 3,752 bytes, line 773
773)(ej,ej.exports);var KG=ej.exports,$De=9007199254740991,IDe=/^(?:0|[1-9]\d*)$/;function RDe(e,t){var n=typeof e;return t=t??$De,!!t&&(n=="number"||n!="symbol"&&IDe.test(e))&&e>-1&&e%1==0&&e<t}var KO=RDe,BDe=9007199254740991;function LDe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=BDe}var GO=LDe,UDe=wc,zDe=GO,qDe=jc,WDe="[object Arguments]",HDe="[object Array]",VDe="[object Boolean]",KDe="[object Date]",GDe="[object Error]",YDe="[object Function]",QDe="[object Map]",JDe="[object Number]",XDe="[object Object]",ZDe="[object RegExp]",eAe="[object Set]",tAe="[object String]",sAe="[object WeakMap]",nAe="[object ArrayBuffer]",rAe="[object DataView]",aAe="[object Float32Array]",iAe="[object Float64Array]",oAe="[object Int8Array]",lAe="[object Int16Array]",cAe="[object Int32Array]",dAe="[object Uint8Array]",uAe="[object Uint8ClampedArray]",mAe="[object Uint16Array]",hAe="[object Uint32Array]",Kn={};Kn[aAe]=Kn[iAe]=Kn[oAe]=Kn[lAe]=Kn[cAe]=Kn[dAe]=Kn[uAe]=Kn[mAe]=Kn[hAe]=!0;Kn[WDe]=Kn[HDe]=Kn[nAe]=Kn[VDe]=Kn[rAe]=Kn[KDe]=Kn[GDe]=Kn[YDe]=Kn[QDe]=Kn[JDe]=Kn[XDe]=Kn[ZDe]=Kn[eAe]=Kn[tAe]=Kn[sAe]=!1;function fAe(e){return qDe(e)&&zDe(e.length)&&!!Kn[UDe(e)]}var pAe=fAe;function xAe(e){return function(t){return e(t)}}var GG=xAe,tj={exports:{}};tj.exports;(function(e,t){var n=YW,r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===r,o=i&&n.process,l=function(){try{var c=a&&a.require&&a.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();e.exports=l})(tj,tj.exports);var gAe=tj.exports,yAe=pAe,vAe=GG,Y3=gAe,Q3=Y3&&Y3.isTypedArray,bAe=Q3?vAe(Q3):yAe,YG=bAe,wAe=CDe,jAe=VO,NAe=ni,CAe=KG,SAe=KO,kAe=YG,PAe=Object.prototype,EAe=PAe.hasOwnProperty;function DAe(e,t){var n=NAe(e),r=!n&&jAe(e),a=!n&&!r&&CAe(e),i=!n&&!r&&!a&&kAe(e),o=n||r||a||i,l=o?wAe(e.length,String):[],c=l.length;for(var d in e)(t||EAe.call(e,d))&&!(o&&(d=="length"||a&&(d=="offset"||d=="parent")||i&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||SAe(d,c)))&&l.push(d);return l}var AAe=DAe,TAe=Object.prototype;function OAe(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||TAe;return e===n}var FAe=OAe;function _Ae(e,t){return function(n){return e(t(n))}}var QG=_Ae,MAe=QG,$Ae=MAe(Object.keys,Object),IAe=$Ae,RAe=FAe,BAe=IAe,LAe=Object.prototype,UAe=LAe.hasOwnProperty;function zAe(e){if(!RAe(e))return BAe(e);var t=[];for(var n in Object(e))UAe.call(e,n)&&n!="constructor"&&t.push(n);return t}var qAe=zAe,WAe=DO,HAe=GO;function VAe(e){return e!=null&&HAe(e.length)&&!WAe(e)}var Dv=VAe,KAe=AAe,GAe=qAe,YAe=Dv;function QAe(e){return YAe(e)?KAe(e):GAe(e)}var B1=QAe,JAe=mDe,XAe=jDe,ZAe=B1;function eTe(e){return JAe(e,ZAe,XAe)}var tTe=eTe,J3=tTe,sTe=1,nTe=Object.prototype,rTe=nTe.hasOwnProperty;function aTe(e,t,n,r,a,i){var o=n&sTe,l=J3(e),c=l.length,d=J3(t),m=d.length;if(c!=m&&!o)return!1;for(var u=c;u--;){var h=l[u];if(!(o?h in t:rTe.call(t,h)))return!1}var p=i.get(e),v=i.get(t);if(p&&v)return p==t&&v==e;var y=!0;i.set(e,t),i.set(t,e);for(var g=o;++u<c;){h=l[u];var x=e[h],b=t[h];if(r)var w=o?r(b,x,h,t,e,i):r(x,b,h,e,t,i);if(!(w===void 0?x===b||a(x,b,n,r,i):w)){y=!1;break}g||(g=h=="constructor")}if(y&&!g){var j=e.constructor,N=t.constructor;j!=N&&"constructor"in e&&"constructor"in t&&!(typeof j=="function"&&j instanceof j&&typeof N=="function"&&N instanceof N)&&(y=!1)}return i.delete(e),i.delete(t),y}var iTe=aTe,oTe=Em,lTe=Dl,cTe=oTe(lTe,"DataView"),dTe=cTe,uTe=Em,mTe=Dl,hTe=uTe(mTe,"Promise"),fTe=hTe,pTe=Em,xTe=Dl,gTe=pTe(xTe,"Set"),JG=gTe,yTe=Em,vTe=Dl,bTe=yTe(vTe,"WeakMap"),wTe=bTe,OE=dTe,FE=TO,_E=fTe,ME=JG,$E=wTe,XG=wc,Tp=rG,X3="[object Map]",jTe="[object Object]",Z3="[object Promise]",e6="[object Set]",t6="[object WeakMap]",s6="[object DataView]",NTe=Tp(OE),CTe=Tp(FE),STe=Tp(_E),kTe=Tp(ME),PTe=Tp($E),du
vendor: 4,764 bytes, line 773
773=XG;(OE&&du(new OE(new ArrayBuffer(1)))!=s6||FE&&du(new FE)!=X3||_E&&du(_E.resolve())!=Z3||ME&&du(new ME)!=e6||$E&&du(new $E)!=t6)&&(du=function(e){var t=XG(e),n=t==jTe?e.constructor:void 0,r=n?Tp(n):"";if(r)switch(r){case NTe:return s6;case CTe:return X3;case STe:return Z3;case kTe:return e6;case PTe:return t6}return t});var ETe=du,ok=LG,DTe=WG,ATe=oDe,TTe=iTe,n6=ETe,r6=ni,a6=KG,OTe=YG,FTe=1,i6="[object Arguments]",o6="[object Array]",H0="[object Object]",_Te=Object.prototype,l6=_Te.hasOwnProperty;function MTe(e,t,n,r,a,i){var o=r6(e),l=r6(t),c=o?o6:n6(e),d=l?o6:n6(t);c=c==i6?H0:c,d=d==i6?H0:d;var m=c==H0,u=d==H0,h=c==d;if(h&&a6(e)){if(!a6(t))return!1;o=!0,m=!1}if(h&&!m)return i||(i=new ok),o||OTe(e)?DTe(e,t,n,r,a,i):ATe(e,t,c,n,r,a,i);if(!(n&FTe)){var p=m&&l6.call(e,"__wrapped__"),v=u&&l6.call(t,"__wrapped__");if(p||v){var y=p?e.value():e,g=v?t.value():t;return i||(i=new ok),a(y,g,n,r,i)}}return h?(i||(i=new ok),TTe(e,t,n,r,a,i)):!1}var $Te=MTe,ITe=$Te,c6=jc;function ZG(e,t,n,r,a){return e===t?!0:e==null||t==null||!c6(e)&&!c6(t)?e!==e&&t!==t:ITe(e,t,n,r,ZG,a)}var YO=ZG,RTe=LG,BTe=YO,LTe=1,UTe=2;function zTe(e,t,n,r){var a=n.length,i=a,o=!r;if(e==null)return!i;for(e=Object(e);a--;){var l=n[a];if(o&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++a<i;){l=n[a];var c=l[0],d=e[c],m=l[1];if(o&&l[2]){if(d===void 0&&!(c in e))return!1}else{var u=new RTe;if(r)var h=r(d,m,c,e,t,u);if(!(h===void 0?BTe(m,d,LTe|UTe,r,u):h))return!1}}return!0}var qTe=zTe,WTe=zd;function HTe(e){return e===e&&!WTe(e)}var eY=HTe,VTe=eY,KTe=B1;function GTe(e){for(var t=KTe(e),n=t.length;n--;){var r=t[n],a=e[r];t[n]=[r,a,VTe(a)]}return t}var YTe=GTe;function QTe(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var tY=QTe,JTe=qTe,XTe=YTe,ZTe=tY;function eOe(e){var t=XTe(e);return t.length==1&&t[0][2]?ZTe(t[0][0],t[0][1]):function(n){return n===e||JTe(n,e,t)}}var tOe=eOe;function sOe(e,t){return e!=null&&t in Object(e)}var nOe=sOe,rOe=cG,aOe=VO,iOe=ni,oOe=KO,lOe=GO,cOe=C1;function dOe(e,t,n){t=rOe(t,e);for(var r=-1,a=t.length,i=!1;++r<a;){var o=cOe(t[r]);if(!(i=e!=null&&n(e,o)))break;e=e[o]}return i||++r!=a?i:(a=e==null?0:e.length,!!a&&lOe(a)&&oOe(o,a)&&(iOe(e)||aOe(e)))}var uOe=dOe,mOe=nOe,hOe=uOe;function fOe(e,t){return e!=null&&hOe(e,t,mOe)}var pOe=fOe,xOe=YO,gOe=dG,yOe=pOe,vOe=EO,bOe=eY,wOe=tY,jOe=C1,NOe=1,COe=2;function SOe(e,t){return vOe(e)&&bOe(t)?wOe(jOe(e),t):function(n){var r=gOe(n,e);return r===void 0&&r===t?yOe(n,e):xOe(t,r,NOe|COe)}}var kOe=SOe;function POe(e){return e}var Op=POe;function EOe(e){return function(t){return t==null?void 0:t[e]}}var DOe=EOe,AOe=MO;function TOe(e){return function(t){return AOe(t,e)}}var OOe=TOe,FOe=DOe,_Oe=OOe,MOe=EO,$Oe=C1;function IOe(e){return MOe(e)?FOe($Oe(e)):_Oe(e)}var ROe=IOe,BOe=tOe,LOe=kOe,UOe=Op,zOe=ni,qOe=ROe;function WOe(e){return typeof e=="function"?e:e==null?UOe:typeof e=="object"?zOe(e)?LOe(e[0],e[1]):BOe(e):qOe(e)}var Gd=WOe;function HOe(e,t,n,r){for(var a=e.length,i=n+(r?1:-1);r?i--:++i<a;)if(t(e[i],i,e))return i;return-1}var sY=HOe;function VOe(e){return e!==e}var KOe=VOe;function GOe(e,t,n){for(var r=n-1,a=e.length;++r<a;)if(e[r]===t)return r;return-1}var YOe=GOe,QOe=sY,JOe=KOe,XOe=YOe;function ZOe(e,t,n){return t===t?XOe(e,t,n):QOe(e,JOe,n)}var eFe=ZOe,tFe=eFe;function sFe(e,t){var n=e==null?0:e.length;return!!n&&tFe(e,t,0)>-1}var nFe=sFe;function rFe(e,t,n){for(var r=-1,a=e==null?0:e.length;++r<a;)if(n(t,e[r]))return!0;return!1}var aFe=rFe;function iFe(){}var oFe=iFe,lk=JG,lFe=oFe,cFe=HO,dFe=1/0,uFe=lk&&1/cFe(new lk([,-0]))[1]==dFe?function(e){return new lk(e)}:lFe,mFe=uFe,hFe=UG,fFe=nFe,pFe=aFe,xFe=qG,gFe=mFe,yFe=HO,vFe=200;function bFe(e,t,n){var r=-1,a=fFe,i=e.length,o=!0,l=[],c=l;if(n)o=!1,a=pFe;else if(i>=vFe){var d=t?null:gFe(e);if(d)return yFe(d);o=!1,a=xFe,c=new hFe}else c=t?[]:l;e:for(;++r<i;){var m=e[r],u=t?t(m):m;if(m=n||m!==0?m:0,o&&u===u){for(var h=c.length;h--;)if(c[h]===u)continue e;t&&c.push(u),l.push(m)}else a(c,u,n)||(c!==l&&c.push(u),l.push(m))}return l}var wFe=bFe,jFe=Gd,NFe=wFe;function CFe(e,t){return e&&e.length?NFe(e,jFe(t)):[]}var SFe=CFe;const d6=Qs(SFe);function nY(e,t,n){return t===!0?d6(e,n):Ks(t)?d6(e,t):e}function qf(e){"@babel/helpers - typeof";return qf=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},qf(e)}var kFe=["ref"];function u6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function _l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
vendor: 4,215 bytes, line 773
773t%2?u6(Object(n),!0).forEach(function(r){L1(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function PFe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m6(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,aY(r.key),r)}}function EFe(e,t,n){return t&&m6(e.prototype,t),n&&m6(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function DFe(e,t,n){return t=sj(t),AFe(e,rY()?Reflect.construct(t,n||[],sj(e).constructor):t.apply(e,n))}function AFe(e,t){if(t&&(qf(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return TFe(e)}function TFe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rY(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rY=function(){return!!e})()}function sj(e){return sj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},sj(e)}function OFe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&IE(e,t)}function IE(e,t){return IE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},IE(e,t)}function L1(e,t,n){return t=aY(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aY(e){var t=FFe(e,"string");return qf(t)=="symbol"?t:t+""}function FFe(e,t){if(qf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(qf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function _Fe(e,t){if(e==null)return{};var n=MFe(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function MFe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function $Fe(e){return e.value}function IFe(e,t){if(he.isValidElement(e))return he.cloneElement(e,t);if(typeof e=="function")return he.createElement(e,t);t.ref;var n=_Fe(t,kFe);return he.createElement(WO,n)}var h6=1,Ju=function(e){function t(){var n;PFe(this,t);for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];return n=DFe(this,t,[].concat(a)),L1(n,"lastBoundingBox",{width:-1,height:-1}),n}return OFe(t,e),EFe(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,a=this.getBBox();a?(Math.abs(a.width-this.lastBoundingBox.width)>h6||Math.abs(a.height-this.lastBoundingBox.height)>h6)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,r&&r(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?_l({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var a=this.props,i=a.layout,o=a.align,l=a.verticalAlign,c=a.margin,d=a.chartWidth,m=a.chartHeight,u,h;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&i==="vertical"){var p=this.getBBoxSnapsh
773ot();u={left:((d||0)-p.width)/2}}else u=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(l==="middle"){var v=this.getBBoxSnapshot();h={top:((m||0)-v.height)/2}}else h=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return _l(_l({},u),h)}},{key:"render",value:function(){var r=this,a=this.props,i=a.content,o=a.width,l=a.height,c=a.wrapperStyle,d=a.payloadUniqBy,m=a.payload,u=_l(_l({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return he.createElement("div",{className:"recharts-legend-wrapper",style:u,ref:function(p){r.wrapperNode=p}},IFe(i,_l(_l({},this.props),{},{payload:nY(m,d,$Fe)})))}}],[{key:"getWithHeight",value:function(r,a){var i=_l(_l({},this.defaultProps),r.props),o=i.layout;return o==="vertical"&&Ut(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||a}:null}}])}(f.PureComponent);L1(Ju,"displayName","Legend");L1(Ju,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var f6=jv,RFe=VO,BFe=ni,p6=f6?f6.isConcatSpreadable:void 0;function LFe(e){return BFe(e)||RFe(e)||!!(p6&&e&&e[p6])}var UFe=LFe,zFe=HG,qFe=UFe;function iY(e,t,n,r,a){var i=-1,o=e.length;for(n||(n=qFe),a||(a=[]);++i<o;){var l=e[i];t>0&&n(l)?t>1?iY(l,t-1,n,r,a):zFe(a,l):r||(a[a.length]=l)}return a}var oY=iY;function WFe(e){return function(t,n,r){for(var a=-1,i=Object(t),o=r(t),l=o.length;l--;){var c=o[e?l:++a];if(n(i[c],c,i)===!1)break}return t}}var HFe=WFe,VFe=HFe,KFe=VFe(),GFe=KFe,YFe=GFe,QFe=B1;function JFe(e,t){return e&&YFe(e,t,QFe)}var lY=JFe,XFe=Dv;function ZFe(e,t){return function(n,r){if(n==null)return n;if(!XFe(n))return e(n,r);for(var a=n.length,i=t?a:-1,o=Object(n);(t?i--:++i<a)&&r(o[i],i,o)!==!1;);return n}}var e4e=ZFe,t4e=lY,s4e=e4e,n4e=s4e(t4e),QO=n4e,r4e=QO,a4e=Dv;function i4e(e,t){var n=-1,r=a4e(e)?Array(e.length):[];return r4e(e,function(a,i,o){r[++n]=t(a,i,o)}),r}var cY=i4e;function o4e(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}var l4e=o4e,x6=Sp;function c4e(e,t){if(e!==t){var n=e!==void 0,r=e===null,a=e===e,i=x6(e),o=t!==void 0,l=t===null,c=t===t,d=x6(t);if(!l&&!d&&!i&&e>t||i&&o&&c&&!l&&!d||r&&o&&c||!n&&c||!a)return 1;if(!r&&!i&&!d&&e<t||d&&n&&a&&!r&&!i||l&&n&&a||!o&&a||!c)return-1}return 0}var d4e=c4e,u4e=d4e;function m4e(e,t,n){for(var r=-1,a=e.criteria,i=t.criteria,o=a.length,l=n.length;++r<o;){var c=u4e(a[r],i[r]);if(c){if(r>=l)return c;var d=n[r];return c*(d=="desc"?-1:1)}}return e.index-t.index}var h4e=m4e,ck=_O,f4e=MO,p4e=Gd,x4e=cY,g4e=l4e,y4e=GG,v4e=h4e,b4e=Op,w4e=ni;function j4e(e,t,n){t.length?t=ck(t,function(i){return w4e(i)?function(o){return f4e(o,i.length===1?i[0]:i)}:i}):t=[b4e];var r=-1;t=ck(t,y4e(p4e));var a=x4e(e,function(i,o,l){var c=ck(t,function(d){return d(i)});return{criteria:c,index:++r,value:i}});return g4e(a,function(i,o){return v4e(i,o,n)})}var N4e=j4e;function C4e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var S4e=C4e,k4e=S4e,g6=Math.max;function P4e(e,t,n){return t=g6(t===void 0?e.length-1:t,0),function(){for(var r=arguments,a=-1,i=g6(r.length-t,0),o=Array(i);++a<i;)o[a]=r[t+a];a=-1;for(var l=Array(t+1);++a<t;)l[a]=r[a];return l[t]=n(o),k4e(e,this,l)}}var E4e=P4e;function D4e(e){return function(){return e}}var A4e=D4e,T4e=Em,O4e=function(){try{var e=T4e(Object,"defineProperty");return e({},"",{}),e}catch{}}(),dY=O4e,F4e=A4e,y6=dY,_4e=Op,M4e=y6?function(e,t){return y6(e,"toString",{configurable:!0,enumerable:!1,value:F4e(t),writable:!0})}:_4e,$4e=M4e,I4e=800,R4e=16,B4e=Date.now;function L4e(e){var t=0,n=0;return function(){var r=B4e(),a=R4e-(r-n);if(n=r,a>0){if(++t>=I4e)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var U4e=L4e,z4e=$4e,q4e=U4e,W4e=q4e(z4e),H4e=W4e,V4e=Op,K4e=E4e,G4e=H4e;function Y4e(e,t){return G4e(K4e(e,t,V4e),e+"")}var Q4e=Y4e,J4e=AO,X4e=Dv,Z4e=KO,e_e=zd;function t_e(e,t,n){if(!e_e(n))return!1;var r=typeof t;return(r=="number"?X4e(n)&&Z4e(t,n.length):r=="string"&&t in n)?J4e(n[t],e):!1}var U1=t_e,s_e=oY,n_e=N4e,r_e=Q4e,v6=U1,a_e=r_e(function(e,t){if(e==null)return[];var n=t.length;return n>1&&v6(e,t[0],t[1])?t=[]:n>2&&v6(t[0],t[1],t[2])&&(t=[t[0]]),n_e(e,s_e(t,1),[])}),i_e=a_e;const JO=Qs(i_e);function Kg(e){"@babel/helpers - typeof";return Kg=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},Kg(e)}function RE(){return RE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},RE.apply(this,arguments)}function o_e(e,t){return u_e(e)||d_e(e,t)||c_e(e,t)||l_e()}
vendor: 27,031 bytes, lines 773-780
773function l_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
774In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c_e(e,t){if(e){if(typeof e=="string")return b6(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b6(e,t)}}function b6(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function d_e(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(m){d=!0,a=m}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function u_e(e){if(Array.isArray(e))return e}function w6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function dk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?w6(Object(n),!0).forEach(function(r){m_e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function m_e(e,t,n){return t=h_e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h_e(e){var t=f_e(e,"string");return Kg(t)=="symbol"?t:t+""}function f_e(e,t){if(Kg(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Kg(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function p_e(e){return Array.isArray(e)&&zr(e[0])&&zr(e[1])?e.join(" ~ "):e}var x_e=function(t){var n=t.separator,r=n===void 0?" : ":n,a=t.contentStyle,i=a===void 0?{}:a,o=t.itemStyle,l=o===void 0?{}:o,c=t.labelStyle,d=c===void 0?{}:c,m=t.payload,u=t.formatter,h=t.itemSorter,p=t.wrapperClassName,v=t.labelClassName,y=t.label,g=t.labelFormatter,x=t.accessibilityLayer,b=x===void 0?!1:x,w=function(){if(m&&m.length){var O={padding:0,margin:0},D=(h?JO(m,h):m).map(function(k,F){if(k.type==="none")return null;var W=dk({display:"block",paddingTop:4,paddingBottom:4,color:k.color||"#000"},l),q=k.formatter||u||p_e,H=k.value,_=k.name,L=H,U=_;if(q&&L!=null&&U!=null){var J=q(H,_,k,F,m);if(Array.isArray(J)){var I=o_e(J,2);L=I[0],U=I[1]}else L=J}return he.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(F),style:W},zr(U)?he.createElement("span",{className:"recharts-tooltip-item-name"},U):null,zr(U)?he.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,he.createElement("span",{className:"recharts-tooltip-item-value"},L),he.createElement("span",{className:"recharts-tooltip-item-unit"},k.unit||""))});return he.createElement("ul",{className:"recharts-tooltip-item-list",style:O},D)}return null},j=dk({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),N=dk({margin:0},d),C=!tn(y),P=C?y:"",S=pn("recharts-default-tooltip",p),E=pn("recharts-tooltip-label",v);C&&g&&m!==void 0&&m!==null&&(P=g(y,m));var T=b?{role:"status","aria-live":"assertive"}:{};return he.createElement("div",RE({className:S,style:j},T),he.createElement("p",{className:E,style:N},he.isValidElement(P)?P:"".concat(P)),w())};function Gg(e){"@babel/helpers - typeof";return Gg=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},Gg(e)}function V0(e,t,n){return t=g_e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g_e(e){var t=y_e(e,"string");return Gg(t)=="symbol"?t:t+""}function y_e(e,t){if(Gg(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gg(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ox="recharts-tooltip-wrapper",v_e={visibility:"hidden"};function b_e(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return pn(ox,V0(V0(V0(V0({},"".concat(ox,"-right"),Ut(n)&&t&&Ut(t.x)&&n>=t.x),"".concat(ox,"-left"),Ut(n)&&t&&Ut(t.x)&&n<t.x),"".concat(ox,"-bottom"),Ut(r)&&t&&Ut(t.y)&&r>=t.y),"".concat(ox,"-top"),Ut(r)&&t&&Ut(t.y)&&r<t.y))}function j6(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.key,a=e.offsetTopLeft,i=e.position,o=e.reverseDirection,l=e.tooltipDimension,c=e.viewBox,d=e.viewBoxDimension;if(i&&Ut(i[r]))return i[r];var m=n[r]-l-a,u=n[r]+a;if(t[r])return o[r]?m:u;if(o[r]){var h=m,p=c[r];return h<p?Math.max(u,c[r]):Math.max(m,c[r])}var v=u+l,y=c[r]+d;return v>y?Math.max(m,c[r]):Math.max(u,c[r])}function w_e(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function j_e(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,a=e.position,i=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,d,m,u;return o.height>0&&o.width>0&&n?(m=j6({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:a,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),u=j6({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:a,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),d=w_e({translateX:m,translateY:u,useTranslate3d:l})):d=v_e,{cssProperties:d,cssClasses:b_e({translateX:m,translateY:u,coordinate:n})}}function Wf(e){"@babel/helpers - typeof";return Wf=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},Wf(e)}function N6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function C6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?N6(Object(n),!0).forEach(function(r){LE(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function N_e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C_e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mY(r.key),r)}}function S_e(e,t,n){return t&&C_e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function k_e(e,t,n){return t=nj(t),P_e(e,uY()?Reflect.construct(t,n||[],nj(e).constructor):t.apply(e,n))}function P_e(e,t){if(t&&(Wf(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return E_e(e)}function E_e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uY(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uY=function(){return!!e})()}function nj(e){return nj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},nj(e)}function D_e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&BE(e,t)}function BE(e,t){return BE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},BE(e,t)}function LE(e,t,n){return t=mY(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mY(e){var t=A_e(e,"string");return Wf(t)=="symbol"?t:t+""}function A_e(e,t){if(Wf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Wf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var S6=1,T_e=function(e){function t(){var n;N_e(this,t);for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];return n=k_e(this,t,[].concat(a)),LE(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),LE(n,"handleKeyDown",function(o){if(o.key==="Escape"){var l,c,d,m;n.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=n.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(d=(m=n.props.coordinate)===null||m===void 0?void 0:m.y)!==null&&d!==void 0?d:0}})}}),n}return D_e(t,e),S_e(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>S6||Math.abs(r.height-this.state.lastBoundingBox.height)>S6)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,a=this.props,i=a.active,o=a.allowEscapeViewBox,l=a.animationDuration,c=a.animationEasing,d=a.children,m=a.coordinate,u=a.hasPayload,h=a.isAnimationActive,p=a.offset,v=a.position,y=a.reverseDirection,g=a.useTranslate3d,x=a.viewBox,b=a.wrapperStyle,w=j_e({allowEscapeViewBox:o,coordinate:m,offsetTopLeft:p,position:v,reverseDirection:y,tooltipBox:this.state.lastBoundingBox,useTranslate3d:g,viewBox:x}),j=w.cssClasses,N=w.cssProperties,C=C6(C6({transition:h&&i?"transform ".concat(l,"ms ").concat(c):void 0},N),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&u?"visible":"hidden",position:"absolute",top:0,left:0},b);return he.createElement("div",{tabIndex:-1,className:j,style:C,ref:function(S){r.wrapperNode=S}},d)}}])}(f.PureComponent),O_e=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Fp={isSsr:O_e()};function Hf(e){"@babel/helpers - typeof";return Hf=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},Hf(e)}function k6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function P6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?k6(Object(n),!0).forEach(function(r){XO(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function F_e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function __e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,fY(r.key),r)}}function M_e(e,t,n){return t&&__e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $_e(e,t,n){return t=rj(t),I_e(e,hY()?Reflect.construct(t,n||[],rj(e).constructor):t.apply(e,n))}function I_e(e,t){if(t&&(Hf(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return R_e(e)}function R_e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hY(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(hY=function(){return!!e})()}function rj(e){return rj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},rj(e)}function B_e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&UE(e,t)}function UE(e,t){return UE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},UE(e,t)}function XO(e,t,n){return t=fY(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fY(e){var t=L_e(e,"string");return Hf(t)=="symbol"?t:t+""}function L_e(e,t){if(Hf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Hf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function U_e(e){return e.dataKey}function z_e(e,t){return he.isValidElement(e)?he.cloneElement(e,t):typeof e=="function"?he.createElement(e,t):he.createElement(x_e,t)}var sl=function(e){function t(){return F_e(this,t),$_e(this,t,arguments)}return B_e(t,e),M_e(t,[{key:"render",value:function(){var r=this,a=this.props,i=a.active,o=a.allowEscapeViewBox,l=a.animationDuration,c=a.animationEasing,d=a.content,m=a.coordinate,u=a.filterNull,h=a.isAnimationActive,p=a.offset,v=a.payload,y=a.payloadUniqBy,g=a.position,x=a.reverseDirection,b=a.useTranslate3d,w=a.viewBox,j=a.wrapperStyle,N=v??[];u&&N.length&&(N=nY(v.filter(function(P){return P.value!=null&&(P.hide!==!0||r.props.includeHidden)}),y,U_e));var C=N.length>0;return he.createElement(T_e,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:h,active:i,coordinate:m,hasPayload:C,offset:p,position:g,reverseDirection:x,useTranslate3d:b,viewBox:w,wrapperStyle:j},z_e(d,P6(P6({},this.props),{},{payload:N})))}}])}(f.PureComponent);XO(sl,"displayName","Tooltip");XO(sl,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Fp.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});function Yg(e){"@babel/helpers - typeof";return Yg=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},Yg(e)}function E6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function K0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?E6(Object(n),!0).forEach(function(r){q_e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function q_e(e,t,n){return t=W_e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W_e(e){var t=H_e(e,"string");return Yg(t)=="symbol"?t:t+""}function H_e(e,t){if(Yg(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Yg(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function V_e(e,t){return Q_e(e)||Y_e(e,t)||G_e(e,t)||K_e()}function K_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
775In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function G_e(e,t){if(e){if(typeof e=="string")return D6(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return D6(e,t)}}function D6(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Y_e(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(m){d=!0,a=m}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function Q_e(e){if(Array.isArray(e))return e}var pY=f.forwardRef(function(e,t){var n=e.aspect,r=e.initialDimension,a=r===void 0?{width:-1,height:-1}:r,i=e.width,o=i===void 0?"100%":i,l=e.height,c=l===void 0?"100%":l,d=e.minWidth,m=d===void 0?0:d,u=e.minHeight,h=e.maxHeight,p=e.children,v=e.debounce,y=v===void 0?0:v,g=e.id,x=e.className,b=e.onResize,w=e.style,j=w===void 0?{}:w,N=f.useRef(null),C=f.useRef();C.current=b,f.useImperativeHandle(t,function(){return Object.defineProperty(N.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),N.current},configurable:!0})});var P=f.useState({containerWidth:a.width,containerHeight:a.height}),S=V_e(P,2),E=S[0],T=S[1],z=f.useCallback(function(D,k){T(function(F){var W=Math.round(D),q=Math.round(k);return F.containerWidth===W&&F.containerHeight===q?F:{containerWidth:W,containerHeight:q}})},[]);f.useEffect(function(){var D=function(_){var L,U=_[0].contentRect,J=U.width,I=U.height;z(J,I),(L=C.current)===null||L===void 0||L.call(C,J,I)};y>0&&(D=c1(D,y,{trailing:!0,leading:!1}));var k=new ResizeObserver(D),F=N.current.getBoundingClientRect(),W=F.width,q=F.height;return z(W,q),k.observe(N.current),function(){k.disconnect()}},[z,y]);var O=f.useMemo(function(){var D=E.containerWidth,k=E.containerHeight;if(D<0||k<0)return null;rc(bu(o)||bu(c),`The width(%s) and height(%s) are both fixed numbers,
776       maybe you don't need to use a ResponsiveContainer.`,o,c),rc(!n||n>0,"The aspect(%s) must be greater than zero.",n);var F=bu(o)?D:o,W=bu(c)?k:c;n&&n>0&&(F?W=F/n:W&&(F=W*n),h&&W>h&&(W=h)),rc(F>0||W>0,`The width(%s) and height(%s) of chart should be greater than 0,
777       please check the style of container, or the props width(%s) and height(%s),
778       or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
779       height and width.`,F,W,o,c,m,u,n);var q=!Array.isArray(p)&&nc(p.type).endsWith("Chart");return he.Children.map(p,function(H){return he.isValidElement(H)?f.cloneElement(H,K0({width:F,height:W},q?{style:K0({height:"100%",width:"100%",maxHeight:W,maxWidth:F},H.props.style)}:{})):H})},[n,p,c,h,u,m,E,o]);return he.createElement("div",{id:g?"".concat(g):void 0,className:pn("recharts-responsive-container",x),style:K0(K0({},j),{},{width:o,height:c,minWidth:m,minHeight:u,maxHeight:h}),ref:N},O)}),xY=function(t){return null};xY.displayName="Cell";function Qg(e){"@babel/helpers - typeof";return Qg=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},Qg(e)}function A6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function zE(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?A6(Object(n),!0).forEach(function(r){J_e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function J_e(e,t,n){return t=X_e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function X_e(e){var t=Z_e(e,"string");return Qg(t)=="symbol"?t:t+""}function Z_e(e,t){if(Qg(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qg(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gm={widthCache:{},cacheCount:0},eMe=2e3,tMe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},T6="recharts_measurement_span";function sMe(e){var t=zE({},e);return Object.keys(t).forEach(function(n){t[n]||delete t[n]}),t}var Jx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Fp.isSsr)return{width:0,height:0};var r=sMe(n),a=JSON.stringify({text:t,copyStyle:r});if(Gm.widthCache[a])return Gm.widthCache[a];try{var i=document.getElementById(T6);i||(i=document.createElement("span"),i.setAttribute("id",T6),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=zE(zE({},tMe),r);Object.assign(i.style,o),i.textContent="".concat(t);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return Gm.widthCache[a]=c,++Gm.cacheCount>eMe&&(Gm.cacheCount=0,Gm.widthCache={}),c}catch{return{width:0,height:0}}},nMe=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Jg(e){"@babel/helpers - typeof";return Jg=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},Jg(e)}function aj(e,t){return oMe(e)||iMe(e,t)||aMe(e,t)||rMe()}function rMe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
780In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aMe(e,t){if(e){if(typeof e=="string")return O6(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O6(e,t)}}function O6(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function iMe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(m){d=!0,a=m}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function oMe(e){if(Array.isArray(e))return e}function lMe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F6(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,dMe(r.key),r)}}function cMe(e,t,n){return t&&F6(e.prototype,t),n&&F6(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function dMe(e){var t=uMe(e,"string");return Jg(t)=="symbol"?t:t+""}function uMe(e,t){if(Jg(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Jg(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var _6=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,M6=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,mMe=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,hMe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,gY={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},fMe=Object.keys(gY),yh="NaN";function pMe(e,t){return e*gY[t]}var G0=function(){function e(t,n){lMe(this,e),this.num=t,this.unit=n,this.num=t,this.unit=n,Number.isNaN(t)&&(this.unit=""),n!==""&&!mMe.test(n)&&(this.num=NaN,this.unit=""),fMe.includes(n)&&(this.num=pMe(t,n),this.unit="px")}return cMe(e,[{key:"add",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num+n.num,this.unit)}},{key:"subtract",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num-n.num,this.unit)}},{key:"multiply",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num*n.num,this.unit||n.unit)}},{key:"divide",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num/n.num,this.unit||n.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(n){var r,a=(r=hMe.exec(n))!==null&&r!==void 0?r:[],i=aj(a,3),o=i[1],l=i[2];return new e(parseFloat(o),l??"")}}])}();function yY(e){if(e.includes(yh))return yh;for(var t=e;t.includes("*")||t.includes("/");){var n,r=(n=_6.exec(t))!==null&&n!==void 0?n:[],a=aj(r,4),i=a[1],o=a[2],l=a[3],c=G0.parse(i??""),d=G0.parse(l??""),m=o==="*"?c.multiply(d):c.divide(d);if(m.isNaN())return yh;t=t.replace(_6,m.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,h=(u=M6.exec(t))!==null&&u!==void 0?u:[],p=aj(h,4),v=p[1],y=p[2],g=p[3],x=G0.parse(v??""),b=G0.parse(g??""),w=y==="+"?x.add(b):x.subtract(b);if(w.isNaN())return yh;t=t.replace(M6,w.toString())}return t}var $6=/\(([^()]*)\)/;function xMe(e){for(var t=e;t.includes("(");){var n=$6.exec(t),r=aj(n,2),a=r[1];t=t.replace($6,yY(a))}return t}function gMe(e){var t=e.replace(/\s+/g,"");return t=xMe(t),t=yY(t),t}function yMe(e){try{return gMe(e)}catch{return yh}}function uk(e){var t=yMe(e.slice(5,-1));return t===yh?"":t}var vMe=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],bMe=["dx","dy","angle","className","breakAll"];function qE(){return qE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qE.apply(this,arguments)}function I6(e,t){if(e==null)return{};var n=wMe(e,t),r,a;
780if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function wMe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function R6(e,t){return SMe(e)||CMe(e,t)||NMe(e,t)||jMe()}function jMe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
781In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NMe(e,t){if(e){if(typeof e=="string")return B6(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return B6(e,t)}}function B6(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function CMe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(m){d=!0,a=m}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function SMe(e){if(Array.isArray(e))return e}var vY=/[ \f\n\r\t\v\u2028\u2029]+/,bY=function(t){var n=t.children,r=t.breakAll,a=t.style;try{var i=[];tn(n)||(r?i=n.toString().split(""):i=n.toString().split(vY));var o=i.map(function(c){return{word:c,width:Jx(c,a).width}}),l=r?0:Jx(" ",a).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},kMe=function(t,n,r,a,i){var o=t.maxLines,l=t.children,c=t.style,d=t.breakAll,m=Ut(o),u=l,h=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return F.reduce(function(W,q){var H=q.word,_=q.width,L=W[W.length-1];if(L&&(a==null||i||L.width+_+r<Number(a)))L.words.push(H),L.width+=_+r;else{var U={words:[H],width:_};W.push(U)}return W},[])},p=h(n),v=function(F){return F.reduce(function(W,q){return W.width>q.width?W:q})};if(!m)return p;for(var y="…",g=function(F){var W=u.slice(0,F),q=bY({breakAll:d,style:c,children:W+y}).wordsWithComputedWidth,H=h(q),_=H.length>o||v(H).width>Number(a);return[_,H]},x=0,b=u.length-1,w=0,j;x<=b&&w<=u.length-1;){var N=Math.floor((x+b)/2),C=N-1,P=g(C),S=R6(P,2),E=S[0],T=S[1],z=g(N),O=R6(z,1),D=O[0];if(!E&&!D&&(x=N+1),E&&D&&(b=N-1),!E&&D){j=T;break}w++}return j||p},L6=function(t){var n=tn(t)?[]:t.toString().split(vY);return[{words:n}]},PMe=function(t){var n=t.width,r=t.scaleToFit,a=t.children,i=t.style,o=t.breakAll,l=t.maxLines;if((n||r)&&!Fp.isSsr){var c,d,m=bY({breakAll:o,children:a,style:i});if(m){var u=m.wordsWithComputedWidth,h=m.spaceWidth;c=u,d=h}else return L6(a);return kMe({breakAll:o,children:a,maxLines:l,style:i},c,d,n,r)}return L6(a)},U6="#808080",ij=function(t){var n=t.x,r=n===void 0?0:n,a=t.y,i=a===void 0?0:a,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,d=c===void 0?"0.71em":c,m=t.scaleToFit,u=m===void 0?!1:m,h=t.textAnchor,p=h===void 0?"start":h,v=t.verticalAnchor,y=v===void 0?"end":v,g=t.fill,x=g===void 0?U6:g,b=I6(t,vMe),w=f.useMemo(function(){return PMe({breakAll:b.breakAll,children:b.children,maxLines:b.maxLines,scaleToFit:u,style:b.style,width:b.width})},[b.breakAll,b.children,b.maxLines,u,b.style,b.width]),j=b.dx,N=b.dy,C=b.angle,P=b.className,S=b.breakAll,E=I6(b,bMe);if(!zr(r)||!zr(i))return null;var T=r+(Ut(j)?j:0),z=i+(Ut(N)?N:0),O;switch(y){case"start":O=uk("calc(".concat(d,")"));break;case"middle":O=uk("calc(".concat((w.length-1)/2," * -").concat(l," + (").concat(d," / 2))"));break;default:O=uk("calc(".concat(w.length-1," * -").concat(l,")"));break}var D=[];if(u){var k=w[0].width,F=b.width;D.push("scale(".concat((Ut(F)?F/k:1)/k,")"))}return C&&D.push("rotate(".concat(C,", ").concat(T,", ").concat(z,")")),D.length&&(E.transform=D.join(" ")),he.createElement("text",qE({},fn(E,!0),{x:T,y:z,className:pn("recharts-text",P),textAnchor:p,fill:x.includes("url")?U6:x}),w.map(function(W,q){var H=W.words.join(S?"":" ");return he.createElement("tspan",{x:T,dy:q===0?O:l,key:"".concat(H,"-").concat(q)},H)}))};function Sd(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function EMe(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ZO(e){let t,n,r;e.length!==2?(t=Sd,n=(l,c)=>Sd(e(l),c),r=(l,c)=>e(l)-c):(t=e===Sd||e===EMe?e:DMe,n=e,r=e);function a(l,c,d=0,m=l.length){if(d<m){if(t(c,c)!==0)return m;do{const u=d+m>>>1;n(l[u],c)<0?d=u+1:m=u}while(d<m)}return d}function i(l,c,d=0,m=l.length){if(d<m){if(t(c,c)!==0)return m;do{const u=d+m>>>1;n(l[u],c)<=0?d=u+1:m=u}while(d<m)}return d}function o(l,c,d=0,m=l.length){const u=a(l,c,d,m-1);return u>d&&r(l[u-1],c)>-r(l[u],c)?u-1:u}return{left:a,center:o,right:i}}function DMe(){return 0}function wY(e){return e===null?NaN:+e}function*AMe(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const TMe=ZO(Sd),Av=TMe.right;ZO(wY).center;class z6 extends Map{constructor(t,n=_Me){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,a]of t)this.set(r,a)}get(t){return super.get(q6(this,t))}has(t){return super.has(q6(this,t))}set(t,n){return super.set(OMe(this,t),n)}delete(t){return super.delete(FMe(this,t))}}function q6({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function OMe({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function FMe({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function _Me(e){return e!==null&&typeof e=="object"?e.valueOf():e}
781function MMe(e=Sd){if(e===Sd)return jY;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function jY(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const $Me=Math.sqrt(50),IMe=Math.sqrt(10),RMe=Math.sqrt(2);function oj(e,t,n){const r=(t-e)/Math.max(0,n),a=Math.floor(Math.log10(r)),i=r/Math.pow(10,a),o=i>=$Me?10:i>=IMe?5:i>=RMe?2:1;let l,c,d;return a<0?(d=Math.pow(10,-a)/o,l=Math.round(e*d),c=Math.round(t*d),l/d<e&&++l,c/d>t&&--c,d=-d):(d=Math.pow(10,a)*o,l=Math.round(e/d),c=Math.round(t/d),l*d<e&&++l,c*d>t&&--c),c<l&&.5<=n&&n<2?oj(e,t,n*2):[l,c,d]}function WE(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[a,i,o]=r?oj(t,e,n):oj(e,t,n);if(!(i>=a))return[];const l=i-a+1,c=new Array(l);if(r)if(o<0)for(let d=0;d<l;++d)c[d]=(i-d)/-o;else for(let d=0;d<l;++d)c[d]=(i-d)*o;else if(o<0)for(let d=0;d<l;++d)c[d]=(a+d)/-o;else for(let d=0;d<l;++d)c[d]=(a+d)*o;return c}function HE(e,t,n){return t=+t,e=+e,n=+n,oj(e,t,n)[2]}function VE(e,t,n){t=+t,e=+e,n=+n;const r=t<e,a=r?HE(t,e,n):HE(e,t,n);return(r?-1:1)*(a<0?1/-a:a)}function W6(e,t){let n;for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function H6(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function NY(e,t,n=0,r=1/0,a){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(a=a===void 0?jY:MMe(a);r>n;){if(r-n>600){const c=r-n+1,d=t-n+1,m=Math.log(c),u=.5*Math.exp(2*m/3),h=.5*Math.sqrt(m*u*(c-u)/c)*(d-c/2<0?-1:1),p=Math.max(n,Math.floor(t-d*u/c+h)),v=Math.min(r,Math.floor(t+(c-d)*u/c+h));NY(e,t,p,v,a)}const i=e[t];let o=n,l=r;for(lx(e,n,t),a(e[r],i)>0&&lx(e,n,r);o<l;){for(lx(e,o,l),++o,--l;a(e[o],i)<0;)++o;for(;a(e[l],i)>0;)--l}a(e[n],i)===0?lx(e,n,l):(++l,lx(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function lx(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function BMe(e,t,n){if(e=Float64Array.from(AMe(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return H6(e);if(t>=1)return W6(e);var r,a=(r-1)*t,i=Math.floor(a),o=W6(NY(e,i).subarray(0,i+1)),l=H6(e.subarray(i+1));return o+(l-o)*(a-i)}}function LMe(e,t,n=wY){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,a=(r-1)*t,i=Math.floor(a),o=+n(e[i],i,e),l=+n(e[i+1],i+1,e);return o+(l-o)*(a-i)}}function UMe(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(a);++r<a;)i[r]=e+r*n;return i}function ro(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Sc(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const KE=Symbol("implicit");function eF(){var e=new z6,t=[],n=[],r=KE;function a(i){let o=e.get(i);if(o===void 0){if(r!==KE)return r;e.set(i,o=t.push(i)-1)}return n[o%n.length]}return a.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new z6;for(const o of i)e.has(o)||e.set(o,t.push(o)-1);return a},a.range=function(i){return arguments.length?(n=Array.from(i),a):n.slice()},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return eF(t,n).unknown(r)},ro.apply(a,arguments),a}function Xg(){var e=eF().unknown(void 0),t=e.domain,n=e.range,r=0,a=1,i,o,l=!1,c=0,d=0,m=.5;delete e.unknown;function u(){var h=t().length,p=a<r,v=p?a:r,y=p?r:a;i=(y-v)/Math.max(1,h-c+d*2),l&&(i=Math.floor(i)),v+=(y-v-i*(h-c))*m,o=i*(1-c),l&&(v=Math.round(v),o=Math.round(o));var g=UMe(h).map(function(x){return v+i*x});return n(p?g.reverse():g)}return e.domain=function(h){return arguments.length?(t(h),u()):t()},e.range=function(h){return arguments.length?([r,a]=h,r=+r,a=+a,u()):[r,a]},e.rangeRound=function(h){return[r,a]=h,r=+r,a=+a,l=!0,u()},e.bandwidth=function(){return o},e.step=function(){return i},e.round=function(h){return arguments.length?(l=!!h,u()):l},e.padding=function(h){return arguments.length?(c=Math.min(1,d=+h),u()):c},e.paddingInner=function(h){return arguments.length?(c=Math.min(1,h),u()):c},e.paddingOuter=function(h){return arguments.length?(d=+h,u()):d},e.align=function(h){return arguments.length?(m=Math.max(0,Math.min(1,h)),u()):m},e.copy=function(){return Xg(t(),[r,a]).round(l).paddingInner(c).paddingOuter(d).align(m)},ro.apply(u(),arguments)}function CY(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return CY(t())},e}function Xx(){return CY(Xg.apply(null,arguments).paddingInner(1))}function tF(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function SY(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Tv(){}var Zg=.7,lj=1/Zg,Lh="\\s*([+-]?\\d+)\\s*",ey="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",bl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",zMe=/^#([0-9a-f]{3,8})$/,qMe=new RegExp(`^rgb\\(${Lh},${Lh},${Lh}\\)$`),WMe=new RegExp(`^rgb\\(${bl},${bl},${bl}\\)$`),HMe=new RegExp(`^rgba\\(${Lh},${Lh},${Lh},${ey}\\)$`),VMe=new RegExp(`^rgba\\(${bl},${bl},${bl},${ey}\\)$`),KMe=new RegExp(`^hsl\\(${ey},${bl},${bl}\\)$`),GMe=new RegExp(`^hsla\\(${ey},${bl},${bl},${ey}\\)$`),V6={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};tF(Tv,ty,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:K6,formatHex:K6,formatHex8:YMe,formatHsl:QMe,formatRgb:G6,toString:G6});function K6(){return this.rgb().formatHex()}function YMe(){return this.rgb().formatHex8()}function QMe(){return kY(this).formatHsl()}function G6(){return this.rgb().formatRgb()}function ty(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=zMe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Y6(t):n===3?new Ga(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Y0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Y0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=qMe.exec(e))?new Ga(t[1],t[2],t[3],1):(t=WMe.exec(e))?new Ga(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=HMe.exec(e))?Y0(t[1],t[2],t[3],t[4]):(t=VMe.exec(e))?Y0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=KMe.exec(e))?X6(t[1],t[2]/100,t[3]/100,1):(t=GMe.exec(e))?X6(t[1],t[2]/100,t[3]/100,t[4]):V6.hasOwnProperty(e)?Y6(V6[e]):e==="transparent"?new Ga(NaN,NaN,NaN,0):null}function Y6(e){return new Ga(e>>16&255,e>>8&255,e&255,1)}function Y0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ga(e,t,n,r)}function JMe(e){return e instanceof Tv||(e=ty(e)),e?(e=e.rgb(),new Ga(e.r,e.g,e.b,e.opacity)):new Ga}function GE(e,t,n,r){return arguments.length===1?JMe(e):new Ga(e,t,n,r??1)}function Ga(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}tF(Ga,GE,SY(Tv,{brighter(e){return e=e==null?lj:Math.pow(lj,e),new Ga(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Zg:Math.pow(Zg,e),new Ga(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ga(Xu(this.r),Xu(this.g),Xu(this.b),cj(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Q6,formatHex:Q6,formatHex8:XMe,formatRgb:J6,toString:J6}));function Q6(){return`#${wu(this.r)}${wu(this.g)}${wu(this.b)}`}function XMe(){return`#${wu(this.r)}${wu(this.g)}${wu(this.b)}${wu((isNaN(this.opacity)?1:this.opacity)*255)}`}function J6(){const e=cj(this.opacity);return`${e===1?"rgb(":"rgba("}${Xu(this.r)}, ${Xu(this.g)}, ${Xu(this.b)}${e===1?")":`, ${e})`}`}function cj(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}
vendor: 5,722 bytes, line 781
781function wu(e){return e=Xu(e),(e<16?"0":"")+e.toString(16)}function X6(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Do(e,t,n,r)}function kY(e){if(e instanceof Do)return new Do(e.h,e.s,e.l,e.opacity);if(e instanceof Tv||(e=ty(e)),!e)return new Do;if(e instanceof Do)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-a,c=(i+a)/2;return l?(t===i?o=(n-r)/l+(n<r)*6:n===i?o=(r-t)/l+2:o=(t-n)/l+4,l/=c<.5?i+a:2-i-a,o*=60):l=c>0&&c<1?0:o,new Do(o,l,c,e.opacity)}function ZMe(e,t,n,r){return arguments.length===1?kY(e):new Do(e,t,n,r??1)}function Do(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}tF(Do,ZMe,SY(Tv,{brighter(e){return e=e==null?lj:Math.pow(lj,e),new Do(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Zg:Math.pow(Zg,e),new Do(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new Ga(mk(e>=240?e-240:e+120,a,r),mk(e,a,r),mk(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Do(Z6(this.h),Q0(this.s),Q0(this.l),cj(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=cj(this.opacity);return`${e===1?"hsl(":"hsla("}${Z6(this.h)}, ${Q0(this.s)*100}%, ${Q0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Z6(e){return e=(e||0)%360,e<0?e+360:e}function Q0(e){return Math.max(0,Math.min(1,e||0))}function mk(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const sF=e=>()=>e;function e5e(e,t){return function(n){return e+n*t}}function t5e(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function s5e(e){return(e=+e)==1?PY:function(t,n){return n-t?t5e(t,n,e):sF(isNaN(t)?n:t)}}function PY(e,t){var n=t-e;return n?e5e(e,n):sF(isNaN(e)?t:e)}const eR=function e(t){var n=s5e(t);function r(a,i){var o=n((a=GE(a)).r,(i=GE(i)).r),l=n(a.g,i.g),c=n(a.b,i.b),d=PY(a.opacity,i.opacity);return function(m){return a.r=o(m),a.g=l(m),a.b=c(m),a.opacity=d(m),a+""}}return r.gamma=e,r}(1);function n5e(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(i){for(a=0;a<n;++a)r[a]=e[a]*(1-i)+t[a]*i;return r}}function r5e(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function a5e(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,a=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)a[o]=_p(e[o],t[o]);for(;o<n;++o)i[o]=t[o];return function(l){for(o=0;o<r;++o)i[o]=a[o](l);return i}}function i5e(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function dj(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function o5e(e,t){var n={},r={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?n[a]=_p(e[a],t[a]):r[a]=t[a];return function(i){for(a in n)r[a]=n[a](i);return r}}var YE=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hk=new RegExp(YE.source,"g");function l5e(e){return function(){return e}}function c5e(e){return function(t){return e(t)+""}}function d5e(e,t){var n=YE.lastIndex=hk.lastIndex=0,r,a,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(r=YE.exec(e))&&(a=hk.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(a=a[0])?l[o]?l[o]+=a:l[++o]=a:(l[++o]=null,c.push({i:o,x:dj(r,a)})),n=hk.lastIndex;return n<t.length&&(i=t.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?c5e(c[0].x):l5e(t):(t=c.length,function(d){for(var m=0,u;m<t;++m)l[(u=c[m]).i]=u.x(d);return l.join("")})}function _p(e,t){var n=typeof t,r;return t==null||n==="boolean"?sF(t):(n==="number"?dj:n==="string"?(r=ty(t))?(t=r,eR):d5e:t instanceof ty?eR:t instanceof Date?i5e:r5e(t)?n5e:Array.isArray(t)?a5e:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?o5e:dj)(e,t)}function nF(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function u5e(e,t){t===void 0&&(t=e,e=_p);for(var n=0,r=t.length-1,a=t[0],i=new Array(r<0?0:r);n<r;)i[n]=e(a,a=t[++n]);return function(o){var l=Math.max(0,Math.min(r-1,Math.floor(o*=r)));return i[l](o-l)}}function m5e(e){return function(){return e}}function uj(e){return+e}var tR=[0,1];function Ma(e){return e}function QE(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:m5e(isNaN(t)?NaN:.5)}function h5e(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function f5e(e,t,n){var r=e[0],a=e[1],i=t[0],o=t[1];return a<r?(r=QE(a,r),i=n(o,i)):(r=QE(r,a),i=n(i,o)),function(l){return i(r(l))}}function p5e(e,t,n){var r=Math.min(e.length,t.length)-1,a=new Array(r),i=new Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)a[o]=QE(e[o],e[o+1]),i[o]=n(t[o],t[o+1]);return function(l){var c=Av(e,l,1,r)-1;return i[c](a[c](l))}}function Ov(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function z1(){var e=tR,t=tR,n=_p,r,a,i,o=Ma,l,c,d;function m(){var h=Math.min(e.length,t.length);return o!==Ma&&(o=h5e(e[0],e[h-1])),l=h>2?p5e:f5e,c=d=null,u}function u(h){return h==null||isNaN(h=+h)?i:(c||(c=l(e.map(r),t,n)))(r(o(h)))}return u.invert=function(h){return o(a((d||(d=l(t,e.map(r),dj)))(h)))},u.domain=function(h){return arguments.length?(e=Array.from(h,uj),m()):e.slice()},u.range=function(h){return arguments.length?(t=Array.from(h),m()):t.slice()},u.rangeRound=function(h){return t=Array.from(h),n=nF,m()},u.clamp=function(h){return arguments.length?(o=h?!0:Ma,m()):o!==Ma},u.interpolate=function(h){return arguments.length?(n=h,m()):n},u.unknown=function(h){return arguments.length?(i=h,u):i},function(h,p){return r=h,a=p,m()}}function rF(){return z1()(Ma,Ma)}
vendor: 4,597 bytes, line 781
781function x5e(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function mj(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Vf(e){return e=mj(Math.abs(e)),e?e[1]:NaN}function g5e(e,t){return function(n,r){for(var a=n.length,i=[],o=0,l=e[0],c=0;a>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),i.push(n.substring(a-=l,a+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return i.reverse().join(t)}}function y5e(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var v5e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function sy(e){if(!(t=v5e.exec(e)))throw new Error("invalid format: "+e);var t;return new aF({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}sy.prototype=aF.prototype;function aF(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}aF.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function b5e(e){e:for(var t=e.length,n=1,r=-1,a;n<t;++n)switch(e[n]){case".":r=a=n;break;case"0":r===0&&(r=n),a=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(a+1):e}var hj;function w5e(e,t){var n=mj(e,t);if(!n)return hj=void 0,e.toPrecision(t);var r=n[0],a=n[1],i=a-(hj=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+mj(e,Math.max(0,t+i-1))[0]}function sR(e,t){var n=mj(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}const nR={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:x5e,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>sR(e*100,t),r:sR,s:w5e,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function rR(e){return e}var aR=Array.prototype.map,iR=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function j5e(e){var t=e.grouping===void 0||e.thousands===void 0?rR:g5e(aR.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?rR:y5e(aR.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function d(u,h){u=sy(u);var p=u.fill,v=u.align,y=u.sign,g=u.symbol,x=u.zero,b=u.width,w=u.comma,j=u.precision,N=u.trim,C=u.type;C==="n"?(w=!0,C="g"):nR[C]||(j===void 0&&(j=12),N=!0,C="g"),(x||p==="0"&&v==="=")&&(x=!0,p="0",v="=");var P=(h&&h.prefix!==void 0?h.prefix:"")+(g==="$"?n:g==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():""),S=(g==="$"?r:/[%p]/.test(C)?o:"")+(h&&h.suffix!==void 0?h.suffix:""),E=nR[C],T=/[defgprs%]/.test(C);j=j===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function z(O){var D=P,k=S,F,W,q;if(C==="c")k=E(O)+k,O="";else{O=+O;var H=O<0||1/O<0;if(O=isNaN(O)?c:E(Math.abs(O),j),N&&(O=b5e(O)),H&&+O==0&&y!=="+"&&(H=!1),D=(H?y==="("?y:l:y==="-"||y==="("?"":y)+D,k=(C==="s"&&!isNaN(O)&&hj!==void 0?iR[8+hj/3]:"")+k+(H&&y==="("?")":""),T){for(F=-1,W=O.length;++F<W;)if(q=O.charCodeAt(F),48>q||q>57){k=(q===46?a+O.slice(F+1):O.slice(F))+k,O=O.slice(0,F);break}}}w&&!x&&(O=t(O,1/0));var _=D.length+O.length+k.length,L=_<b?new Array(b-_+1).join(p):"";switch(w&&x&&(O=t(L+O,L.length?b-k.length:1/0),L=""),v){case"<":O=D+O+k+L;break;case"=":O=D+L+O+k;break;case"^":O=L.slice(0,_=L.length>>1)+D+O+k+L.slice(_);break;default:O=L+D+O+k;break}return i(O)}return z.toString=function(){return u+""},z}function m(u,h){var p=Math.max(-8,Math.min(8,Math.floor(Vf(h)/3)))*3,v=Math.pow(10,-p),y=d((u=sy(u),u.type="f",u),{suffix:iR[8+p/3]});return function(g){return y(v*g)}}return{format:d,formatPrefix:m}}var J0,iF,EY;
781N5e({thousands:",",grouping:[3],currency:["$",""]});function N5e(e){return J0=j5e(e),iF=J0.format,EY=J0.formatPrefix,J0}function C5e(e){return Math.max(0,-Vf(Math.abs(e)))}function S5e(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Vf(t)/3)))*3-Vf(Math.abs(e)))}function k5e(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Vf(t)-Vf(e))+1}function DY(e,t,n,r){var a=VE(e,t,n),i;switch(r=sy(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(i=S5e(a,o))&&(r.precision=i),EY(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=k5e(a,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=C5e(a))&&(r.precision=i-(r.type==="%")*2);break}}return iF(r)}function Yd(e){var t=e.domain;return e.ticks=function(n){var r=t();return WE(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var a=t();return DY(a[0],a[a.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),a=0,i=r.length-1,o=r[a],l=r[i],c,d,m=10;for(l<o&&(d=o,o=l,l=d,d=a,a=i,i=d);m-- >0;){if(d=HE(o,l,n),d===c)return r[a]=o,r[i]=l,t(r);if(d>0)o=Math.floor(o/d)*d,l=Math.ceil(l/d)*d;else if(d<0)o=Math.ceil(o*d)/d,l=Math.floor(l*d)/d;else break;c=d}return e},e}function fj(){var e=rF();return e.copy=function(){return Ov(e,fj())},ro.apply(e,arguments),Yd(e)}function AY(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,uj),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return AY(e).unknown(t)},e=arguments.length?Array.from(e,uj):[0,1],Yd(n)}function TY(e,t){e=e.slice();var n=0,r=e.length-1,a=e[n],i=e[r],o;return i<a&&(o=n,n=r,r=o,o=a,a=i,i=o),e[n]=t.floor(a),e[r]=t.ceil(i),e}function oR(e){return Math.log(e)}function lR(e){return Math.exp(e)}function P5e(e){return-Math.log(-e)}function E5e(e){return-Math.exp(-e)}function D5e(e){return isFinite(e)?+("1e"+e):e<0?0:e}function A5e(e){return e===10?D5e:e===Math.E?Math.exp:t=>Math.pow(e,t)}function T5e(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function cR(e){return(t,n)=>-e(-t,n)}function oF(e){const t=e(oR,lR),n=t.domain;let r=10,a,i;function o(){return a=T5e(r),i=A5e(r),n()[0]<0?(a=cR(a),i=cR(i),e(P5e,E5e)):e(oR,lR),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let d=c[0],m=c[c.length-1];const u=m<d;u&&([d,m]=[m,d]);let h=a(d),p=a(m),v,y;const g=l==null?10:+l;let x=[];if(!(r%1)&&p-h<g){if(h=Math.floor(h),p=Math.ceil(p),d>0){for(;h<=p;++h)for(v=1;v<r;++v)if(y=h<0?v/i(-h):v*i(h),!(y<d)){if(y>m)break;x.push(y)}}else for(;h<=p;++h)for(v=r-1;v>=1;--v)if(y=h>0?v/i(-h):v*i(h),!(y<d)){if(y>m)break;x.push(y)}x.length*2<g&&(x=WE(d,m,g))}else x=WE(h,p,Math.min(p-h,g)).map(i);return u?x.reverse():x},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=sy(c)).precision==null&&(c.trim=!0),c=iF(c)),l===1/0)return c;const d=Math.max(1,r*l/t.ticks().length);return m=>{let u=m/i(Math.round(a(m)));return u*r<r-.5&&(u*=r),u<=d?c(m):""}},t.nice=()=>n(TY(n(),{floor:l=>i(Math.floor(a(l))),ceil:l=>i(Math.ceil(a(l)))})),t}function OY(){const e=oF(z1()).domain([1,10]);return e.copy=()=>Ov(e,OY()).base(e.base()),ro.apply(e,arguments),e}function dR(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function uR(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function lF(e){var t=1,n=e(dR(t),uR(t));return n.constant=function(r){return arguments.length?e(dR(t=+r),uR(t)):t},Yd(n)}function FY(){var e=lF(z1());return e.copy=function(){return Ov(e,FY()).constant(e.constant())},ro.apply(e,arguments)}function mR(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function O5e(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function F5e(e){return e<0?-e*e:e*e}function cF(e){var t=e(Ma,Ma),n=1;function r(){return n===1?e(Ma,Ma):n===.5?e(O5e,F5e):e(mR(n),mR(1/n))}return t.exponent=function(a){return arguments.length?(n=+a,r()):n},Yd(t)}function dF(){var e=cF(z1());return e.copy=function(){return Ov(e,dF()).exponent(e.exponent())},ro.apply(e,arguments),e}function _5e(){return dF.apply(null,arguments).exponent(.5)}function hR(e){return Math.sign(e)*e*e}function M5e(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function _Y(){var e=rF(),t=[0,1],n=!1,r;function a(i){var o=M5e(e(i));return isNaN(o)?r:n?Math.round(o):o}return a.invert=function(i){return e.invert(hR(i))},a.domain=function(i){return arguments.length?(e.domain(i),a):e.domain()},a.range=function(i){return arguments.length?(e.range((t=Array.from(i,uj)).map(hR)),a):t.slice()}
781,a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(n=!!i,a):n},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return _Y(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},ro.apply(a,arguments),Yd(a)}function MY(){var e=[],t=[],n=[],r;function a(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o<l;)n[o-1]=LMe(e,o/l);return i}function i(o){return o==null||isNaN(o=+o)?r:t[Av(n,o)]}return i.invertExtent=function(o){var l=t.indexOf(o);return l<0?[NaN,NaN]:[l>0?n[l-1]:e[0],l<n.length?n[l]:e[e.length-1]]},i.domain=function(o){if(!arguments.length)return e.slice();e=[];for(let l of o)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(Sd),a()},i.range=function(o){return arguments.length?(t=Array.from(o),a()):t.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.quantiles=function(){return n.slice()},i.copy=function(){return MY().domain(e).range(t).unknown(r)},ro.apply(i,arguments)}function $Y(){var e=0,t=1,n=1,r=[.5],a=[0,1],i;function o(c){return c!=null&&c<=c?a[Av(r,c,0,n)]:i}function l(){var c=-1;for(r=new Array(n);++c<n;)r[c]=((c+1)*t-(c-n)*e)/(n+1);return o}return o.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},o.range=function(c){return arguments.length?(n=(a=Array.from(c)).length-1,l()):a.slice()},o.invertExtent=function(c){var d=a.indexOf(c);return d<0?[NaN,NaN]:d<1?[e,r[0]]:d>=n?[r[n-1],t]:[r[d-1],r[d]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return $Y().domain([e,t]).range(a).unknown(i)},ro.apply(Yd(o),arguments)}function IY(){var e=[.5],t=[0,1],n,r=1;function a(i){return i!=null&&i<=i?t[Av(e,i,0,r)]:n}return a.domain=function(i){return arguments.length?(e=Array.from(i),r=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),r=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(i){var o=t.indexOf(i);return[e[o-1],e[o]]},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return IY().domain(e).range(t).unknown(n)},ro.apply(a,arguments)}const fk=new Date,pk=new Date;function qr(e,t,n,r){function a(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(e(i=new Date(+i)),i),a.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),a.round=i=>{const o=a(i),l=a.ceil(i);return i-o<l-i?o:l},a.offset=(i,o)=>(t(i=new Date(+i),o==null?1:Math.floor(o)),i),a.range=(i,o,l)=>{const c=[];if(i=a.ceil(i),l=l==null?1:Math.floor(l),!(i<o)||!(l>0))return c;let d;do c.push(d=new Date(+i)),t(i,l),e(i);while(d<i&&i<o);return c},a.filter=i=>qr(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!i(o););else for(;--l>=0;)for(;t(o,1),!i(o););}),n&&(a.count=(i,o)=>(fk.setTime(+i),pk.setTime(+o),e(fk),e(pk),Math.floor(n(fk,pk))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(r?o=>r(o)%i===0:o=>a.count(0,o)%i===0):a)),a}const pj=qr(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);pj.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?qr(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):pj);pj.range;const Xl=1e3,qi=Xl*60,Zl=qi*60,xc=Zl*24,uF=xc*7,fR=xc*30,xk=xc*365,ju=qr(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Xl)},(e,t)=>(t-e)/Xl,e=>e.getUTCSeconds());ju.range;const mF=qr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Xl)},(e,t)=>{e.setTime(+e+t*qi)},(e,t)=>(t-e)/qi,e=>e.getMinutes());mF.range;const hF=qr(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*qi)},(e,t)=>(t-e)/qi,e=>e.getUTCMinutes());hF.range;const fF=qr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Xl-e.getMinutes()*qi)},(e,t)=>{e.setTime(+e+t*Zl)},(e,t)=>(t-e)/Zl,e=>e.getHours());fF.range;const pF=qr(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Zl)},(e,t)=>(t-e)/Zl,e=>e.getUTCHours());pF.range;const Fv=qr(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*qi)/xc,e=>e.getDate()-1);Fv.range;const q1=qr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/xc,e=>e.getUTCDate()-1);q1.range;const RY=qr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/xc,e=>Math.floor(e/xc));RY.range;function Dm(e){return qr(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*qi)/uF)}const W1=Dm(0),xj=Dm(1),$5e=Dm(2),I5e=Dm(3),Kf=Dm(4),R5e=Dm(5),B5e=Dm(6);W1.range;xj.range;$5e.range;I5e.range;Kf.range;R5e.range;B5e.range;function Am(e){return qr(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/uF)}const H1=Am(0),gj=Am(1),L5e=Am(2),U5e=Am(3),Gf=Am(4),z5e=Am(5),q5e=Am(6);H1.range;gj.range;L5e.range;U5e.range;Gf.range;z5e.range;q5e.range;const xF=qr(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());xF.range;const gF=qr(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());gF.range;const gc=qr(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());gc.every=e=>
vendor: 5,977 bytes, line 781
781!isFinite(e=Math.floor(e))||!(e>0)?null:qr(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});gc.range;const yc=qr(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());yc.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:qr(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});yc.range;function BY(e,t,n,r,a,i){const o=[[ju,1,Xl],[ju,5,5*Xl],[ju,15,15*Xl],[ju,30,30*Xl],[i,1,qi],[i,5,5*qi],[i,15,15*qi],[i,30,30*qi],[a,1,Zl],[a,3,3*Zl],[a,6,6*Zl],[a,12,12*Zl],[r,1,xc],[r,2,2*xc],[n,1,uF],[t,1,fR],[t,3,3*fR],[e,1,xk]];function l(d,m,u){const h=m<d;h&&([d,m]=[m,d]);const p=u&&typeof u.range=="function"?u:c(d,m,u),v=p?p.range(d,+m+1):[];return h?v.reverse():v}function c(d,m,u){const h=Math.abs(m-d)/u,p=ZO(([,,g])=>g).right(o,h);if(p===o.length)return e.every(VE(d/xk,m/xk,u));if(p===0)return pj.every(Math.max(VE(d,m,u),1));const[v,y]=o[h/o[p-1][2]<o[p][2]/h?p-1:p];return v.every(y)}return[l,c]}const[W5e,H5e]=BY(yc,gF,H1,RY,pF,hF),[V5e,K5e]=BY(gc,xF,W1,Fv,fF,mF);function gk(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function yk(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function cx(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function G5e(e){var t=e.dateTime,n=e.date,r=e.time,a=e.periods,i=e.days,o=e.shortDays,l=e.months,c=e.shortMonths,d=dx(a),m=ux(a),u=dx(i),h=ux(i),p=dx(o),v=ux(o),y=dx(l),g=ux(l),x=dx(c),b=ux(c),w={a:q,A:H,b:_,B:L,c:null,d:bR,e:bR,f:g$e,g:P$e,G:D$e,H:f$e,I:p$e,j:x$e,L:LY,m:y$e,M:v$e,p:U,q:J,Q:NR,s:CR,S:b$e,u:w$e,U:j$e,V:N$e,w:C$e,W:S$e,x:null,X:null,y:k$e,Y:E$e,Z:A$e,"%":jR},j={a:I,A:re,b:R,B:Y,c:null,d:wR,e:wR,f:_$e,g:W$e,G:V$e,H:T$e,I:O$e,j:F$e,L:zY,m:M$e,M:$$e,p:M,q:se,Q:NR,s:CR,S:I$e,u:R$e,U:B$e,V:L$e,w:U$e,W:z$e,x:null,X:null,y:q$e,Y:H$e,Z:K$e,"%":jR},N={a:T,A:z,b:O,B:D,c:k,d:yR,e:yR,f:d$e,g:gR,G:xR,H:vR,I:vR,j:i$e,L:c$e,m:a$e,M:o$e,p:E,q:r$e,Q:m$e,s:h$e,S:l$e,u:Z5e,U:e$e,V:t$e,w:X5e,W:s$e,x:F,X:W,y:gR,Y:xR,Z:n$e,"%":u$e};w.x=C(n,w),w.X=C(r,w),w.c=C(t,w),j.x=C(n,j),j.X=C(r,j),j.c=C(t,j);function C(Q,te){return function(G){var Z=[],ie=-1,A=0,ge=Q.length,je,ke,Ie;for(G instanceof Date||(G=new Date(+G));++ie<ge;)Q.charCodeAt(ie)===37&&(Z.push(Q.slice(A,ie)),(ke=pR[je=Q.charAt(++ie)])!=null?je=Q.charAt(++ie):ke=je==="e"?" ":"0",(Ie=te[je])&&(je=Ie(G,ke)),Z.push(je),A=ie+1);return Z.push(Q.slice(A,ie)),Z.join("")}}function P(Q,te){return function(G){var Z=cx(1900,void 0,1),ie=S(Z,Q,G+="",0),A,ge;if(ie!=G.length)return null;if("Q"in Z)return new Date(Z.Q);if("s"in Z)return new Date(Z.s*1e3+("L"in Z?Z.L:0));if(te&&!("Z"in Z)&&(Z.Z=0),"p"in Z&&(Z.H=Z.H%12+Z.p*12),Z.m===void 0&&(Z.m="q"in Z?Z.q:0),"V"in Z){if(Z.V<1||Z.V>53)return null;"w"in Z||(Z.w=1),"Z"in Z?(A=yk(cx(Z.y,0,1)),ge=A.getUTCDay(),A=ge>4||ge===0?gj.ceil(A):gj(A),A=q1.offset(A,(Z.V-1)*7),Z.y=A.getUTCFullYear(),Z.m=A.getUTCMonth(),Z.d=A.getUTCDate()+(Z.w+6)%7):(A=gk(cx(Z.y,0,1)),ge=A.getDay(),A=ge>4||ge===0?xj.ceil(A):xj(A),A=Fv.offset(A,(Z.V-1)*7),Z.y=A.getFullYear(),Z.m=A.getMonth(),Z.d=A.getDate()+(Z.w+6)%7)}else("W"in Z||"U"in Z)&&("w"in Z||(Z.w="u"in Z?Z.u%7:"W"in Z?1:0),ge="Z"in Z?yk(cx(Z.y,0,1)).getUTCDay():gk(cx(Z.y,0,1)).getDay(),Z.m=0,Z.d="W"in Z?(Z.w+6)%7+Z.W*7-(ge+5)%7:Z.w+Z.U*7-(ge+6)%7);return"Z"in Z?(Z.H+=Z.Z/100|0,Z.M+=Z.Z%100,yk(Z)):gk(Z)}}function S(Q,te,G,Z){for(var ie=0,A=te.length,ge=G.length,je,ke;ie<A;){if(Z>=ge)return-1;if(je=te.charCodeAt(ie++),je===37){if(je=te.charAt(ie++),ke=N[je in pR?te.charAt(ie++):je],!ke||(Z=ke(Q,G,Z))<0)return-1}else if(je!=G.charCodeAt(Z++))return-1}return Z}function E(Q,te,G){var Z=d.exec(te.slice(G));return Z?(Q.p=m.get(Z[0].toLowerCase()),G+Z[0].length):-1}function T(Q,te,G){var Z=p.exec(te.slice(G));return Z?(Q.w=v.get(Z[0].toLowerCase()),G+Z[0].length):-1}function z(Q,te,G){var Z=u.exec(te.slice(G));return Z?(Q.w=h.get(Z[0].toLowerCase()),G+Z[0].length):-1}function O(Q,te,G){var Z=x.exec(te.slice(G));return Z?(Q.m=b.get(Z[0].toLowerCase()),G+Z[0].length):-1}function D(Q,te,G){var Z=y.exec(te.slice(G));return Z?(Q.m=g.get(Z[0].toLowerCase()),G+Z[0].length):-1}function k(Q,te,G){return S(Q,t,te,G)}function F(Q,te,G){return S(Q,n,te,G)}function W(Q,te,G){return S(Q,r,te,G)}function q(Q){return o[Q.getDay()]}function H(Q){return i[Q.getDay()]}function _(Q){return c[Q.getMonth()]}function L(Q){return l[Q.getMonth()]}function U(Q){return a[+(Q.getHours()>=12)]}function J(Q){return 1+~~(Q.getMonth()/3)}function I(Q){return o[Q.getUTCDay()]}function re(Q){return i[Q.getUTCDay()]}function R(Q){return c[Q.getUTCMonth()]}function Y(Q){return l[Q.getUTCMonth()]}function M(Q){return a[+(Q.getUTCHours()>=12)]}function se(Q){return 1+~~(Q.getUTCMonth()/3)}return{format:function(Q){var te=C(Q+="",w);return te.toString=function(){return Q},te},parse:function(Q){var te=P(Q+="",!1);return te.toString=function(){return Q},te},utcFormat:function(Q){var te=C(Q+="",j);return te.toString=function(){return Q},te},utcParse:function(Q){var te=P(Q+="",!0);return te.toString=function(){return Q},te}}}var pR={"-":"",_:" ",0:"0"},na=/^\s*\d+/,Y5e=/^%/,Q5e=/[\\^$*+?|[\]().{}]/g;function wn(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",i=a.length;return r+(i<n?new Array(n-i+1).join(t)+a:a)}function J5e(e){return e.replace(Q5e,"\\$&")}function dx(e){return new RegExp("^(?:"+e.map(J5e).join("|")+")","i")}function ux(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function X5e(e,t,n){var r=na.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Z5e(e,t,n){var r=na.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function e$e(e,t,n){var r=na.exec(t.slice(n,n+2));
vendor: 4,106 bytes, line 781
781return r?(e.U=+r[0],n+r[0].length):-1}function t$e(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function s$e(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function xR(e,t,n){var r=na.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function gR(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function n$e(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function r$e(e,t,n){var r=na.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function a$e(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function yR(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function i$e(e,t,n){var r=na.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function vR(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function o$e(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function l$e(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function c$e(e,t,n){var r=na.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function d$e(e,t,n){var r=na.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function u$e(e,t,n){var r=Y5e.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function m$e(e,t,n){var r=na.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function h$e(e,t,n){var r=na.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function bR(e,t){return wn(e.getDate(),t,2)}function f$e(e,t){return wn(e.getHours(),t,2)}function p$e(e,t){return wn(e.getHours()%12||12,t,2)}function x$e(e,t){return wn(1+Fv.count(gc(e),e),t,3)}function LY(e,t){return wn(e.getMilliseconds(),t,3)}function g$e(e,t){return LY(e,t)+"000"}function y$e(e,t){return wn(e.getMonth()+1,t,2)}function v$e(e,t){return wn(e.getMinutes(),t,2)}function b$e(e,t){return wn(e.getSeconds(),t,2)}function w$e(e){var t=e.getDay();return t===0?7:t}function j$e(e,t){return wn(W1.count(gc(e)-1,e),t,2)}function UY(e){var t=e.getDay();return t>=4||t===0?Kf(e):Kf.ceil(e)}function N$e(e,t){return e=UY(e),wn(Kf.count(gc(e),e)+(gc(e).getDay()===4),t,2)}function C$e(e){return e.getDay()}function S$e(e,t){return wn(xj.count(gc(e)-1,e),t,2)}function k$e(e,t){return wn(e.getFullYear()%100,t,2)}function P$e(e,t){return e=UY(e),wn(e.getFullYear()%100,t,2)}function E$e(e,t){return wn(e.getFullYear()%1e4,t,4)}function D$e(e,t){var n=e.getDay();return e=n>=4||n===0?Kf(e):Kf.ceil(e),wn(e.getFullYear()%1e4,t,4)}function A$e(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+wn(t/60|0,"0",2)+wn(t%60,"0",2)}function wR(e,t){return wn(e.getUTCDate(),t,2)}function T$e(e,t){return wn(e.getUTCHours(),t,2)}function O$e(e,t){return wn(e.getUTCHours()%12||12,t,2)}function F$e(e,t){return wn(1+q1.count(yc(e),e),t,3)}function zY(e,t){return wn(e.getUTCMilliseconds(),t,3)}function _$e(e,t){return zY(e,t)+"000"}function M$e(e,t){return wn(e.getUTCMonth()+1,t,2)}function $$e(e,t){return wn(e.getUTCMinutes(),t,2)}function I$e(e,t){return wn(e.getUTCSeconds(),t,2)}function R$e(e){var t=e.getUTCDay();return t===0?7:t}function B$e(e,t){return wn(H1.count(yc(e)-1,e),t,2)}function qY(e){var t=e.getUTCDay();return t>=4||t===0?Gf(e):Gf.ceil(e)}function L$e(e,t){return e=qY(e),wn(Gf.count(yc(e),e)+(yc(e).getUTCDay()===4),t,2)}function U$e(e){return e.getUTCDay()}function z$e(e,t){return wn(gj.count(yc(e)-1,e),t,2)}function q$e(e,t){return wn(e.getUTCFullYear()%100,t,2)}function W$e(e,t){return e=qY(e),wn(e.getUTCFullYear()%100,t,2)}function H$e(e,t){return wn(e.getUTCFullYear()%1e4,t,4)}function V$e(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Gf(e):Gf.ceil(e),wn(e.getUTCFullYear()%1e4,t,4)}function K$e(){return"+0000"}function jR(){return"%"}function NR(e){return+e}function CR(e){return Math.floor(+e/1e3)}var Ym,WY,HY;G$e({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
781ay","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function G$e(e){return Ym=G5e(e),WY=Ym.format,Ym.parse,HY=Ym.utcFormat,Ym.utcParse,Ym}function Y$e(e){return new Date(e)}function Q$e(e){return e instanceof Date?+e:+new Date(+e)}function yF(e,t,n,r,a,i,o,l,c,d){var m=rF(),u=m.invert,h=m.domain,p=d(".%L"),v=d(":%S"),y=d("%I:%M"),g=d("%I %p"),x=d("%a %d"),b=d("%b %d"),w=d("%B"),j=d("%Y");function N(C){return(c(C)<C?p:l(C)<C?v:o(C)<C?y:i(C)<C?g:r(C)<C?a(C)<C?x:b:n(C)<C?w:j)(C)}return m.invert=function(C){return new Date(u(C))},m.domain=function(C){return arguments.length?h(Array.from(C,Q$e)):h().map(Y$e)},m.ticks=function(C){var P=h();return e(P[0],P[P.length-1],C??10)},m.tickFormat=function(C,P){return P==null?N:d(P)},m.nice=function(C){var P=h();return(!C||typeof C.range!="function")&&(C=t(P[0],P[P.length-1],C??10)),C?h(TY(P,C)):m},m.copy=function(){return Ov(m,yF(e,t,n,r,a,i,o,l,c,d))},m}function J$e(){return ro.apply(yF(V5e,K5e,gc,xF,W1,Fv,fF,mF,ju,WY).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function X$e(){return ro.apply(yF(W5e,H5e,yc,gF,H1,q1,pF,hF,ju,HY).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function V1(){var e=0,t=1,n,r,a,i,o=Ma,l=!1,c;function d(u){return u==null||isNaN(u=+u)?c:o(a===0?.5:(u=(i(u)-n)*a,l?Math.max(0,Math.min(1,u)):u))}d.domain=function(u){return arguments.length?([e,t]=u,n=i(e=+e),r=i(t=+t),a=n===r?0:1/(r-n),d):[e,t]},d.clamp=function(u){return arguments.length?(l=!!u,d):l},d.interpolator=function(u){return arguments.length?(o=u,d):o};function m(u){return function(h){var p,v;return arguments.length?([p,v]=h,o=u(p,v),d):[o(0),o(1)]}}return d.range=m(_p),d.rangeRound=m(nF),d.unknown=function(u){return arguments.length?(c=u,d):c},function(u){return i=u,n=u(e),r=u(t),a=n===r?0:1/(r-n),d}}function Qd(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function VY(){var e=Yd(V1()(Ma));return e.copy=function(){return Qd(e,VY())},Sc.apply(e,arguments)}function KY(){var e=oF(V1()).domain([1,10]);return e.copy=function(){return Qd(e,KY()).base(e.base())},Sc.apply(e,arguments)}function GY(){var e=lF(V1());return e.copy=function(){return Qd(e,GY()).constant(e.constant())},Sc.apply(e,arguments)}function vF(){var e=cF(V1());return e.copy=function(){return Qd(e,vF()).exponent(e.exponent())},Sc.apply(e,arguments)}function Z$e(){return vF.apply(null,arguments).exponent(.5)}function YY(){var e=[],t=Ma;function n(r){if(r!=null&&!isNaN(r=+r))return t((Av(e,r,1)-1)/(e.length-1))}return n.domain=function(r){if(!arguments.length)return e.slice();e=[];for(let a of r)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Sd),n},n.interpolator=function(r){return arguments.length?(t=r,n):t},n.range=function(){return e.map((r,a)=>t(a/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(a,i)=>BMe(e,i/r))},n.copy=function(){return YY(t).domain(e)},Sc.apply(n,arguments)}function K1(){var e=0,t=.5,n=1,r=1,a,i,o,l,c,d=Ma,m,u=!1,h;function p(y){return isNaN(y=+y)?h:(y=.5+((y=+m(y))-i)*(r*y<r*i?l:c),d(u?Math.max(0,Math.min(1,y)):y))}p.domain=function(y){return arguments.length?([e,t,n]=y,a=m(e=+e),i=m(t=+t),o=m(n=+n),l=a===i?0:.5/(i-a),c=i===o?0:.5/(o-i),r=i<a?-1:1,p):[e,t,n]},p.clamp=function(y){return arguments.length?(u=!!y,p):u},p.interpolator=function(y){return arguments.length?(d=y,p):d};function v(y){return function(g){var x,b,w;return arguments.length?([x,b,w]=g,d=u5e(y,[x,b,w]),p):[d(0),d(.5),d(1)]}}return p.range=v(_p),p.rangeRound=v(nF),p.unknown=function(y){return arguments.length?(h=y,p):h},function(y){return m=y,a=y(e),i=y(t),o=y(n),l=a===i?0:.5/(i-a),c=i===o?0:.5/(o-i),r=i<a?-1:1,p}}function QY(){var e=Yd(K1()(Ma));return e.copy=function(){return Qd(e,QY())},Sc.apply(e,arguments)}function JY(){var e=oF(K1()).domain([.1,1,10]);return e.copy=function(){return Qd(e,JY()).base(e.base())},Sc.apply(e,arguments)}function XY(){var e=lF(K1());return e.copy=function(){return Qd(e,XY()).constant(e.constant())},Sc.apply(e,arguments)}function bF(){var e=cF(K1());return e.copy=function(){return Qd(e,bF()).exponent(e.exponent())},Sc.apply(e,arguments)}function eIe(){return bF.apply(null,arguments).exponent(.5)}const SR=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:Xg,scaleDiverging:QY,scaleDivergingLog:JY,scaleDivergingPow:bF,scaleDivergingSqrt:eIe,scaleDivergingSymlog:XY,scaleIdentity:AY,scaleImplicit:KE,scaleLinear:fj,scaleLog:OY,scaleOrdinal:eF,scalePoint:Xx,scalePow:dF,scaleQuantile:MY,scaleQuantize:$Y,scaleRadial:_Y,scaleSequential:VY,scaleSequentialLog:KY,scaleSequentialPow:vF,scaleSequentialQuantile:YY,scaleSequentialSqrt:Z$e,scaleSequentialSymlog:GY,scaleSqrt:_5e,scaleSymlog:FY,scaleThreshold:IY,scaleTime:J$e,scaleUtc:X$e,tickFormat:DY},Symbol.toStringTag,{value:"Module"}));var tIe=Sp;function sIe(e,t,n){for(var r=-1,a=e.length;++r<a;){var i=e[r],o=t(i);if(o!=null&&(l===void 0?o===o&&!tIe(o):n(o,l)))var l=o,c=i}return c}var ZY=sIe;function nIe(e,t){return e>t}var rIe=nIe,aIe=ZY,iIe=rIe,oIe=Op;function lIe(e){return e&&e.length?aIe(e,oIe,iIe):void 0}var cIe=lIe;const G1=Qs(cIe);function dIe(e,t){return e<t}var uIe=dIe,mIe=ZY,hIe=uIe,fIe=Op;function pIe(e){return e&&e.length?mIe(e,fIe,hIe):void 0}var xIe=pIe;const Y1=Qs(xIe);var gIe=_O,yIe=Gd,vIe=cY,bIe=ni;function wIe(e,t){var n=bIe(e)?gIe:vIe;return n(e,yIe(t))}var jIe=wIe,NIe=oY,CIe=jIe;function SIe(e,t){return NIe(CIe(e,t),1)}var kIe=SIe;const PIe=Qs(kIe);var EIe=YO;function DIe(e,t){return EIe(e,t)}var AIe=DIe;const Q1=Qs(AIe);
vendor: 233,304 bytes, lines 781-830
781var Mp=1e9,TIe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},jF,nr=!0,so="[DecimalError] ",Zu=so+"Invalid argument: ",wF=so+"Exponent out of range: ",$p=Math.floor,uu=Math.pow,OIe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,mi,Kr=1e7,Gn=7,eQ=9007199254740991,yj=$p(eQ/Gn),as={};as.absoluteValue=as.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};as.comparedTo=as.cmp=function(e){var t,n,r,a,i=this;if(e=new i.constructor(e),i.s!==e.s)return i.s||-e.s;if(i.e!==e.e)return i.e>e.e^i.s<0?1:-1;for(r=i.d.length,a=e.d.length,t=0,n=r<a?r:a;t<n;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return r===a?0:r>a^i.s<0?1:-1};as.decimalPlaces=as.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Gn;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};as.dividedBy=as.div=function(e){return ac(this,new this.constructor(e))};as.dividedToIntegerBy=as.idiv=function(e){var t=this,n=t.constructor;return Rn(ac(t,new n(e),0,1),n.precision)};as.equals=as.eq=function(e){return!this.cmp(e)};as.exponent=function(){return Ar(this)};as.greaterThan=as.gt=function(e){return this.cmp(e)>0};as.greaterThanOrEqualTo=as.gte=function(e){return this.cmp(e)>=0};as.isInteger=as.isint=function(){return this.e>this.d.length-2};as.isNegative=as.isneg=function(){return this.s<0};as.isPositive=as.ispos=function(){return this.s>0};as.isZero=function(){return this.s===0};as.lessThan=as.lt=function(e){return this.cmp(e)<0};as.lessThanOrEqualTo=as.lte=function(e){return this.cmp(e)<1};as.logarithm=as.log=function(e){var t,n=this,r=n.constructor,a=r.precision,i=a+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(mi))throw Error(so+"NaN");if(n.s<1)throw Error(so+(n.s?"NaN":"-Infinity"));return n.eq(mi)?new r(0):(nr=!1,t=ac(ny(n,i),ny(e,i),i),nr=!0,Rn(t,a))};as.minus=as.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?nQ(t,e):tQ(t,(e.s=-e.s,e))};as.modulo=as.mod=function(e){var t,n=this,r=n.constructor,a=r.precision;if(e=new r(e),!e.s)throw Error(so+"NaN");return n.s?(nr=!1,t=ac(n,e,0,1).times(e),nr=!0,n.minus(t)):Rn(new r(n),a)};as.naturalExponential=as.exp=function(){return sQ(this)};as.naturalLogarithm=as.ln=function(){return ny(this)};as.negated=as.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};as.plus=as.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?tQ(t,e):nQ(t,(e.s=-e.s,e))};as.precision=as.sd=function(e){var t,n,r,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Zu+e);if(t=Ar(a)+1,r=a.d.length-1,n=r*Gn+1,r=a.d[r],r){for(;r%10==0;r/=10)n--;for(r=a.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};as.squareRoot=as.sqrt=function(){var e,t,n,r,a,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(so+"NaN")}for(e=Ar(l),nr=!1,a=Math.sqrt(+l),a==0||a==1/0?(t=xl(l.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=$p((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(a.toString()),n=c.precision,a=o=n+3;;)if(i=r,r=i.plus(ac(l,i,o+2)).times(.5),xl(i.d).slice(0,o)===(t=xl(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),a==o&&t=="4999"){if(Rn(i,n+1,0),i.times(i).eq(l)){r=i;break}}else if(t!="9999")break;o+=4}return nr=!0,Rn(r,n)};as.times=as.mul=function(e){var t,n,r,a,i,o,l,c,d,m=this,u=m.constructor,h=m.d,p=(e=new u(e)).d;if(!m.s||!e.s)return new u(0);for(e.s*=m.s,n=m.e+e.e,c=h.length,d=p.length,c<d&&(i=h,h=p,p=i,o=c,c=d,d=o),i=[],o=c+d,r=o;r--;)i.push(0);for(r=d;--r>=0;){for(t=0,a=c+r;a>r;)l=i[a]+p[r]*h[a-r-1]+t,i[a--]=l%Kr|0,t=l/Kr|0;i[a]=(i[a]+t)%Kr|0}for(;!i[--o];)i.pop();return t?++n:i.shift(),e.d=i,e.e=n,nr?Rn(e,u.precision):e};as.toDecimalPlaces=as.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(kl(e,0,Mp),t===void 0?t=r.rounding:kl(t,0,8),Rn(n,e+Ar(n)+1,t))};as.toExponential=function(e,t){var n,r=this,a=r.constructor;return e===void 0?n=wm(r,!0):(kl(e,0,Mp),t===void 0?t=a.rounding:kl(t,0,8),r=Rn(new a(r),e+1,t),n=wm(r,!0,e+1)),n};as.toFixed=function(e,t){var n,r,a=this,i=a.constructor;return e===void 0?wm(a):(kl(e,0,Mp),t===void 0?t=i.rounding:kl(t,0,8),r=Rn(new i(a),e+Ar(a)+1,t),n=wm(r.abs(),!1,e+Ar(r)+1),a.isneg()&&!a.isZero()?"-"+n:n)};as.toInteger=as.toint=function(){var e=this,t=e.constructor;return Rn(new t(e),Ar(e)+1,t.rounding)};as.toNumber=function(){return+this};as.toPower=as.pow=function(e){var t,n,r,a,i,o,l=this,c=l.constructor,d=12,m=+(e=new c(e));if(!e.s)return new c(mi);if(l=new c(l),!l.s){if(e.s<1)throw Error(so+"Infinity");return l}if(l.eq(mi))return l;if(r=c.precision,e.eq(mi))return Rn(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,i=l.s,o){if((n=m<0?-m:m)<=eQ){for(a=new c(mi),t=Math.ceil(r/Gn+4),nr=!1;n%2&&(a=a.times(l),PR(a.d,t)),n=$p(n/2),n!==0;)l=l.times(l),PR(l.d,t);return nr=!0,e.s<0?new c(mi).div(a):Rn(a,r)}}else if(i<0)throw Error(so+"NaN");return i=i<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,nr=!1,a=e.times(ny(l,r+d)),nr=!0,a=sQ(a),a.s=i,a};as.toPrecision=function(e,t){var n,r,a=this,i=a.constructor;return e===void 0?(n=Ar(a),r=wm(a,n<=i.toExpNeg||n>=i.toExpPos)):(kl(e,1,Mp),t===void 0?t=i.rounding:kl(t,0,8),a=Rn(new i(a),e,t),n=Ar(a),r=wm(a,e<=n||n<=i.toExpNeg,e)),r};as.toSignificantDigits=as.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(kl(e,1,Mp),t===void 0?t=r.rounding:kl(t,0,8)),Rn(new r(n),e,t)};as.toString=as.valueOf=as.val=as.toJSON=as[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Ar(e),n=e.constructor;return wm(e,t<=n.toExpNeg||t>=n.toExpPos)};function tQ(e,t){var n,r,a,i,o,l,c,d,m=e.constructor,u=m.precision;if(!e.s||!t.s)return t.s||(t=new m(e)),nr?Rn(t,u):t;if(c=e.d,d=t.d,o=e.e,a=t.e,c=c.slice(),i=o-a,i){for(i<0?(r=c,i=-i,l=d.length):(r=d,a=o,l=c.length),o=Math.ceil(u/Gn),l=o>l?o+1:l+1,i>l&&(i=l,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(l=c.length,i=d.length,l-i<0&&(i=l,r=d,d=c,c=r),n=0;i;)n=(c[--i]=c[i]+d[i]+n)/Kr|0,c[i]%=Kr;for(n&&(c.unshift(n),++a),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=a,nr?Rn(t,u):t}function kl(e,t,n){if(e!==~~e||e<t||e>n)throw Error(Zu+e)}function xl(e){var t,n,r,a=e.length-1,i="",o=e[0];if(a>0){for(i+=o,t=1;t<a;t++)r=e[t]+"",n=Gn-r.length,n&&(i+=Uc(n)),i+=r;o=e[t],r=o+"",n=Gn-r.length,n&&(i+=Uc(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var ac=function(){function e(r,a){var i,o=0,l=r.length;for(r=r.slice();l--;)i=r[l]*a+o,r[l]=i%Kr|0,o=i/Kr|0;return o&&r.unshift(o),r}function t(r,a,i,o){var l,c;if(i!=o)c=i>o?1:-1;else for(l=c=0;l<i;l++)if(r[l]!=a[l]){c=r[l]>a[l]?1:-1;break}return c}function n(r,a,i){for(var o=0;i--;)r[i]-=o,o=r[i]<a[i]?1:0,r[i]=o*Kr+r[i]-a[i];for(;!r[0]&&r.length>1;)r.shift()}return function(r,a,i,o){var l,c,d,m,u,h,p,v,y,g,x,b,w,j,N,C,P,S,E=r.constructor,T=r.s==a.s?1:-1,z=r.d,O=a.d;if(!r.s)return new E(r);if(!a.s)throw Error(so+"Division by zero");for(c=r.e-a.e,P=O.length,N=z.length,p=new E(T),v=p.d=[],d=0;O[d]==(z[d]||0);)++d;if(O[d]>(z[d]||0)&&--c,i==null?b=i=E.precision:o?b=i+(Ar(r)-Ar(a))+1:b=i,b<0)return new E(0);if(b=b/Gn+2|0,d=0,P==1)for(m=0,O=O[0],b++;(d<N||m)&&b--;d++)w=m*Kr+(z[d]||0),v[d]=w/O|0,m=w%O|0;else{for(m=Kr/(O[0]+1)|0,m>1&&(O=e(O,m),z=e(z,m),P=O.length,N=z.length),j=P,y=z.slice(0,P),g=y.length;g<P;)y[g++]=0;S=O.slice(),S.unshift(0),C=O[0],O[1]>=Kr/2&&++C;do m=0,l=t(O,y,P,g),l<0?(x=y[0],P!=g&&(x=x*Kr+(y[1]||0)),m=x/C|0,m>1?(m>=Kr&&(m=Kr-1),u=e(O,m),h=u.length,g=y.length,l=t(u,y,h,g),l==1&&(m--,n(u,P<h?S:O,h))):(m==0&&(l=m=1),u=O.slice()),h=u.length,h<g&&u.unshift(0),n(y,u,g),l==-1&&(g=y.length,l=t(O,y,P,g),l<1&&(m++,n(y,P<g?S:O,g))),g=y.length):l===0&&(m++,y=[0]),v[d++]=m,l&&y[0]?y[g++]=z[j]||0:(y=[z[j]],g=1);while((j++<N||y[0]!==void 0)&&b--)}return v[0]||v.shift(),p.e=c,Rn(p,o?i+Ar(p)+1:i)}}();function sQ(e,t){var n,r,a,i,o,l,c=0,d=0,m=e.constructor,u=m.precision;if(Ar(e)>16)throw Error(wF+Ar(e));if(!e.s)return new m(mi);for(nr=!1,l=u,o=new m(.03125);e.abs().gte(.1);)e=e.times(o),d+=5;for(r=Math.log(uu(2,d))/Math.LN10*2+5|0,l+=r,n=a=i=new m(mi),m.precision=l;;){if(a=Rn(a.times(e),l),n=n.times(++c),o=i.plus(ac(a,n,l)),xl(o.d).slice(0,l)===xl(i.d).slice(0,l)){for(;d--;)i=Rn(i.times(i),l);return m.precision=u,t==null?(nr=!0,Rn(i,u)):i}i=o}}function Ar(e){for(var t=e.e*Gn,n=e.d[0];n>=10;n/=10)t++;return t}function vk(e,t,n){if(t>e.LN10.sd())throw nr=!0,n&&(e.precision=n),Error(so+"LN10 precision limit exceeded");return Rn(new e(e.LN10),t)}function Uc(e){for(var t="";e--;)t+="0";return t}function ny(e,t){var n,r,a,i,o,l,c,d,m,u=1,h=10,p=e,v=p.d,y=p.constructor,g=y.precision;if(p.s<1)throw Error(so+(p.s?"NaN":"-Infinity"));if(p.eq(mi))return new y(0);if(t==null?(nr=!1,d=g):d=t,p.eq(10))return t==null&&(nr=!0),vk(y,d);if(d+=h,y.precision=d,n=xl(v),r=n.charAt(0),i=Ar(p),Math.abs(i)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(e),n=xl(p.d),r=n.charAt(0),u++;i=Ar(p),r>1?(p=new y("0."+n),i++):p=new y(r+"."+n.slice(1))}else return c=vk(y,d+2,g).times(i+""),p=ny(new y(r+"."+n.slice(1)),d-h).plus(c),y.precision=g,t==null?(nr=!0,Rn(p,g)):p;for(l=o=p=ac(p.minus(mi),p.plus(mi),d),m=Rn(p.times(p),d),a=3;;){if(o=Rn(o.times(m),d),c=l.plus(ac(o,new y(a),d)),xl(c.d).slice(0,d)===xl(l.d).slice(0,d))return l=l.times(2),i!==0&&(l=l.plus(vk(y,d+2,g).times(i+""))),l=ac(l,new y(u),d),y.precision=g,t==null?(nr=!0,Rn(l,g)):l;l=c,a+=2}}function kR(e,t){var n,r,a;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=$p(n/Gn),e.d=[],r=(n+1)%Gn,n<0&&(r+=Gn),r<a){for(r&&e.d.push(+t.slice(0,r)),a-=Gn;r<a;)e.d.push(+t.slice(r,r+=Gn));t=t.slice(r),r=Gn-t.length}else r-=a;for(;r--;)t+="0";if(e.d.push(+t),nr&&(e.e>yj||e.e<-yj))throw Error(wF+n)}else e.s=0,e.e=0,e.d=[0];return e}function Rn(e,t,n){var r,a,i,o,l,c,d,m,u=e.d;for(o=1,i=u[0];i>=10;i/=10)o++;if(r=t-o,r<0)r+=Gn,a=t,d=u[m=0];else{if(m=Math.ceil((r+1)/Gn),i=u.length,m>=i)return e;for(d=i=u[m],o=1;i>=10;i/=10)o++;r%=Gn,a=r-Gn+o}if(n!==void 0&&(i=uu(10,o-a-1),l=d/i%10|0,c=t<0||u[m+1]!==void 0||d%i,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?a>0?d/uu(10,o-a):0:u[m-1])%10&1||n==(e.s<0?8:7))),t<1||!u[0])return c?(i=Ar(e),u.length=1,t=t-i-1,u[0]=uu(10,(Gn-t%Gn)%Gn),e.e=$p(-t/Gn)||0):(u.length=1,u[0]=e.e=e.s=0),e;if(r==0?(u.length=m,i=1,m--):(u.length=m+1,i=uu(10,Gn-r),u[m]=a>0?(d/uu(10,o-a)%uu(10,a)|0)*i:0),c)for(;;)if(m==0){(u[0]+=i)==Kr&&(u[0]=1,++e.e);break}else{if(u[m]+=i,u[m]!=Kr)break;u[m--]=0,i=1}for(r=u.length;u[--r]===0;)u.pop();if(nr&&(e.e>yj||e.e<-yj))throw Error(wF+Ar(e));return e}function nQ(e,t){var n,r,a,i,o,l,c,d,m,u,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),nr?Rn(t,p):t;if(c=e.d,u=t.d,r=t.e,d=e.e,c=c.slice(),o=d-r,o){for(m=o<0,m?(n=c,o=-o,l=u.length):(n=u,r=d,l=c.length),a=Math.max(Math.ceil(p/Gn),l)+2,o>a&&(o=a,n.length=1),n.reverse(),a=o;a--;)n.push(0);n.reverse()}else{for(a=c.length,l=u.length,m=a<l,m&&(l=a),a=0;a<l;a++)if(c[a]!=u[a]){m=c[a]<u[a];break}o=0}for(m&&(n=c,c=u,u=n,t.s=-t.s),l=c.length,a=u.length-l;a>0;--a)c[l++]=0;for(a=u.length;a>o;){if(c[--a]<u[a]){for(i=a;i&&c[--i]===0;)c[i]=Kr-1;--c[i],c[a]+=Kr}c[a]-=u[a]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--r;return c[0]?(t.d=c,t.e=r,nr?Rn(t,p):t):new h(0)}function wm(e,t,n){var r,a=Ar(e),i=xl(e.d),o=i.length;return t?(n&&(r=n-o)>0?i=i.charAt(0)+"."+i.slice(1)+Uc(r):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+Uc(-a-1)+i,n&&(r=n-o)>0&&(i+=Uc(r))):a>=o?(i+=Uc(a+1-o),n&&(r=n-a-1)>0&&(i=i+"."+Uc(r))):((r=a+1)<o&&(i=i.slice(0,r)+"."+i.slice(r)),n&&(r=n-o)>0&&(a+1===o&&(i+="."),i+=Uc(r))),e.s<0?"-"+i:i}function PR(e,t){if(e.length>t)return e.length=t,!0}function rQ(e){var t,n,r;function a(i){var o=this;if(!(o instanceof a))return new a(i);if(o.constructor=a,i instanceof a){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(Zu+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return kR(o,i.toString())}else if(typeof i!="string")throw Error(Zu+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,OIe.test(i))kR(o,i);else throw Error(Zu+i)}if(a.prototype=as,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=rQ,a.config=a.set=FIe,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return a.config(e),a}function FIe(e){if(!e||typeof e!="object")throw Error(so+"Object expected");var t,n,r,a=["precision",1,Mp,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if((r=e[n=a[t]])!==void 0)if($p(r)===r&&r>=a[t+1]&&r<=a[t+2])this[n]=r;else throw Error(Zu+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Zu+n+": "+r);return this}var jF=rQ(TIe);mi=new jF(1);const Fn=jF;function _Ie(e){return RIe(e)||IIe(e)||$Ie(e)||MIe()}function MIe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
782In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $Ie(e,t){if(e){if(typeof e=="string")return JE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return JE(e,t)}}function IIe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function RIe(e){if(Array.isArray(e))return JE(e)}function JE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var BIe=function(t){return t},aQ={},iQ=function(t){return t===aQ},ER=function(t){return function n(){return arguments.length===0||arguments.length===1&&iQ(arguments.length<=0?void 0:arguments[0])?n:t.apply(void 0,arguments)}},LIe=function e(t,n){return t===1?n:ER(function(){for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];var o=a.filter(function(l){return l!==aQ}).length;return o>=t?n.apply(void 0,a):e(t-o,ER(function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];var m=a.map(function(u){return iQ(u)?c.shift():u});return n.apply(void 0,_Ie(m).concat(c))}))})},J1=function(t){return LIe(t.length,t)},XE=function(t,n){for(var r=[],a=t;a<n;++a)r[a-t]=a;return r},UIe=J1(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(n){return t[n]}).map(e)}),zIe=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return BIe;var a=n.reverse(),i=a[0],o=a.slice(1);return function(){return o.reduce(function(l,c){return c(l)},i.apply(void 0,arguments))}},ZE=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},oQ=function(t){var n=null,r=null;return function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return n&&i.every(function(l,c){return l===n[c]})||(n=i,r=t.apply(void 0,i)),r}};function qIe(e){var t;return e===0?t=1:t=Math.floor(new Fn(e).abs().log(10).toNumber())+1,t}function WIe(e,t,n){for(var r=new Fn(e),a=0,i=[];r.lt(t)&&a<1e5;)i.push(r.toNumber()),r=r.add(n),a++;return i}var HIe=J1(function(e,t,n){var r=+e,a=+t;return r+n*(a-r)}),VIe=J1(function(e,t,n){var r=t-+e;return r=r||1/0,(n-e)/r}),KIe=J1(function(e,t,n){var r=t-+e;return r=r||1/0,Math.max(0,Math.min(1,(n-e)/r))});const X1={rangeStep:WIe,getDigitCount:qIe,interpolateNumber:HIe,uninterpolateNumber:VIe,uninterpolateTruncation:KIe};function eD(e){return QIe(e)||YIe(e)||lQ(e)||GIe()}function GIe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
783In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YIe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function QIe(e){if(Array.isArray(e))return tD(e)}function ry(e,t){return ZIe(e)||XIe(e,t)||lQ(e,t)||JIe()}function JIe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
784In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lQ(e,t){if(e){if(typeof e=="string")return tD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tD(e,t)}}function tD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function XIe(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,a=!1,i=void 0;try{for(var o=e[Symbol.iterator](),l;!(r=(l=o.next()).done)&&(n.push(l.value),!(t&&n.length===t));r=!0);}catch(c){a=!0,i=c}finally{try{!r&&o.return!=null&&o.return()}finally{if(a)throw i}}return n}}function ZIe(e){if(Array.isArray(e))return e}function cQ(e){var t=ry(e,2),n=t[0],r=t[1],a=n,i=r;return n>r&&(a=r,i=n),[a,i]}function dQ(e,t,n){if(e.lte(0))return new Fn(0);var r=X1.getDigitCount(e.toNumber()),a=new Fn(10).pow(r),i=e.div(a),o=r!==1?.05:.1,l=new Fn(Math.ceil(i.div(o).toNumber())).add(n).mul(o),c=l.mul(a);return t?c:new Fn(Math.ceil(c))}function e3e(e,t,n){var r=1,a=new Fn(e);if(!a.isint()&&n){var i=Math.abs(e);i<1?(r=new Fn(10).pow(X1.getDigitCount(e)-1),a=new Fn(Math.floor(a.div(r).toNumber())).mul(r)):i>1&&(a=new Fn(Math.floor(e)))}else e===0?a=new Fn(Math.floor((t-1)/2)):n||(a=new Fn(Math.floor(e)));var o=Math.floor((t-1)/2),l=zIe(UIe(function(c){return a.add(new Fn(c-o).mul(r)).toNumber()}),XE);return l(0,t)}function uQ(e,t,n,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Fn(0),tickMin:new Fn(0),tickMax:new Fn(0)};var i=dQ(new Fn(t).sub(e).div(n-1),r,a),o;e<=0&&t>=0?o=new Fn(0):(o=new Fn(e).add(t).div(2),o=o.sub(new Fn(o).mod(i)));var l=Math.ceil(o.sub(e).div(i).toNumber()),c=Math.ceil(new Fn(t).sub(o).div(i).toNumber()),d=l+c+1;return d>n?uQ(e,t,n,r,a+1):(d<n&&(c=t>0?c+(n-d):c,l=t>0?l:l+(n-d)),{step:i,tickMin:o.sub(new Fn(l).mul(i)),tickMax:o.add(new Fn(c).mul(i))})}function t3e(e){var t=ry(e,2),n=t[0],r=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(a,2),l=cQ([n,r]),c=ry(l,2),d=c[0],m=c[1];if(d===-1/0||m===1/0){var u=m===1/0?[d].concat(eD(XE(0,a-1).map(function(){return 1/0}))):[].concat(eD(XE(0,a-1).map(function(){return-1/0})),[m]);return n>r?ZE(u):u}if(d===m)return e3e(d,a,i);var h=uQ(d,m,o,i),p=h.step,v=h.tickMin,y=h.tickMax,g=X1.rangeStep(v,y.add(new Fn(.1).mul(p)),p);return n>r?ZE(g):g}function s3e(e,t){var n=ry(e,2),r=n[0],a=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=cQ([r,a]),l=ry(o,2),c=l[0],d=l[1];if(c===-1/0||d===1/0)return[r,a];if(c===d)return[c];var m=Math.max(t,2),u=dQ(new Fn(d).sub(c).div(m-1),i,0),h=[].concat(eD(X1.rangeStep(new Fn(c),new Fn(d).sub(new Fn(.99).mul(u)),u)),[d]);return r>a?ZE(h):h}var n3e=oQ(t3e),r3e=oQ(s3e),a3e="Invariant failed";function jm(e,t){throw new Error(a3e)}var i3e=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Yf(e){"@babel/helpers - typeof";return Yf=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},Yf(e)}function vj(){return vj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vj.apply(this,arguments)}function o3e(e,t){return u3e(e)||d3e(e,t)||c3e(e,t)||l3e()}function l3e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
785In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c3e(e,t){if(e){if(typeof e=="string")return DR(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return DR(e,t)}}function DR(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function d3e(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(m){d=!0,a=m}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function u3e(e){if(Array.isArray(e))return e}function m3e(e,t){if(e==null)return{};var n=h3e(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function h3e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function f3e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p3e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,fQ(r.key),r)}}function x3e(e,t,n){return t&&p3e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function g3e(e,t,n){return t=bj(t),y3e(e,mQ()?Reflect.construct(t,n||[],bj(e).constructor):t.apply(e,n))}function y3e(e,t){if(t&&(Yf(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return v3e(e)}function v3e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mQ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mQ=function(){return!!e})()}function bj(e){return bj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},bj(e)}function b3e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&sD(e,t)}function sD(e,t){return sD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},sD(e,t)}function hQ(e,t,n){return t=fQ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fQ(e){var t=w3e(e,"string");return Yf(t)=="symbol"?t:t+""}function w3e(e,t){if(Yf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Yf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var _v=function(e){function t(){return f3e(this,t),g3e(this,t,arguments)}return b3e(t,e),x3e(t,[{key:"render",value:function(){var r=this.props,a=r.offset,i=r.layout,o=r.width,l=r.dataKey,c=r.data,d=r.dataPointFormatter,m=r.xAxis,u=r.yAxis,h=m3e(r,i3e),p=fn(h,!1);this.props.direction==="x"&&m.type!=="number"&&jm();var v=c.map(function(y){var g=d(y,l),x=g.x,b=g.y,w=g.value,j=g.errorVal;if(!j)return null;var N=[],C,P;if(Array.isArray(j)){var S=o3e(j,2);C=S[0],P=S[1]}else C=P=j;if(i==="vertical"){var E=m.scale,T=b+a,z=T+o,O=T-o,D=E(w-C),k=E(w+P);N.push({x1:k,y1:z,x2:k,y2:O}),N.push({x1:D,y1:T,x2:k,y2:T}),N.push({x1:D,y1:z,x2:D,y2:O})}else if(i==="horizontal"){var F=u.scale,W=x+a,q=W-o,H=W+o,_=F(w-C),L=F(w+P);N.push({x1:q,y1:L,x2:H,y2:L}),N.push({x1:W,y1:_,x2:W,y2:L}),N.push({x1:q,y1:_,x2:H,y2:_})}return he.createElement(wr,vj({className:"recharts-errorBar",key:"bar-".concat(N.map(function(U){return"".concat(U.x1,"-").concat(U.x2,"-").concat(U.y1,"-").concat(U.y2)}))},p),N.map(function(U){return he.createElement("line",vj({},U,{key:"line-".concat(U.x1,"-").concat(U.x2,"-").concat(U.y1,"-").concat(U.y2)}))}))});return he.createElement(wr,{className:"recharts-errorBars"},v)}}])}(he.Component);hQ(_v,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});hQ(_v,"displayName","ErrorBar");function ay(e){"@babel/helpers - typeof";return ay=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},ay(e)}function AR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function su(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?AR(Object(n),!0).forEach(function(r){j3e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AR(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function j3e(e,t,n){return t=N3e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N3e(e){var t=C3e(e,"string");return ay(t)=="symbol"?t:t+""}function C3e(e,t){if(ay(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ay(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var pQ=function(t){var n=t.children,r=t.formattedGraphicalItems,a=t.legendWidth,i=t.legendContent,o=di(n,Ju);if(!o)return null;var l=Ju.defaultProps,c=l!==void 0?su(su({},l),o.props):{},d;return o.props&&o.props.payload?d=o.props&&o.props.payload:i==="children"?d=(r||[]).reduce(function(m,u){var h=u.item,p=u.props,v=p.sectors||p.data||[];return m.concat(v.map(function(y){return{type:o.props.iconType||h.props.legendType,value:y.name,color:y.fill,payload:y}}))},[]):d=(r||[]).map(function(m){var u=m.item,h=u.type.defaultProps,p=h!==void 0?su(su({},h),u.props):{},v=p.dataKey,y=p.name,g=p.legendType,x=p.hide;return{inactive:x,dataKey:v,type:c.iconType||g||"square",color:NF(u),value:y||v,payload:p}}),su(su(su({},c),Ju.getWithHeight(o,a)),{},{payload:d,item:o})};function iy(e){"@babel/helpers - typeof";return iy=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},iy(e)}function TR(e){return E3e(e)||P3e(e)||k3e(e)||S3e()}function S3e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
786In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function k3e(e,t){if(e){if(typeof e=="string")return nD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nD(e,t)}}function P3e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function E3e(e){if(Array.isArray(e))return nD(e)}function nD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function OR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?OR(Object(n),!0).forEach(function(r){Uh(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OR(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Uh(e,t,n){return t=D3e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D3e(e){var t=A3e(e,"string");return iy(t)=="symbol"?t:t+""}function A3e(e,t){if(iy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(iy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ki(e,t,n){return tn(e)||tn(t)?n:zr(t)?Vi(e,t,n):Ks(t)?t(e):n}function Zx(e,t,n,r){var a=PIe(e,function(l){return ki(l,t)});if(n==="number"){var i=a.filter(function(l){return Ut(l)||parseFloat(l)});return i.length?[Y1(i),G1(i)]:[1/0,-1/0]}var o=r?a.filter(function(l){return!tn(l)}):a;return o.map(function(l){return zr(l)||l instanceof Date?l:""})}var T3e=function(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,d=0;d<l;d++){var m=d>0?a[d-1].coordinate:a[l-1].coordinate,u=a[d].coordinate,h=d>=l-1?a[0].coordinate:a[d+1].coordinate,p=void 0;if(Fo(u-m)!==Fo(h-u)){var v=[];if(Fo(h-u)===Fo(c[1]-c[0])){p=h;var y=u+c[1]-c[0];v[0]=Math.min(y,(y+m)/2),v[1]=Math.max(y,(y+m)/2)}else{p=m;var g=h+c[1]-c[0];v[0]=Math.min(u,(g+u)/2),v[1]=Math.max(u,(g+u)/2)}var x=[Math.min(u,(p+u)/2),Math.max(u,(p+u)/2)];if(t>x[0]&&t<=x[1]||t>=v[0]&&t<=v[1]){o=a[d].index;break}}else{var b=Math.min(m,h),w=Math.max(m,h);if(t>(b+u)/2&&t<=(w+u)/2){o=a[d].index;break}}}else for(var j=0;j<l;j++)if(j===0&&t<=(r[j].coordinate+r[j+1].coordinate)/2||j>0&&j<l-1&&t>(r[j].coordinate+r[j-1].coordinate)/2&&t<=(r[j].coordinate+r[j+1].coordinate)/2||j===l-1&&t>(r[j].coordinate+r[j-1].coordinate)/2){o=r[j].index;break}return o},NF=function(t){var n,r=t,a=r.type.displayName,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?fr(fr({},t.type.defaultProps),t.props):t.props,o=i.stroke,l=i.fill,c;switch(a){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},O3e=function(t){var n=t.barSize,r=t.totalSize,a=t.stackGroups,i=a===void 0?{}:a;if(!i)return{};for(var o={},l=Object.keys(i),c=0,d=l.length;c<d;c++)for(var m=i[l[c]].stackGroups,u=Object.keys(m),h=0,p=u.length;h<p;h++){var v=m[u[h]],y=v.items,g=v.cateAxisId,x=y.filter(function(P){return nc(P.type).indexOf("Bar")>=0});if(x&&x.length){var b=x[0].type.defaultProps,w=b!==void 0?fr(fr({},b),x[0].props):x[0].props,j=w.barSize,N=w[g];o[N]||(o[N]=[]);var C=tn(j)?n:j;o[N].push({item:x[0],stackList:x.slice(1),barSize:tn(C)?void 0:bm(C,r,0)})}}return o},F3e=function(t){var n=t.barGap,r=t.barCategoryGap,a=t.bandSize,i=t.sizeList,o=i===void 0?[]:i,l=t.maxBarSize,c=o.length;if(c<1)return null;var d=bm(n,a,0,!0),m,u=[];if(o[0].barSize===+o[0].barSize){var h=!1,p=a/c,v=o.reduce(function(j,N){return j+N.barSize||0},0);v+=(c-1)*d,v>=a&&(v-=(c-1)*d,d=0),v>=a&&p>0&&(h=!0,p*=.9,v=c*p);var y=(a-v)/2>>0,g={offset:y-d,size:0};m=o.reduce(function(j,N){var C={item:N.item,position:{offset:g.offset+g.size+d,size:h?p:N.barSize}},P=[].concat(TR(j),[C]);return g=P[P.length-1].position,N.stackList&&N.stackList.length&&N.stackList.forEach(function(S){P.push({item:S,position:g})}),P},u)}else{var x=bm(r,a,0,!0);a-2*x-(c-1)*d<=0&&(d=0);var b=(a-2*x-(c-1)*d)/c;b>1&&(b>>=0);var w=l===+l?Math.min(b,l):b;m=o.reduce(function(j,N,C){var P=[].concat(TR(j),[{item:N.item,position:{offset:x+(b+d)*C+(b-w)/2,size:w}}]);return N.stackList&&N.stackList.length&&N.stackList.forEach(function(S){P.push({item:S,position:P[P.length-1].position})}),P},u)}return m},_3e=function(t,n,r,a){var i=r.children,o=r.width,l=r.margin,c=o-(l.left||0)-(l.right||0),d=pQ({children:i,legendWidth:c});if(d){var m=a||{},u=m.width,h=m.height,p=d.align,v=d.verticalAlign,y=d.layout;if((y==="vertical"||y==="horizontal"&&v==="middle")&&p!=="center"&&Ut(t[p]))return fr(fr({},t),{},Uh({},p,t[p]+(u||0)));if((y==="horizontal"||y==="vertical"&&p==="center")&&v!=="middle"&&Ut(t[v]))return fr(fr({},t),{},Uh({},v,t[v]+(h||0)))}return t},M3e=function(t,n,r){return tn(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},xQ=function(t,n,r,a,i){var o=n.props.children,l=Ki(o,_v).filter(function(d){return M3e(a,i,d.props.direction)});if(l&&l.length){var c=l.map(function(d){return d.props.dataKey});return t.reduce(function(d,m){var u=ki(m,r);if(tn(u))return d;var h=Array.isArray(u)?[Y1(u),G1(u)]:[u,u],p=c.reduce(function(v,y){var g=ki(m,y,0),x=h[0]-Math.abs(Array.isArray(g)?g[0]:g),b=h[1]+Math.abs(Array.isArray(g)?g[1]:g);return[Math.min(x,v[0]),Math.max(b,v[1])]},[1/0,-1/0]);return[Math.min(p[0],d[0]),Math.max(p[1],d[1])]},[1/0,-1/0])}return null},$3e=function(t,n,r,a,i){var o=n.map(function(l){return xQ(t,l,r,i,a)}).filter(function(l){return!tn(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},gQ=function(t,n,r,a,i){var o=n.map(function(c){var d=c.props.dataKey;return r==="number"&&d&&xQ(t,c,d,a)||Zx(t,d,r,i)});if(r==="number")return o.reduce(function(c,d){return[Math.min(c[0],d[0]),Math.max(c[1],d[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,d){for(var m=0,u=d.length;m<u;m++)l[d[m]]||(l[d[m]]=!0,c.push(d[m]));return c},[])},yQ=function(t,n){return t==="horizontal"&&n==="xAxis"||t==="vertical"&&n==="yAxis"||t==="centric"&&n==="angleAxis"||t==="radial"&&n==="radiusAxis"},vQ=function(t,n,r,a){if(a)return t.map(function(c){return c.coordinate});var i,o,l=t.map(function(c){return c.coordinate===n&&(i=!0),c.coordinate===r&&(o=!0),c.coordinate});return i||l.push(n),o||l.push(r),l},ec=function(t,n,r){if(!t)return null;var a=t.scale,i=t.duplicateDomain,o=t.type,l=t.range,c=t.realScaleType==="scaleBand"?a.bandwidth()/2:2,d=(n||r)&&o==="category"&&a.bandwidth?a.bandwidth()/c:0;if(d=t.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?Fo(l[0]-l[1])*2*d:d,n&&(t.ticks||t.niceTicks)){var m=(t.ticks||t.niceTicks).map(function(u){var h=i?i.indexOf(u):u;return{coordinate:a(h)+d,value:u,offset:d}});return m.filter(function(u){return!Pv(u.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(u,h){return{coordinate:a(u)+d,value:u,index:h,offset:d}}):a.ticks&&!r?a.ticks(t.tickCount).map(function(u){return{coordinate:a(u)+d,value:u,offset:d}}):a.domain().map(function(u,h){return{coordinate:a(u)+d,value:i?i[u]:u,index:h,offset:d}})},bk=new WeakMap,X0=function(t,n){if(typeof n!="function")return t;bk.has(t)||bk.set(t,new WeakMap);var r=bk.get(t);if(r.has(n))return r.get(n);var a=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,a),a},I3e=function(t,n,r){var a=t.scale,i=t.type,o=t.layout,l=t.axisType;if(a==="auto")return o==="radial"&&l==="radiusAxis"?{scale:Xg(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:fj(),realScaleType:"linear"}:i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:Xx(),realScaleType:"point"}:i==="category"?{scale:Xg(),realScaleType:"band"}:{scale:fj(),realScaleType:"linear"};if(vm(a)){var c="scale".concat(M1(a));return{scale:(SR[c]||Xx)(),realScaleType:SR[c]?c:"point"}}return Ks(a)?{scale:a}:{scale:Xx(),realScaleType:"point"}},FR=1e-4,R3e=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,a=t.range(),i=Math.min(a[0],a[1])-FR,o=Math.max(a[0],a[1])+FR,l=t(n[0]),c=t(n[r-1]);(l<i||l>o||c<i||c>o)&&t.domain([n[0],n[r-1]])}},B3e=function(t,n){if(!t)return null;for(var r=0,a=t.length;r<a;r++)if(t[r].item===n)return t[r].position;return null},L3e=function(t,n){if(!n||n.length!==2||!Ut(n[0])||!Ut(n[1]))return t;var r=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]),i=[t[0],t[1]];return(!Ut(t[0])||t[0]<r)&&(i[0]=r),(!Ut(t[1])||t[1]>a)&&(i[1]=a),i[0]>a&&(i[0]=a),i[1]<r&&(i[1]=r),i},U3e=function(t){var n=t.length;if(!(n<=0))for(var r=0,a=t[0].length;r<a;++r)for(var i=0,o=0,l=0;l<n;++l){var c=Pv(t[l][r][1])?t[l][r][0]:t[l][r][1];c>=0?(t[l][r][0]=i,t[l][r][1]=i+c,i=t[l][r][1]):(t[l][r][0]=o,t[l][r][1]=o+c,o=t[l][r][1])}},z3e=function(t){var n=t.length;if(!(n<=0))for(var r=0,a=t[0].length;r<a;++r)for(var i=0,o=0;o<n;++o){var l=Pv(t[o][r][1])?t[o][r][0]:t[o][r][1];l>=0?(t[o][r][0]=i,t[o][r][1]=i+l,i=t[o][r][1]):(t[o][r][0]=0,t[o][r][1]=0)}},q3e={sign:U3e,expand:OPe,none:Uf,silhouette:FPe,wiggle:_Pe,positive:z3e},W3e=function(t,n,r){var a=n.map(function(l){return l.props.dataKey}),i=q3e[r],o=TPe().keys(a).value(function(l,c){return+ki(l,c,0)}).order(EE).offset(i);return o(t)},H3e=function(t,n,r,a,i,o){if(!t)return null;var l=o?n.reverse():n,c={},d=l.reduce(function(u,h){var p,v=(p=h.type)!==null&&p!==void 0&&p.defaultProps?fr(fr({},h.type.defaultProps),h.props):h.props,y=v.stackId,g=v.hide;if(g)return u;var x=v[r],b=u[x]||{hasStack:!1,stackGroups:{}};if(zr(y)){var w=b.stackGroups[y]||{numericAxisId:r,cateAxisId:a,items:[]};w.items.push(h),b.hasStack=!0,b.stackGroups[y]=w}else b.stackGroups[Ev("_stackId_")]={numericAxisId:r,cateAxisId:a,items:[h]};return fr(fr({},u),{},Uh({},x,b))},c),m={};return Object.keys(d).reduce(function(u,h){var p=d[h];if(p.hasStack){var v={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(y,g){var x=p.stackGroups[g];return fr(fr({},y),{},Uh({},g,{numericAxisId:r,cateAxisId:a,items:x.items,stackedData:W3e(t,x.items,i)}))},v)}return fr(fr({},u),{},Uh({},h,p))},m)},V3e=function(t,n){var r=n.realScaleType,a=n.type,i=n.tickCount,o=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&a==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var d=t.domain();if(!d.length)return null;var m=n3e(d,i,l);return t.domain([Y1(m),G1(m)]),{niceTicks:m}}if(i&&a==="number"){var u=t.domain(),h=r3e(u,i,l);return{niceTicks:h}}return null};function _R(e){var t=e.axis,n=e.ticks,r=e.bandSize,a=e.entry,i=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!tn(a[t.dataKey])){var l=Ww(n,"value",a[t.dataKey]);if(l)return l.coordinate+r/2}return n[i]?n[i].coordinate+r/2:null}var c=ki(a,tn(o)?t.dataKey:o);return tn(c)?null:t.scale(c)}var MR=function(t){var n=t.axis,r=t.ticks,a=t.offset,i=t.bandSize,o=t.entry,l=t.index;if(n.type==="category")return r[l]?r[l].coordinate+a:null;var c=ki(o,n.dataKey,n.domain[l]);return tn(c)?null:n.scale(c)-i/2+a},K3e=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var a=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return a<=0&&i>=0?0:i<0?i:a}return r[0]},G3e=function(t,n){var r,a=(r=t.type)!==null&&r!==void 0&&r.defaultProps?fr(fr({},t.type.defaultProps),t.props):t.props,i=a.stackId;if(zr(i)){var o=n[i];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},Y3e=function(t){return t.reduce(function(n,r){return[Y1(r.concat([n[0]]).filter(Ut)),G1(r.concat([n[1]]).filter(Ut))]},[1/0,-1/0])},bQ=function(t,n,r){return Object.keys(t).reduce(function(a,i){var o=t[i],l=o.stackedData,c=l.reduce(function(d,m){var u=Y3e(m.slice(n,r+1));return[Math.min(d[0],u[0]),Math.max(d[1],u[1])]},[1/0,-1/0]);return[Math.min(c[0],a[0]),Math.max(c[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},$R=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,IR=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,rD=function(t,n,r){if(Ks(t))return t(n,r);if(!Array.isArray(t))return n;var a=[];if(Ut(t[0]))a[0]=r?t[0]:Math.min(t[0],n[0]);else if($R.test(t[0])){var i=+$R.exec(t[0])[1];a[0]=n[0]-i}else Ks(t[0])?a[0]=t[0](n[0]):a[0]=n[0];if(Ut(t[1]))a[1]=r?t[1]:Math.max(t[1],n[1]);else if(IR.test(t[1])){var o=+IR.exec(t[1])[1];a[1]=n[1]+o}else Ks(t[1])?a[1]=t[1](n[1]):a[1]=n[1];return a},wj=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!r||a>0)return a}if(t&&n&&n.length>=2){for(var i=JO(n,function(u){return u.coordinate}),o=1/0,l=1,c=i.length;l<c;l++){var d=i[l],m=i[l-1];o=Math.min((d.coordinate||0)-(m.coordinate||0),o)}return o===1/0?0:o}return r?void 0:0},RR=function(t,n,r){return!t||!t.length||Q1(t,Vi(r,"type.defaultProps.domain"))?n:t},wQ=function(t,n){var r=t.type.defaultProps?fr(fr({},t.type.defaultProps),t.props):t.props,a=r.dataKey,i=r.name,o=r.unit,l=r.formatter,c=r.tooltipType,d=r.chartType,m=r.hide;return fr(fr({},fn(t,!1)),{},{dataKey:a,unit:o,formatter:l,name:i||a,color:NF(t),value:ki(n,a),type:c,payload:n,chartType:d,hide:m})};function oy(e){"@babel/helpers - typeof";return oy=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},oy(e)}function BR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function LR(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?BR(Object(n),!0).forEach(function(r){Q3e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BR(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Q3e(e,t,n){return t=J3e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function J3e(e){var t=X3e(e,"string");return oy(t)=="symbol"?t:t+""}function X3e(e,t){if(oy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(oy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var jj=Math.PI/180,Z3e=function(t){return t*180/Math.PI},la=function(t,n,r,a){return{x:t+Math.cos(-jj*a)*r,y:n+Math.sin(-jj*a)*r}},e6e=function(t,n){var r=t.x,a=t.y,i=n.x,o=n.y;return Math.sqrt(Math.pow(r-i,2)+Math.pow(a-o,2))},t6e=function(t,n){var r=t.x,a=t.y,i=n.cx,o=n.cy,l=e6e({x:r,y:a},{x:i,y:o});if(l<=0)return{radius:l};var c=(r-i)/l,d=Math.acos(c);return a>o&&(d=2*Math.PI-d),{radius:l,angle:Z3e(d),angleInRadian:d}},s6e=function(t){var n=t.startAngle,r=t.endAngle,a=Math.floor(n/360),i=Math.floor(r/360),o=Math.min(a,i);return{startAngle:n-o*360,endAngle:r-o*360}},n6e=function(t,n){var r=n.startAngle,a=n.endAngle,i=Math.floor(r/360),o=Math.floor(a/360),l=Math.min(i,o);return t+l*360},UR=function(t,n){var r=t.x,a=t.y,i=t6e({x:r,y:a},n),o=i.radius,l=i.angle,c=n.innerRadius,d=n.outerRadius;if(o<c||o>d)return!1;if(o===0)return!0;var m=s6e(n),u=m.startAngle,h=m.endAngle,p=l,v;if(u<=h){for(;p>h;)p-=360;for(;p<u;)p+=360;v=p>=u&&p<=h}else{for(;p>u;)p-=360;for(;p<h;)p+=360;v=p>=h&&p<=u}return v?LR(LR({},n),{},{radius:o,angle:n6e(p,n)}):null};function ly(e){"@babel/helpers - typeof";return ly=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},ly(e)}var r6e=["offset"];function a6e(e){return c6e(e)||l6e(e)||o6e(e)||i6e()}function i6e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
787In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o6e(e,t){if(e){if(typeof e=="string")return aD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return aD(e,t)}}function l6e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c6e(e){if(Array.isArray(e))return aD(e)}function aD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function d6e(e,t){if(e==null)return{};var n=u6e(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function u6e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function zR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Fr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zR(Object(n),!0).forEach(function(r){m6e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zR(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function m6e(e,t,n){return t=h6e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h6e(e){var t=f6e(e,"string");return ly(t)=="symbol"?t:t+""}function f6e(e,t){if(ly(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ly(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cy(){return cy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cy.apply(this,arguments)}var p6e=function(t){var n=t.value,r=t.formatter,a=tn(t.children)?n:t.children;return Ks(r)?r(a):a},x6e=function(t,n){var r=Fo(n-t),a=Math.min(Math.abs(n-t),360);return r*a},g6e=function(t,n,r){var a=t.position,i=t.viewBox,o=t.offset,l=t.className,c=i,d=c.cx,m=c.cy,u=c.innerRadius,h=c.outerRadius,p=c.startAngle,v=c.endAngle,y=c.clockWise,g=(u+h)/2,x=x6e(p,v),b=x>=0?1:-1,w,j;a==="insideStart"?(w=p+b*o,j=y):a==="insideEnd"?(w=v-b*o,j=!y):a==="end"&&(w=v+b*o,j=y),j=x<=0?j:!j;var N=la(d,m,g,w),C=la(d,m,g,w+(j?1:-1)*359),P="M".concat(N.x,",").concat(N.y,`
788    A`).concat(g,",").concat(g,",0,1,").concat(j?0:1,`,
789    `).concat(C.x,",").concat(C.y),S=tn(t.id)?Ev("recharts-radial-line-"):t.id;return he.createElement("text",cy({},r,{dominantBaseline:"central",className:pn("recharts-radial-bar-label",l)}),he.createElement("defs",null,he.createElement("path",{id:S,d:P})),he.createElement("textPath",{xlinkHref:"#".concat(S)},n))},y6e=function(t){var n=t.viewBox,r=t.offset,a=t.position,i=n,o=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,m=i.startAngle,u=i.endAngle,h=(m+u)/2;if(a==="outside"){var p=la(o,l,d+r,h),v=p.x,y=p.y;return{x:v,y,textAnchor:v>=o?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var g=(c+d)/2,x=la(o,l,g,h),b=x.x,w=x.y;return{x:b,y:w,textAnchor:"middle",verticalAnchor:"middle"}},v6e=function(t){var n=t.viewBox,r=t.parentViewBox,a=t.offset,i=t.position,o=n,l=o.x,c=o.y,d=o.width,m=o.height,u=m>=0?1:-1,h=u*a,p=u>0?"end":"start",v=u>0?"start":"end",y=d>=0?1:-1,g=y*a,x=y>0?"end":"start",b=y>0?"start":"end";if(i==="top"){var w={x:l+d/2,y:c-u*a,textAnchor:"middle",verticalAnchor:p};return Fr(Fr({},w),r?{height:Math.max(c-r.y,0),width:d}:{})}if(i==="bottom"){var j={x:l+d/2,y:c+m+h,textAnchor:"middle",verticalAnchor:v};return Fr(Fr({},j),r?{height:Math.max(r.y+r.height-(c+m),0),width:d}:{})}if(i==="left"){var N={x:l-g,y:c+m/2,textAnchor:x,verticalAnchor:"middle"};return Fr(Fr({},N),r?{width:Math.max(N.x-r.x,0),height:m}:{})}if(i==="right"){var C={x:l+d+g,y:c+m/2,textAnchor:b,verticalAnchor:"middle"};return Fr(Fr({},C),r?{width:Math.max(r.x+r.width-C.x,0),height:m}:{})}var P=r?{width:d,height:m}:{};return i==="insideLeft"?Fr({x:l+g,y:c+m/2,textAnchor:b,verticalAnchor:"middle"},P):i==="insideRight"?Fr({x:l+d-g,y:c+m/2,textAnchor:x,verticalAnchor:"middle"},P):i==="insideTop"?Fr({x:l+d/2,y:c+h,textAnchor:"middle",verticalAnchor:v},P):i==="insideBottom"?Fr({x:l+d/2,y:c+m-h,textAnchor:"middle",verticalAnchor:p},P):i==="insideTopLeft"?Fr({x:l+g,y:c+h,textAnchor:b,verticalAnchor:v},P):i==="insideTopRight"?Fr({x:l+d-g,y:c+h,textAnchor:x,verticalAnchor:v},P):i==="insideBottomLeft"?Fr({x:l+g,y:c+m-h,textAnchor:b,verticalAnchor:p},P):i==="insideBottomRight"?Fr({x:l+d-g,y:c+m-h,textAnchor:x,verticalAnchor:p},P):Cp(i)&&(Ut(i.x)||bu(i.x))&&(Ut(i.y)||bu(i.y))?Fr({x:l+bm(i.x,d),y:c+bm(i.y,m),textAnchor:"end",verticalAnchor:"end"},P):Fr({x:l+d/2,y:c+m/2,textAnchor:"middle",verticalAnchor:"middle"},P)},b6e=function(t){return"cx"in t&&Ut(t.cx)};function ga(e){var t=e.offset,n=t===void 0?5:t,r=d6e(e,r6e),a=Fr({offset:n},r),i=a.viewBox,o=a.position,l=a.value,c=a.children,d=a.content,m=a.className,u=m===void 0?"":m,h=a.textBreakAll;if(!i||tn(l)&&tn(c)&&!f.isValidElement(d)&&!Ks(d))return null;if(f.isValidElement(d))return f.cloneElement(d,a);var p;if(Ks(d)){if(p=f.createElement(d,a),f.isValidElement(p))return p}else p=p6e(a);var v=b6e(i),y=fn(a,!0);if(v&&(o==="insideStart"||o==="insideEnd"||o==="end"))return g6e(a,p,y);var g=v?y6e(a):v6e(a);return he.createElement(ij,cy({className:pn("recharts-label",u)},y,g,{breakAll:h}),p)}ga.displayName="Label";var jQ=function(t){var n=t.cx,r=t.cy,a=t.angle,i=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,d=t.innerRadius,m=t.outerRadius,u=t.x,h=t.y,p=t.top,v=t.left,y=t.width,g=t.height,x=t.clockWise,b=t.labelViewBox;if(b)return b;if(Ut(y)&&Ut(g)){if(Ut(u)&&Ut(h))return{x:u,y:h,width:y,height:g};if(Ut(p)&&Ut(v))return{x:p,y:v,width:y,height:g}}return Ut(u)&&Ut(h)?{x:u,y:h,width:0,height:0}:Ut(n)&&Ut(r)?{cx:n,cy:r,startAngle:i||a||0,endAngle:o||a||0,innerRadius:d||0,outerRadius:m||c||l||0,clockWise:x}:t.viewBox?t.viewBox:{}},w6e=function(t,n){return t?t===!0?he.createElement(ga,{key:"label-implicit",viewBox:n}):zr(t)?he.createElement(ga,{key:"label-implicit",viewBox:n,value:t}):f.isValidElement(t)?t.type===ga?f.cloneElement(t,{key:"label-implicit",viewBox:n}):he.createElement(ga,{key:"label-implicit",content:t,viewBox:n}):Ks(t)?he.createElement(ga,{key:"label-implicit",content:t,viewBox:n}):Cp(t)?he.createElement(ga,cy({viewBox:n},t,{key:"label-implicit"})):null:null},j6e=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var a=t.children,i=jQ(t),o=Ki(a,ga).map(function(c,d){return f.cloneElement(c,{viewBox:n||i,key:"label-".concat(d)})});if(!r)return o;var l=w6e(t.label,n||i);return[l].concat(a6e(o))};ga.parseViewBox=jQ;ga.renderCallByParent=j6e;function N6e(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var C6e=N6e;const S6e=Qs(C6e);function dy(e){"@babel/helpers - typeof";return dy=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},dy(e)}var k6e=["valueAccessor"],P6e=["data","dataKey","clockWise","id","textBreakAll"];function E6e(e){return O6e(e)||T6e(e)||A6e(e)||D6e()}function D6e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
790In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A6e(e,t){if(e){if(typeof e=="string")return iD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return iD(e,t)}}function T6e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function O6e(e){if(Array.isArray(e))return iD(e)}function iD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Nj(){return Nj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nj.apply(this,arguments)}function qR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function WR(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qR(Object(n),!0).forEach(function(r){F6e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qR(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function F6e(e,t,n){return t=_6e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _6e(e){var t=M6e(e,"string");return dy(t)=="symbol"?t:t+""}function M6e(e,t){if(dy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(dy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function HR(e,t){if(e==null)return{};var n=$6e(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $6e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var I6e=function(t){return Array.isArray(t.value)?S6e(t.value):t.value};function kd(e){var t=e.valueAccessor,n=t===void 0?I6e:t,r=HR(e,k6e),a=r.data,i=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,d=HR(r,P6e);return!a||!a.length?null:he.createElement(wr,{className:"recharts-label-list"},a.map(function(m,u){var h=tn(i)?n(m,u):ki(m&&m.payload,i),p=tn(l)?{}:{id:"".concat(l,"-").concat(u)};return he.createElement(ga,Nj({},fn(m,!0),d,p,{parentViewBox:m.parentViewBox,value:h,textBreakAll:c,viewBox:ga.parseViewBox(tn(o)?m:WR(WR({},m),{},{clockWise:o})),key:"label-".concat(u),index:u}))}))}kd.displayName="LabelList";function R6e(e,t){return e?e===!0?he.createElement(kd,{key:"labelList-implicit",data:t}):he.isValidElement(e)||Ks(e)?he.createElement(kd,{key:"labelList-implicit",data:t,content:e}):Cp(e)?he.createElement(kd,Nj({data:t},e,{key:"labelList-implicit"})):null:null}function B6e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,a=Ki(r,kd).map(function(o,l){return f.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!n)return a;var i=R6e(e.label,t);return[i].concat(E6e(a))}kd.renderCallByParent=B6e;function uy(e){"@babel/helpers - typeof";return uy=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},uy(e)}function oD(){return oD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},oD.apply(this,arguments)}function VR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function KR(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?VR(Object(n),!0).forEach(function(r){L6e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VR(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function L6e(e,t,n){return t=U6e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function U6e(e){var t=z6e(e,"string");return uy(t)=="symbol"?t:t+""}function z6e(e,t){if(uy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(uy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var q6e=function(t,n){var r=Fo(n-t),a=Math.min(Math.abs(n-t),359.999);return r*a},Z0=function(t){var n=t.cx,r=t.cy,a=t.radius,i=t.angle,o=t.sign,l=t.isExternal,c=t.cornerRadius,d=t.cornerIsExternal,m=c*(l?1:-1)+a,u=Math.asin(c/m)/jj,h=d?i:i+o*u,p=la(n,r,m,h),v=la(n,r,a,h),y=d?i-o*u:i,g=la(n,r,m*Math.cos(u*jj),y);return{center:p,circleTangency:v,lineTangency:g,theta:u}},NQ=function(t){var n=t.cx,r=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.startAngle,l=t.endAngle,c=q6e(o,l),d=o+c,m=la(n,r,i,o),u=la(n,r,i,d),h="M ".concat(m.x,",").concat(m.y,`
791    A `).concat(i,",").concat(i,`,0,
792    `).concat(+(Math.abs(c)>180),",").concat(+(o>d),`,
793    `).concat(u.x,",").concat(u.y,`
794  `);if(a>0){var p=la(n,r,a,o),v=la(n,r,a,d);h+="L ".concat(v.x,",").concat(v.y,`
795            A `).concat(a,",").concat(a,`,0,
796            `).concat(+(Math.abs(c)>180),",").concat(+(o<=d),`,
797            `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(n,",").concat(r," Z");return h},W6e=function(t){var n=t.cx,r=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,d=t.startAngle,m=t.endAngle,u=Fo(m-d),h=Z0({cx:n,cy:r,radius:i,angle:d,sign:u,cornerRadius:o,cornerIsExternal:c}),p=h.circleTangency,v=h.lineTangency,y=h.theta,g=Z0({cx:n,cy:r,radius:i,angle:m,sign:-u,cornerRadius:o,cornerIsExternal:c}),x=g.circleTangency,b=g.lineTangency,w=g.theta,j=c?Math.abs(d-m):Math.abs(d-m)-y-w;if(j<0)return l?"M ".concat(v.x,",").concat(v.y,`
798        a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
799        a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
800      `):NQ({cx:n,cy:r,innerRadius:a,outerRadius:i,startAngle:d,endAngle:m});var N="M ".concat(v.x,",").concat(v.y,`
801    A`).concat(o,",").concat(o,",0,0,").concat(+(u<0),",").concat(p.x,",").concat(p.y,`
802    A`).concat(i,",").concat(i,",0,").concat(+(j>180),",").concat(+(u<0),",").concat(x.x,",").concat(x.y,`
803    A`).concat(o,",").concat(o,",0,0,").concat(+(u<0),",").concat(b.x,",").concat(b.y,`
804  `);if(a>0){var C=Z0({cx:n,cy:r,radius:a,angle:d,sign:u,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),P=C.circleTangency,S=C.lineTangency,E=C.theta,T=Z0({cx:n,cy:r,radius:a,angle:m,sign:-u,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),z=T.circleTangency,O=T.lineTangency,D=T.theta,k=c?Math.abs(d-m):Math.abs(d-m)-E-D;if(k<0&&o===0)return"".concat(N,"L").concat(n,",").concat(r,"Z");N+="L".concat(O.x,",").concat(O.y,`
805      A`).concat(o,",").concat(o,",0,0,").concat(+(u<0),",").concat(z.x,",").concat(z.y,`
806      A`).concat(a,",").concat(a,",0,").concat(+(k>180),",").concat(+(u>0),",").concat(P.x,",").concat(P.y,`
807      A`).concat(o,",").concat(o,",0,0,").concat(+(u<0),",").concat(S.x,",").concat(S.y,"Z")}else N+="L".concat(n,",").concat(r,"Z");return N},H6e={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},CQ=function(t){var n=KR(KR({},H6e),t),r=n.cx,a=n.cy,i=n.innerRadius,o=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,d=n.cornerIsExternal,m=n.startAngle,u=n.endAngle,h=n.className;if(o<i||m===u)return null;var p=pn("recharts-sector",h),v=o-i,y=bm(l,v,0,!0),g;return y>0&&Math.abs(m-u)<360?g=W6e({cx:r,cy:a,innerRadius:i,outerRadius:o,cornerRadius:Math.min(y,v/2),forceCornerRadius:c,cornerIsExternal:d,startAngle:m,endAngle:u}):g=NQ({cx:r,cy:a,innerRadius:i,outerRadius:o,startAngle:m,endAngle:u}),he.createElement("path",oD({},fn(n,!0),{className:p,d:g,role:"img"}))};function my(e){"@babel/helpers - typeof";return my=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},my(e)}function lD(){return lD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},lD.apply(this,arguments)}function GR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function YR(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?GR(Object(n),!0).forEach(function(r){V6e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GR(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function V6e(e,t,n){return t=K6e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K6e(e){var t=G6e(e,"string");return my(t)=="symbol"?t:t+""}function G6e(e,t){if(my(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(my(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var QR={curveBasisClosed:bPe,curveBasisOpen:wPe,curveBasis:vPe,curveBumpX:aPe,curveBumpY:iPe,curveLinearClosed:jPe,curveLinear:I1,curveMonotoneX:NPe,curveMonotoneY:CPe,curveNatural:SPe,curveStep:kPe,curveStepAfter:EPe,curveStepBefore:PPe},eb=function(t){return t.x===+t.x&&t.y===+t.y},mx=function(t){return t.x},hx=function(t){return t.y},Y6e=function(t,n){if(Ks(t))return t;var r="curve".concat(M1(t));return(r==="curveMonotone"||r==="curveBump")&&n?QR["".concat(r).concat(n==="vertical"?"Y":"X")]:QR[r]||I1},Q6e=function(t){var n=t.type,r=n===void 0?"linear":n,a=t.points,i=a===void 0?[]:a,o=t.baseLine,l=t.layout,c=t.connectNulls,d=c===void 0?!1:c,m=Y6e(r,l),u=d?i.filter(function(y){return eb(y)}):i,h;if(Array.isArray(o)){var p=d?o.filter(function(y){return eb(y)}):o,v=u.map(function(y,g){return YR(YR({},y),{},{base:p[g]})});return l==="vertical"?h=W0().y(hx).x1(mx).x0(function(y){return y.base.x}):h=W0().x(mx).y1(hx).y0(function(y){return y.base.y}),h.defined(eb).curve(m),h(v)}return l==="vertical"&&Ut(o)?h=W0().y(hx).x1(mx).x0(o):Ut(o)?h=W0().x(mx).y1(hx).y0(o):h=kG().x(mx).y(hx),h.defined(eb).curve(m),h(u)},cD=function(t){var n=t.className,r=t.points,a=t.path,i=t.pathRef;if((!r||!r.length)&&!a)return null;var o=r&&r.length?Q6e(t):a;return f.createElement("path",lD({},fn(t,!1),Hw(t),{className:pn("recharts-curve",n),d:o,ref:i}))};const{getOwnPropertyNames:J6e,getOwnPropertySymbols:X6e}=Object,{hasOwnProperty:Z6e}=Object.prototype;function wk(e,t){return function(r,a,i){return e(r,a,i)&&t(r,a,i)}}function tb(e){return function(n,r,a){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,a);const{cache:i}=a,o=i.get(n),l=i.get(r);if(o&&l)return o===r&&l===n;i.set(n,r),i.set(r,n);const c=e(n,r,a);return i.delete(n),i.delete(r),c}}function eRe(e){return e!=null?e[Symbol.toStringTag]:void 0}function JR(e){return J6e(e).concat(X6e(e))}const tRe=Object.hasOwn||((e,t)=>Z6e.call(e,t));function Tm(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const sRe="__v",nRe="__o",rRe="_owner",{getOwnPropertyDescriptor:XR,keys:ZR}=Object;function aRe(e,t){return e.byteLength===t.byteLength&&Cj(new Uint8Array(e),new Uint8Array(t))}function iRe(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function oRe(e,t){return e.byteLength===t.byteLength&&Cj(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function lRe(e,t){return Tm(e.getTime(),t.getTime())}function cRe(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function dRe(e,t){return e===t}function eB(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const a=new Array(r),i=e.entries();let o,l,c=0;for(;(o=i.next())&&!o.done;){const d=t.entries();let m=!1,u=0;for(;(l=d.next())&&!l.done;){if(a[u]){u++;continue}const h=o.value,p=l.value;if(n.equals(h[0],p[0],c,u,e,t,n)&&n.equals(h[1],p[1],h[0],p[0],e,t,n)){m=a[u]=!0;break}u++}if(!m)return!1;c++}return!0}const uRe=Tm;function mRe(e,t,n){const r=ZR(e);let a=r.length;if(ZR(t).length!==a)return!1;for(;a-- >0;)if(!SQ(e,t,n,r[a]))return!1;return!0}function fx(e,t,n){const r=JR(e);let a=r.length;if(JR(t).length!==a)return!1;let i,o,l;for(;a-- >0;)if(i=r[a],!SQ(e,t,n,i)||(o=XR(e,i),l=XR(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function hRe(e,t){return Tm(e.valueOf(),t.valueOf())}function fRe(e,t){return e.source===t.source&&e.flags===t.flags}function tB(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const a=new Array(r),i=e.values();let o,l;for(;(o=i.next())&&!o.done;){const c=t.values();let d=!1,m=0;for(;(l=c.next())&&!l.done;){if(!a[m]&&n.equals(o.value,l.value,o.value,l.value,e,t,n)){d=a[m]=!0;break}m++}if(!d)return!1}return!0}function Cj(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function pRe(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function SQ(e,t,n,r){return(r===rRe||r===nRe||r===sRe)&&(e.$$typeof||t.$$typeof)?!0:tRe(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const xRe="[object ArrayBuffer]",gRe="[object Arguments]",yRe="[object Boolean]",vRe="[object DataView]",bRe="[object Date]",wRe="[object Error]",jRe="[object Map]",NRe="[object Number]",CRe="[object Object]",SRe="[object RegExp]",kRe="[object Set]",PRe="[object String]",ERe={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},DRe="[object URL]",ARe=Object.prototype.toString;function TRe({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:d,areRegExpsEqual:m,areSetsEqual:u,areTypedArraysEqual:h,areUrlsEqual:p,unknownTagComparators:v}){return function(g,x,b){if(g===x)return!0;if(g==null||x==null)return!1;const w=typeof g;if(w!==typeof x)return!1;if(w!=="object")return w==="number"?l(g,x,b):w==="function"?i(g,x,b):!1;const j=g.constructor;if(j!==x.constructor)return!1;if(j===Object)return c(g,x,b);if(Array.isArray(g))return t(g,x,b);if(j===Date)return r(g,x,b);if(j===RegExp)return m(g,x,b);if(j===Map)return o(g,x,b);if(j===Set)return u(g,x,b);const N=ARe.call(g);if(N===bRe)return r(g,x,b);if(N===SRe)return m(g,x,b);if(N===jRe)return o(g,x,b);if(N===kRe)return u(g,x,b);if(N===CRe)return typeof g.then!="function"&&typeof x.then!="function"&&c(g,x,b);if(N===DRe)return p(g,x,b);if(N===wRe)return a(g,x,b);if(N===gRe)return c(g,x,b);if(ERe[N])return h(g,x,b);if(N===xRe)return e(g,x,b);if(N===vRe)return n(g,x,b);if(N===yRe||N===NRe||N===PRe)return d(g,x,b);if(v){let C=v[N];if(!C){const P=eRe(g);P&&(C=v[P])}if(C)return C(g,x,b)}return!1}}function ORe({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:aRe,areArraysEqual:n?fx:iRe,areDataViewsEqual:oRe,areDatesEqual:lRe,areErrorsEqual:cRe,areFunctionsEqual:dRe,areMapsEqual:n?wk(eB,fx):eB,areNumbersEqual:uRe,areObjectsEqual:n?fx:mRe,arePrimitiveWrappersEqual:hRe,areRegExpsEqual:fRe,areSetsEqual:n?wk(tB,fx):tB,areTypedArraysEqual:n?wk(Cj,fx):Cj,areUrlsEqual:pRe,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const a=tb(r.areArraysEqual),i=tb(r.areMapsEqual),o=tb(r.areObjectsEqual),l=tb(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return r}function FRe(e){return function(t,n,r,a,i,o,l){return e(t,n,l)}}function _Re({circular:e,comparator:t,createState:n,equals:r,strict:a}){if(n)return function(l,c){const{cache:d=e?new WeakMap:void 0,meta:m}=n();return t(l,c,{cache:d,equals:r,meta:m,strict:a})};if(e)return function(l,c){return t(l,c,{cache:new WeakMap,equals:r,meta:void 0,strict:a})};const i={cache:void 0,equals:r,meta:void 0,strict:a};return function(l,c){return t(l,c,i)}}const MRe=Jd();Jd({strict:!0});Jd({circular:!0});Jd({circular:!0,strict:!0});Jd({createInternalComparator:()=>Tm});Jd({strict:!0,createInternalComparator:()=>Tm});Jd({circular:!0,createInternalComparator:()=>Tm});Jd({circular:!0,createInternalComparator:()=>Tm,strict:!0});function Jd(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:a=!1}=e,i=ORe(e),o=TRe(i),l=n?n(o):FRe(o);return _Re({circular:t,comparator:o,createState:r,equals:l,strict:a})}function $Re(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function sB(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function a(i){n<0&&(n=i),i-n>t?(e(i),n=-1):$Re(a)};requestAnimationFrame(r)}function dD(e){"@babel/helpers - typeof";return dD=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},dD(e)}function IRe(e){return URe(e)||LRe(e)||BRe(e)||RRe()}function RRe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
808In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BRe(e,t){if(e){if(typeof e=="string")return nB(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nB(e,t)}}function nB(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function LRe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function URe(e){if(Array.isArray(e))return e}function zRe(){var e={},t=function(){return null},n=!1,r=function a(i){if(!n){if(Array.isArray(i)){if(!i.length)return;var o=i,l=IRe(o),c=l[0],d=l.slice(1);if(typeof c=="number"){sB(a.bind(null,d),c);return}a(c),sB(a.bind(null,d));return}dD(i)==="object"&&(e=i,t(e)),typeof i=="function"&&i()}};return{stop:function(){n=!0},start:function(i){n=!1,r(i)},subscribe:function(i){return t=i,function(){t=function(){return null}}}}}function hy(e){"@babel/helpers - typeof";return hy=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},hy(e)}function rB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function aB(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rB(Object(n),!0).forEach(function(r){kQ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function kQ(e,t,n){return t=qRe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qRe(e){var t=WRe(e,"string");return hy(t)==="symbol"?t:String(t)}function WRe(e,t){if(hy(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hy(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var HRe=function(t,n){return[Object.keys(t),Object.keys(n)].reduce(function(r,a){return r.filter(function(i){return a.includes(i)})})},VRe=function(t){return t},KRe=function(t){return t.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},eg=function(t,n){return Object.keys(n).reduce(function(r,a){return aB(aB({},r),{},kQ({},a,t(a,n[a])))},{})},iB=function(t,n,r){return t.map(function(a){return"".concat(KRe(a)," ").concat(n,"ms ").concat(r)}).join(",")};function GRe(e,t){return JRe(e)||QRe(e,t)||PQ(e,t)||YRe()}function YRe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
809In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QRe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(m){d=!0,a=m}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function JRe(e){if(Array.isArray(e))return e}function XRe(e){return tBe(e)||eBe(e)||PQ(e)||ZRe()}function ZRe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
810In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PQ(e,t){if(e){if(typeof e=="string")return uD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uD(e,t)}}function eBe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function tBe(e){if(Array.isArray(e))return uD(e)}function uD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Sj=1e-4,EQ=function(t,n){return[0,3*t,3*n-6*t,3*t-3*n+1]},DQ=function(t,n){return t.map(function(r,a){return r*Math.pow(n,a)}).reduce(function(r,a){return r+a})},oB=function(t,n){return function(r){var a=EQ(t,n);return DQ(a,r)}},sBe=function(t,n){return function(r){var a=EQ(t,n),i=[].concat(XRe(a.map(function(o,l){return o*l}).slice(1)),[0]);return DQ(i,r)}},lB=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=n[0],i=n[1],o=n[2],l=n[3];if(n.length===1)switch(n[0]){case"linear":a=0,i=0,o=1,l=1;break;case"ease":a=.25,i=.1,o=.25,l=1;break;case"ease-in":a=.42,i=0,o=1,l=1;break;case"ease-out":a=.42,i=0,o=.58,l=1;break;case"ease-in-out":a=0,i=0,o=.58,l=1;break;default:{var c=n[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var d=c[1].split(")")[0].split(",").map(function(g){return parseFloat(g)}),m=GRe(d,4);a=m[0],i=m[1],o=m[2],l=m[3]}}}var u=oB(a,o),h=oB(i,l),p=sBe(a,o),v=function(x){return x>1?1:x<0?0:x},y=function(x){for(var b=x>1?1:x,w=b,j=0;j<8;++j){var N=u(w)-b,C=p(w);if(Math.abs(N-b)<Sj||C<Sj)return h(w);w=v(w-N/C)}return h(w)};return y.isStepper=!1,y},nBe=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,a=t.damping,i=a===void 0?8:a,o=t.dt,l=o===void 0?17:o,c=function(m,u,h){var p=-(m-u)*r,v=h*i,y=h+(p-v)*l/1e3,g=h*l/1e3+m;return Math.abs(g-u)<Sj&&Math.abs(y)<Sj?[u,0]:[g,y]};return c.isStepper=!0,c.dt=l,c},rBe=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=n[0];if(typeof a=="string")switch(a){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return lB(a);case"spring":return nBe();default:if(a.split("(")[0]==="cubic-bezier")return lB(a)}return typeof a=="function"?a:null};function fy(e){"@babel/helpers - typeof";return fy=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},fy(e)}function cB(e){return oBe(e)||iBe(e)||AQ(e)||aBe()}function aBe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
811In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iBe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function oBe(e){if(Array.isArray(e))return hD(e)}function dB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function aa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dB(Object(n),!0).forEach(function(r){mD(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function mD(e,t,n){return t=lBe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lBe(e){var t=cBe(e,"string");return fy(t)==="symbol"?t:String(t)}function cBe(e,t){if(fy(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fy(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dBe(e,t){return hBe(e)||mBe(e,t)||AQ(e,t)||uBe()}function uBe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
812In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function AQ(e,t){if(e){if(typeof e=="string")return hD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hD(e,t)}}function hD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function mBe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(m){d=!0,a=m}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function hBe(e){if(Array.isArray(e))return e}var kj=function(t,n,r){return t+(n-t)*r},fD=function(t){var n=t.from,r=t.to;return n!==r},fBe=function e(t,n,r){var a=eg(function(i,o){if(fD(o)){var l=t(o.from,o.to,o.velocity),c=dBe(l,2),d=c[0],m=c[1];return aa(aa({},o),{},{from:d,velocity:m})}return o},n);return r<1?eg(function(i,o){return fD(o)?aa(aa({},o),{},{velocity:kj(o.velocity,a[i].velocity,r),from:kj(o.from,a[i].from,r)}):o},n):e(t,a,r-1)};const pBe=function(e,t,n,r,a){var i=HRe(e,t),o=i.reduce(function(g,x){return aa(aa({},g),{},mD({},x,[e[x],t[x]]))},{}),l=i.reduce(function(g,x){return aa(aa({},g),{},mD({},x,{from:e[x],velocity:0,to:t[x]}))},{}),c=-1,d,m,u=function(){return null},h=function(){return eg(function(x,b){return b.from},l)},p=function(){return!Object.values(l).filter(fD).length},v=function(x){d||(d=x);var b=x-d,w=b/n.dt;l=fBe(n,l,w),a(aa(aa(aa({},e),t),h())),d=x,p()||(c=requestAnimationFrame(u))},y=function(x){m||(m=x);var b=(x-m)/r,w=eg(function(N,C){return kj.apply(void 0,cB(C).concat([n(b)]))},o);if(a(aa(aa(aa({},e),t),w)),b<1)c=requestAnimationFrame(u);else{var j=eg(function(N,C){return kj.apply(void 0,cB(C).concat([n(1)]))},o);a(aa(aa(aa({},e),t),j))}};return u=n.isStepper?v:y,function(){return requestAnimationFrame(u),function(){cancelAnimationFrame(c)}}};function Qf(e){"@babel/helpers - typeof";return Qf=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},Qf(e)}var xBe=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function gBe(e,t){if(e==null)return{};var n=yBe(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yBe(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function jk(e){return jBe(e)||wBe(e)||bBe(e)||vBe()}function vBe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
813In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bBe(e,t){if(e){if(typeof e=="string")return pD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pD(e,t)}}function wBe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function jBe(e){if(Array.isArray(e))return pD(e)}function pD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function uB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function io(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uB(Object(n),!0).forEach(function(r){Ex(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ex(e,t,n){return t=TQ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function NBe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function CBe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,TQ(r.key),r)}}function SBe(e,t,n){return t&&CBe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function TQ(e){var t=kBe(e,"string");return Qf(t)==="symbol"?t:String(t)}function kBe(e,t){if(Qf(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qf(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function PBe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xD(e,t)}function xD(e,t){return xD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},xD(e,t)}function EBe(e){var t=DBe();return function(){var r=Pj(e),a;if(t){var i=Pj(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return gD(this,a)}}function gD(e,t){if(t&&(Qf(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yD(e)}function yD(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function DBe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Pj(e){return Pj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Pj(e)}var vc=function(e){PBe(n,e);var t=EBe(n);function n(r,a){var i;NBe(this,n),i=t.call(this,r,a);var o=i.props,l=o.isActive,c=o.attributeName,d=o.from,m=o.to,u=o.steps,h=o.children,p=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind(yD(i)),i.changeStyle=i.changeStyle.bind(yD(i)),!l||p<=0)return i.state={style:{}},typeof h=="function"&&(i.state={style:m}),gD(i);if(u&&u.length)i.state={style:u[0].style};else if(d){if(typeof h=="function")return i.state={style:d},gD(i);i.state={style:c?Ex({},c,d):d}}else i.state={style:{}};return i}return SBe(n,[{key:"componentDidMount",value:function(){var a=this.props,i=a.isActive,o=a.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var i=this.props,o=i.isActive,l=i.canBegin,c=i.attributeName,d=i.shouldReAnimate,m=i.to,u=i.from,h=this.state.style;if(l){if(!o){var p={style:c?Ex({},c,m):m};this.state&&h&&(c&&h[c]!==m||!c&&h!==m)&&this.setState(p);return}if(!(MRe(a.to,m)&&a.canBegin&&a.isActive)){var v=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var y=v||d?u:a.to;if(this.state&&h){var g={style:c?Ex({},c,y):y};(c&&h[c]!==y||!c&&h!==y)&&this.setState(g)}this.runAnimation(io(io({},this.props),{},{from:y,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var i=this,o=a.from,l=a.to,c=a.duration,d=a.easing,m=a.begin,u=a.onAnimationEnd,h=a.onAnimationStart,p=pBe(o,l,rBe(d),c,this.changeStyle),v=function(){i.stopJSAnimation=p()};this.manager.start([h,m,v,c,u])}},{key:"runStepAnimation",value:function(a){var i=this,o=a.steps,l=a.begin,c=a.onAnimationStart,d=o[0],m=d.style,u=d.duration,h=u===void 0?0:u,p=function(y,g,x){if(x===0)return y;var b=g.duration,w=g.easing,j=w===void 0?"ease":w,N=g.style,C=g.properties,P=g.onAnimationEnd,S=x>0?o[x-1]:g,E=C||Object.keys(N);if(typeof j=="function"||j==="spring")return[].concat(jk(y),[i.runJSAnimation.bind(i,{from:S.style,to:N,duration:b,easing:j}),b]);var T=iB(E,b,j),z=io(io(io({},S.style),N),{},{transition:T});return[].concat(jk(y),[z,b,P]).filter(VRe)};return this.manager.start([c].concat(jk(o.reduce(p,[m,Math.max(h,l)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=zRe());var i=a.begin,o=a.duration,l=a.attributeName,c=a.to,d=a.easing,m=a.onAnimationStart,u=a.onAnimationEnd,h=a.steps,p=a.children,v=this.manager;if(this.unSubscribe=v.subscribe(this.handleStyleChange),typeof d=="function"||typeof p=="function"||d==="spring"){this.runJSAnimation(a);return}if(h.length>1){this.runStepAnimation(a);return}var y=l?Ex({},l,c):c,g=iB(Object.keys(y),o,d);v.start([m,i,io(io({},y),{},{transition:g}),o,u])}},{key:"render",value:function(){var a=this.props,i=a.children;a.begin;var o=a.duration;a.attributeName,a.easing;var l=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var c=gBe(a,xBe),d=f.Children.count(i),m=this.state.style;if(typeof i=="function")return i(m);if(!l||d===0||o<=0)return i;var u=function(p){var v=p.props,y=v.style,g=y===void 0?{}:y,x=v.className,b=f.cloneElement(p,io(io({},c),{},{style:io(io({},g),m),className:x}));return b};return d===1?u(f.Children.only(i)):he.createElement("div",null,f.Children.map(i,function(h){return u(h)}))}}]),n}(f.PureComponent);vc.displayName="Animate";vc.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};vc.propTypes={from:vs.oneOfType([vs.object,vs.string]),to:vs.oneOfType([vs.object,vs.string]),attributeName:vs.string,duration:vs.number,begin:vs.number,easing:vs.oneOfType([vs.string,vs.func]),steps:vs.arrayOf(vs.shape({duration:vs.number.isRequired,style:vs.object.isRequired,easing:vs.oneOfType([vs.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),vs.func]),properties:vs.arrayOf("string"),onAnimationEnd:vs.func})),children:vs.oneOfType([vs.node,vs.func]),isActive:vs.bool,canBegin:vs.bool,onAnimationEnd:vs.func,shouldReAnimate:vs.bool,onAnimationStart:vs.func,onAnimationReStart:vs.func};function py(e){"@babel/helpers - typeof";return py=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},py(e)}function Ej(){return Ej=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ej.apply(this,arguments)}function ABe(e,t){return _Be(e)||FBe(e,t)||OBe(e,t)||TBe()}function TBe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
814In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OBe(e,t){if(e){if(typeof e=="string")return mB(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mB(e,t)}}function mB(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function FBe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(m){d=!0,a=m}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function _Be(e){if(Array.isArray(e))return e}function hB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fB(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hB(Object(n),!0).forEach(function(r){MBe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function MBe(e,t,n){return t=$Be(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $Be(e){var t=IBe(e,"string");return py(t)=="symbol"?t:t+""}function IBe(e,t){if(py(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(py(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var pB=function(t,n,r,a,i){var o=Math.min(Math.abs(r)/2,Math.abs(a)/2),l=a>=0?1:-1,c=r>=0?1:-1,d=a>=0&&r>=0||a<0&&r<0?1:0,m;if(o>0&&i instanceof Array){for(var u=[0,0,0,0],h=0,p=4;h<p;h++)u[h]=i[h]>o?o:i[h];m="M".concat(t,",").concat(n+l*u[0]),u[0]>0&&(m+="A ".concat(u[0],",").concat(u[0],",0,0,").concat(d,",").concat(t+c*u[0],",").concat(n)),m+="L ".concat(t+r-c*u[1],",").concat(n),u[1]>0&&(m+="A ".concat(u[1],",").concat(u[1],",0,0,").concat(d,`,
815        `).concat(t+r,",").concat(n+l*u[1])),m+="L ".concat(t+r,",").concat(n+a-l*u[2]),u[2]>0&&(m+="A ".concat(u[2],",").concat(u[2],",0,0,").concat(d,`,
816        `).concat(t+r-c*u[2],",").concat(n+a)),m+="L ".concat(t+c*u[3],",").concat(n+a),u[3]>0&&(m+="A ".concat(u[3],",").concat(u[3],",0,0,").concat(d,`,
817        `).concat(t,",").concat(n+a-l*u[3])),m+="Z"}else if(o>0&&i===+i&&i>0){var v=Math.min(o,i);m="M ".concat(t,",").concat(n+l*v,`
818            A `).concat(v,",").concat(v,",0,0,").concat(d,",").concat(t+c*v,",").concat(n,`
819            L `).concat(t+r-c*v,",").concat(n,`
820            A `).concat(v,",").concat(v,",0,0,").concat(d,",").concat(t+r,",").concat(n+l*v,`
821            L `).concat(t+r,",").concat(n+a-l*v,`
822            A `).concat(v,",").concat(v,",0,0,").concat(d,",").concat(t+r-c*v,",").concat(n+a,`
823            L `).concat(t+c*v,",").concat(n+a,`
824            A `).concat(v,",").concat(v,",0,0,").concat(d,",").concat(t,",").concat(n+a-l*v," Z")}else m="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(a," h ").concat(-r," Z");return m},RBe=function(t,n){if(!t||!n)return!1;var r=t.x,a=t.y,i=n.x,o=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var d=Math.min(i,i+l),m=Math.max(i,i+l),u=Math.min(o,o+c),h=Math.max(o,o+c);return r>=d&&r<=m&&a>=u&&a<=h}return!1},BBe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},CF=function(t){var n=fB(fB({},BBe),t),r=f.useRef(),a=f.useState(-1),i=ABe(a,2),o=i[0],l=i[1];f.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var j=r.current.getTotalLength();j&&l(j)}catch{}},[]);var c=n.x,d=n.y,m=n.width,u=n.height,h=n.radius,p=n.className,v=n.animationEasing,y=n.animationDuration,g=n.animationBegin,x=n.isAnimationActive,b=n.isUpdateAnimationActive;if(c!==+c||d!==+d||m!==+m||u!==+u||m===0||u===0)return null;var w=pn("recharts-rectangle",p);return b?he.createElement(vc,{canBegin:o>0,from:{width:m,height:u,x:c,y:d},to:{width:m,height:u,x:c,y:d},duration:y,animationEasing:v,isActive:b},function(j){var N=j.width,C=j.height,P=j.x,S=j.y;return he.createElement(vc,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:g,duration:y,isActive:x,easing:v},he.createElement("path",Ej({},fn(n,!0),{className:w,d:pB(P,S,N,C,h),ref:r})))}):he.createElement("path",Ej({},fn(n,!0),{className:w,d:pB(c,d,m,u,h)}))};function vD(){return vD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vD.apply(this,arguments)}var SF=function(t){var n=t.cx,r=t.cy,a=t.r,i=t.className,o=pn("recharts-dot",i);return n===+n&&r===+r&&a===+a?f.createElement("circle",vD({},fn(t,!1),Hw(t),{className:o,cx:n,cy:r,r:a})):null};function xy(e){"@babel/helpers - typeof";return xy=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},xy(e)}var LBe=["x","y","top","left","width","height","className"];function bD(){return bD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bD.apply(this,arguments)}function xB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function UBe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xB(Object(n),!0).forEach(function(r){zBe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zBe(e,t,n){return t=qBe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qBe(e){var t=WBe(e,"string");return xy(t)=="symbol"?t:t+""}function WBe(e,t){if(xy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(xy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function HBe(e,t){if(e==null)return{};var n=VBe(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function VBe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var KBe=function(t,n,r,a,i,o){return"M".concat(t,",").concat(i,"v").concat(a,"M").concat(o,",").concat(n,"h").concat(r)},GBe=function(t){var n=t.x,r=n===void 0?0:n,a=t.y,i=a===void 0?0:a,o=t.top,l=o===void 0?0:o,c=t.left,d=c===void 0?0:c,m=t.width,u=m===void 0?0:m,h=t.height,p=h===void 0?0:h,v=t.className,y=HBe(t,LBe),g=UBe({x:r,y:i,top:l,left:d,width:u,height:p},y);return!Ut(r)||!Ut(i)||!Ut(u)||!Ut(p)||!Ut(l)||!Ut(d)?null:he.createElement("path",bD({},fn(g,!0),{className:pn("recharts-cross",v),d:KBe(r,i,u,p,l,d)}))},YBe=QG,QBe=YBe(Object.getPrototypeOf,Object),JBe=QBe,XBe=wc,ZBe=JBe,eLe=jc,tLe="[object Object]",sLe=Function.prototype,nLe=Object.prototype,OQ=sLe.toString,rLe=nLe.hasOwnProperty,aLe=OQ.call(Object);function iLe(e){if(!eLe(e)||XBe(e)!=tLe)return!1;var t=ZBe(e);if(t===null)return!0;var n=rLe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&OQ.call(n)==aLe}var oLe=iLe;const lLe=Qs(oLe);var cLe=wc,dLe=jc,uLe="[object Boolean]";function mLe(e){return e===!0||e===!1||dLe(e)&&cLe(e)==uLe}var hLe=mLe;const fLe=Qs(hLe);function gy(e){"@babel/helpers - typeof";return gy=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},gy(e)}function Dj(){return Dj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Dj.apply(this,arguments)}function pLe(e,t){return vLe(e)||yLe(e,t)||gLe(e,t)||xLe()}function xLe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
825In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gLe(e,t){if(e){if(typeof e=="string")return gB(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gB(e,t)}}function gB(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yLe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(m){d=!0,a=m}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function vLe(e){if(Array.isArray(e))return e}function yB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function vB(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yB(Object(n),!0).forEach(function(r){bLe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function bLe(e,t,n){return t=wLe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wLe(e){var t=jLe(e,"string");return gy(t)=="symbol"?t:t+""}function jLe(e,t){if(gy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var bB=function(t,n,r,a,i){var o=r-a,l;return l="M ".concat(t,",").concat(n),l+="L ".concat(t+r,",").concat(n),l+="L ".concat(t+r-o/2,",").concat(n+i),l+="L ".concat(t+r-o/2-a,",").concat(n+i),l+="L ".concat(t,",").concat(n," Z"),l},NLe={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},CLe=function(t){var n=vB(vB({},NLe),t),r=f.useRef(),a=f.useState(-1),i=pLe(a,2),o=i[0],l=i[1];f.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var w=r.current.getTotalLength();w&&l(w)}catch{}},[]);var c=n.x,d=n.y,m=n.upperWidth,u=n.lowerWidth,h=n.height,p=n.className,v=n.animationEasing,y=n.animationDuration,g=n.animationBegin,x=n.isUpdateAnimationActive;if(c!==+c||d!==+d||m!==+m||u!==+u||h!==+h||m===0&&u===0||h===0)return null;var b=pn("recharts-trapezoid",p);return x?he.createElement(vc,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:d},to:{upperWidth:m,lowerWidth:u,height:h,x:c,y:d},duration:y,animationEasing:v,isActive:x},function(w){var j=w.upperWidth,N=w.lowerWidth,C=w.height,P=w.x,S=w.y;return he.createElement(vc,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:g,duration:y,easing:v},he.createElement("path",Dj({},fn(n,!0),{className:b,d:bB(P,S,j,N,C),ref:r})))}):he.createElement("g",null,he.createElement("path",Dj({},fn(n,!0),{className:b,d:bB(c,d,m,u,h)})))},SLe=["option","shapeType","propTransformer","activeClassName","isActive"];function yy(e){"@babel/helpers - typeof";return yy=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},yy(e)}function kLe(e,t){if(e==null)return{};var n=PLe(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function PLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function wB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Aj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?wB(Object(n),!0).forEach(function(r){ELe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ELe(e,t,n){return t=DLe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DLe(e){var t=ALe(e,"string");return yy(t)=="symbol"?t:t+""}function ALe(e,t){if(yy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(yy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function TLe(e,t){return Aj(Aj({},t),e)}function OLe(e,t){return e==="symbols"}function jB(e){var t=e.shapeType,n=e.elementProps;switch(t){case"rectangle":return he.createElement(CF,n);case"trapezoid":return he.createElement(CLe,n);case"sector":return he.createElement(CQ,n);case"symbols":if(OLe(t))return he.createElement(qO,n);break;default:return null}}function FLe(e){return f.isValidElement(e)?e.props:e}function _Le(e){var t=e.option,n=e.shapeType,r=e.propTransformer,a=r===void 0?TLe:r,i=e.activeClassName,o=i===void 0?"recharts-active-shape":i,l=e.isActive,c=kLe(e,SLe),d;if(f.isValidElement(t))d=f.cloneElement(t,Aj(Aj({},c),FLe(t)));else if(Ks(t))d=t(c);else if(lLe(t)&&!fLe(t)){var m=a(t,c);d=he.createElement(jB,{shapeType:n,elementProps:m})}else{var u=c;d=he.createElement(jB,{shapeType:n,elementProps:u})}return l?he.createElement(wr,{className:o},d):d}function Z1(e,t){return t!=null&&"trapezoids"in e.props}function eC(e,t){return t!=null&&"sectors"in e.props}function vy(e,t){return t!=null&&"points"in e.props}function MLe(e,t){var n,r,a=e.x===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.x)||e.x===t.x,i=e.y===(t==null||(r=t.labelViewBox)===null||r===void 0?void 0:r.y)||e.y===t.y;return a&&i}function $Le(e,t){var n=e.endAngle===t.endAngle,r=e.startAngle===t.startAngle;return n&&r}function ILe(e,t){var n=e.x===t.x,r=e.y===t.y,a=e.z===t.z;return n&&r&&a}function RLe(e,t){var n;return Z1(e,t)?n=MLe:eC(e,t)?n=$Le:vy(e,t)&&(n=ILe),n}function BLe(e,t){var n;return Z1(e,t)?n="trapezoids":eC(e,t)?n="sectors":vy(e,t)&&(n="points"),n}function LLe(e,t){if(Z1(e,t)){var n;return(n=t.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}if(eC(e,t)){var r;return(r=t.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}return vy(e,t)?t.payload:{}}function ULe(e){var t=e.activeTooltipItem,n=e.graphicalItem,r=e.itemData,a=BLe(n,t),i=LLe(n,t),o=r.filter(function(c,d){var m=Q1(i,c),u=n.props[a].filter(function(v){var y=RLe(n,t);return y(v,t)}),h=n.props[a].indexOf(u[u.length-1]),p=d===h;return m&&p}),l=r.indexOf(o[o.length-1]);return l}var zLe=Math.ceil,qLe=Math.max;function WLe(e,t,n,r){for(var a=-1,i=qLe(zLe((t-e)/(n||1)),0),o=Array(i);i--;)o[r?i:++a]=e,e+=n;return o}var HLe=WLe,VLe=JW,NB=1/0,KLe=17976931348623157e292;function GLe(e){if(!e)return e===0?e:0;if(e=VLe(e),e===NB||e===-NB){var t=e<0?-1:1;return t*KLe}return e===e?e:0}var FQ=GLe,YLe=HLe,QLe=U1,Nk=FQ;function JLe(e){return function(t,n,r){return r&&typeof r!="number"&&QLe(t,n,r)&&(n=r=void 0),t=Nk(t),n===void 0?(n=t,t=0):n=Nk(n),r=r===void 0?t<n?1:-1:Nk(r),YLe(t,n,r,e)}}var XLe=JLe,ZLe=XLe,e8e=ZLe(),t8e=e8e;const Tj=Qs(t8e);function by(e){"@babel/helpers - typeof";return by=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},by(e)}function CB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function SB(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?CB(Object(n),!0).forEach(function(r){_Q(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _Q(e,t,n){return t=s8e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s8e(e){var t=n8e(e,"string");return by(t)=="symbol"?t:t+""}function n8e(e,t){if(by(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(by(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var r8e=["Webkit","Moz","O","ms"],a8e=function(t,n){var r=t.replace(/(\w)/,function(i){return i.toUpperCase()}),a=r8e.reduce(function(i,o){return SB(SB({},i),{},_Q({},o+r,n))},{});return a[t]=n,a};function Jf(e){"@babel/helpers - typeof";return Jf=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},Jf(e)}function Oj(){return Oj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Oj.apply(this,arguments)}function kB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ck(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kB(Object(n),!0).forEach(function(r){li(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function i8e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function PB(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,$Q(r.key),r)}}function o8e(e,t,n){return t&&PB(e.prototype,t),n&&PB(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l8e(e,t,n){return t=Fj(t),c8e(e,MQ()?Reflect.construct(t,n||[],Fj(e).constructor):t.apply(e,n))}function c8e(e,t){if(t&&(Jf(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return d8e(e)}function d8e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function MQ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(MQ=function(){return!!e})()}function Fj(e){return Fj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Fj(e)}function u8e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wD(e,t)}function wD(e,t){return wD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},wD(e,t)}function li(e,t,n){return t=$Q(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $Q(e){var t=m8e(e,"string");return Jf(t)=="symbol"?t:t+""}function m8e(e,t){if(Jf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Jf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var h8e=function(t){var n=t.data,r=t.startIndex,a=t.endIndex,i=t.x,o=t.width,l=t.travellerWidth;if(!n||!n.length)return{};var c=n.length,d=Xx().domain(Tj(0,c)).range([i,i+o-l]),m=d.domain().map(function(u){return d(u)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:d(r),endX:d(a),scale:d,scaleValues:m}},EB=function(t){return t.changedTouches&&!!t.changedTouches.length},Xf=function(e){function t(n){var r;return i8e(this,t),r=l8e(this,t,[n]),li(r,"handleDrag",function(a){r.leaveTimer&&(clearTimeout(r.leaveTimer),r.leaveTimer=null),r.state.isTravellerMoving?r.handleTravellerMove(a):r.state.isSlideMoving&&r.handleSlideDrag(a)}),li(r,"handleTouchMove",function(a){a.changedTouches!=null&&a.changedTouches.length>0&&r.handleDrag(a.changedTouches[0])}),li(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=r.props,i=a.endIndex,o=a.onDragEnd,l=a.startIndex;o==null||o({endIndex:i,startIndex:l})}),r.detachDragEndListener()}),li(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),li(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),li(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),li(r,"handleSlideDragStart",function(a){var i=EB(a)?a.changedTouches[0]:a;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return u8e(t,e),o8e(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var a=r.startX,i=r.endX,o=this.state.scaleValues,l=this.props,c=l.gap,d=l.data,m=d.length-1,u=Math.min(a,i),h=Math.max(a,i),p=t.getIndexInRange(o,u),v=t.getIndexInRange(o,h);return{startIndex:p-p%c,endIndex:v===m?m:v-v%c}}},{key:"getTextOfTick",value:function(r){var a=this.props,i=a.data,o=a.tickFormatter,l=a.dataKey,c=ki(i[r],l,r);return Ks(o)?o(c,r):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var a=this.state,i=a.slideMoveStartX,o=a.startX,l=a.endX,c=this.props,d=c.x,m=c.width,u=c.travellerWidth,h=c.startIndex,p=c.endIndex,v=c.onChange,y=r.pageX-i;y>0?y=Math.min(y,d+m-u-l,d+m-u-o):y<0&&(y=Math.max(y,d-o,d-l));var g=this.getIndex({startX:o+y,endX:l+y});(g.startIndex!==h||g.endIndex!==p)&&v&&v(g),this.setState({startX:o+y,endX:l+y,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,a){var i=EB(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var a=this.state,i=a.brushMoveStartX,o=a.movingTravellerId,l=a.endX,c=a.startX,d=this.state[o],m=this.props,u=m.x,h=m.width,p=m.travellerWidth,v=m.onChange,y=m.gap,g=m.data,x={startX:this.state.startX,endX:this.state.endX},b=r.pageX-i;b>0?b=Math.min(b,u+h-p-d):b<0&&(b=Math.max(b,u-d)),x[o]=d+b;var w=this.getIndex(x),j=w.startIndex,N=w.endIndex,C=function(){var S=g.length-1;return o==="startX"&&(l>c?j%y===0:N%y===0)||l<c&&N===S||o==="endX"&&(l>c?N%y===0:j%y===0)||l>c&&N===S};this.setState(li(li({},o,d+b),"brushMoveStartX",r.pageX),function(){v&&C()&&v(w)})}},{key:"handleTravellerMoveKeyboard",value:function(r,a){var i=this,o=this.state,l=o.scaleValues,c=o.startX,d=o.endX,m=this.state[a],u=l.indexOf(m);if(u!==-1){var h=u+r;if(!(h===-1||h>=l.length)){var p=l[h];a==="startX"&&p>=d||a==="endX"&&p<=c||this.setState(li({},a,p),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,a=r.x,i=r.y,o=r.width,l=r.height,c=r.fill,d=r.stroke;return he.createElement("rect",{stroke:d,fill:c,x:a,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,a=r.x,i=r.y,o=r.width,l=r.height,c=r.data,d=r.children,m=r.padding,u=f.Children.only(d);return u?he.cloneElement(u,{x:a,y:i,width:o,height:l,margin:m,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,a){var i,o,l=this,c=this.props,d=c.y,m=c.travellerWidth,u=c.height,h=c.traveller,p=c.ariaLabel,v=c.data,y=c.startIndex,g=c.endIndex,x=Math.max(r,this.props.x),b=Ck(Ck({},fn(this.props,!1)),{},{x,y:d,width:m,height:u}),w=p||"Min value: ".concat((i=v[y])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=v[g])===null||o===void 0?void 0:o.name);return he.createElement(wr,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(N){["ArrowLeft","ArrowRight"].includes(N.key)&&(N.preventDefault(),N.stopPropagation(),l.handleTravellerMoveKeyboard(N.key==="ArrowRight"?1:-1,a))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,b))}},{key:"renderSlide",value:function(r,a){var i=this.props,o=i.y,l=i.height,c=i.stroke,d=i.travellerWidth,m=Math.min(r,a)+d,u=Math.max(Math.abs(a-r)-d,0);return he.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:m,y:o,width:u,height:l})}},{key:"renderText",value:function(){var r=this.props,a=r.startIndex,i=r.endIndex,o=r.y,l=r.height,c=r.travellerWidth,d=r.stroke,m=this.state,u=m.startX,h=m.endX,p=5,v={pointerEvents:"none",fill:d};return he.createElement(wr,{className:"recharts-brush-texts"},he.createElement(ij,Oj({textAnchor:"end",verticalAnchor:"middle",x:Math.min(u,h)-p,y:o+l/2},v),this.getTextOfTick(a)),he.createElement(ij,Oj({textAnchor:"start",verticalAnchor:"middle",x:Math.max(u,h)+c+p,y:o+l/2},v),this.getTextOfTick(i)))}},{key:"render",value:function(){var r=this.props,a=r.data,i=r.className,o=r.children,l=r.x,c=r.y,d=r.width,m=r.height,u=r.alwaysShowText,h=this.state,p=h.startX,v=h.endX,y=h.isTextActive,g=h.isSlideMoving,x=h.isTravellerMoving,b=h.isTravellerFocused;if(!a||!a.length||!Ut(l)||!Ut(c)||!Ut(d)||!Ut(m)||d<=0||m<=0)return null;var w=pn("recharts-brush",i),j=he.Children.count(o)===1,N=a8e("userSelect","none");return he.createElement(wr,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:N},this.renderBackground(),j&&this.renderPanorama(),this.renderSlide(p,v),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(v,"endX"),(y||g||x||b||u)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var a=r.x,i=r.y,o=r.width,l=r.height,c=r.stroke,d=Math.floor(i+l/2)-1;return he.createElement(he.Fragment,null,he.createElement("rect",{x:a,y:i,width:o,height:l,fill:c,stroke:"none"}),he.createElement("line",{x1:a+1,y1:d,x2:a+o-1,y2:d,fill:"none",stroke:"#fff"}),he.createElement("line",{x1:a+1,y1:d+2,x2:a+o-1,y2:d+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,a){var i;return he.isValidElement(r)?i=he.cloneElement(r,a):Ks(r)?i=r(a):i=t.renderDefaultTraveller(a),i}},{key:"getDerivedStateFromProps",value:function(r,a){var i=r.data,o=r.width,l=r.x,c=r.travellerWidth,d=r.updateId,m=r.startIndex,u=r.endIndex;if(i!==a.prevData||d!==a.prevUpdateId)return Ck({prevData:i,prevTravellerWidth:c,prevUpdateId:d,prevX:l,prevWidth:o},i&&i.length?h8e({data:i,width:o,x:l,travellerWidth:c,startIndex:m,endIndex:u}):{scale:null,scaleValues:null});if(a.scale&&(o!==a.prevWidth||l!==a.prevX||c!==a.prevTravellerWidth)){a.scale.range([l,l+o-c]);var h=a.scale.domain().map(function(p){return a.scale(p)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:d,prevX:l,prevWidth:o,startX:a.scale(r.startIndex),endX:a.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,a){for(var i=r.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);r[c]>a?l=c:o=c}return a>=r[l]?l:o}}])}(f.PureComponent);li(Xf,"displayName","Brush");li(Xf,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var f8e=QO;function p8e(e,t){var n;return f8e(e,function(r,a,i){return n=t(r,a,i),!n}),!!n}var x8e=p8e,g8e=zG,y8e=Gd,v8e=x8e,b8e=ni,w8e=U1;function j8e(e,t,n){var r=b8e(e)?g8e:v8e;return n&&w8e(e,t,n)&&(t=void 0),r(e,y8e(t))}var N8e=j8e;const C8e=Qs(N8e);var wl=function(t,n){var r=t.alwaysShow,a=t.ifOverflow;return r&&(a="extendDomain"),a===n},DB=dY;function S8e(e,t,n){t=="__proto__"&&DB?DB(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var k8e=S8e,P8e=k8e,E8e=lY,D8e=Gd;function A8e(e,t){var n={};return t=D8e(t),E8e(e,function(r,a,i){P8e(n,a,t(r,a,i))}),n}var T8e=A8e;const O8e=Qs(T8e);function F8e(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}var _8e=F8e,M8e=QO;function $8e(e,t){var n=!0;return M8e(e,function(r,a,i){return n=!!t(r,a,i),n}),n}var I8e=$8e,R8e=_8e,B8e=I8e,L8e=Gd,U8e=ni,z8e=U1;function q8e(e,t,n){var r=U8e(e)?R8e:B8e;return n&&z8e(e,t,n)&&(t=void 0),r(e,L8e(t))}var W8e=q8e;const IQ=Qs(W8e);var H8e=["x","y"];function wy(e){"@babel/helpers - typeof";return wy=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},wy(e)}function jD(){return jD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jD.apply(this,arguments)}function AB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function px(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?AB(Object(n),!0).forEach(function(r){V8e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function V8e(e,t,n){return t=K8e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K8e(e){var t=G8e(e,"string");return wy(t)=="symbol"?t:t+""}function G8e(e,t){if(wy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(wy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Y8e(e,t){if(e==null)return{};var n=Q8e(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Q8e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function J8e(e,t){var n=e.x,r=e.y,a=Y8e(e,H8e),i="".concat(n),o=parseInt(i,10),l="".concat(r),c=parseInt(l,10),d="".concat(t.height||a.height),m=parseInt(d,10),u="".concat(t.width||a.width),h=parseInt(u,10);return px(px(px(px(px({},t),a),o?{x:o}:{}),c?{y:c}:{}),{},{height:m,width:h,name:t.name,radius:t.radius})}function TB(e){return he.createElement(_Le,jD({shapeType:"rectangle",propTransformer:J8e,activeClassName:"recharts-active-bar"},e))}var X8e=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,a){if(typeof t=="number")return t;var i=Ut(r)||Wke(r);return i?t(r,a):(i||jm(),n)}},Z8e=["value","background"],RQ;function Zf(e){"@babel/helpers - typeof";return Zf=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},Zf(e)}function eUe(e,t){if(e==null)return{};var n=tUe(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tUe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function _j(){return _j=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_j.apply(this,arguments)}function OB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Cr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?OB(Object(n),!0).forEach(function(r){ud(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sUe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FB(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,LQ(r.key),r)}}function nUe(e,t,n){return t&&FB(e.prototype,t),n&&FB(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function rUe(e,t,n){return t=Mj(t),aUe(e,BQ()?Reflect.construct(t,n||[],Mj(e).constructor):t.apply(e,n))}function aUe(e,t){if(t&&(Zf(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iUe(e)}function iUe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function BQ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(BQ=function(){return!!e})()}function Mj(e){return Mj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Mj(e)}function oUe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ND(e,t)}function ND(e,t){return ND=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},ND(e,t)}function ud(e,t,n){return t=LQ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function LQ(e){var t=lUe(e,"string");return Zf(t)=="symbol"?t:t+""}function lUe(e,t){if(Zf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Zf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Mv=function(e){function t(){var n;sUe(this,t);for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];return n=rUe(this,t,[].concat(a)),ud(n,"state",{isAnimationFinished:!1}),ud(n,"id",Ev("recharts-bar-")),ud(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),o&&o()}),ud(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),o&&o()}),n}return oUe(t,e),nUe(t,[{key:"renderRectanglesStatically",value:function(r){var a=this,i=this.props,o=i.shape,l=i.dataKey,c=i.activeIndex,d=i.activeBar,m=fn(this.props,!1);return r&&r.map(function(u,h){var p=h===c,v=p?d:o,y=Cr(Cr(Cr({},m),u),{},{isActive:p,option:v,index:h,dataKey:l,onAnimationStart:a.handleAnimationStart,onAnimationEnd:a.handleAnimationEnd});return he.createElement(wr,_j({className:"recharts-bar-rectangle"},Vw(a.props,u,h),{key:"rectangle-".concat(u==null?void 0:u.x,"-").concat(u==null?void 0:u.y,"-").concat(u==null?void 0:u.value,"-").concat(h)}),he.createElement(TB,y))})}},{key:"renderRectanglesWithAnimation",value:function(){var r=this,a=this.props,i=a.data,o=a.layout,l=a.isAnimationActive,c=a.animationBegin,d=a.animationDuration,m=a.animationEasing,u=a.animationId,h=this.state.prevData;return he.createElement(vc,{begin:c,duration:d,isActive:l,easing:m,from:{t:0},to:{t:1},key:"bar-".concat(u),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(p){var v=p.t,y=i.map(function(g,x){var b=h&&h[x];if(b){var w=Po(b.x,g.x),j=Po(b.y,g.y),N=Po(b.width,g.width),C=Po(b.height,g.height);return Cr(Cr({},g),{},{x:w(v),y:j(v),width:N(v),height:C(v)})}if(o==="horizontal"){var P=Po(0,g.height),S=P(v);return Cr(Cr({},g),{},{y:g.y+g.height-S,height:S})}var E=Po(0,g.width),T=E(v);return Cr(Cr({},g),{},{width:T})});return he.createElement(wr,null,r.renderRectanglesStatically(y))})}},{key:"renderRectangles",value:function(){var r=this.props,a=r.data,i=r.isAnimationActive,o=this.state.prevData;return i&&a&&a.length&&(!o||!Q1(o,a))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(a)}},{key:"renderBackground",value:function(){var r=this,a=this.props,i=a.data,o=a.dataKey,l=a.activeIndex,c=fn(this.props.background,!1);return i.map(function(d,m){d.value;var u=d.background,h=eUe(d,Z8e);if(!u)return null;var p=Cr(Cr(Cr(Cr(Cr({},h),{},{fill:"#eee"},u),c),Vw(r.props,d,m)),{},{onAnimationStart:r.handleAnimationStart,onAnimationEnd:r.handleAnimationEnd,dataKey:o,index:m,className:"recharts-bar-background-rectangle"});return he.createElement(TB,_j({key:"background-bar-".concat(m),option:r.props.background,isActive:m===l},p))})}},{key:"renderErrorBar",value:function(r,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.data,l=i.xAxis,c=i.yAxis,d=i.layout,m=i.children,u=Ki(m,_v);if(!u)return null;var h=d==="vertical"?o[0].height/2:o[0].width/2,p=function(g,x){var b=Array.isArray(g.value)?g.value[1]:g.value;return{x:g.x,y:g.y,value:b,errorVal:ki(g,x)}},v={clipPath:r?"url(#clipPath-".concat(a,")"):null};return he.createElement(wr,v,u.map(function(y){return he.cloneElement(y,{key:"error-bar-".concat(a,"-").concat(y.props.dataKey),data:o,xAxis:l,yAxis:c,layout:d,offset:h,dataPointFormatter:p})}))}},{key:"render",value:function(){var r=this.props,a=r.hide,i=r.data,o=r.className,l=r.xAxis,c=r.yAxis,d=r.left,m=r.top,u=r.width,h=r.height,p=r.isAnimationActive,v=r.background,y=r.id;if(a||!i||!i.length)return null;var g=this.state.isAnimationFinished,x=pn("recharts-bar",o),b=l&&l.allowDataOverflow,w=c&&c.allowDataOverflow,j=b||w,N=tn(y)?this.id:y;return he.createElement(wr,{className:x},b||w?he.createElement("defs",null,he.createElement("clipPath",{id:"clipPath-".concat(N)},he.createElement("rect",{x:b?d:d-u/2,y:w?m:m-h/2,width:b?u:u*2,height:w?h:h*2}))):null,he.createElement(wr,{className:"recharts-bar-rectangles",clipPath:j?"url(#clipPath-".concat(N,")"):null},v?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(j,N),(!p||g)&&kd.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(r,a){return r.animationId!==a.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:a.curData}:r.data!==a.curData?{curData:r.data}:null}}])}(f.PureComponent);RQ=Mv;ud(Mv,"displayName","Bar");ud(Mv,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Fp.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});ud(Mv,"getComposedData",function(e){var t=e.props,n=e.item,r=e.barPosition,a=e.bandSize,i=e.xAxis,o=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,d=e.stackedData,m=e.dataStartIndex,u=e.displayedData,h=e.offset,p=B3e(r,n);if(!p)return null;var v=t.layout,y=n.type.defaultProps,g=y!==void 0?Cr(Cr({},y),n.props):n.props,x=g.dataKey,b=g.children,w=g.minPointSize,j=v==="horizontal"?o:i,N=d?j.scale.domain():null,C=K3e({numericAxis:j}),P=Ki(b,xY),S=u.map(function(E,T){var z,O,D,k,F,W;d?z=L3e(d[m+T],N):(z=ki(E,x),Array.isArray(z)||(z=[C,z]));var q=X8e(w,RQ.defaultProps.minPointSize)(z[1],T);if(v==="horizontal"){var H,_=[o.scale(z[0]),o.scale(z[1])],L=_[0],U=_[1];O=MR({axis:i,ticks:l,bandSize:a,offset:p.offset,entry:E,index:T}),D=(H=U??L)!==null&&H!==void 0?H:void 0,k=p.size;var J=L-U;if(F=Number.isNaN(J)?0:J,W={x:O,y:o.y,width:k,height:o.height},Math.abs(q)>0&&Math.abs(F)<Math.abs(q)){var I=Fo(F||q)*(Math.abs(q)-Math.abs(F));D-=I,F+=I}}else{var re=[i.scale(z[0]),i.scale(z[1])],R=re[0],Y=re[1];if(O=R,D=MR({axis:o,ticks:c,bandSize:a,offset:p.offset,entry:E,index:T}),k=Y-R,F=p.size,W={x:i.x,y:D,width:i.width,height:F},Math.abs(q)>0&&Math.abs(k)<Math.abs(q)){var M=Fo(k||q)*(Math.abs(q)-Math.abs(k));k+=M}}return Cr(Cr(Cr({},E),{},{x:O,y:D,width:k,height:F,value:d?z:z[1],payload:E,background:W},P&&P[T]&&P[T].props),{},{tooltipPayload:[wQ(n,E)],tooltipPosition:{x:O+k/2,y:D+F/2}})});return Cr({data:S,layout:v},h)});function jy(e){"@babel/helpers - typeof";return jy=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},jy(e)}function cUe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _B(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,UQ(r.key),r)}}function dUe(e,t,n){return t&&_B(e.prototype,t),n&&_B(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function MB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function No(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?MB(Object(n),!0).forEach(function(r){tC(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tC(e,t,n){return t=UQ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UQ(e){var t=uUe(e,"string");return jy(t)=="symbol"?t:t+""}function uUe(e,t){if(jy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(jy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var mUe=function(t,n,r,a,i){var o=t.width,l=t.height,c=t.layout,d=t.children,m=Object.keys(n),u={left:r.left,leftMirror:r.left,right:o-r.right,rightMirror:o-r.right,top:r.top,topMirror:r.top,bottom:l-r.bottom,bottomMirror:l-r.bottom},h=!!di(d,Mv);return m.reduce(function(p,v){var y=n[v],g=y.orientation,x=y.domain,b=y.padding,w=b===void 0?{}:b,j=y.mirror,N=y.reversed,C="".concat(g).concat(j?"Mirror":""),P,S,E,T,z;if(y.type==="number"&&(y.padding==="gap"||y.padding==="no-gap")){var O=x[1]-x[0],D=1/0,k=y.categoricalDomain.sort(Kke);if(k.forEach(function(re,R){R>0&&(D=Math.min((re||0)-(k[R-1]||0),D))}),Number.isFinite(D)){var F=D/O,W=y.layout==="vertical"?r.height:r.width;if(y.padding==="gap"&&(P=F*W/2),y.padding==="no-gap"){var q=bm(t.barCategoryGap,F*W),H=F*W/2;P=H-q-(H-q)/W*q}}}a==="xAxis"?S=[r.left+(w.left||0)+(P||0),r.left+r.width-(w.right||0)-(P||0)]:a==="yAxis"?S=c==="horizontal"?[r.top+r.height-(w.bottom||0),r.top+(w.top||0)]:[r.top+(w.top||0)+(P||0),r.top+r.height-(w.bottom||0)-(P||0)]:S=y.range,N&&(S=[S[1],S[0]]);var _=I3e(y,i,h),L=_.scale,U=_.realScaleType;L.domain(x).range(S),R3e(L);var J=V3e(L,No(No({},y),{},{realScaleType:U}));a==="xAxis"?(z=g==="top"&&!j||g==="bottom"&&j,E=r.left,T=u[C]-z*y.height):a==="yAxis"&&(z=g==="left"&&!j||g==="right"&&j,E=u[C]-z*y.width,T=r.top);var I=No(No(No({},y),J),{},{realScaleType:U,x:E,y:T,scale:L,width:a==="xAxis"?r.width:y.width,height:a==="yAxis"?r.height:y.height});return I.bandSize=wj(I,J),!y.hide&&a==="xAxis"?u[C]+=(z?-1:1)*I.height:y.hide||(u[C]+=(z?-1:1)*I.width),No(No({},p),{},tC({},v,I))},{})},zQ=function(t,n){var r=t.x,a=t.y,i=n.x,o=n.y;return{x:Math.min(r,i),y:Math.min(a,o),width:Math.abs(i-r),height:Math.abs(o-a)}},hUe=function(t){var n=t.x1,r=t.y1,a=t.x2,i=t.y2;return zQ({x:n,y:r},{x:a,y:i})},qQ=function(){function e(t){cUe(this,e),this.scale=t}return dUe(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=r.bandAware,i=r.position;if(n!==void 0){if(i)switch(i){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(a){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),a=r[0],i=r[r.length-1];return a<=i?n>=a&&n<=i:n>=i&&n<=a}}],[{key:"create",value:function(n){return new e(n)}}])}();tC(qQ,"EPS",1e-4);var kF=function(t){var n=Object.keys(t).reduce(function(r,a){return No(No({},r),{},tC({},a,qQ.create(t[a])))},{});return No(No({},n),{},{apply:function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return O8e(a,function(c,d){return n[d].apply(c,{bandAware:o,position:l})})},isInRange:function(a){return IQ(a,function(i,o){return n[o].isInRange(i)})}})};function fUe(e){return(e%180+180)%180}var pUe=function(t){var n=t.width,r=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=fUe(a),o=i*Math.PI/180,l=Math.atan(r/n),c=o>l&&o<Math.PI-l?r/Math.sin(o):n/Math.cos(o);return Math.abs(c)},xUe=Gd,gUe=Dv,yUe=B1;function vUe(e){return function(t,n,r){var a=Object(t);if(!gUe(t)){var i=xUe(n);t=yUe(t),n=function(l){return i(a[l],l,a)}}var o=e(t,n,r);return o>-1?a[i?t[o]:o]:void 0}}var bUe=vUe,wUe=FQ;function jUe(e){var t=wUe(e),n=t%1;return t===t?n?t-n:t:0}var NUe=jUe,CUe=sY,SUe=Gd,kUe=NUe,PUe=Math.max;function EUe(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var a=n==null?0:kUe(n);return a<0&&(a=PUe(r+a,0)),CUe(e,SUe(t),a)}var DUe=EUe,AUe=bUe,TUe=DUe,OUe=AUe(TUe),FUe=OUe;const _Ue=Qs(FUe);var MUe=QSe(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),PF=f.createContext(void 0),EF=f.createContext(void 0),WQ=f.createContext(void 0),HQ=f.createContext({}),VQ=f.createContext(void 0),KQ=f.createContext(0),GQ=f.createContext(0),$B=function(t){var n=t.state,r=n.xAxisMap,a=n.yAxisMap,i=n.offset,o=t.clipPathId,l=t.children,c=t.width,d=t.height,m=MUe(i);return he.createElement(PF.Provider,{value:r},he.createElement(EF.Provider,{value:a},he.createElement(HQ.Provider,{value:i},he.createElement(WQ.Provider,{value:m},he.createElement(VQ.Provider,{value:o},he.createElement(KQ.Provider,{value:d},he.createElement(GQ.Provider,{value:c},l)))))))},$Ue=function(){return f.useContext(VQ)},YQ=function(t){var n=f.useContext(PF);n==null&&jm();var r=n[t];return r==null&&jm(),r},IUe=function(){var t=f.useContext(PF);return Wc(t)},RUe=function(){var t=f.useContext(EF),n=_Ue(t,function(r){return IQ(r.domain,Number.isFinite)});return n||Wc(t)},QQ=function(t){var n=f.useContext(EF);n==null&&jm();var r=n[t];return r==null&&jm(),r},BUe=function(){var t=f.useContext(WQ);return t},LUe=function(){return f.useContext(HQ)},DF=function(){return f.useContext(GQ)},AF=function(){return f.useContext(KQ)};function ep(e){"@babel/helpers - typeof";return ep=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},ep(e)}function UUe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zUe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,XQ(r.key),r)}}function qUe(e,t,n){return t&&zUe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function WUe(e,t,n){return t=$j(t),HUe(e,JQ()?Reflect.construct(t,n||[],$j(e).constructor):t.apply(e,n))}function HUe(e,t){if(t&&(ep(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return VUe(e)}function VUe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function JQ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(JQ=function(){return!!e})()}function $j(e){return $j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},$j(e)}function KUe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&CD(e,t)}function CD(e,t){return CD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},CD(e,t)}function IB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function RB(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?IB(Object(n),!0).forEach(function(r){TF(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function TF(e,t,n){return t=XQ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function XQ(e){var t=GUe(e,"string");return ep(t)=="symbol"?t:t+""}function GUe(e,t){if(ep(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ep(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function YUe(e,t){return ZUe(e)||XUe(e,t)||JUe(e,t)||QUe()}function QUe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
826In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JUe(e,t){if(e){if(typeof e=="string")return BB(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return BB(e,t)}}function BB(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function XUe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(m){d=!0,a=m}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function ZUe(e){if(Array.isArray(e))return e}function SD(){return SD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},SD.apply(this,arguments)}var e9e=function(t,n){var r;return he.isValidElement(t)?r=he.cloneElement(t,n):Ks(t)?r=t(n):r=he.createElement("line",SD({},n,{className:"recharts-reference-line-line"})),r},t9e=function(t,n,r,a,i,o,l,c,d){var m=i.x,u=i.y,h=i.width,p=i.height;if(r){var v=d.y,y=t.y.apply(v,{position:o});if(wl(d,"discard")&&!t.y.isInRange(y))return null;var g=[{x:m+h,y},{x:m,y}];return c==="left"?g.reverse():g}if(n){var x=d.x,b=t.x.apply(x,{position:o});if(wl(d,"discard")&&!t.x.isInRange(b))return null;var w=[{x:b,y:u+p},{x:b,y:u}];return l==="top"?w.reverse():w}if(a){var j=d.segment,N=j.map(function(C){return t.apply(C,{position:o})});return wl(d,"discard")&&C8e(N,function(C){return!t.isInRange(C)})?null:N}return null};function s9e(e){var t=e.x,n=e.y,r=e.segment,a=e.xAxisId,i=e.yAxisId,o=e.shape,l=e.className,c=e.alwaysShow,d=$Ue(),m=YQ(a),u=QQ(i),h=BUe();if(!d||!h)return null;rc(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var p=kF({x:m.scale,y:u.scale}),v=zr(t),y=zr(n),g=r&&r.length===2,x=t9e(p,v,y,g,h,e.position,m.orientation,u.orientation,e);if(!x)return null;var b=YUe(x,2),w=b[0],j=w.x,N=w.y,C=b[1],P=C.x,S=C.y,E=wl(e,"hidden")?"url(#".concat(d,")"):void 0,T=RB(RB({clipPath:E},fn(e,!0)),{},{x1:j,y1:N,x2:P,y2:S});return he.createElement(wr,{className:pn("recharts-reference-line",l)},e9e(o,T),ga.renderCallByParent(e,hUe({x1:j,y1:N,x2:P,y2:S})))}var OF=function(e){function t(){return UUe(this,t),WUe(this,t,arguments)}return KUe(t,e),qUe(t,[{key:"render",value:function(){return he.createElement(s9e,this.props)}}])}(he.Component);TF(OF,"displayName","ReferenceLine");TF(OF,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function kD(){return kD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kD.apply(this,arguments)}function tp(e){"@babel/helpers - typeof";return tp=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},tp(e)}function LB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function UB(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?LB(Object(n),!0).forEach(function(r){sC(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function n9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r9e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,eJ(r.key),r)}}function a9e(e,t,n){return t&&r9e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function i9e(e,t,n){return t=Ij(t),o9e(e,ZQ()?Reflect.construct(t,n||[],Ij(e).constructor):t.apply(e,n))}function o9e(e,t){if(t&&(tp(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return l9e(e)}function l9e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ZQ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ZQ=function(){return!!e})()}function Ij(e){return Ij=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ij(e)}function c9e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&PD(e,t)}function PD(e,t){return PD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},PD(e,t)}function sC(e,t,n){return t=eJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eJ(e){var t=d9e(e,"string");return tp(t)=="symbol"?t:t+""}function d9e(e,t){if(tp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(tp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var u9e=function(t){var n=t.x,r=t.y,a=t.xAxis,i=t.yAxis,o=kF({x:a.scale,y:i.scale}),l=o.apply({x:n,y:r},{bandAware:!0});return wl(t,"discard")&&!o.isInRange(l)?null:l},nC=function(e){function t(){return n9e(this,t),i9e(this,t,arguments)}return c9e(t,e),a9e(t,[{key:"render",value:function(){var r=this.props,a=r.x,i=r.y,o=r.r,l=r.alwaysShow,c=r.clipPathId,d=zr(a),m=zr(i);if(rc(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!d||!m)return null;var u=u9e(this.props);if(!u)return null;var h=u.x,p=u.y,v=this.props,y=v.shape,g=v.className,x=wl(this.props,"hidden")?"url(#".concat(c,")"):void 0,b=UB(UB({clipPath:x},fn(this.props,!0)),{},{cx:h,cy:p});return he.createElement(wr,{className:pn("recharts-reference-dot",g)},t.renderDot(y,b),ga.renderCallByParent(this.props,{x:h-o,y:p-o,width:2*o,height:2*o}))}}])}(he.Component);sC(nC,"displayName","ReferenceDot");sC(nC,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});sC(nC,"renderDot",function(e,t){var n;return he.isValidElement(e)?n=he.cloneElement(e,t):Ks(e)?n=e(t):n=he.createElement(SF,kD({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),n});function ED(){return ED=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ED.apply(this,arguments)}function sp(e){"@babel/helpers - typeof";return sp=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},sp(e)}function zB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function qB(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zB(Object(n),!0).forEach(function(r){rC(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function m9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h9e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,sJ(r.key),r)}}function f9e(e,t,n){return t&&h9e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function p9e(e,t,n){return t=Rj(t),x9e(e,tJ()?Reflect.construct(t,n||[],Rj(e).constructor):t.apply(e,n))}function x9e(e,t){if(t&&(sp(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return g9e(e)}function g9e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tJ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tJ=function(){return!!e})()}function Rj(e){return Rj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Rj(e)}function y9e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&DD(e,t)}function DD(e,t){return DD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},DD(e,t)}function rC(e,t,n){return t=sJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sJ(e){var t=v9e(e,"string");return sp(t)=="symbol"?t:t+""}function v9e(e,t){if(sp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var b9e=function(t,n,r,a,i){var o=i.x1,l=i.x2,c=i.y1,d=i.y2,m=i.xAxis,u=i.yAxis;if(!m||!u)return null;var h=kF({x:m.scale,y:u.scale}),p={x:t?h.x.apply(o,{position:"start"}):h.x.rangeMin,y:r?h.y.apply(c,{position:"start"}):h.y.rangeMin},v={x:n?h.x.apply(l,{position:"end"}):h.x.rangeMax,y:a?h.y.apply(d,{position:"end"}):h.y.rangeMax};return wl(i,"discard")&&(!h.isInRange(p)||!h.isInRange(v))?null:zQ(p,v)},aC=function(e){function t(){return m9e(this,t),p9e(this,t,arguments)}return y9e(t,e),f9e(t,[{key:"render",value:function(){var r=this.props,a=r.x1,i=r.x2,o=r.y1,l=r.y2,c=r.className,d=r.alwaysShow,m=r.clipPathId;rc(d===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var u=zr(a),h=zr(i),p=zr(o),v=zr(l),y=this.props.shape;if(!u&&!h&&!p&&!v&&!y)return null;var g=b9e(u,h,p,v,this.props);if(!g&&!y)return null;var x=wl(this.props,"hidden")?"url(#".concat(m,")"):void 0;return he.createElement(wr,{className:pn("recharts-reference-area",c)},t.renderRect(y,qB(qB({clipPath:x},fn(this.props,!0)),g)),ga.renderCallByParent(this.props,g))}}])}(he.Component);rC(aC,"displayName","ReferenceArea");rC(aC,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});rC(aC,"renderRect",function(e,t){var n;return he.isValidElement(e)?n=he.cloneElement(e,t):Ks(e)?n=e(t):n=he.createElement(CF,ED({},t,{className:"recharts-reference-area-rect"})),n});function nJ(e,t,n){if(t<1)return[];if(t===1&&n===void 0)return e;for(var r=[],a=0;a<e.length;a+=t)r.push(e[a]);return r}function w9e(e,t,n){var r={width:e.width+t.width,height:e.height+t.height};return pUe(r,n)}function j9e(e,t,n){var r=n==="width",a=e.x,i=e.y,o=e.width,l=e.height;return t===1?{start:r?a:i,end:r?a+o:i+l}:{start:r?a+o:i+l,end:r?a:i}}function Bj(e,t,n,r,a){if(e*t<e*r||e*t>e*a)return!1;var i=n();return e*(t-e*i/2-r)>=0&&e*(t+e*i/2-a)<=0}function N9e(e,t){return nJ(e,t+1)}function C9e(e,t,n,r,a){for(var i=(r||[]).slice(),o=t.start,l=t.end,c=0,d=1,m=o,u=function(){var v=r==null?void 0:r[c];if(v===void 0)return{v:nJ(r,d)};var y=c,g,x=function(){return g===void 0&&(g=n(v,y)),g},b=v.coordinate,w=c===0||Bj(e,b,x,m,l);w||(c=0,m=o,d+=1),w&&(m=b+e*(x()/2+a),c+=d)},h;d<=i.length;)if(h=u(),h)return h.v;return[]}function Ny(e){"@babel/helpers - typeof";return Ny=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},Ny(e)}function WB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function pa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?WB(Object(n),!0).forEach(function(r){S9e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function S9e(e,t,n){return t=k9e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k9e(e){var t=P9e(e,"string");return Ny(t)=="symbol"?t:t+""}function P9e(e,t){if(Ny(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ny(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function E9e(e,t,n,r,a){for(var i=(r||[]).slice(),o=i.length,l=t.start,c=t.end,d=function(h){var p=i[h],v,y=function(){return v===void 0&&(v=n(p,h)),v};if(h===o-1){var g=e*(p.coordinate+e*y()/2-c);i[h]=p=pa(pa({},p),{},{tickCoord:g>0?p.coordinate-g*e:p.coordinate})}else i[h]=p=pa(pa({},p),{},{tickCoord:p.coordinate});var x=Bj(e,p.tickCoord,y,l,c);x&&(c=p.tickCoord-e*(y()/2+a),i[h]=pa(pa({},p),{},{isShow:!0}))},m=o-1;m>=0;m--)d(m);return i}function D9e(e,t,n,r,a,i){var o=(r||[]).slice(),l=o.length,c=t.start,d=t.end;if(i){var m=r[l-1],u=n(m,l-1),h=e*(m.coordinate+e*u/2-d);o[l-1]=m=pa(pa({},m),{},{tickCoord:h>0?m.coordinate-h*e:m.coordinate});var p=Bj(e,m.tickCoord,function(){return u},c,d);p&&(d=m.tickCoord-e*(u/2+a),o[l-1]=pa(pa({},m),{},{isShow:!0}))}for(var v=i?l-1:l,y=function(b){var w=o[b],j,N=function(){return j===void 0&&(j=n(w,b)),j};if(b===0){var C=e*(w.coordinate-e*N()/2-c);o[b]=w=pa(pa({},w),{},{tickCoord:C<0?w.coordinate-C*e:w.coordinate})}else o[b]=w=pa(pa({},w),{},{tickCoord:w.coordinate});var P=Bj(e,w.tickCoord,N,c,d);P&&(c=w.tickCoord+e*(N()/2+a),o[b]=pa(pa({},w),{},{isShow:!0}))},g=0;g<v;g++)y(g);return o}function FF(e,t,n){var r=e.tick,a=e.ticks,i=e.viewBox,o=e.minTickGap,l=e.orientation,c=e.interval,d=e.tickFormatter,m=e.unit,u=e.angle;if(!a||!a.length||!r)return[];if(Ut(c)||Fp.isSsr)return N9e(a,typeof c=="number"&&Ut(c)?c:0);var h=[],p=l==="top"||l==="bottom"?"width":"height",v=m&&p==="width"?Jx(m,{fontSize:t,letterSpacing:n}):{width:0,height:0},y=function(w,j){var N=Ks(d)?d(w.value,j):w.value;return p==="width"?w9e(Jx(N,{fontSize:t,letterSpacing:n}),v,u):Jx(N,{fontSize:t,letterSpacing:n})[p]},g=a.length>=2?Fo(a[1].coordinate-a[0].coordinate):1,x=j9e(i,g,p);return c==="equidistantPreserveStart"?C9e(g,x,y,a,o):(c==="preserveStart"||c==="preserveStartEnd"?h=D9e(g,x,y,a,o,c==="preserveStartEnd"):h=E9e(g,x,y,a,o),h.filter(function(b){return b.isShow}))}var A9e=["viewBox"],T9e=["viewBox"],O9e=["ticks"];function np(e){"@babel/helpers - typeof";return np=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},np(e)}function vh(){return vh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vh.apply(this,arguments)}function HB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Or(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?HB(Object(n),!0).forEach(function(r){_F(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Sk(e,t){if(e==null)return{};var n=F9e(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function F9e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function _9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VB(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,aJ(r.key),r)}}function M9e(e,t,n){return t&&VB(e.prototype,t),n&&VB(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function $9e(e,t,n){return t=Lj(t),I9e(e,rJ()?Reflect.construct(t,n||[],Lj(e).constructor):t.apply(e,n))}function I9e(e,t){if(t&&(np(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return R9e(e)}function R9e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rJ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rJ=function(){return!!e})()}function Lj(e){return Lj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Lj(e)}function B9e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&AD(e,t)}function AD(e,t){return AD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},AD(e,t)}function _F(e,t,n){return t=aJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aJ(e){var t=L9e(e,"string");return np(t)=="symbol"?t:t+""}function L9e(e,t){if(np(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(np(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ip=function(e){function t(n){var r;return _9e(this,t),r=$9e(this,t,[n]),r.state={fontSize:"",letterSpacing:""},r}return B9e(t,e),M9e(t,[{key:"shouldComponentUpdate",value:function(r,a){var i=r.viewBox,o=Sk(r,A9e),l=this.props,c=l.viewBox,d=Sk(l,T9e);return!Bh(i,c)||!Bh(o,d)||!Bh(a,this.state)}},{key:"componentDidMount",value:function(){var r=this.layerReference;if(r){var a=r.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];a&&this.setState({fontSize:window.getComputedStyle(a).fontSize,letterSpacing:window.getComputedStyle(a).letterSpacing})}}},{key:"getTickLineCoord",value:function(r){var a=this.props,i=a.x,o=a.y,l=a.width,c=a.height,d=a.orientation,m=a.tickSize,u=a.mirror,h=a.tickMargin,p,v,y,g,x,b,w=u?-1:1,j=r.tickSize||m,N=Ut(r.tickCoord)?r.tickCoord:r.coordinate;switch(d){case"top":p=v=r.coordinate,g=o+ +!u*c,y=g-w*j,b=y-w*h,x=N;break;case"left":y=g=r.coordinate,v=i+ +!u*l,p=v-w*j,x=p-w*h,b=N;break;case"right":y=g=r.coordinate,v=i+ +u*l,p=v+w*j,x=p+w*h,b=N;break;default:p=v=r.coordinate,g=o+ +u*c,y=g+w*j,b=y+w*h,x=N;break}return{line:{x1:p,y1:y,x2:v,y2:g},tick:{x,y:b}}}},{key:"getTickTextAnchor",value:function(){var r=this.props,a=r.orientation,i=r.mirror,o;switch(a){case"left":o=i?"start":"end";break;case"right":o=i?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var r=this.props,a=r.orientation,i=r.mirror,o="end";switch(a){case"left":case"right":o="middle";break;case"top":o=i?"start":"end";break;default:o=i?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var r=this.props,a=r.x,i=r.y,o=r.width,l=r.height,c=r.orientation,d=r.mirror,m=r.axisLine,u=Or(Or(Or({},fn(this.props,!1)),fn(m,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var h=+(c==="top"&&!d||c==="bottom"&&d);u=Or(Or({},u),{},{x1:a,y1:i+h*l,x2:a+o,y2:i+h*l})}else{var p=+(c==="left"&&!d||c==="right"&&d);u=Or(Or({},u),{},{x1:a+p*o,y1:i,x2:a+p*o,y2:i+l})}return he.createElement("line",vh({},u,{className:pn("recharts-cartesian-axis-line",Vi(m,"className"))}))}},{key:"renderTicks",value:function(r,a,i){var o=this,l=this.props,c=l.tickLine,d=l.stroke,m=l.tick,u=l.tickFormatter,h=l.unit,p=FF(Or(Or({},this.props),{},{ticks:r}),a,i),v=this.getTickTextAnchor(),y=this.getTickVerticalAnchor(),g=fn(this.props,!1),x=fn(m,!1),b=Or(Or({},g),{},{fill:"none"},fn(c,!1)),w=p.map(function(j,N){var C=o.getTickLineCoord(j),P=C.line,S=C.tick,E=Or(Or(Or(Or({textAnchor:v,verticalAnchor:y},g),{},{stroke:"none",fill:d},x),S),{},{index:N,payload:j,visibleTicksCount:p.length,tickFormatter:u});return he.createElement(wr,vh({className:"recharts-cartesian-axis-tick",key:"tick-".concat(j.value,"-").concat(j.coordinate,"-").concat(j.tickCoord)},Vw(o.props,j,N)),c&&he.createElement("line",vh({},b,P,{className:pn("recharts-cartesian-axis-tick-line",Vi(c,"className"))})),m&&t.renderTickItem(m,E,"".concat(Ks(u)?u(j.value,N):j.value).concat(h||"")))});return he.createElement("g",{className:"recharts-cartesian-axis-ticks"},w)}},{key:"render",value:function(){var r=this,a=this.props,i=a.axisLine,o=a.width,l=a.height,c=a.ticksGenerator,d=a.className,m=a.hide;if(m)return null;var u=this.props,h=u.ticks,p=Sk(u,O9e),v=h;return Ks(c)&&(v=h&&h.length>0?c(this.props):c(p)),o<=0||l<=0||!v||!v.length?null:he.createElement(wr,{className:pn("recharts-cartesian-axis",d),ref:function(g){r.layerReference=g}},i&&this.renderAxisLine(),this.renderTicks(v,this.state.fontSize,this.state.letterSpacing),ga.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,a,i){var o,l=pn(a.className,"recharts-cartesian-axis-tick-value");return he.isValidElement(r)?o=he.cloneElement(r,Or(Or({},a),{},{className:l})):Ks(r)?o=r(Or(Or({},a),{},{className:l})):o=he.createElement(ij,vh({},a,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])}(f.Component);_F(Ip,"displayName","CartesianAxis");_F(Ip,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var U9e=["x1","y1","x2","y2","key"],z9e=["offset"];function Nm(e){"@babel/helpers - typeof";return Nm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nm(e)}function KB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ya(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?KB(Object(n),!0).forEach(function(r){q9e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function q9e(e,t,n){return t=W9e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W9e(e){var t=H9e(e,"string");return Nm(t)=="symbol"?t:t+""}function H9e(e,t){if(Nm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Nm(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nu(){return Nu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nu.apply(this,arguments)}function GB(e,t){if(e==null)return{};var n=V9e(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function V9e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var K9e=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,a=t.x,i=t.y,o=t.width,l=t.height,c=t.ry;return he.createElement("rect",{x:a,y:i,ry:c,width:o,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function iJ(e,t){var n;if(he.isValidElement(e))n=he.cloneElement(e,t);else if(Ks(e))n=e(t);else{var r=t.x1,a=t.y1,i=t.x2,o=t.y2,l=t.key,c=GB(t,U9e),d=fn(c,!1);d.offset;var m=GB(d,z9e);n=he.createElement("line",Nu({},m,{x1:r,y1:a,x2:i,y2:o,fill:"none",key:l}))}return n}function G9e(e){var t=e.x,n=e.width,r=e.horizontal,a=r===void 0?!0:r,i=e.horizontalPoints;if(!a||!i||!i.length)return null;var o=i.map(function(l,c){var d=ya(ya({},e),{},{x1:t,y1:l,x2:t+n,y2:l,key:"line-".concat(c),index:c});return iJ(a,d)});return he.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function Y9e(e){var t=e.y,n=e.height,r=e.vertical,a=r===void 0?!0:r,i=e.verticalPoints;if(!a||!i||!i.length)return null;var o=i.map(function(l,c){var d=ya(ya({},e),{},{x1:l,y1:t,x2:l,y2:t+n,key:"line-".concat(c),index:c});return iJ(a,d)});return he.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function Q9e(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,a=e.y,i=e.width,o=e.height,l=e.horizontalPoints,c=e.horizontal,d=c===void 0?!0:c;if(!d||!t||!t.length)return null;var m=l.map(function(h){return Math.round(h+a-a)}).sort(function(h,p){return h-p});a!==m[0]&&m.unshift(0);var u=m.map(function(h,p){var v=!m[p+1],y=v?a+o-h:m[p+1]-h;if(y<=0)return null;var g=p%t.length;return he.createElement("rect",{key:"react-".concat(p),y:h,x:r,height:y,width:i,stroke:"none",fill:t[g],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return he.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function J9e(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,a=e.fillOpacity,i=e.x,o=e.y,l=e.width,c=e.height,d=e.verticalPoints;if(!n||!r||!r.length)return null;var m=d.map(function(h){return Math.round(h+i-i)}).sort(function(h,p){return h-p});i!==m[0]&&m.unshift(0);var u=m.map(function(h,p){var v=!m[p+1],y=v?i+l-h:m[p+1]-h;if(y<=0)return null;var g=p%r.length;return he.createElement("rect",{key:"react-".concat(p),x:h,y:o,width:y,height:c,stroke:"none",fill:r[g],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return he.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var X9e=function(t,n){var r=t.xAxis,a=t.width,i=t.height,o=t.offset;return vQ(FF(ya(ya(ya({},Ip.defaultProps),r),{},{ticks:ec(r,!0),viewBox:{x:0,y:0,width:a,height:i}})),o.left,o.left+o.width,n)},Z9e=function(t,n){var r=t.yAxis,a=t.width,i=t.height,o=t.offset;return vQ(FF(ya(ya(ya({},Ip.defaultProps),r),{},{ticks:ec(r,!0),viewBox:{x:0,y:0,width:a,height:i}})),o.top,o.top+o.height,n)},Qm={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function oJ(e){var t,n,r,a,i,o,l=DF(),c=AF(),d=LUe(),m=ya(ya({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Qm.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:Qm.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:Qm.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:Qm.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:Qm.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:Qm.verticalFill,x:Ut(e.x)?e.x:d.left,y:Ut(e.y)?e.y:d.top,width:Ut(e.width)?e.width:d.width,height:Ut(e.height)?e.height:d.height}),u=m.x,h=m.y,p=m.width,v=m.height,y=m.syncWithTicks,g=m.horizontalValues,x=m.verticalValues,b=IUe(),w=RUe();if(!Ut(p)||p<=0||!Ut(v)||v<=0||!Ut(u)||u!==+u||!Ut(h)||h!==+h)return null;var j=m.verticalCoordinatesGenerator||X9e,N=m.horizontalCoordinatesGenerator||Z9e,C=m.horizontalPoints,P=m.verticalPoints;if((!C||!C.length)&&Ks(N)){var S=g&&g.length,E=N({yAxis:w?ya(ya({},w),{},{ticks:S?g:w.ticks}):void 0,width:l,height:c,offset:d},S?!0:y);rc(Array.isArray(E),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Nm(E),"]")),Array.isArray(E)&&(C=E)}if((!P||!P.length)&&Ks(j)){var T=x&&x.length,z=j({xAxis:b?ya(ya({},b),{},{ticks:T?x:b.ticks}):void 0,width:l,height:c,offset:d},T?!0:y);rc(Array.isArray(z),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Nm(z),"]")),Array.isArray(z)&&(P=z)}return he.createElement("g",{className:"recharts-cartesian-grid"},he.createElement(K9e,{fill:m.fill,fillOpacity:m.fillOpacity,x:m.x,y:m.y,width:m.width,height:m.height,ry:m.ry}),he.createElement(G9e,Nu({},m,{offset:d,horizontalPoints:C,xAxis:b,yAxis:w})),he.createElement(Y9e,Nu({},m,{offset:d,verticalPoints:P,xAxis:b,yAxis:w})),he.createElement(Q9e,Nu({},m,{horizontalPoints:C})),he.createElement(J9e,Nu({},m,{verticalPoints:P})))}oJ.displayName="CartesianGrid";var e7e=["type","layout","connectNulls","ref"],t7e=["key"];function rp(e){"@babel/helpers - typeof";return rp=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},rp(e)}function YB(e,t){if(e==null)return{};var n=s7e(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function s7e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function tg(){return tg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tg.apply(this,arguments)}function QB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function oi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?QB(Object(n),!0).forEach(function(r){Co(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Jm(e){return i7e(e)||a7e(e)||r7e(e)||n7e()}function n7e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
827In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function r7e(e,t){if(e){if(typeof e=="string")return TD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return TD(e,t)}}function a7e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i7e(e){if(Array.isArray(e))return TD(e)}function TD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o7e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function JB(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,cJ(r.key),r)}}function l7e(e,t,n){return t&&JB(e.prototype,t),n&&JB(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c7e(e,t,n){return t=Uj(t),d7e(e,lJ()?Reflect.construct(t,n||[],Uj(e).constructor):t.apply(e,n))}function d7e(e,t){if(t&&(rp(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return u7e(e)}function u7e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lJ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lJ=function(){return!!e})()}function Uj(e){return Uj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Uj(e)}function m7e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&OD(e,t)}function OD(e,t){return OD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},OD(e,t)}function Co(e,t,n){return t=cJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cJ(e){var t=h7e(e,"string");return rp(t)=="symbol"?t:t+""}function h7e(e,t){if(rp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(rp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var em=function(e){function t(){var n;o7e(this,t);for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];return n=c7e(this,t,[].concat(a)),Co(n,"state",{isAnimationFinished:!0,totalLength:0}),Co(n,"generateSimpleStrokeDasharray",function(o,l){return"".concat(l,"px ").concat(o-l,"px")}),Co(n,"getStrokeDasharray",function(o,l,c){var d=c.reduce(function(x,b){return x+b});if(!d)return n.generateSimpleStrokeDasharray(l,o);for(var m=Math.floor(o/d),u=o%d,h=l-o,p=[],v=0,y=0;v<c.length;y+=c[v],++v)if(y+c[v]>u){p=[].concat(Jm(c.slice(0,v)),[u-y]);break}var g=p.length%2===0?[0,h]:[h];return[].concat(Jm(t.repeat(c,m)),Jm(p),g).map(function(x){return"".concat(x,"px")}).join(", ")}),Co(n,"id",Ev("recharts-line-")),Co(n,"pathRef",function(o){n.mainCurve=o}),Co(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),Co(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return m7e(t,e),l7e(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.points,l=i.xAxis,c=i.yAxis,d=i.layout,m=i.children,u=Ki(m,_v);if(!u)return null;var h=function(y,g){return{x:y.x,y:y.y,value:y.value,errorVal:ki(y.payload,g)}},p={clipPath:r?"url(#clipPath-".concat(a,")"):null};return he.createElement(wr,p,u.map(function(v){return he.cloneElement(v,{key:"bar-".concat(v.props.dataKey),data:o,xAxis:l,yAxis:c,layout:d,dataPointFormatter:h})}))}},{key:"renderDots",value:function(r,a,i){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,d=l.points,m=l.dataKey,u=fn(this.props,!1),h=fn(c,!0),p=d.map(function(y,g){var x=oi(oi(oi({key:"dot-".concat(g),r:3},u),h),{},{index:g,cx:y.x,cy:y.y,value:y.value,dataKey:m,payload:y.payload,points:d});return t.renderDotItem(c,x)}),v={clipPath:r?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return he.createElement(wr,tg({className:"recharts-line-dots",key:"dots"},v),p)}},{key:"renderCurveStatically",value:function(r,a,i,o){var l=this.props,c=l.type,d=l.layout,m=l.connectNulls;l.ref;var u=YB(l,e7e),h=oi(oi(oi({},fn(u,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(i,")"):null,points:r},o),{},{type:c,layout:d,connectNulls:m});return he.createElement(cD,tg({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,a){var i=this,o=this.props,l=o.points,c=o.strokeDasharray,d=o.isAnimationActive,m=o.animationBegin,u=o.animationDuration,h=o.animationEasing,p=o.animationId,v=o.animateNewValues,y=o.width,g=o.height,x=this.state,b=x.prevPoints,w=x.totalLength;return he.createElement(vc,{begin:m,duration:u,isActive:d,easing:h,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(j){var N=j.t;if(b){var C=b.length/l.length,P=l.map(function(O,D){var k=Math.floor(D*C);if(b[k]){var F=b[k],W=Po(F.x,O.x),q=Po(F.y,O.y);return oi(oi({},O),{},{x:W(N),y:q(N)})}if(v){var H=Po(y*2,O.x),_=Po(g/2,O.y);return oi(oi({},O),{},{x:H(N),y:_(N)})}return oi(oi({},O),{},{x:O.x,y:O.y})});return i.renderCurveStatically(P,r,a)}var S=Po(0,w),E=S(N),T;if(c){var z="".concat(c).split(/[,\s]+/gim).map(function(O){return parseFloat(O)});T=i.getStrokeDasharray(E,w,z)}else T=i.generateSimpleStrokeDasharray(w,E);return i.renderCurveStatically(l,r,a,{strokeDasharray:T})})}},{key:"renderCurve",value:function(r,a){var i=this.props,o=i.points,l=i.isAnimationActive,c=this.state,d=c.prevPoints,m=c.totalLength;return l&&o&&o.length&&(!d&&m>0||!Q1(d,o))?this.renderCurveWithAnimation(r,a):this.renderCurveStatically(o,r,a)}},{key:"render",value:function(){var r,a=this.props,i=a.hide,o=a.dot,l=a.points,c=a.className,d=a.xAxis,m=a.yAxis,u=a.top,h=a.left,p=a.width,v=a.height,y=a.isAnimationActive,g=a.id;if(i||!l||!l.length)return null;var x=this.state.isAnimationFinished,b=l.length===1,w=pn("recharts-line",c),j=d&&d.allowDataOverflow,N=m&&m.allowDataOverflow,C=j||N,P=tn(g)?this.id:g,S=(r=fn(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},E=S.r,T=E===void 0?3:E,z=S.strokeWidth,O=z===void 0?2:z,D=s2e(o)?o:{},k=D.clipDot,F=k===void 0?!0:k,W=T*2+O;return he.createElement(wr,{className:w},j||N?he.createElement("defs",null,he.createElement("clipPath",{id:"clipPath-".concat(P)},he.createElement("rect",{x:j?h:h-p/2,y:N?u:u-v/2,width:j?p:p*2,height:N?v:v*2})),!F&&he.createElement("clipPath",{id:"clipPath-dots-".concat(P)},he.createElement("rect",{x:h-W/2,y:u-W/2,width:p+W,height:v+W}))):null,!b&&this.renderCurve(C,P),this.renderErrorBar(C,P),(b||o)&&this.renderDots(C,F,P),(!y||x)&&kd.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,a){return r.animationId!==a.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:a.curPoints}:r.points!==a.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,a){for(var i=r.length%2!==0?[].concat(Jm(r),[0]):r,o=[],l=0;l<a;++l)o=[].concat(Jm(o),Jm(i));return o}},{key:"renderDotItem",value:function(r,a){var i;if(he.isValidElement(r))i=he.cloneElement(r,a);else if(Ks(r))i=r(a);else{var o=a.key,l=YB(a,t7e),c=pn("recharts-line-dot",typeof r!="boolean"?r.className:"");i=he.createElement(SF,tg({key:o},l,{className:c}))}return i}}])}(f.PureComponent);Co(em,"displayName","Line");Co(em,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Fp.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Co(em,"getComposedData",function(e){var t=e.props,n=e.xAxis,r=e.yAxis,a=e.xAxisTicks,i=e.yAxisTicks,o=e.dataKey,l=e.bandSize,c=e.displayedData,d=e.offset,m=t.layout,u=c.map(function(h,p){var v=ki(h,o);return m==="horizontal"?{x:_R({axis:n,ticks:a,bandSize:l,entry:h,index:p}),y:tn(v)?null:r.scale(v),value:v,payload:h}:{x:tn(v)?null:n.scale(v),y:_R({axis:r,ticks:i,bandSize:l,entry:h,index:p}),value:v,payload:h}});return oi({points:u,layout:m},d)});function ap(e){"@babel/helpers - typeof";return ap=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},ap(e)}function f7e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p7e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mJ(r.key),r)}}function x7e(e,t,n){return t&&p7e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function g7e(e,t,n){return t=zj(t),y7e(e,dJ()?Reflect.construct(t,n||[],zj(e).constructor):t.apply(e,n))}function y7e(e,t){if(t&&(ap(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return v7e(e)}function v7e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dJ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dJ=function(){return!!e})()}function zj(e){return zj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},zj(e)}function b7e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&FD(e,t)}function FD(e,t){return FD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},FD(e,t)}function uJ(e,t,n){return t=mJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mJ(e){var t=w7e(e,"string");return ap(t)=="symbol"?t:t+""}function w7e(e,t){if(ap(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ap(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function _D(){return _D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_D.apply(this,arguments)}function j7e(e){var t=e.xAxisId,n=DF(),r=AF(),a=YQ(t);return a==null?null:f.createElement(Ip,_D({},a,{className:pn("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(o){return ec(o,!0)}}))}var iC=function(e){function t(){return f7e(this,t),g7e(this,t,arguments)}return b7e(t,e),x7e(t,[{key:"render",value:function(){return f.createElement(j7e,this.props)}}])}(f.Component);uJ(iC,"displayName","XAxis");uJ(iC,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function ip(e){"@babel/helpers - typeof";return ip=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},ip(e)}function N7e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C7e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,pJ(r.key),r)}}function S7e(e,t,n){return t&&C7e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function k7e(e,t,n){return t=qj(t),P7e(e,hJ()?Reflect.construct(t,n||[],qj(e).constructor):t.apply(e,n))}function P7e(e,t){if(t&&(ip(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return E7e(e)}function E7e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hJ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(hJ=function(){return!!e})()}function qj(e){return qj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},qj(e)}function D7e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&MD(e,t)}function MD(e,t){return MD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},MD(e,t)}function fJ(e,t,n){return t=pJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pJ(e){var t=A7e(e,"string");return ip(t)=="symbol"?t:t+""}function A7e(e,t){if(ip(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ip(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function $D(){return $D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$D.apply(this,arguments)}var T7e=function(t){var n=t.yAxisId,r=DF(),a=AF(),i=QQ(n);return i==null?null:f.createElement(Ip,$D({},i,{className:pn("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:r,height:a},ticksGenerator:function(l){return ec(l,!0)}}))},oC=function(e){function t(){return N7e(this,t),k7e(this,t,arguments)}return D7e(t,e),S7e(t,[{key:"render",value:function(){return f.createElement(T7e,this.props)}}])}(f.Component);fJ(oC,"displayName","YAxis");fJ(oC,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function XB(e){return M7e(e)||_7e(e)||F7e(e)||O7e()}function O7e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
828In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function F7e(e,t){if(e){if(typeof e=="string")return ID(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ID(e,t)}}function _7e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function M7e(e){if(Array.isArray(e))return ID(e)}function ID(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var RD=function(t,n,r,a,i){var o=Ki(t,OF),l=Ki(t,nC),c=[].concat(XB(o),XB(l)),d=Ki(t,aC),m="".concat(a,"Id"),u=a[0],h=n;if(c.length&&(h=c.reduce(function(y,g){if(g.props[m]===r&&wl(g.props,"extendDomain")&&Ut(g.props[u])){var x=g.props[u];return[Math.min(y[0],x),Math.max(y[1],x)]}return y},h)),d.length){var p="".concat(u,"1"),v="".concat(u,"2");h=d.reduce(function(y,g){if(g.props[m]===r&&wl(g.props,"extendDomain")&&Ut(g.props[p])&&Ut(g.props[v])){var x=g.props[p],b=g.props[v];return[Math.min(y[0],x,b),Math.max(y[1],x,b)]}return y},h)}return i&&i.length&&(h=i.reduce(function(y,g){return Ut(g)?[Math.min(y[0],g),Math.max(y[1],g)]:y},h)),h},xJ={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function a(c,d,m){this.fn=c,this.context=d,this.once=m||!1}function i(c,d,m,u,h){if(typeof m!="function")throw new TypeError("The listener must be a function");var p=new a(m,u||c,h),v=n?n+d:d;return c._events[v]?c._events[v].fn?c._events[v]=[c._events[v],p]:c._events[v].push(p):(c._events[v]=p,c._eventsCount++),c}function o(c,d){--c._eventsCount===0?c._events=new r:delete c._events[d]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],m,u;if(this._eventsCount===0)return d;for(u in m=this._events)t.call(m,u)&&d.push(n?u.slice(1):u);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(m)):d},l.prototype.listeners=function(d){var m=n?n+d:d,u=this._events[m];if(!u)return[];if(u.fn)return[u.fn];for(var h=0,p=u.length,v=new Array(p);h<p;h++)v[h]=u[h].fn;return v},l.prototype.listenerCount=function(d){var m=n?n+d:d,u=this._events[m];return u?u.fn?1:u.length:0},l.prototype.emit=function(d,m,u,h,p,v){var y=n?n+d:d;if(!this._events[y])return!1;var g=this._events[y],x=arguments.length,b,w;if(g.fn){switch(g.once&&this.removeListener(d,g.fn,void 0,!0),x){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,m),!0;case 3:return g.fn.call(g.context,m,u),!0;case 4:return g.fn.call(g.context,m,u,h),!0;case 5:return g.fn.call(g.context,m,u,h,p),!0;case 6:return g.fn.call(g.context,m,u,h,p,v),!0}for(w=1,b=new Array(x-1);w<x;w++)b[w-1]=arguments[w];g.fn.apply(g.context,b)}else{var j=g.length,N;for(w=0;w<j;w++)switch(g[w].once&&this.removeListener(d,g[w].fn,void 0,!0),x){case 1:g[w].fn.call(g[w].context);break;case 2:g[w].fn.call(g[w].context,m);break;case 3:g[w].fn.call(g[w].context,m,u);break;case 4:g[w].fn.call(g[w].context,m,u,h);break;default:if(!b)for(N=1,b=new Array(x-1);N<x;N++)b[N-1]=arguments[N];g[w].fn.apply(g[w].context,b)}}return!0},l.prototype.on=function(d,m,u){return i(this,d,m,u,!1)},l.prototype.once=function(d,m,u){return i(this,d,m,u,!0)},l.prototype.removeListener=function(d,m,u,h){var p=n?n+d:d;if(!this._events[p])return this;if(!m)return o(this,p),this;var v=this._events[p];if(v.fn)v.fn===m&&(!h||v.once)&&(!u||v.context===u)&&o(this,p);else{for(var y=0,g=[],x=v.length;y<x;y++)(v[y].fn!==m||h&&!v[y].once||u&&v[y].context!==u)&&g.push(v[y]);g.length?this._events[p]=g.length===1?g[0]:g:o(this,p)}return this},l.prototype.removeAllListeners=function(d){var m;return d?(m=n?n+d:d,this._events[m]&&o(this,m)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l})(xJ);var $7e=xJ.exports;const I7e=Qs($7e);var kk=new I7e,Pk="recharts.syncMouseEvents";function Cy(e){"@babel/helpers - typeof";return Cy=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},Cy(e)}function R7e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B7e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,gJ(r.key),r)}}function L7e(e,t,n){return t&&B7e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ek(e,t,n){return t=gJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gJ(e){var t=U7e(e,"string");return Cy(t)=="symbol"?t:t+""}function U7e(e,t){if(Cy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Cy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var z7e=function(){function e(){R7e(this,e),Ek(this,"activeIndex",0),Ek(this,"coordinateList",[]),Ek(this,"layout","horizontal")}return L7e(e,[{key:"setDetails",value:function(n){var r,a=n.coordinateList,i=a===void 0?null:a,o=n.container,l=o===void 0?null:o,c=n.layout,d=c===void 0?null:c,m=n.offset,u=m===void 0?null:m,h=n.mouseHandlerCallback,p=h===void 0?null:h;this.coordinateList=(r=i??this.coordinateList)!==null&&r!==void 0?r:[],this.container=l??this.container,this.layout=d??this.layout,this.offset=u??this.offset,this.mouseHandlerCallback=p??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var a=this.container.getBoundingClientRect(),i=a.x,o=a.y,l=a.height,c=this.coordinateList[this.activeIndex].coordinate,d=((n=window)===null||n===void 0?void 0:n.scrollX)||0,m=((r=window)===null||r===void 0?void 0:r.scrollY)||0,u=i+c+d,h=o+this.offset.top+l/2+m;this.mouseHandlerCallback({pageX:u,pageY:h})}}}])}();function q7e(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var r=e==null?void 0:e[0],a=e==null?void 0:e[1];if(r&&a&&Ut(r)&&Ut(a))return!0}return!1}function W7e(e,t,n,r){var a=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-a:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-a,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function yJ(e){var t=e.cx,n=e.cy,r=e.radius,a=e.startAngle,i=e.endAngle,o=la(t,n,r,a),l=la(t,n,r,i);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:a,endAngle:i}}function H7e(e,t,n){var r,a,i,o;if(e==="horizontal")r=t.x,i=r,a=n.top,o=n.top+n.height;else if(e==="vertical")a=t.y,o=a,r=n.left,i=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var l=t.cx,c=t.cy,d=t.innerRadius,m=t.outerRadius,u=t.angle,h=la(l,c,d,u),p=la(l,c,m,u);r=h.x,a=h.y,i=p.x,o=p.y}else return yJ(t);return[{x:r,y:a},{x:i,y:o}]}function Sy(e){"@babel/helpers - typeof";return Sy=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},Sy(e)}function ZB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function sb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ZB(Object(n),!0).forEach(function(r){V7e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZB(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function V7e(e,t,n){return t=K7e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K7e(e){var t=G7e(e,"string");return Sy(t)=="symbol"?t:t+""}function G7e(e,t){if(Sy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Sy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Y7e(e){var t,n,r=e.element,a=e.tooltipEventType,i=e.isActive,o=e.activeCoordinate,l=e.activePayload,c=e.offset,d=e.activeTooltipIndex,m=e.tooltipAxisBandSize,u=e.layout,h=e.chartName,p=(t=r.props.cursor)!==null&&t!==void 0?t:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!p||!i||!o||h!=="ScatterChart"&&a!=="axis")return null;var v,y=cD;if(h==="ScatterChart")v=o,y=GBe;else if(h==="BarChart")v=W7e(u,o,c,m),y=CF;else if(u==="radial"){var g=yJ(o),x=g.cx,b=g.cy,w=g.radius,j=g.startAngle,N=g.endAngle;v={cx:x,cy:b,startAngle:j,endAngle:N,innerRadius:w,outerRadius:w},y=CQ}else v={points:H7e(u,o,c)},y=cD;var C=sb(sb(sb(sb({stroke:"#ccc",pointerEvents:"none"},c),v),fn(p,!1)),{},{payload:l,payloadIndex:d,className:pn("recharts-tooltip-cursor",p.className)});return f.isValidElement(p)?f.cloneElement(p,C):f.createElement(y,C)}var Q7e=["item"],J7e=["children","className","width","height","style","compact","title","desc"];function op(e){"@babel/helpers - typeof";return op=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},op(e)}function bh(){return bh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bh.apply(this,arguments)}function eL(e,t){return eze(e)||Z7e(e,t)||bJ(e,t)||X7e()}function X7e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
829In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Z7e(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(m){d=!0,a=m}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function eze(e){if(Array.isArray(e))return e}function tL(e,t){if(e==null)return{};var n=tze(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tze(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function sze(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nze(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,wJ(r.key),r)}}function rze(e,t,n){return t&&nze(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function aze(e,t,n){return t=Wj(t),ize(e,vJ()?Reflect.construct(t,n||[],Wj(e).constructor):t.apply(e,n))}function ize(e,t){if(t&&(op(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return oze(e)}function oze(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vJ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(vJ=function(){return!!e})()}function Wj(e){return Wj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Wj(e)}function lze(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&BD(e,t)}function BD(e,t){return BD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},BD(e,t)}function lp(e){return uze(e)||dze(e)||bJ(e)||cze()}function cze(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
830In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bJ(e,t){if(e){if(typeof e=="string")return LD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return LD(e,t)}}function dze(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function uze(e){if(Array.isArray(e))return LD(e)}function LD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function it(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sL(Object(n),!0).forEach(function(r){ks(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ks(e,t,n){return t=wJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wJ(e){var t=mze(e,"string");return op(t)=="symbol"?t:t+""}function mze(e,t){if(op(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(op(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var hze={xAxis:["bottom","top"],yAxis:["left","right"]},fze={width:"100%",height:"100%"},jJ={x:0,y:0};function nb(e){return e}var pze=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},xze=function(t,n,r,a){var i=n.find(function(m){return m&&m.index===r});if(i){if(t==="horizontal")return{x:i.coordinate,y:a.y};if(t==="vertical")return{x:a.x,y:i.coordinate};if(t==="centric"){var o=i.coordinate,l=a.radius;return it(it(it({},a),la(a.cx,a.cy,l,o)),{},{angle:o,radius:l})}var c=i.coordinate,d=a.angle;return it(it(it({},a),la(a.cx,a.cy,c,d)),{},{angle:d,radius:c})}return jJ},lC=function(t,n){var r=n.graphicalItems,a=n.dataStartIndex,i=n.dataEndIndex,o=(r??[]).reduce(function(l,c){var d=c.props.data;return d&&d.length?[].concat(lp(l),lp(d)):l},[]);return o.length>0?o:t&&t.length&&Ut(a)&&Ut(i)?t.slice(a,i+1):[]};function NJ(e){return e==="number"?[0,"auto"]:void 0}var UD=function(t,n,r,a){var i=t.graphicalItems,o=t.tooltipAxis,l=lC(n,t);return r<0||!i||!i.length||r>=l.length?null:i.reduce(function(c,d){var m,u=(m=d.props.data)!==null&&m!==void 0?m:n;u&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(u=u.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var p=u===void 0?l:u;h=Ww(p,o.dataKey,a)}else h=u&&u[r]||l[r];return h?[].concat(lp(c),[wQ(d,h)]):c},[])},nL=function(t,n,r,a){var i=a||{x:t.chartX,y:t.chartY},o=pze(i,r),l=t.orderedTooltipTicks,c=t.tooltipAxis,d=t.tooltipTicks,m=T3e(o,l,d,c);if(m>=0&&d){var u=d[m]&&d[m].value,h=UD(t,n,m,u),p=xze(r,l,m,i);return{activeTooltipIndex:m,activeLabel:u,activePayload:h,activeCoordinate:p}}return null},gze=function(t,n){var r=n.axes,a=n.graphicalItems,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,m=t.layout,u=t.children,h=t.stackOffset,p=yQ(m,i);return r.reduce(function(v,y){var g,x=y.type.defaultProps!==void 0?it(it({},y.type.defaultProps),y.props):y.props,b=x.type,w=x.dataKey,j=x.allowDataOverflow,N=x.allowDuplicatedCategory,C=x.scale,P=x.ticks,S=x.includeHidden,E=x[o];if(v[E])return v;var T=lC(t.data,{graphicalItems:a.filter(function(J){var I,re=o in J.props?J.props[o]:(I=J.type.defaultProps)===null||I===void 0?void 0:I[o];return re===E}),dataStartIndex:c,dataEndIndex:d}),z=T.length,O,D,k;q7e(x.domain,j,b)&&(O=rD(x.domain,null,j),p&&(b==="number"||C!=="auto")&&(k=Zx(T,w,"category")));var F=NJ(b);if(!O||O.length===0){var W,q=(W=x.domain)!==null&&W!==void 0?W:F;if(w){if(O=Zx(T,w,b),b==="category"&&p){var H=Vke(O);N&&H?(D=O,O=Tj(0,z)):N||(O=RR(q,O,y).reduce(function(J,I){return J.indexOf(I)>=0?J:[].concat(lp(J),[I])},[]))}else if(b==="category")N?O=O.filter(function(J){return J!==""&&!tn(J)}):O=RR(q,O,y).reduce(function(J,I){return J.indexOf(I)>=0||I===""||tn(I)?J:[].concat(lp(J),[I])},[]);else if(b==="number"){var _=$3e(T,a.filter(function(J){var I,re,R=o in J.props?J.props[o]:(I=J.type.defaultProps)===null||I===void 0?void 0:I[o],Y="hide"in J.props?J.props.hide:(re=J.type.defaultProps)===null||re===void 0?void 0:re.hide;return R===E&&(S||!Y)}),w,i,m);_&&(O=_)}p&&(b==="number"||C!=="auto")&&(k=Zx(T,w,"category"))}else p?O=Tj(0,z):l&&l[E]&&l[E].hasStack&&b==="number"?O=h==="expand"?[0,1]:bQ(l[E].stackGroups,c,d):O=gQ(T,a.filter(function(J){var I=o in J.props?J.props[o]:J.type.defaultProps[o],re="hide"in J.props?J.props.hide:J.type.defaultProps.hide;return I===E&&(S||!re)}),b,m,!0);if(b==="number")O=RD(u,O,E,i,P),q&&(O=rD(q,O,j));else if(b==="category"&&q){var L=q,U=O.every(function(J){return L.indexOf(J)>=0});U&&(O=L)}}return it(it({},v),{},ks({},E,it(it({},x),{},{axisType:i,domain:O,categoricalDomain:k,duplicateDomain:D,originalDomain:(g=x.domain)!==null&&g!==void 0?g:F,isCategorical:p,layout:m})))},{})},yze=function(t,n){var r=n.graphicalItems,a=n.Axis,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,m=t.layout,u=t.children,h=lC(t.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:d}),p=h.length,v=yQ(m,i),y=-1;return r.reduce(function(g,x){var b=x.type.defaultProps!==void 0?it(it({},x.type.defaultProps),x.props):x.props,w=b[o],j=NJ("number");if(!g[w]){y++;var N;return v?N=Tj(0,p):l&&l[w]&&l[w].hasStack?(N=bQ(l[w].stackGroups,c,d),N=RD(u,N,w,i)):(N=rD(j,gQ(h,r.filter(function(C){var P,S,E=o in C.props?C.props[o]:(P=C.type.defaultProps)===null||P===void 0?void 0:P[o],T="hide"in C.props?C.props.hide:(S=C.type.defaultProps)===null||S===void 0?void 0:S.hide;return E===w&&!T}),"number",m),a.defaultProps.allowDataOverflow),N=RD(u,N,w,i)),it(it({},g),{},ks({},w,it(it({axisType:i},a.defaultProps),{},{hide:!0,orientation:Vi(hze,"".concat(i,".").concat(y%2),null),domain:N,originalDomain:j,isCategorical:v,layout:m})))}return g},{})},vze=function(t,n){var r=n.axisType,a=r===void 0?"xAxis":r,i=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,m=t.children,u="".concat(a,"Id"),h=Ki(m,i),p={};return h&&h.length?p=gze(t,{axes:h,graphicalItems:o,axisType:a,axisIdKey:u,stackGroups:l,dataStartIndex:c,dataEndIndex:d}):o&&o.length&&(p=yze(t,{Axis:i,graphicalItems:o,axisType:a,axisIdKey:u,stackGroups:l,dataStartIndex:c,dataEndIndex:d})),p},bze=function(t){var n=Wc(t),r=ec(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:JO(r,function(a){return a.coordinate}),tooltipAxis:n,tooltipAxisBandSize:wj(n,r)}},rL=function(t){var n=t.children,r=t.defaultShowTooltip,a=di(n,Xf),i=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(i=a.props.startIndex),a.props.endIndex>=0&&(o=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},wze=function(t){return!t||!t.length?!1:t.some(function(n){var r=nc(n&&n.type);return r&&r.indexOf("Bar")>=0})},aL=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},jze=function(t,n){var r=t.props,a=t.graphicalItems,i=t.xAxisMap,o=i===void 0?{}:i,l=t.yAxisMap,c=l===void 0?{}:l,d=r.width,m=r.height,u=r.children,h=r.margin||{},p=di(u,Xf),v=di(u,Ju),y=Object.keys(c).reduce(function(N,C){var P=c[C],S=P.orientation;return!P.mirror&&!P.hide?it(it({},N),{},ks({},S,N[S]+P.width)):N},{left:h.left||0,right:h.right||0}),g=Object.keys(o).reduce(function(N,C){var P=o[C],S=P.orientation;return!P.mirror&&!P.hide?it(it({},N),{},ks({},S,Vi(N,"".concat(S))+P.height)):N},{top:h.top||0,bottom:h.bottom||0}),x=it(it({},g),y),b=x.bottom;p&&(x.bottom+=p.props.height||Xf.defaultProps.height),v&&n&&(x=_3e(x,a,r,n));var w=d-x.left-x.right,j=m-x.top-x.bottom;return it(it({brushBottom:b},x),{},{width:Math.max(w,0),height:Math.max(j,0)})},Nze=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},Cze=function(t){var n=t.chartName,r=t.GraphicalChild,a=t.defaultTooltipEventType,i=a===void 0?"axis":a,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,d=t.legendContent,m=t.formatAxisMap,u=t.defaultProps,h=function(x,b){var w=b.graphicalItems,j=b.stackGroups,N=b.offset,C=b.updateId,P=b.dataStartIndex,S=b.dataEndIndex,E=x.barSize,T=x.layout,z=x.barGap,O=x.barCategoryGap,D=x.maxBarSize,k=aL(T),F=k.numericAxisName,W=k.cateAxisName,q=wze(w),H=[];return w.forEach(function(_,L){var U=lC(x.data,{graphicalItems:[_],dataStartIndex:P,dataEndIndex:S}),J=_.type.defaultProps!==void 0?it(it({},_.type.defaultProps),_.props):_.props,I=J.dataKey,re=J.maxBarSize,R=J["".concat(F,"Id")],Y=J["".concat(W,"Id")],M={},se=c.reduce(function(ft,be){var Fe=b["".concat(be.axisType,"Map")],_e=J["".concat(be.axisType,"Id")];Fe&&Fe[_e]||be.axisType==="zAxis"||jm();var ze=Fe[_e];return it(it({},ft),{},ks(ks({},be.axisType,ze),"".concat(be.axisType,"Ticks"),ec(ze)))},M),Q=se[W],te=se["".concat(W,"Ticks")],G=j&&j[R]&&j[R].hasStack&&G3e(_,j[R].stackGroups),Z=nc(_.type).indexOf("Bar")>=0,ie=wj(Q,te),A=[],ge=q&&O3e({barSize:E,stackGroups:j,totalSize:Nze(se,W)});if(Z){var je,ke,Ie=tn(re)?D:re,$e=(je=(ke=wj(Q,te,!0))!==null&&ke!==void 0?ke:Ie)!==null&&je!==void 0?je:0;A=F3e({barGap:z,barCategoryGap:O,bandSize:$e!==ie?$e:ie,sizeList:ge[Y],maxBarSize:Ie}),$e!==ie&&(A=A.map(function(ft){return it(it({},ft),{},{position:it(it({},ft.position),{},{offset:ft.position.offset-$e/2})})}))}var qe=_&&_.type&&_.type.getComposedData;qe&&H.push({props:it(it({},qe(it(it({},se),{},{displayedData:U,props:x,dataKey:I,item:_,bandSize:ie,barPosition:A,offset:N,stackedData:G,layout:T,dataStartIndex:P,dataEndIndex:S}))),{},ks(ks(ks({key:_.key||"item-".concat(L)},F,se[F]),W,se[W]),"animationId",C)),childIndex:a2e(_,x.children),item:_})}),H},p=function(x,b){var w=x.props,j=x.dataStartIndex,N=x.dataEndIndex,C=x.updateId;if(!_3({props:w}))return null;var P=w.children,S=w.layout,E=w.stackOffset,T=w.data,z=w.reverseStackOrder,O=aL(S),D=O.numericAxisName,k=O.cateAxisName,F=Ki(P,r),W=H3e(T,F,"".concat(D,"Id"),"".concat(k,"Id"),E,z),q=c.reduce(function(J,I){var re="".concat(I.axisType,"Map");return it(it({},J),{},ks({},re,vze(w,it(it({},I),{},{graphicalItems:F,stackGroups:I.axisType===D&&W,dataStartIndex:j,dataEndIndex:N}))))},{}),H=jze(it(it({},q),{},{props:w,graphicalItems:F}),b==null?void 0:b.legendBBox);Object.keys(q).forEach(function(J){q[J]=m(w,q[J],H,J.replace("Map",""),n)});var _=q["".concat(k,"Map")],L=bze(_),U=h(w,it(it({},q),{},{dataStartIndex:j,dataEndIndex:N,updateId:C,graphicalItems:F,stackGroups:W,offset:H}));return it(it({formattedGraphicalItems:U,graphicalItems:F,offset:H,stackGroups:W},L),q)},v=function(g){function x(b){var w,j,N;return sze(this,x),N=aze(this,x,[b]),ks(N,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ks(N,"accessibilityManager",new z7e),ks(N,"handleLegendBBoxUpdate",function(C){if(C){var P=N.state,S=P.dataStartIndex,E=P.dataEndIndex,T=P.updateId;N.setState(it({legendBBox:C},p({props:N.props,dataStartIndex:S,dataEndIndex:E,updateId:T},it(it({},N.state),{},{legendBBox:C}))))}}),ks(N,"handleReceiveSyncEvent",function(C,P,S){if(N.props.syncId===C){if(S===N.eventEmitterSymbol&&typeof N.props.syncMethod!="function")return;N.applySyncEvent(P)}}),ks(N,"handleBrushChange",function(C){var P=C.startIndex,S=C.endIndex;if(P!==N.state.dataStartIndex||S!==N.state.dataEndIndex){var E=N.state.updateId;N.setState(function(){return it({dataStartIndex:P,dataEndIndex:S},p({props:N.props,dataStartIndex:P,dataEndIndex:S,updateId:E},N.state))}),N.triggerSyncEvent({dataStartIndex:P,dataEndIndex:S})}}),ks(N,"handleMouseEnter",function(C){var P=N.getMouseInfo(C);if(P){var S=it(it({},P),{},{isTooltipActive:!0});N.setState(S),N.triggerSyncEvent(S);var E=N.props.onMouseEnter;Ks(E)&&E(S,C)}}),ks(N,"triggeredAfterMouseMove",function(C){var P=N.getMouseInfo(C),S=P?it(it({},P),{},{isTooltipActive:!0}):{isTooltipActive:!1};N.setState(S),N.triggerSyncEvent(S);var E=N.props.onMouseMove;Ks(E)&&E(S,C)}),ks(N,"handleItemMouseEnter",function(C){N.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),ks(N,"handleItemMouseLeave",function(){N.setState(function(){return{isTooltipActive:!1}})}),ks(N,"handleMouseMove",function(C){C.persist(),N.throttleTriggeredAfterMouseMove(C)}),ks(N,"handleMouseLeave",function(C){N.throttleTriggeredAfterMouseMove.cancel();var P={isTooltipActive:!1};N.setState(P),N.triggerSyncEvent(P);var S=N.props.onMouseLeave;Ks(S)&&S(P,C)}),ks(N,"handleOuterEvent",function(C){var P=r2e(C),S=Vi(N.props,"".concat(P));if(P&&Ks(S)){var E,T;/.*touch.*/i.test(P)?T=N.getMouseInfo(C.changedTouches[0]):T=N.getMouseInfo(C),S((E=T)!==null&&E!==void 0?E:{},C)}}),ks(N,"handleClick",function(C){var P=N.getMouseInfo(C);if(P){var S=it(it({},P),{},{isTooltipActive:!0});N.setState(S),N.triggerSyncEvent(S);var E=N.props.onClick;Ks(E)&&E(S,C)}}),ks(N,"handleMouseDown",function(C){var P=N.props.onMouseDown;if(Ks(P)){var S=N.getMouseInfo(C);P(S,C)}}),ks(N,"handleMouseUp",function(C){var P=N.props.onMouseUp;if(Ks(P)){var S=N.getMouseInfo(C);P(S,C)}}),ks(N,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&N.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),ks(N,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&N.handleMouseDown(C.changedTouches[0])}),ks(N,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&N.handleMouseUp(C.changedTouches[0])}),ks(N,"handleDoubleClick",function(C){var P=N.props.onDoubleClick;if(Ks(P)){var S=N.getMouseInfo(C);P(S,C)}}),ks(N,"handleContextMenu",function(C){var P=N.props.onContextMenu;if(Ks(P)){var S=N.getMouseInfo(C);P(S,C)}}),ks(N,"triggerSyncEvent",function(C){N.props.syncId!==void 0&&kk.emit(Pk,N.props.syncId,C,N.eventEmitterSymbol)}),ks(N,"applySyncEvent",function(C){var P=N.props,S=P.layout,E=P.syncMethod,T=N.state.updateId,z=C.dataStartIndex,O=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)N.setState(it({dataStartIndex:z,dataEndIndex:O},p({props:N.props,dataStartIndex:z,dataEndIndex:O,updateId:T},N.state)));else if(C.activeTooltipIndex!==void 0){var D=C.chartX,k=C.chartY,F=C.activeTooltipIndex,W=N.state,q=W.offset,H=W.tooltipTicks;if(!q)return;if(typeof E=="function")F=E(H,C);else if(E==="value"){F=-1;for(var _=0;_<H.length;_++)if(H[_].value===C.activeLabel){F=_;break}}var L=it(it({},q),{},{x:q.left,y:q.top}),U=Math.min(D,L.x+L.width),J=Math.min(k,L.y+L.height),I=H[F]&&H[F].value,re=UD(N.state,N.props.data,F),R=H[F]?{x:S==="horizontal"?H[F].coordinate:U,y:S==="horizontal"?J:H[F].coordinate}:jJ;N.setState(it(it({},C),{},{activeLabel:I,activeCoordinate:R,activePayload:re,activeTooltipIndex:F}))}else N.setState(C)}),ks(N,"renderCursor",function(C){var P,S=N.state,E=S.isTooltipActive,T=S.activeCoordinate,z=S.activePayload,O=S.offset,D=S.activeTooltipIndex,k=S.tooltipAxisBandSize,F=N.getTooltipEventType(),W=(P=C.props.active)!==null&&P!==void 0?P:E,q=N.props.layout,H=C.key||"_recharts-cursor";return he.createElement(Y7e,{key:H,activeCoordinate:T,activePayload:z,activeTooltipIndex:D,chartName:n,element:C,isActive:W,layout:q,offset:O,tooltipAxisBandSize:k,tooltipEventType:F})}),ks(N,"renderPolarAxis",function(C,P,S){var E=Vi(C,"type.axisType"),T=Vi(N.state,"".concat(E,"Map")),z=C.type.defaultProps,O=z!==void 0?it(it({},z),C.props):C.props,D=T&&T[O["".concat(E,"Id")]];return f.cloneElement(C,it(it({},D),{},{className:pn(E,D.className),key:C.key||"".concat(P,"-").concat(S),ticks:ec(D,!0)}))}),ks(N,"renderPolarGrid",function(C){var P=C.props,S=P.radialLines,E=P.polarAngles,T=P.polarRadius,z=N.state,O=z.radiusAxisMap,D=z.angleAxisMap,k=Wc(O),F=Wc(D),W=F.cx,q=F.cy,H=F.innerRadius,_=F.outerRadius;return f.cloneElement(C,{polarAngles:Array.isArray(E)?E:ec(F,!0).map(function(L){return L.coordinate}),polarRadius:Array.isArray(T)?T:ec(k,!0).map(function(L){return L.coordinate}),cx:W,cy:q,innerRadius:H,outerRadius:_,key:C.key||"polar-grid",radialLines:S})}),ks(N,"renderLegend",function(){var C=N.state.formattedGraphicalItems,P=N.props,S=P.children,E=P.width,T=P.height,z=N.props.margin||{},O=E-(z.left||0)-(z.right||0),D=pQ({children:S,formattedGraphicalItems:C,legendWidth:O,legendContent:d});if(!D)return null;var k=D.item,F=tL(D,Q7e);return f.cloneElement(k,it(it({},F),{},{chartWidth:E,chartHeight:T,margin:z,onBBoxUpdate:N.handleLegendBBoxUpdate}))}),ks(N,"renderTooltip",function(){var C,P=N.props,S=P.children,E=P.accessibilityLayer,T=di(S,sl);if(!T)return null;var z=N.state,O=z.isTooltipActive,D=z.activeCoordinate,k=z.activePayload,F=z.activeLabel,W=z.offset,q=(C=T.props.active)!==null&&C!==void 0?C:O;return f.cloneElement(T,{viewBox:it(it({},W),{},{x:W.left,y:W.top}),active:q,label:F,payload:q?k:[],coordinate:D,accessibilityLayer:E})}),ks(N,"renderBrush",function(C){var P=N.props,S=P.margin,E=P.data,T=N.state,z=T.offset,O=T.dataStartIndex,D=T.dataEndIndex,k=T.updateId;return f.cloneElement(C,{key:C.key||"_recharts-brush",onChange:X0(N.handleBrushChange,C.props.onChange),data:E,x:Ut(C.props.x)?C.props.x:z.left,y:Ut(C.props.y)?C.props.y:z.top+z.height+z.brushBottom-(S.bottom||0),width:Ut(C.props.width)?C.props.width:z.width,startIndex:O,endIndex:D,updateId:"brush-".concat(k)})}),ks(N,"renderReferenceElement",function(C,P,S){if(!C)return null;var E=N,T=E.clipPathId,z=N.state,O=z.xAxisMap,D=z.yAxisMap,k=z.offset,F=C.type.defaultProps||{},W=C.props,q=W.xAxisId,H=q===void 0?F.xAxisId:q,_=W.yAxisId,L=_===void 0?F.yAxisId:_;return f.cloneElement(C,{key:C.key||"".concat(P,"-").concat(S),xAxis:O[H],yAxis:D[L],viewBox:{x:k.left,y:k.top,width:k.width,height:k.height},clipPathId:T})}),ks(N,"renderActivePoints",function(C){var P=C.item,S=C.activePoint,E=C.basePoint,T=C.childIndex,z=C.isRange,O=[],D=P.props.key,k=P.item.type.defaultProps!==void 0?it(it({},P.item.type.defaultProps),P.item.props):P.item.props,F=k.activeDot,W=k.dataKey,q=it(it({index:T,dataKey:W,cx:S.x,cy:S.y,r:4,fill:NF(P.item),strokeWidth:2,stroke:"#fff",payload:S.payload,value:S.value},fn(F,!1)),Hw(F));return O.push(x.renderActiveDot(F,q,"".concat(D,"-activePoint-").concat(T))),E?O.push(x.renderActiveDot(F,it(it({},q),{},{cx:E.x,cy:E.y}),"".concat(D,"-basePoint-").concat(T))):z&&O.push(null),O}),ks(N,"renderGraphicChild",function(C,P,S){var E=N.filterFormatItem(C,P,S);if(!E)return null;var T=N.getTooltipEventType(),z=N.state,O=z.isTooltipActive,D=z.tooltipAxis,k=z.activeTooltipIndex,F=z.activeLabel,W=N.props.children,q=di(W,sl),H=E.props,_=H.points,L=H.isRange,U=H.baseLine,J=E.item.type.defaultProps!==void 0?it(it({},E.item.type.defaultProps),E.item.props):E.item.props,I=J.activeDot,re=J.hide,R=J.activeBar,Y=J.activeShape,M=!!(!re&&O&&q&&(I||R||Y)),se={};T!=="axis"&&q&&q.props.trigger==="click"?se={onClick:X0(N.handleItemMouseEnter,C.props.onClick)}:T!=="axis"&&(se={onMouseLeave:X0(N.handleItemMouseLeave,C.props.onMouseLeave),onMouseEnter:X0(N.handleItemMouseEnter,C.props.onMouseEnter)});var Q=f.cloneElement(C,it(it({},E.props),se));function te(be){return typeof D.dataKey=="function"?D.dataKey(be.payload):null}if(M)if(k>=0){var G,Z;if(D.dataKey&&!D.allowDuplicatedCategory){var ie=typeof D.dataKey=="function"?te:"payload.".concat(D.dataKey.toString());G=Ww(_,ie,F),Z=L&&U&&Ww(U,ie,F)}else G=_==null?void 0:_[k],Z=L&&U&&U[k];if(Y||R){var A=C.props.activeIndex!==void 0?C.props.activeIndex:k;return[f.cloneElement(C,it(it(it({},E.props),se),{},{activeIndex:A})),null,null]}if(!tn(G))return[Q].concat(lp(N.renderActivePoints({item:E,activePoint:G,basePoint:Z,childIndex:k,isRange:L})))}else{var ge,je=(ge=N.getItemByXY(N.state.activeCoordinate))!==null&&ge!==void 0?ge:{graphicalItem:Q},ke=je.graphicalItem,Ie=ke.item,$e=Ie===void 0?C:Ie,qe=ke.childIndex,ft=it(it(it({},E.props),se),{},{activeIndex:qe});return[f.cloneElement($e,ft),null,null]}return L?[Q,null,null]:[Q,null]}),ks(N,"renderCustomized",function(C,P,S){return f.cloneElement(C,it(it({key:"recharts-customized-".concat(S)},N.props),N.state))}),ks(N,"renderMap",{CartesianGrid:{handler:nb,once:!0},ReferenceArea:{handler:N.renderReferenceElement},ReferenceLine:{handler:nb},ReferenceDot:{handler:N.renderReferenceElement},XAxis:{handler:nb},YAxis:{handler:nb},Brush:{handler:N.renderBrush,once:!0},Bar:{handler:N.renderGraphicChild},Line:{handler:N.renderGraphicChild},Area:{handler:N.renderGraphicChild},Radar:{handler:N.renderGraphicChild},RadialBar:{handler:N.renderGraphicChild},Scatter:{handler:N.renderGraphicChild},Pie:{handler:N.renderGraphicChild},Funnel:{handler:N.renderGraphicChild},Tooltip:{handler:N.renderCursor,once:!0},PolarGrid:{handler:N.renderPolarGrid,once:!0},PolarAngleAxis:{handler:N.renderPolarAxis},PolarRadiusAxis:{handler:N.renderPolarAxis},Customized:{handler:N.renderCustomized}}),N.clipPathId="".concat((w=b.id)!==null&&w!==void 0?w:Ev("recharts"),"-clip"),N.throttleTriggeredAfterMouseMove=c1(N.triggeredAfterMouseMove,(j=b.throttleDelay)!==null&&j!==void 0?j:1e3/60),N.state={},N}return lze(x,g),rze(x,[{key:"componentDidMount",value:function(){var w,j;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(j=this.props.margin.top)!==null&&j!==void 0?j:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var w=this.props,j=w.children,N=w.data,C=w.height,P=w.layout,S=di(j,sl);if(S){var E=S.props.defaultIndex;if(!(typeof E!="number"||E<0||E>this.state.tooltipTicks.length-1)){var T=this.state.tooltipTicks[E]&&this.state.tooltipTicks[E].value,z=UD(this.state,N,E,T),O=this.state.tooltipTicks[E].coordinate,D=(this.state.offset.top+C)/2,k=P==="horizontal",F=k?{x:O,y:D}:{y:O,x:D},W=this.state.formattedGraphicalItems.find(function(H){var _=H.item;return _.type.name==="Scatter"});W&&(F=it(it({},F),W.props.points[E].tooltipPosition),z=W.props.points[E].tooltipPayload);var q={activeTooltipIndex:E,isTooltipActive:!0,activeLabel:T,activePayload:z,activeCoordinate:F};this.setState(q),this.renderCursor(S),this.accessibilityManager.setIndex(E)}}}},{key:"getSnapshotBeforeUpdate",value:function(w,j){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==j.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==w.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==w.margin){var N,C;this.accessibilityManager.setDetails({offset:{left:(N=this.props.margin.left)!==null&&N!==void 0?N:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(w){vE([di(w.children,sl)],[di(this.props.children,sl)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var w=di(this.props.children,sl);if(w&&typeof w.props.shared=="boolean"){var j=w.props.shared?"axis":"item";return l.indexOf(j)>=0?j:i}return i}},{key:"getMouseInfo",value:function(w){if(!this.container)return null;var j=this.container,N=j.getBoundingClientRect(),C=nMe(N),P={chartX:Math.round(w.pageX-C.left),chartY:Math.round(w.pageY-C.top)},S=N.width/j.offsetWidth||1,E=this.inRange(P.chartX,P.chartY,S);if(!E)return null;var T=this.state,z=T.xAxisMap,O=T.yAxisMap,D=this.getTooltipEventType(),k=nL(this.state,this.props.data,this.props.layout,E);if(D!=="axis"&&z&&O){var F=Wc(z).scale,W=Wc(O).scale,q=F&&F.invert?F.invert(P.chartX):null,H=W&&W.invert?W.invert(P.chartY):null;return it(it({},P),{},{xValue:q,yValue:H},k)}return k?it(it({},P),k):null}},{key:"inRange",value:function(w,j){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,P=w/N,S=j/N;if(C==="horizontal"||C==="vertical"){var E=this.state.offset,T=P>=E.left&&P<=E.left+E.width&&S>=E.top&&S<=E.top+E.height;return T?{x:P,y:S}:null}var z=this.state,O=z.angleAxisMap,D=z.radiusAxisMap;if(O&&D){var k=Wc(O);return UR({x:P,y:S},k)}return null}},{key:"parseEventsOfWrapper",value:function(){var w=this.props.children,j=this.getTooltipEventType(),N=di(w,sl),C={};N&&j==="axis"&&(N.props.trigger==="click"?C={onClick:this.handleClick}:C={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var P=Hw(this.props,this.handleOuterEvent);return it(it({},P),C)}},{key:"addListener",value:function(){kk.on(Pk,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){kk.removeListener(Pk,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(w,j,N){for(var C=this.state.formattedGraphicalItems,P=0,S=C.length;P<S;P++){var E=C[P];if(E.item===w||E.props.key===w.key||j===nc(E.item.type)&&N===E.childIndex)return E}return null}},{key:"renderClipPath",value:function(){var w=this.clipPathId,j=this.state.offset,N=j.left,C=j.top,P=j.height,S=j.width;return he.createElement("defs",null,he.createElement("clipPath",{id:w},he.createElement("rect",{x:N,y:C,height:P,width:S})))}},{key:"getXScales",value:function(){var w=this.state.xAxisMap;return w?Object.entries(w).reduce(function(j,N){var C=eL(N,2),P=C[0],S=C[1];return it(it({},j),{},ks({},P,S.scale))},{}):null}},{key:"getYScales",value:function(){var w=this.state.yAxisMap;return w?Object.entries(w).reduce(function(j,N){var C=eL(N,2),P=C[0],S=C[1];return it(it({},j),{},ks({},P,S.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(w){var j;return(j=this.state.xAxisMap)===null||j===void 0||(j=j[w])===null||j===void 0?void 0:j.scale}},{key:"getYScaleByAxisId",value:function(w){var j;return(j=this.state.yAxisMap)===null||j===void 0||(j=j[w])===null||j===void 0?void 0:j.scale}},{key:"getItemByXY",value:function(w){var j=this.state,N=j.formattedGraphicalItems,C=j.activeItem;if(N&&N.length)for(var P=0,S=N.length;P<S;P++){var E=N[P],T=E.props,z=E.item,O=z.type.defaultProps!==void 0?it(it({},z.type.defaultProps),z.props):z.props,D=nc(z.type);if(D==="Bar"){var k=(T.data||[]).find(function(H){return RBe(w,H)});if(k)return{graphicalItem:E,payload:k}}else if(D==="RadialBar"){var F=(T.data||[]).find(function(H){return UR(w,H)});if(F)return{graphicalItem:E,payload:F}}else if(Z1(E,C)||eC(E,C)||vy(E,C)){var W=ULe({graphicalItem:E,activeTooltipItem:C,itemData:O.data}),q=O.activeIndex===void 0?W:O.activeIndex;return{graphicalItem:it(it({},E),{},{childIndex:q}),payload:vy(E,C)?O.data[W]:E.props.data[W]}}}return null}},{key:"render",value:function(){var w=this;if(!_3(this))return null;var j=this.props,N=j.children,C=j.className,P=j.width,S=j.height,E=j.style,T=j.compact,z=j.title,O=j.desc,D=tL(j,J7e),k=fn(D,!1);if(T)return he.createElement($B,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},he.createElement(wE,bh({},k,{width:P,height:S,title:z,desc:O}),this.renderClipPath(),$3(N,this.renderMap)));if(this.props.accessibilityLayer){var F,W;k.tabIndex=(F=this.props.tabIndex)!==null&&F!==void 0?F:0,k.role=(W=this.props.role)!==null&&W!==void 0?W:"application",k.onKeyDown=function(H){w.accessibilityManager.keyboardEvent(H)},k.onFocus=function(){w.accessibilityManager.focus()}}var q=this.parseEventsOfWrapper();return he.createElement($B,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},he.createElement("div",bh({className:pn("recharts-wrapper",C),style:it({position:"relative",cursor:"default",width:P,height:S},E)},q,{ref:function(_){w.container=_}}),he.createElement(wE,bh({},k,{width:P,height:S,title:z,desc:O,style:fze}),this.renderClipPath(),$3(N,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(f.Component);ks(v,"displayName",n),ks(v,"defaultProps",it({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},u)),ks(v,"getDerivedStateFromProps",function(g,x){var b=g.dataKey,w=g.data,j=g.children,N=g.width,C=g.height,P=g.layout,S=g.stackOffset,E=g.margin,T=x.dataStartIndex,z=x.dataEndIndex;if(x.updateId===void 0){var O=rL(g);return it(it(it({},O),{},{updateId:0},p(it(it({props:g},O),{},{updateId:0}),x)),{},{prevDataKey:b,prevData:w,prevWidth:N,prevHeight:C,prevLayout:P,prevStackOffset:S,prevMargin:E,prevChildren:j})}if(b!==x.prevDataKey||w!==x.prevData||N!==x.prevWidth||C!==x.prevHeight||P!==x.prevLayout||S!==x.prevStackOffset||!Bh(E,x.prevMargin)){var D=rL(g),k={chartX:x.chartX,chartY:x.chartY,isTooltipActive:x.isTooltipActive},F=it(it({},nL(x,w,P)),{},{updateId:x.updateId+1}),W=it(it(it({},D),k),F);return it(it(it({},W),p(it({props:g},W),x)),{},{prevDataKey:b,prevData:w,prevWidth:N,prevHeight:C,prevLayout:P,prevStackOffset:S,prevMargin:E,prevChildren:j})}if(!vE(j,x.prevChildren)){var q,H,_,L,U=di(j,Xf),J=U&&(q=(H=U.props)===null||H===void 0?void 0:H.startIndex)!==null&&q!==void 0?q:T,I=U&&(_=(L=U.props)===null||L===void 0?void 0:L.endIndex)!==null&&_!==void 0?_:z,re=J!==T||I!==z,R=!tn(w),Y=R&&!re?x.updateId:x.updateId+1;return it(it({updateId:Y},p(it(it({props:g},x),{},{updateId:Y,dataStartIndex:J,dataEndIndex:I}),x)),{},{prevChildren:j,dataStartIndex:J,dataEndIndex:I})}return null}),ks(v,"renderActiveDot",function(g,x,b){var w;return f.isValidElement(g)?w=f.cloneElement(g,x):Ks(g)?w=g(x):w=he.createElement(SF,x),he.createElement(wr,{className:"recharts-active-dot",key:b},w)});var y=f.forwardRef(function(x,b){return he.createElement(v,bh({},x,{ref:b}))});return y.displayName=v.displayName,y},Sze=Cze({chartName:"LineChart",GraphicalChild:em,axisComponents:[{axisType:"xAxis",AxisComp:iC},{axisType:"yAxis",AxisComp:oC}],formatAxisMap:mUe});const kze={light:"",dark:".dark"},CJ=f.createContext(null);function SJ(){const e=f.useContext(CJ);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const kJ=f.forwardRef(({id:e,className:t,children:n,config:r,...a},i)=>{const o=f.useId(),l=`chart-${e||o.replace(/:/g,"")}`;return s.jsx(CJ.Provider,{value:{config:r},children:s.jsxs("div",{"data-chart":l,ref:i,className:bt("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",t),...a,children:[s.jsx(Pze,{id:l,config:r}),s.jsx(pY,{children:n})]})})});
830kJ.displayName="Chart";const Pze=({id:e,config:t})=>{const n=Object.entries(t).filter(([,r])=>r.theme||r.color);return n.length?s.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(kze).map(([r,a])=>`
831${a} [data-chart=${e}] {
832${n.map(([i,o])=>{var c;const l=((c=o.theme)==null?void 0:c[r])||o.color;return l?`  --color-${i}: ${l};`:null}).join(`
833`)}
834}
835`).join(`
836`)}}):null},Eze=sl,Dze=f.forwardRef(({active:e,payload:t,className:n,indicator:r="dot",hideLabel:a=!1,hideIndicator:i=!1,label:o,labelFormatter:l,labelClassName:c,formatter:d,color:m,nameKey:u,labelKey:h},p)=>{const{config:v}=SJ(),y=f.useMemo(()=>{var N;if(a||!(t!=null&&t.length))return null;const[x]=t,b=`${h||(x==null?void 0:x.dataKey)||(x==null?void 0:x.name)||"value"}`,w=zD(v,x,b),j=!h&&typeof o=="string"?((N=v[o])==null?void 0:N.label)||o:w==null?void 0:w.label;return l?s.jsx("div",{className:bt("font-medium",c),children:l(j,t)}):j?s.jsx("div",{className:bt("font-medium",c),children:j}):null},[o,l,t,a,c,v,h]);if(!e||!(t!=null&&t.length))return null;const g=t.length===1&&r!=="dot";return s.jsxs("div",{ref:p,className:bt("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[g?null:y,s.jsx("div",{className:"grid gap-1.5",children:t.map((x,b)=>{const w=`${u||x.name||x.dataKey||"value"}`,j=zD(v,x,w),N=m||x.payload.fill||x.color;return s.jsx("div",{className:bt("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:d&&(x==null?void 0:x.value)!==void 0&&x.name?d(x.value,x.name,x,b,x.payload):s.jsxs(s.Fragment,{children:[j!=null&&j.icon?s.jsx(j.icon,{}):!i&&s.jsx("div",{className:bt("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":g&&r==="dashed"}),style:{"--color-bg":N,"--color-border":N}}),s.jsxs("div",{className:bt("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[s.jsxs("div",{className:"grid gap-1.5",children:[g?y:null,s.jsx("span",{className:"text-muted-foreground",children:(j==null?void 0:j.label)||x.name})]}),x.value&&s.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:x.value.toLocaleString()})]})]})},x.dataKey)})})]})});Dze.displayName="ChartTooltip";const Aze=f.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:r="bottom",nameKey:a},i)=>{const{config:o}=SJ();return n!=null&&n.length?s.jsx("div",{ref:i,className:bt("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",e),children:n.map(l=>{const c=`${a||l.dataKey||"value"}`,d=zD(o,l,c);return s.jsxs("div",{className:bt("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[d!=null&&d.icon&&!t?s.jsx(d.icon,{}):s.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:l.color}}),d==null?void 0:d.label]},l.value)})}):null});Aze.displayName="ChartLegend";function zD(e,t,n){if(typeof t!="object"||t===null)return;const r="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let a=n;return n in t&&typeof t[n]=="string"?a=t[n]:r&&n in r&&typeof r[n]=="string"&&(a=r[n]),a in e?e[a]:e[n]}const ii={signups:{label:"Trial Signups",color:"hsl(var(--chart-1))"},subscribers:{label:"Active Subscribers",color:"hsl(var(--chart-2))"},forecast:{label:"Forecast",color:"hsl(var(--chart-3))"}};function Tze({password:e}){var x,b,w,j,N,C,P,S;const{data:t,isLoading:n,error:r}=Ue({queryKey:["/api/superadmin/subscription-forecast",e],queryFn:async()=>{const E=await fetch("/api/superadmin/subscription-forecast",{headers:{Authorization:`Master ${e}`}});if(!E.ok)throw new Error("Failed to fetch subscription forecast");return E.json()}});if(n)return s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Subscription Growth & Forecast"})}),s.jsx(Ee,{children:s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("p",{className:"text-slate-500",children:"Loading forecast data..."})})})]});if(r||!t)return s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Subscription Growth & Forecast"})}),s.jsx(Ee,{children:s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("p",{className:"text-slate-500",children:"Failed to load forecast data"})})})]});if(!((x=t.signups)!=null&&x.historical)||!((b=t.subscribers)!=null&&b.historical)||!((w=t.subscribers)!=null&&w.forecast))return s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Subscription Growth & Forecast"})}),s.jsx(Ee,{children:s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("p",{className:"text-slate-500",children:"Invalid data format received"})})})]});const a=new Set([...(t.signups.historical||[]).map(E=>E.month),...(t.subscribers.historical||[]).map(E=>E.month),...(t.subscribers.forecast||[]).map(E=>E.month)]),i=Array.from(a).sort(),o=new Map(t.signups.historical.map(E=>
836[E.month,E])),l=new Map(t.subscribers.historical.map(E=>[E.month,E])),c=new Map(t.subscribers.forecast.map(E=>[E.month,E])),d=((j=t.subscribers)==null?void 0:j.historical)||[],m=((N=t.signups)==null?void 0:N.historical)||[],u=i.map(E=>{const T=o.get(E),z=l.get(E),O=c.get(E);return{month:iL(E),signups:(T==null?void 0:T.cumulative)??null,subscribers:(z==null?void 0:z.cumulative)??null,forecast:(O==null?void 0:O.cumulative)??null,isForecast:(O==null?void 0:O.isForecast)??!1}});if(d.length>0&&(((C=t.subscribers)==null?void 0:C.forecast)||[]).length>0){const E=d[d.length-1],T=E.cumulative,z=iL(E.month);u.forEach(D=>{D.forecast!==null&&D.isForecast&&D.forecast<T&&(D.forecast=T)});const O=u.findIndex(D=>D.month===z);O>=0&&(u[O]={...u[O],forecast:T})}const h=d.length>0?d[d.length-1].cumulative-(((P=d[0])==null?void 0:P.cumulative)||0):0,p=d.length>1?h/(d.length-1):0,v=d.length>0?d[d.length-1].cumulative:0,y=(((S=t.subscribers)==null?void 0:S.forecast)||[]).length>0?t.subscribers.forecast[t.subscribers.forecast.length-1].cumulative:v,g=m.length>0?m[m.length-1].cumulative:0;return s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center space-x-2",children:[s.jsx(fh,{className:"h-5 w-5"}),s.jsx("span",{children:"Subscription Growth & Forecast"})]})}),s.jsx(Ee,{children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-2xl font-bold text-slate-900",children:g}),s.jsx("p",{className:"text-sm text-slate-600",children:"Total Signups"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-2xl font-bold text-green-600",children:v}),s.jsx("p",{className:"text-sm text-slate-600",children:"Active Subscribers"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-2xl font-bold text-blue-600",children:Math.round(p)}),s.jsx("p",{className:"text-sm text-slate-600",children:"Avg Monthly Growth"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-2xl font-bold text-purple-600",children:y}),s.jsx("p",{className:"text-sm text-slate-600",children:"Projected (6 months)"})]})]}),s.jsx(kJ,{config:ii,className:"h-[400px] w-full",children:s.jsx(pY,{width:"100%",height:"100%",children:s.jsxs(Sze,{data:u,margin:{top:5,right:30,left:20,bottom:5},children:[s.jsx(oJ,{strokeDasharray:"3 3",className:"stroke-slate-200"}),s.jsx(iC,{dataKey:"month",className:"text-xs",tick:{fill:"currentColor"},angle:-45,textAnchor:"end",height:80}),s.jsx(oC,{className:"text-xs",tick:{fill:"currentColor"},label:{value:"Count",angle:-90,position:"insideLeft"}}),s.jsx(Eze,{content:({active:E,payload:T})=>{if(!E||!T||!T.length)return null;const z=T[0].payload;return s.jsxs("div",{className:"rounded-lg border bg-white p-3 shadow-lg",children:[s.jsx("div",{className:"font-semibold",children:z.month}),s.jsxs("div",{className:"mt-2 space-y-1",children:[z.signups!==null&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"h-3 w-3 rounded-full",style:{backgroundColor:ii.signups.color}}),s.jsxs("span",{className:"text-sm",children:[z.signups," trial signups"]})]}),z.subscribers!==null&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"h-3 w-3 rounded-full",style:{backgroundColor:ii.subscribers.color}}),s.jsxs("span",{className:"text-sm",children:[z.subscribers," active subscribers"]}
836)]}),z.forecast!==null&&s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"h-3 w-3 rounded-full",style:{backgroundColor:ii.forecast.color}}),s.jsxs("span",{className:"text-sm",children:[z.forecast," forecast (subscribers)"]})]})]})]})}}),s.jsx(Ju,{}),s.jsx(em,{type:"monotone",dataKey:"signups",stroke:ii.signups.color,strokeWidth:2,dot:{fill:ii.signups.color,r:4},activeDot:{r:6},connectNulls:!1,name:ii.signups.label}),s.jsx(em,{type:"monotone",dataKey:"subscribers",stroke:ii.subscribers.color,strokeWidth:2,dot:{fill:ii.subscribers.color,r:4},activeDot:{r:6},connectNulls:!1,name:ii.subscribers.label}),s.jsx(em,{type:"monotone",dataKey:"forecast",stroke:ii.forecast.color,strokeWidth:2,strokeDasharray:"5 5",dot:{fill:ii.forecast.color,r:4},connectNulls:!1,name:ii.forecast.label})]})})}),s.jsx("div",{className:"text-sm text-slate-500 text-center",children:s.jsx("p",{children:"Shows trial signups and active subscribers (with Stripe/RevenueCat subscriptions). Forecast based on linear regression of historical subscriber data."})}),s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Raw Data"})}),s.jsx(Ee,{children:s.jsx("div",{className:"overflow-x-auto max-h-[600px] overflow-y-auto",children:s.jsxs(qd,{children:[s.jsx(Wd,{className:"sticky top-0 bg-white",children:s.jsxs(Ra,{children:[s.jsx(Es,{children:"Month"}),s.jsx(Es,{className:"text-right",children:"Trial Signups (New)"}),s.jsx(Es,{className:"text-right",children:"Trial Signups (Cumulative)"}),s.jsx(Es,{className:"text-right",children:"Subscribers (New)"}),s.jsx(Es,{className:"text-right",children:"Subscribers (Cumulative)"}),s.jsx(Es,{className:"text-right",children:"Forecast (Cumulative)"})]})}),s.jsx(Hd,{children:u.map((E,T)=>{const z=T===0?E.signups!==null?E.signups:null:u[T-1].signups!==null&&E.signups!==null?E.signups-u[T-1].signups:null,O=T===0?E.subscribers!==null?E.subscribers:null:u[T-1].subscribers!==null&&E.subscribers!==null?E.subscribers-u[T-1].subscribers:null;return T===0||u[T-1].forecast===null?E.forecast!==null&&E.forecast:E.forecast!==null&&u[T-1].forecast!==null&&E.forecast-u[T-1].forecast,s.jsxs(Ra,{children:[s.jsx(Ds,{className:"font-medium",children:E.month}),s.jsx(Ds,{className:"text-right",children:z!==null?z.toLocaleString():"-"}),s.jsx(Ds,{className:"text-right",children:E.signups!==null?E.signups.toLocaleString():"-"}),s.jsx(Ds,{className:"text-right",children:O!==null?O.toLocaleString():"-"}),s.jsx(Ds,{className:"text-right",children:E.subscribers!==null?E.subscribers.toLocaleString():"-"}),s.jsx(Ds,{className:"text-right",children:E.forecast!==null?s.jsxs("span",{className:E.isForecast?"text-slate-500 italic":"",children:[E.forecast.toLocaleString(),E.isForecast&&" (forecast)"]}):"-"})]},T)})})]})})})]})]})})]})}function iL(e){const[t,n]=e.split("-");return new Date(parseInt(t),parseInt(n)-1,1).toLocaleDateString("en-US",{month:"short",year:"numeric"})}const Oze=kT,Fze=PT,PJ=f.forwardRef(({className:e,...t},n)=>s.jsx(mv,{className:bt("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));PJ.displayName=mv.displayName;const _ze=ov("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"}}),EJ=f.forwardRef(({side:e="right",className:t,children:n,...r},a)=>s.jsxs(Fze,{children:[s.jsx(PJ,{}),s.jsxs(hv,{ref:a,className:bt(_ze({side:e}),t),...r,children:[n,s.jsxs(XN,{className:"absolute right-4 top-4 roun
836ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[s.jsx(ja,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));EJ.displayName=hv.displayName;const DJ=({className:e,...t})=>s.jsx("div",{className:bt("flex flex-col space-y-2 text-center sm:text-left",e),...t});DJ.displayName="SheetHeader";const AJ=f.forwardRef(({className:e,...t},n)=>s.jsx(fv,{ref:n,className:bt("text-lg font-semibold text-foreground",e),...t}));AJ.displayName=fv.displayName;const Mze=f.forwardRef(({className:e,...t},n)=>s.jsx(pv,{ref:n,className:bt("text-sm text-muted-foreground",e),...t}));Mze.displayName=pv.displayName;function $ze(e){const t=Ize(e),n=f.forwardRef((r,a)=>{const{children:i,...o}=r,l=f.Children.toArray(i),c=l.find(Bze);if(c){const d=c.props.children,m=l.map(u=>u===c?f.Children.count(d)>1?f.Children.only(null):f.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...o,ref:a,children:f.isValidElement(d)?f.cloneElement(d,void 0,m):null})}return s.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function Ize(e){const t=f.forwardRef((n,r)=>{const{children:a,...i}=n;if(f.isValidElement(a)){const o=Uze(a),l=Lze(i,a.props);return a.type!==f.Fragment&&(l.ref=r?Pl(r,o):o),f.cloneElement(a,l)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Rze=Symbol("radix.slottable");function Bze(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Rze}function Lze(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function Uze(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var qD=["Enter"," "],zze=["ArrowDown","PageUp","Home"],TJ=["ArrowUp","PageDown","End"],qze=[...zze,...TJ],Wze={ltr:[...qD,"ArrowRight"],rtl:[...qD,"ArrowLeft"]},Hze={ltr:["ArrowLeft"],rtl:["ArrowRight"]},$v="Menu",[ky,Vze,Kze]=DN($v),[Om,OJ]=ua($v,[Kze,Rd,Np]),cC=Rd(),FJ=Np(),[Gze,Fm]=Om($v),[Yze,Iv]=Om($v),_J=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:i,modal:o=!0}=e,l=cC(t),[c,d]=f.useState(null),m=f.useRef(!1),u=Za(i),h=xv(a);return f.useEffect(()=>{const p=()=>{m.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>m.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),s.jsx(UN,{...l,children:s.jsx(Gze,{scope:t,open:n,onOpenChange:u,content:c,onContentChange:d,children:s.jsx(Yze,{scope:t,onClose:f.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:m,dir:h,modal:o,children:r})})})};_J.displayName=$v;var Qze="MenuAnchor",MF=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=cC(n);return s.jsx(cv,{...a,...r,ref:t})});MF.displayName=Qze;var $F="MenuPortal",[Jze,MJ]=Om($F,{forceMount:void 0}),$J=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,i=Fm($F,t);return s.jsx(Jze,{scope:t,forceMount:n,children:s.jsx(Na,{present:n||i.open,children:s.jsx(yp,{asChild:!0,container:a,children:r})})})};$J.displayName=$F;var Gi="MenuContent",[Xze,IF]=Om(Gi),IJ=f.forwardRef((e,t)=>{const n=MJ(Gi,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,i=Fm(Gi,e.__scopeMenu),o=Iv(Gi,e.__scopeMenu);return s.jsx(ky.Provider,{scope:e.__scopeMenu,children:s.jsx(Na,{present:r||i.open,children:s.jsx(ky.Slot,{scope:e.__scopeMenu,children:o.modal?s.jsx(Zze,{...a,ref:t}):s.jsx(eqe,{...a,ref:t})})})})}),Zze=f.forwardRef((e,t)=>
vendor: 13,119 bytes, line 836
836{const n=Fm(Gi,e.__scopeMenu),r=f.useRef(null),a=Us(t,r);return f.useEffect(()=>{const i=r.current;if(i)return QN(i)},[]),s.jsx(RF,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:At(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),eqe=f.forwardRef((e,t)=>{const n=Fm(Gi,e.__scopeMenu);return s.jsx(RF,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),tqe=$ze("MenuContent.ScrollLock"),RF=f.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:u,onInteractOutside:h,onDismiss:p,disableOutsideScroll:v,...y}=e,g=Fm(Gi,n),x=Iv(Gi,n),b=cC(n),w=FJ(n),j=Vze(n),[N,C]=f.useState(null),P=f.useRef(null),S=Us(t,P,g.onContentChange),E=f.useRef(0),T=f.useRef(""),z=f.useRef(0),O=f.useRef(null),D=f.useRef("right"),k=f.useRef(0),F=v?uv:f.Fragment,W=v?{as:tqe,allowPinchZoom:!0}:void 0,q=_=>{var M,se;const L=T.current+_,U=j().filter(Q=>!Q.disabled),J=document.activeElement,I=(M=U.find(Q=>Q.ref.current===J))==null?void 0:M.textValue,re=U.map(Q=>Q.textValue),R=hqe(re,L,I),Y=(se=U.find(Q=>Q.textValue===R))==null?void 0:se.ref.current;(function Q(te){T.current=te,window.clearTimeout(E.current),te!==""&&(E.current=window.setTimeout(()=>Q(""),1e3))})(L),Y&&setTimeout(()=>Y.focus())};f.useEffect(()=>()=>window.clearTimeout(E.current),[]),GN();const H=f.useCallback(_=>{var U,J;return D.current===((U=O.current)==null?void 0:U.side)&&pqe(_,(J=O.current)==null?void 0:J.area)},[]);return s.jsx(Xze,{scope:n,searchRef:T,onItemEnter:f.useCallback(_=>{H(_)&&_.preventDefault()},[H]),onItemLeave:f.useCallback(_=>{var L;H(_)||((L=P.current)==null||L.focus(),C(null))},[H]),onTriggerLeave:f.useCallback(_=>{H(_)&&_.preventDefault()},[H]),pointerGraceTimerRef:z,onPointerGraceIntentChange:f.useCallback(_=>{O.current=_},[]),children:s.jsx(F,{...W,children:s.jsx(dv,{asChild:!0,trapped:a,onMountAutoFocus:At(i,_=>{var L;_.preventDefault(),(L=P.current)==null||L.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:s.jsx(Pm,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:u,onInteractOutside:h,onDismiss:p,children:s.jsx(AT,{asChild:!0,...w,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:N,onCurrentTabStopIdChange:C,onEntryFocus:At(c,_=>{x.isUsingKeyboardRef.current||_.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(zN,{role:"menu","aria-orientation":"vertical","data-state":ZJ(g.open),"data-radix-menu-content":"",dir:x.dir,...b,...y,ref:S,style:{outline:"none",...y.style},onKeyDown:At(y.onKeyDown,_=>{const U=_.target.closest("[data-radix-menu-content]")===_.currentTarget,J=_.ctrlKey||_.altKey||_.metaKey,I=_.key.length===1;U&&(_.key==="Tab"&&_.preventDefault(),!J&&I&&q(_.key));const re=P.current;if(_.target!==re||!qze.includes(_.key))return;_.preventDefault();const Y=j().filter(M=>!M.disabled).map(M=>M.ref.current);TJ.includes(_.key)&&Y.reverse(),uqe(Y)}),onBlur:At(e.onBlur,_=>{_.currentTarget.contains(_.target)||(window.clearTimeout(E.current),T.current="")}),onPointerMove:At(e.onPointerMove,Py(_=>{const L=_.target,U=k.current!==_.clientX;if(_.currentTarget.contains(L)&&U){const J=_.clientX>k.current?"right":"left";D.current=J,k.current=_.clientX}}))})})})})})})});IJ.displayName=Gi;var sqe="MenuGroup",BF=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(ms.div,{role:"group",...r,ref:t})});BF.displayName=sqe;var nqe="MenuLabel",RJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(ms.div,{...r,ref:t})});RJ.displayName=nqe;var Hj="MenuItem",oL="menu.itemSelect",dC=f.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,i=f.useRef(null),o=Iv(Hj,e.__scopeMenu),l=IF(Hj,e.__scopeMenu),c=Us(t,i),d=f.useRef(!1),m=()=>{const u=i.current;if(!n&&u){const h=new CustomEvent(oL,{bubbles:!0,cancelable:!0});u.addEventListener(oL,p=>r==null?void 0:r(p),{once:!0}),sT(u,h),h.defaultPrevented?d.current=!1:o.onClose()}};return s.jsx(BJ,{...a,ref:c,disabled:n,onClick:At(e.onClick,m),onPointerDown:u=>{var h;(h=e.onPointerDown)==null||h.call(e,u),d.current=!0},onPointerUp:At(e.onPointerUp,u=>{var h;d.current||(h=u.currentTarget)==null||h.click()}),onKeyDown:At(e.onKeyDown,u=>{const h=l.searchRef.current!=="";n||h&&u.key===" "||qD.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})});dC.displayName=Hj;var BJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...i}=e,o=IF(Hj,n),l=FJ(n),c=f.useRef(null),d=Us(t,c),[m,u]=f.useState(!1),[h,p]=f.useState("");return f.useEffect(()=>{const v=c.current;v&&p((v.textContent??"").trim())},[i.children]),s.jsx(ky.ItemSlot,{scope:n,disabled:r,textValue:a??h,children:s.jsx(TT,{asChild:!0,...l,focusable:!r,children:s.jsx(ms.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:d,onPointerMove:At(e.onPointerMove,Py(v=>{r?o.onItemLeave(v):(o.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:At(e.onPointerLeave,Py(v=>o.onItemLeave(v))),onFocus:At(e.onFocus,()=>u(!0)),onBlur:At(e.onBlur,()=>u(!1))})})})}),rqe="MenuCheckboxItem",LJ=f.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return s.jsx(HJ,{scope:e.__scopeMenu,checked:n,children:s.jsx(dC,{role:"menuitemcheckbox","aria-checked":Vj(n)?"mixed":n,...a,ref:t,"data-state":UF(n),onSelect:At(a.onSelect,()=>r==null?void 0:r(Vj(n)?!0:!n),{checkForDefaultPrevented:!1})})})});LJ.displayName=rqe;var UJ="MenuRadioGroup",[aqe,iqe]=Om(UJ,{value:void 0,onValueChange:()=>{}}),zJ=f.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,i=Za(r);return s.jsx(aqe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:s.jsx(BF,{...a,ref:t})})});zJ.displayName=UJ;var qJ="MenuRadioItem",WJ=f.forwardRef((e,t)=>{const{value:n,...r}=e,a=iqe(qJ,e.__scopeMenu),i=n===a.value;return s.jsx(HJ,{scope:e.__scopeMenu,checked:i,children:s.jsx(dC,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":UF(i),onSelect:At(r.onSelect,()=>{var o;return(o=a.onValueChange)==null?void 0:o.call(a,n)},{checkForDefaultPrevented:!1})})})});WJ.displayName=qJ;var LF="MenuItemIndicator",[HJ,oqe]=Om(LF,{checked:!1}),VJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,i=oqe(LF,n);return s.jsx(Na,{present:r||Vj(i.checked)||i.checked===!0,children:s.jsx(ms.span,{...a,ref:t,"data-state":UF(i.checked)})})});VJ.displayName=LF;var lqe="MenuSeparator",KJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(ms.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});KJ.displayName=lqe;var cqe="MenuArrow",GJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=cC(n);return s.jsx(qN,{...a,...r,ref:t})});GJ.displayName=cqe;var dqe="MenuSub",[HVe,YJ]=Om(dqe),Dx="MenuSubTrigger",QJ=f.forwardRef((e,t)=>{const n=Fm(Dx,e.__scopeMenu),r=Iv(Dx,e.__scopeMenu),a=YJ(Dx,e.__scopeMenu),i=IF(Dx,e.__scopeMenu),o=f.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,d={__scopeMenu:e.__scopeMenu},m=f.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return f.useEffect(()=>m,[m]),f.useEffect(()=>{const u=l.current;return()=>{window.clearTimeout(u),c(null)}},[l,c]),s.jsx(MF,{asChild:!0,...d,children:s.jsx(BJ,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":ZJ(n.open),...e,ref:Pl(t,a.onTriggerChange),onClick:u=>{var h;(h=e.onClick)==null||h.call(e,u),!(e.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:At(e.onPointerMove,Py(u=>{i.onItemEnter(u),!u.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:At(e.onPointerLeave,Py(u=>{var p,v;m();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const y=(v=n.content)==null?void 0:v.dataset.side,g=y==="right",x=g?-5:5,b=h[g?"left":"right"],w=h[g?"right":"left"];i.onPointerGraceIntentChange({area:[{x:u.clientX+x,y:u.clientY},{x:b,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x:b,y:h.bottom}],side:y}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(u),u.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:At(e.onKeyDown,u=>{var p;const h=i.searchRef.current!=="";e.disabled||h&&u.key===" "||Wze[r.dir].includes(u.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),u.preventDefault())})})})});QJ.displayName=Dx;var JJ="MenuSubContent",XJ=f.forwardRef((e,t)=>{const n=MJ(Gi,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,i=Fm(Gi,e.__scopeMenu),o=Iv(Gi,e.__scopeMenu),l=YJ(JJ,e.__scopeMenu),c=f.useRef(null),d=Us(t,c);return s.jsx(ky.Provider,{scope:e.__scopeMenu,children:s.jsx(Na,{present:r||i.open,children:s.jsx(ky.Slot,{scope:e.__scopeMenu,children:s.jsx(RF,{id:l.contentId,"aria-labelledby":l.triggerId,...a,ref:d,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{var u;o.isUsingKeyboardRef.current&&((u=c.current)==null||u.focus()),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:At(e.onFocusOutside,m=>{m.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:At(e.onEscapeKeyDown,m=>{o.onClose(),m.preventDefault()}),onKeyDown:At(e.onKeyDown,m=>{var p;const u=m.currentTarget.contains(m.target),h=Hze[o.dir].includes(m.key);u&&h&&(i.onOpenChange(!1),(p=l.trigger)==null||p.focus(),m.preventDefault())})})})})})});XJ.displayName=JJ;function ZJ(e){return e?"open":"closed"}function Vj(e){return e==="indeterminate"}function UF(e){return Vj(e)?"indeterminate":e?"checked":"unchecked"}function uqe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function mqe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function hqe(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=mqe(e,Math.max(i,0));a.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}function fqe(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],d=l.x,m=l.y,u=c.x,h=c.y;m>r!=h>r&&n<(u-d)*(r-m)/(h-m)+d&&(a=!a)}return a}function pqe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return fqe(n,t)}function Py(e){return t=>t.pointerType==="mouse"?e(t):void 0}var xqe=_J,gqe=MF,yqe=$J,vqe=IJ,bqe=BF,wqe=RJ,jqe=dC,Nqe=LJ,Cqe=zJ,Sqe=WJ,kqe=VJ,Pqe=KJ,Eqe=GJ,Dqe=QJ,Aqe=XJ,uC="DropdownMenu",[Tqe]=ua(uC,[OJ]),za=OJ(),[Oqe,eX]=Tqe(uC),tX=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,c=za(t),d=f.useRef(null),[m,u]=yi({prop:a,defaultProp:i??!1,onChange:o,caller:uC});return s.jsx(Oqe,{scope:t,triggerId:pi(),triggerRef:d,contentId:pi(),open:m,onOpenChange:u,onOpenToggle:f.useCallback(()=>u(h=>!h),[u]),modal:l,children:s.jsx(xqe,{...c,open:m,onOpenChange:u,dir:r,modal:l,children:n})})};tX.displayName=uC;var sX="DropdownMenuTrigger",nX=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,i=eX(sX,n),o=za(n);return s.jsx(gqe,{asChild:!0,...o,children:s.jsx(ms.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:Pl(t,i.triggerRef),onPointerDown:At(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:At(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});nX.displayName=sX;var Fqe="DropdownMenuPortal",rX=e=>{const{__scopeDropdownMenu:t,...n}=e,r=za(t);return s.jsx(yqe,{...r,...n})};rX.displayName=Fqe;var aX="DropdownMenuContent",iX=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=eX(aX,n),i=za(n),o=f.useRef(!1);return s.jsx(vqe,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...r,ref:t,onCloseAutoFocus:At(e.onCloseAutoFocus,l=>{var c;o.current||(c=a.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:At(e.onInteractOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,m=c.button===2||d;(!a.modal||m)&&(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)"}})});iX.displayName=aX;var _qe="DropdownMenuGroup",Mqe=f.forwardRef((e,t)=>
836{const{__scopeDropdownMenu:n,...r}=e,a=za(n);return s.jsx(bqe,{...a,...r,ref:t})});Mqe.displayName=_qe;var $qe="DropdownMenuLabel",oX=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=za(n);return s.jsx(wqe,{...a,...r,ref:t})});oX.displayName=$qe;var Iqe="DropdownMenuItem",lX=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=za(n);return s.jsx(jqe,{...a,...r,ref:t})});lX.displayName=Iqe;var Rqe="DropdownMenuCheckboxItem",cX=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=za(n);return s.jsx(Nqe,{...a,...r,ref:t})});cX.displayName=Rqe;var Bqe="DropdownMenuRadioGroup",Lqe=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=za(n);return s.jsx(Cqe,{...a,...r,ref:t})});Lqe.displayName=Bqe;var Uqe="DropdownMenuRadioItem",dX=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=za(n);return s.jsx(Sqe,{...a,...r,ref:t})});dX.displayName=Uqe;var zqe="DropdownMenuItemIndicator",uX=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=za(n);return s.jsx(kqe,{...a,...r,ref:t})});uX.displayName=zqe;var qqe="DropdownMenuSeparator",mX=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=za(n);return s.jsx(Pqe,{...a,...r,ref:t})});mX.displayName=qqe;var Wqe="DropdownMenuArrow",Hqe=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=za(n);return s.jsx(Eqe,{...a,...r,ref:t})});Hqe.displayName=Wqe;var Vqe="DropdownMenuSubTrigger",hX=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=za(n);return s.jsx(Dqe,{...a,...r,ref:t})});hX.displayName=Vqe;var Kqe="DropdownMenuSubContent",fX=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=za(n);return s.jsx(Aqe,{...a,...r,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)"}})});fX.displayName=Kqe;var Gqe=tX,Yqe=nX,Qqe=rX,pX=iX,xX=oX,gX=lX,yX=cX,vX=dX,bX=uX,wX=mX,jX=hX,NX=fX;const lL=Gqe,cL=Yqe,Jqe=f.forwardRef(({className:e,inset:t,children:n,...r},a)=>s.jsxs(jX,{ref:a,className:bt("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,s.jsx(Ji,{className:"ml-auto"})]}));Jqe.displayName=jX.displayName;const Xqe=f.forwardRef(({className:e,...t},n)=>s.jsx(NX,{ref:n,className:bt("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 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t}));Xqe.displayName=NX.displayName;const WD=f.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(Qqe,{children:s.jsx(pX,{ref:r,sideOffset:t,className:bt("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));WD.displayName=pX.displayName;const lo=f.forwardRef(({className:e,inset:t,...n},r)=>s.jsx(gX,{ref:r,className:bt("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n}));lo.displayName=gX.displayName;const Zqe=f.forwardRef(({className:e,children:t,checked:n,...r},a)=>s.jsxs(yX,{ref:a,className:bt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(bX,{children:s.jsx(bn,{className:"h-4 w-4"})})}),t]}));Zqe.displayName=yX.displayName;const eWe=f.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(vX,{ref:r,className:bt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(bX,{children:s.jsx(G9,{className:"h-2 w-2 fill-current"})})}),t]}));eWe.displayName=vX.displayName;const tWe=f.forwardRef(({className:e,inset:t,...n},r)=>s.jsx(xX,{ref:r,className:bt("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));tWe.displayName=xX.displayName;const HD=f.forwardRef(({className:e,...t},n)=>s.jsx(wX,{ref:n,className:bt("-mx-1 my-1 h-px bg-muted",e),...t}));HD.displayName=wX.displayName;function sWe(e){const[t,n]=f.useState(!1);return f.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia(e),a=()=>n(r.matches);return a(),typeof r.addEventListener=="function"?(r.addEventListener("change",a),()=>
836r.removeEventListener("change",a)):(r.addListener(a),()=>r.removeListener(a))},[e]),t}function nWe(){var Cs;const[e,t]=f.useState(null),n=xt({mutationFn:async Ne=>{t(Ne);const rt=await fetch(`/api/superadmin/instructors/${Ne}/send-verification`,{method:"POST",headers:{Authorization:`Master ${l}`,"Content-Type":"application/json"}});if(!rt.ok)throw new Error("Failed to send verification email");return rt.json()},onSuccess:()=>{r({title:"Verification Email Sent",description:"A new verification email has been sent."})},onError:()=>{r({title:"Error",description:"Failed to send verification email.",variant:"destructive"})},onSettled:()=>{t(null)}}),{toast:r}=Yt(),a=jn(),[i,o]=f.useState(!1),[l,c]=f.useState(""),[d,m]=f.useState(""),[u,h]=f.useState(!1),[p,v]=f.useState(null),[y,g]=f.useState(""),[x,b]=f.useState("analytics"),[w,j]=f.useState(null),[N,C]=f.useState(null),[P,S]=f.useState(null),[E,T]=f.useState({email:"",password:"",pagePath:""}),[z,O]=f.useState({email:"",password:"",businessName:"",instructorName:"",description:"",subdomain:""}),[D,k]=f.useState(""),[F,W]=f.useState("all"),[q,H]=f.useState(null),[_,L]=f.useState(null),[U,J]=f.useState({key:"createdAt",direction:"desc"}),I=Ne=>{J(rt=>rt.key===Ne?{key:Ne,direction:rt.direction==="asc"?"desc":"asc"}:{key:Ne,direction:"desc"})},re=Ne=>{J(rt=>({key:Ne,direction:rt.key===Ne?rt.direction:Ne==="instructorName"?"asc":"desc"}))},[R,Y]=f.useState({adminEmail:"",replyEmail:""}),[M,se]=f.useState(""),Q=sWe("(min-width: 1280px)"),{data:te=[],isLoading:G}=Ue({queryKey:["/api/superadmin/instructors",l],enabled:i,queryFn:async()=>{const Ne=await fetch("/api/superadmin/instructors",{headers:{Authorization:`Master ${l}`}});if(!Ne.ok)throw new Error("Failed to fetch instructors");return Ne.json()}}),Z=xt({mutationFn:async({instructorId:Ne,isActive:rt})=>{const ht=await fetch(`/api/superadmin/instructors/${Ne}/active`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Master ${l}`},body:JSON.stringify({isActive:rt})});if(!ht.ok){const Mt=await ht.json().catch(()=>({}));throw new Error(Mt.message||"Failed to update instructor status")}return ht.json()},onSuccess:(Ne,{isActive:rt})=>{r({title:rt?"Instructor enabled":"Instructor disabled",description:`The instructor has been ${rt?"re-enabled":"disabled"}.`}),a.invalidateQueries({queryKey:["/api/superadmin/instructors",l]})},onError:Ne=>{r({title:"Error",description:Ne.message||"Failed to update instructor status.",variant:"destructive"})}}),ie=((Cs=Z.variables)==null?void 0:Cs.instructorId)??null,{data:A=[]}=Ue({queryKey:["/api/instructor-pricing"],enabled:i}),{data:ge=[],refetch:je}=Ue({queryKey:["/api/system-settings",l],enabled:!1,queryFn:async()=>{const Ne=await fetch("/api/system-settings",{headers:{Authorization:`Master ${l}`}});if(!Ne.ok)throw new Error("Failed to fetch settings");return Ne.json()}}),{data:ke,refetch:Ie}=Ue({queryKey:["/api/superadmin/analytics",l],enabled:!1,staleTime:0,gcTime:0,queryFn:async()=>{const Ne=await fetch("/api/superadmin/analytics",{headers:{Authorization:`Master ${l}`}});if(!Ne.ok)throw new Error("Failed to fetch analytics");return Ne.json()}}),{data:$e,refetch:qe}=Ue({queryKey:["/api/superadmin/instructor-stats",l],enabled:!1,staleTime:0,gcTime:0,queryFn:async()=>{const Ne=await fetch("/api/superadmin/instructor-stats",{headers:{Authorization:`Master ${l}`}});if(!Ne.ok)throw new Error("Failed to fetch instructor stats");return Ne.json()}}),ft=$e??[],be=Ne=>s.jsxs("div",{className:"space-y-4 mt-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold",children:Ne.businessName}),s.jsx("p",{className:"text-sm text-muted-foreground",children:Ne.instructorName})]}),s.jsxs("div",{className:"grid gap-2 text-sm",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Email"}),s.jsx("span",{className:"truncate max-w-[60%] text-right",children:Ne.email})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Subdomain"}),s.jsx("span",{children:s.jsx("a",{className:"text-blue-500 hover:text-blue-600 underline",href:`/classes/${Ne.subdomain}`,children:`/classes/${Ne.subdomain}`})})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Status"}),s.jsx(Je,{variant:Ne.isActive?"default":"destructive",children:Ne.isActive?"Active":"Disabled"})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Last Login"}),s.jsx("span",{className:"text-right text-muted-foreground",children:Ot(Ne.lastLoggedIn)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Subscription"}),s.jsx("span",{children:Ne.subscriptionStatus||"-"})]})]})]});f.useEffect(()=>
836{i&&(je(),Ie(),qe())},[i,je,Ie,qe]),f.useEffect(()=>{var Ne,rt,ht;if(ge&&Array.isArray(ge)&&ge.length>0){const Mt=((Ne=ge.find(Js=>Js.key==="admin_notification_email"))==null?void 0:Ne.value)||"",Qt=((rt=ge.find(Js=>Js.key==="booking_reply_to_email"))==null?void 0:rt.value)||"",ts=((ht=ge.find(Js=>Js.key==="master_password"))==null?void 0:ht.value)||"";Y(Js=>Js.adminEmail!==Mt||Js.replyEmail!==Qt?{adminEmail:Mt,replyEmail:Qt}:Js),se(ts)}},[ge]);const Fe=xt({mutationFn:async({instructorId:Ne,requiresSubscription:rt})=>{const ht=await fetch(`/api/superadmin/instructors/${Ne}/subscription-requirement`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Master ${l}`},body:JSON.stringify({requiresSubscription:rt})});if(!ht.ok)throw new Error("Failed to update subscription requirement");return ht.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["/api/instructors"]}),r({title:"Updated successfully",description:"Subscription requirement has been changed."})},onError:()=>{r({title:"Error",description:"Failed to update subscription requirement.",variant:"destructive"})}}),_e=xt({mutationFn:async Ne=>{const rt=await fetch("/api/superadmin/instructors",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Master ${l}`},body:JSON.stringify(Ne)});if(!rt.ok)throw new Error("Failed to create instructor");return rt.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["/api/instructors"]}),h(!1),O({email:"",password:"",businessName:"",instructorName:"",description:"",subdomain:""}),r({title:"Instructor created",description:"The instructor has been successfully created."})},onError:()=>{r({title:"Error",description:"Failed to create instructor.",variant:"destructive"})}}),ze=xt({mutationFn:async({id:Ne,data:rt})=>{const ht=await fetch(`/update-instructor/${Ne}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Master ${l}`},body:JSON.stringify(rt)});if(!ht.ok)throw new Error("Failed to update instructor");return ht.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["/api/instructors"]}),S(null),T({email:"",password:"",pagePath:""}),r({title:"Instructor updated",description:"The instructor has been successfully updated."})},onError:()=>{r({title:"Error",description:"Failed to update instructor.",variant:"destructive"})}}),ue=xt({mutationFn:async({id:Ne,newPassword:rt})=>{const ht=await fetch(`/api/superadmin/instructors/${Ne}/reset-password`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Master ${l}`},body:JSON.stringify({newPassword:rt})});if(!ht.ok)throw new Error("Failed to reset password");return ht.json()},onSuccess:()=>{v(null),g(""),r({title:"Password reset",description:"The instructor's password has been successfully reset."})},onError:()=>{r({title:"Error",description:"Failed to reset password.",variant:"destructive"})}}),Me=xt({mutationFn:async Ne=>await fetch(`/api/instructor-pricing/${Ne.currency}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Master ${l}`},body:JSON.stringify({price:Ne.price,stripePriceId:Ne.stripePriceId})}),onSuccess:()=>{a.invalidateQueries({queryKey:["/api/instructor-pricing"]}),L(null),r({title:"Pricing updated",description:"Instructor subscription pricing has been updated successfully."})},onError:()=>{r({title:"Error",description:"Failed to update pricing.",variant:"destructive"})}}),pt=xt({mutationFn:async Ne=>{const rt=await fetch(`/api/superadmin/instructors/${Ne}/can-delete`,{headers:{Authorization:`Master ${l}`}});if(!rt.ok)throw new Error("Failed to check deletion");return rt.json()},onSuccess:Ne=>{C(Ne)},onError:()=>{r({title:"Error",description:"Failed to check deletion possibility.",variant:"destructive"})}}),de=xt({mutationFn:async Ne=>{const rt=await fetch(`/api/superadmin/instructors/${Ne}`,{method:"DELETE",headers:{Authorization:`Master ${l}`}});if(!rt.ok)throw new Error("Failed to delete instructor");return rt.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["/api/instructors"]}),j(null),C(null),r({title:"Instructor deleted",description:"The instructor has been successfully removed."})},onError:()=>{r({title:"Error",description:"Failed to delete instructor.",variant:"destructive"})}}),fe=xt({mutationFn:async({key:Ne,value:rt})=>{const ht=await fetch("/api/superadmin/system-settings",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Master ${l}`},body:JSON.stringify({key:Ne,value:rt})});if(!ht.ok)throw new Error("Failed to update setting");return ht.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["/api/system-settings"]}
836),r({title:"Settings updated",description:"System settings have been successfully updated."})},onError:()=>{r({title:"Error",description:"Failed to update settings.",variant:"destructive"})}}),le=async Ne=>{try{const rt=await fetch("/api/superadmin/login",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Master ${Ne}`},body:JSON.stringify({password:Ne})});if(rt.ok)c(Ne),o(!0),m(""),a.invalidateQueries();else{const ht=await rt.json();m(ht.message||"Authentication failed")}}catch{m("Connection error - please try again")}},Ke=Ne=>{j(Ne),pt.mutate(Ne)},We=()=>{w&&(N!=null&&N.canDelete)&&de.mutate(w)},vt=()=>{fe.mutate({key:"admin_notification_email",value:R.adminEmail}),fe.mutate({key:"booking_reply_to_email",value:R.replyEmail})},Zt=()=>{M&&fe.mutate({key:"master_password",value:M})},Ht=()=>{a.invalidateQueries({queryKey:["/api/instructors"]}),a.invalidateQueries({queryKey:["/api/instructor-pricing"]}),i&&(je(),Ie(),qe()),r({title:"Data refreshed",description:"All superadmin data has been refreshed successfully."})},Tt=Ne=>ft.find(rt=>rt.instructorId===Ne)||{classCount:0,clientCount:0,bookingCount:0,membershipCount:0,memberSubscriberCount:0},Ot=Ne=>{if(!Ne)return"Never";const rt=new Date(Ne);return isNaN(rt.getTime())?"Never":rt.toLocaleString()},Ft=te.filter(Ne=>{var Js,xn;if(!(Ne.email.toLowerCase().includes(D.toLowerCase())||((Js=Ne.businessName)==null?void 0:Js.toLowerCase().includes(D.toLowerCase()))||((xn=Ne.instructorName)==null?void 0:xn.toLowerCase().includes(D.toLowerCase()))))return!1;if(F==="all")return!0;const ht=Ne,Mt=ht.stripeSubscriptionId&&ht.subscriptionStatus==="active",Qt=ht.requiresSubscription===!1;let ts=!1;if(ht.createdAt){const Xs=new Date(ht.createdAt);Xs.setDate(Xs.getDate()+30),ts=new Date>Xs}switch(F){case"active":return Mt;case"exempt":return Qt;case"trial":return!Mt&&!Qt&&!ts;case"verified-trials":return!Mt&&!Qt&&!ts&&ht.emailVerifiedAt&&ht.isActive;case"expired":return!Mt&&!Qt&&ts;case"unverified":return!ht.emailVerifiedAt;case"disabled":return!ht.isActive;default:return!0}}).map(Ne=>{const rt=Tt(Ne.id);return{...Ne,totalActivity:(rt.classCount||0)+(rt.clientCount||0)+(rt.bookingCount||0)+(rt.membershipCount||0)}}).sort((Ne,rt)=>{const{key:ht,direction:Mt}=U;let Qt,ts;return ht==="stats"?(Qt=Ne.totalActivity,ts=rt.totalActivity):ht==="createdAt"?(Qt=Ne.createdAt?new Date(Ne.createdAt).getTime():0,ts=rt.createdAt?new Date(rt.createdAt).getTime():0):ht==="lastLoggedIn"?(Qt=Ne.lastLoggedIn?new Date(Ne.lastLoggedIn).getTime():0,ts=rt.lastLoggedIn?new Date(rt.lastLoggedIn).getTime():0):(Qt=Ne[ht],ts=rt[ht]),Qt<ts?Mt==="asc"?-1:1:Qt>ts?Mt==="asc"?1:-1:0}),is=Ne=>{if(!Ne.isActive)return s.jsx(Je,{variant:"destructive",children:"Disabled"});const rt=Ne.stripeSubscriptionId&&Ne.subscriptionStatus==="active";if(!Ne.requiresSubscription)return s.jsx(Je,{variant:"secondary",children:"Active (Exempt)"});if(!Ne.emailVerifiedAt)return s.jsxs("div",{className:"flex flex-col gap-1 items-start",children:[s.jsx(Je,{variant:"destructive",children:"Email Unverified"}),s.jsxs(B,{size:"sm",variant:"outline",onClick:()=>n.mutate(Ne.id),disabled:e===Ne.id,title:"Send verification email",className:"h-7 px-2 text-xs",children:[s.jsx(_n,{className:"h-3 w-3 mr-1"}),e===Ne.id?"Sending...":"Send"]})]});if(rt)return s.jsx(Je,{variant:"default",children:"Active Subscription"});let ht=!1;if(Ne.createdAt){const Mt=new Date(Ne.createdAt);Mt.setDate(Mt.getDate()+30),ht=new Date>Mt}return ht?s.jsx(Je,{variant:"destructive",children:"Expired"}):s.jsx(Je,{variant:"outline",children:"Trial Period"})};return i?s.jsxs("div",{className:"min-h-screen bg-slate-50",children:[s.jsx("header",{className:"bg-white shadow-sm border-b border-slate-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsx("div",{className:"flex items-center space-x-4",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(dt,{href:"/",children:s.jsx(Ia,{className:"text-primary",size:"md"})}),s.jsx("span",{className:"text-xl font-bold text-slate-900",children:"Super"})]})}),s.jsxs("div",{className:"flex items-center space-x-4",children:[s.jsxs(B,{variant:"outline",size:"sm",onClick:Ht,className:"flex items-center space-x-2",children:[s.jsx(Of,{className:"h-4 w-4"}),s.jsx("span",{children:"Refresh"})]}),s.jsx(B,{variant:"outline",onClick:()=>o(!1),children:"Logout"})]})]})})}),s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:s.jsxs(sc,{value:x,onValueChange:b,className:"relative",children:[s.jsxs(Hi,{className:"flex max-w-full overflow-x-auto sm:overflow-visible sm:grid sm:grid-cols-6 gap-2 rounded-lg bg-slate-100 p-1 scrollbar-thin [-ms-overflow-style:none] [scrollbar-width:none] sm:[-ms-overflow-style:auto] sm:[scrollbar-width:auto] [&::-webkit-scrollbar]:hidden sm:[&::-webkit-scrollbar]:block justify-start sm:justify-center",children:[s.jsxs(Ts,{value:"analytics",className:"flex items-center space-x-2 px-3 py-2 whitespace-nowrap flex-shrink-0 sm:flex-shrink rounded-md data-[state=active]:bg-white data-[state=active]:shadow",children:[s.jsx(fh,{className:"h-4 w-4"}),s.jsx("span",{children:"Analytics"})]}),s.jsxs(Ts,{value:"instructors",className:"flex items-center space-x-2 px-3 py-2 whitespace-nowrap flex-shrink-0 sm:flex-shrink rounded-md data-[state=active]:bg-white data-[state=active]:shadow",children:[s.jsx(sr,{className:"h-4 w-4"}),s.jsx("span",{children:"Instructors"})]}),s.jsxs(Ts,{value:"featured",className:"flex items-center space-x-2 px-3 py-2 whitespace-nowrap flex-shrink-0 sm:flex-shrink rounded-md data-[state=active]:bg-white data-[state=active]:shadow",children:[s.jsx(dl,{className:"h-4 w-4"}),s.jsx("span",{children:"Featured"})]}),s.jsxs(Ts,{value:"pricing",className:"flex items-center space-x-2 px-3 py-2 whitespace-nowrap flex-shrink-0 sm:flex-shrink rounded-md data-[state=active]:bg-white data-[state=active]:shadow",children:[s.jsx(Ph,{className:"h-4 w-4"}),s.jsx("span",{children:"Pricing"})]}),s.jsxs(Ts,{value:"blog",className:"flex items-center space-x-2 px-3 py-2 whitespace-nowrap flex-shrink-0 sm:flex-shrink rounded-md data-[state=active]:bg-white data-[state=active]:shadow",children:[s.jsx(u
836w,{className:"h-4 w-4"}),s.jsx("span",{children:"Blog"})]}),s.jsxs(Ts,{value:"settings",className:"flex items-center space-x-2 px-3 py-2 whitespace-nowrap flex-shrink-0 sm:flex-shrink rounded-md data-[state=active]:bg-white data-[state=active]:shadow",children:[s.jsx(Dd,{className:"h-4 w-4"}),s.jsx("span",{children:"Settings"})]})]}),s.jsx(on,{value:"instructors",className:"mt-6",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center space-y-4 sm:space-y-0",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900",children:"Instructor Management"}),s.jsx("p",{className:"text-slate-600 mt-1",children:"Manage instructor accounts and subscriptions"})]}),s.jsxs(B,{onClick:()=>h(!0),children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Create Instructor"]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row space-y-4 sm:space-y-0 sm:space-x-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Eh,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400 h-4 w-4"}),s.jsx(me,{placeholder:"Search instructors...",value:D,onChange:Ne=>k(Ne.target.value),className:"pl-10"})]}),s.jsxs(Bt,{value:F,onValueChange:W,children:[s.jsx($t,{className:"w-full sm:w-48",children:s.jsx(Lt,{placeholder:"Filter by status"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"all",children:"All Status"}),s.jsx(ce,{value:"trial",children:"Trial Period"}),s.jsx(ce,{value:"verified-trials",children:"Verified Trials"}),s.jsx(ce,{value:"expired",children:"Expired"}),s.jsx(ce,{value:"active",children:"Active Subscription"}),s.jsx(ce,{value:"exempt",children:"Exempt"}),s.jsx(ce,{value:"unverified",children:"Email Unverified"}),s.jsx(ce,{value:"disabled",children:"Disabled Accounts"})]})]})]}),s.jsx("div",{className:"hidden lg:block border rounded-lg overflow-hidden",children:s.jsx("div",{className:"max-h-[600px] overflow-y-auto",children:s.jsxs(qd,{children:[s.jsx(Wd,{className:"sticky top-0 bg-white",children:s.jsxs(Ra,{children:[s.jsxs(Es,{className:"cursor-pointer select-none",onClick:()=>I("instructorName"),children:["Business & Contact",U.key==="instructorName"&&s.jsx("span",{className:"ml-1 align-middle",children:U.direction==="asc"?"▲":"▼"})]}),s.jsx(Es,{className:"w-[150px]",children:"Status"}),s.jsx(Es,{className:"w-[170px]",children:"Account"}),s.jsxs(Es,{className:"cursor-pointer select-none",onClick:()=>I("createdAt"),children:["Signed Up",U.key==="createdAt"&&s.jsx("span",{className:"ml-1 align-middle",children:U.direction==="asc"?"▲":"▼"})]}),s.jsxs(Es,{className:"w-[170px] cursor-pointer select-none",onClick:()=>I("lastLoggedIn"),children:["Last Login",U.key==="lastLoggedIn"&&s.jsx("span",{className:"ml-1 align-middle",children:U.direction==="asc"?"▲":"▼"})]}),s.jsxs(Es,{className:"cursor-pointer select-none min-w-[170px] w-[170px]",onClick:()=>I("stats"),children:["Stats",U.key==="stats"&&s.jsx("span",{className:"ml-1 align-middle",children:U.direction==="asc"?"▲":"▼"})]}),s.jsx(Es,{className:"w-[100px]",children:"Sub"}),s.jsx(Es,{children:"Actions"})]})}),s.jsx(Hd,{children:Ft.map(Ne=>{const rt=Tt(Ne.id),ht=Ne.createdAt,Mt=ht?new Date(ht).toLocaleDateString():"Unknown";return s.jsxs(Ra,{children:[s.jsx(Ds,{className:"w-[200px]",children:s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-slate-900",children:Ne.businessName||"No Business Name"}),s.jsx("div",{className:"text-sm text-slate-600",children:Ne.instructorName||"No Instructor Name"}),s.jsx("div",{className:"text-sm text-slate-600",children:s.jsx("a",{href:`/classes/${Ne.subdomain}`,children:`/classes/${Ne.subdomain}`})}),s.jsx("div",{className:"text-sm text-slate-500",children:Ne.email})]})}),s.jsx(Ds,{className:"w-[150px]",children:is(Ne)}),s.jsx(Ds,{className:"w-[170px]",children:s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx(Rs,{checked:!!Ne.isActive,onCheckedChange:Qt=>Z.mutate({instructorId:Ne.id,isActive:Qt}),disabled:!!(Z.isPending&&ie===Ne.id)}),s.jsx("span",{className:"text-sm text-slate-600",children:Ne.isActive?"Enabled":"Disabled"})]})}),s.jsx(Ds,{children:s.jsx("div",{className:"text-sm text-slate-900",children:Mt})}),s.jsx(Ds,{children:s.jsx("div",{className:"text-sm text-slate-900",children:Ot(Ne.lastLoggedIn)})}),s.jsx(Ds,{className:"min-w-[170px] w-[170px]",children:s.jsxs("div",{className:"text-xs space-y-1",children:[s.jsxs("div",{children:[rt.classCount," classes"]}
836),s.jsxs("div",{children:[rt.clientCount," clients"]}),s.jsxs("div",{children:[rt.bookingCount," bookings"]}),s.jsxs("div",{children:[rt.memberSubscriberCount," members"]}),s.jsxs("div",{children:[rt.membershipCount," memberships"]})]})}),s.jsx(Ds,{className:"w-[100px]",children:s.jsx(Rs,{checked:Ne.requiresSubscription||!1,onCheckedChange:Qt=>Fe.mutate({instructorId:Ne.id,requiresSubscription:Qt})})}),s.jsx(Ds,{children:s.jsxs(lL,{children:[s.jsx(cL,{asChild:!0,children:s.jsxs(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[s.jsx(yM,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Open menu"})]})}),s.jsxs(WD,{align:"end",children:[s.jsxs(lo,{onClick:()=>{window.open(`/admin?login=${encodeURIComponent(Ne.email)}`,"_blank")},children:[s.jsx(sr,{className:"h-4 w-4 mr-2"}),"Login as instructor"]}),s.jsxs(lo,{onClick:()=>{S(Ne),T({email:Ne.email,password:"",pagePath:Ne.subdomain||""})},children:[s.jsx(eS,{className:"h-4 w-4 mr-2"}),"Edit details"]}),s.jsxs(lo,{onClick:()=>v(Ne.id),children:[s.jsx(jd,{className:"h-4 w-4 mr-2"}),"Reset password"]}),s.jsxs(lo,{onClick:()=>H(Ne),children:[s.jsx(wa,{className:"h-4 w-4 mr-2"}),"View details"]}),s.jsx(HD,{}),s.jsxs(lo,{onClick:()=>Ke(Ne.id),className:"text-red-600 focus:text-red-600",children:[s.jsx(ln,{className:"h-4 w-4 mr-2"}),"Delete instructor"]})]})]})})]},Ne.id)})})]})})}),s.jsxs("div",{className:"lg:hidden space-y-4",children:[s.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:s.jsxs(Bt,{value:U.key,onValueChange:re,children:[s.jsx($t,{className:"w-full sm:w-60",children:s.jsx(Lt,{placeholder:"Sort by"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"createdAt",children:"Newest Signups"}),s.jsx(ce,{value:"stats",children:"Most Active"}),s.jsx(ce,{value:"instructorName",children:"Name (A-Z)"}),s.jsx(ce,{value:"lastLoggedIn",children:"Recent Logins"})]})]})}),Ft.map(Ne=>{const rt=Tt(Ne.id),ht=Ne.createdAt,Mt=ht?new Date(ht).toLocaleDateString():"Unknown";return s.jsxs(Ce,{children:[s.jsx(gt,{className:"pb-3",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Nt,{className:"text-lg",children:Ne.businessName||"No Business Name"}),s.jsx("p",{className:"text-sm text-slate-600",children:Ne.instructorName||"No Instructor Name"}),s.jsx("p",{className:"text-sm text-slate-500",children:Ne.email}),s.jsxs("p",{className:"text-xs text-slate-400",children:["Joined: ",Mt]}),s.jsxs("p",{className:"text-xs text-slate-400",children:["Last login: ",Ot(Ne.lastLoggedIn)]})]}),is(Ne)]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3 py-3 border-b border-slate-200",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-lg font-semibold text-slate-900",children:rt.clientCount}),s.jsx("p",{className:"text-xs text-slate-500",children:"Clients"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-lg font-semibold text-slate-900",children:rt.bookingCount}),s.jsx("p",{className:"text-xs text-slate-500",children:"Bookings"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-lg font-semibold text-slate-900",children:rt.classCount}),s.jsx("p",{className:"text-xs text-slate-500",children:"Classes"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-lg font-semibold text-slate-900",children:rt.memberSubscriberCount}),s.jsx("p",{className:"text-xs text-slate-500",children:"Members"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-lg font-semibold text-slate-900",children:rt.membershipCount}),s.jsx("p",{className:"text-xs text-slate-500",children:"Memberships"})]})]}),s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx("span",{className:"text-slate-500",children:"Account Enabled:"}),s.jsx(Rs,{checked:!!Ne.isActive,onCheckedChange:Qt=>Z.mutate({instructorId:Ne.id,isActive:Qt}),disabled:!!(Z.isPending&&ie===Ne.id)})]}),s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx("span",{className:"text-slate-500",children:"Requires Subscription:"}),s.jsx(Rs,{checked:Ne.requiresSubscription||!1,onCheckedChange:Qt=>Fe.mutate({instructorId:Ne.id,requiresSubscription:Qt})})]}),s.jsxs(lL,{children:[s.jsx(cL,{asChild:!0,children:s.jsxs(B,{variant:"outline",size:"sm",className:"w-full",children:[s.jsx(yM,{className:"h-4 w-4 mr-2"}),"Actions"]})}),s.jsxs(WD,{align:"end",className:"w-56",children:[s.jsxs(lo,{onClick:()=>{window.open(`/admin?login=${encodeURIComponent(Ne.email)}`,"_blank")},children:[s.jsx(sr,{className:"h-4 w-4 mr-2"}),"Login as instructor"]}),s.jsxs(lo,{onClick:()=>{S(Ne),T({email:Ne.email,password:"",pagePath:Ne.subdomain||""})},children:[s.jsx(eS,{className:"h-4 w-4 mr-2"}),"Edit details"]}
836),s.jsxs(lo,{onClick:()=>v(Ne.id),children:[s.jsx(jd,{className:"h-4 w-4 mr-2"}),"Reset password"]}),s.jsxs(lo,{onClick:()=>H(Ne),children:[s.jsx(wa,{className:"h-4 w-4 mr-2"}),"View details"]}),s.jsx(HD,{}),s.jsxs(lo,{onClick:()=>Ke(Ne.id),className:"text-red-600 focus:text-red-600",children:[s.jsx(ln,{className:"h-4 w-4 mr-2"}),"Delete instructor"]})]})]})]})]},Ne.id)})]}),Ft.length===0&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(sr,{className:"h-12 w-12 text-slate-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-medium text-slate-900 mb-2",children:"No instructors found"}),s.jsx("p",{className:"text-slate-600",children:"Try adjusting your search or filter criteria."})]})]})}),s.jsx(on,{value:"featured",className:"mt-6",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900",children:"Featured Classes Management"}),s.jsx("p",{className:"text-slate-600 mt-1",children:"Control which classes appear on the public landing page"})]}),s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{children:"All Classes"})}),s.jsx(Ee,{children:s.jsx(M1e,{password:l})})]})]})}),s.jsx(on,{value:"analytics",className:"mt-6",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900",children:"Platform Analytics"}),s.jsx("p",{className:"text-slate-600 mt-1",children:"Overview of platform statistics and performance"})]}),ke&&s.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-4",children:[s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(sr,{className:"h-8 w-8 text-blue-600"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-slate-900",children:ke.instructors.total}),s.jsx("p",{className:"text-sm text-slate-600",children:"Total Instructors"}),s.jsxs("div",{className:"text-xs text-slate-500 mt-1",children:["Active: ",ke.instructors.activeSubscriptions," ","| Trials: ",ke.instructors.trials," | Exempt:"," ",ke.instructors.exempt]})]})]})})}),s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(sr,{className:"h-8 w-8 text-green-600"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-slate-900",children:ke.clients.total}),s.jsx("p",{className:"text-sm text-slate-600",children:"Total Clients"})]})]})})}),s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ls,{className:"h-8 w-8 text-purple-600"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-slate-900",children:ke.classes.total}),s.jsx("p",{className:"text-sm text-slate-600",children:"Total Classes"}),s.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:["Active: ",ke.classes.active]})]})]})})}),s.jsx(Ce,{children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(uw,{className:"h-8 w-8 text-orange-600"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-slate-900",children:ke.bookings.total}),s.jsx("p",{className:"text-sm text-slate-600",children:"Total Bookings"})]})]})})}),s.jsx(Ce,{className:"md:col-span-2 lg:col-span-4",children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ph,{className:"h-8 w-8 text-green-600"}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-2xl font-bold text-slate-900",children:["£",Number.parseFloat(ke.revenue.total).toLocaleString("en-GB",{minimumFractionDigits:2,maximumFractionDigits:2})]}),s.jsx("p",{className:"text-sm text-slate-600",children:"Total Platform Revenue"})]})]})})})]}),s.jsx(Tze,{password:l})]})}),s.jsx(on,{value:"pricing",className:"mt-6",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900",children:"Instructor Subscription Pricing"}),s.jsx("p",{className:"text-slate-600 mt-1",children:"Set pricing for instructor subscriptions by currency. Prices are automatically shown to users based on their location."})]}),s.jsx("div",{className:"grid gap-6 md:grid-cols-3",children:[{currency:"GBP",label:"British Poun
836d (£)",symbol:"£"},{currency:"EUR",label:"Euro (€)",symbol:"€"},{currency:"USD",label:"US Dollar ($)",symbol:"$"}].map(Ne=>{const rt=A.find(ht=>ht.currency===Ne.currency);return s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center space-x-2",children:[s.jsx(Ph,{className:"h-5 w-5"}),s.jsx("span",{children:Ne.label})]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{children:"Monthly Price"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"text-2xl font-bold text-slate-900",children:[Ne.symbol,(rt==null?void 0:rt.price)||"0.00"]}),s.jsx("div",{className:"text-sm text-slate-500",children:"per month"})]}),s.jsx(B,{size:"sm",variant:"outline",onClick:()=>L({currency:Ne.currency,price:(rt==null?void 0:rt.price)||"0.00",stripePriceId:(rt==null?void 0:rt.stripePriceId)||""}),children:"Edit"})]})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Stripe Price ID"}),s.jsx("div",{className:"text-sm text-slate-600 font-mono bg-slate-50 p-2 rounded border",children:(rt==null?void 0:rt.stripePriceId)||"Not configured"})]})]})]},Ne.currency)})}),s.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx("div",{className:"text-blue-600 mt-0.5",children:s.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("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 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium text-blue-900",children:"Currency Targeting"}),s.jsx("p",{className:"text-sm text-blue-700 mt-1",children:"Users from the USA see USD pricing, EUR countries see EUR pricing, and all others see GBP pricing. This only affects instructor subscription pricing - client bookings use the instructor's chosen currency."})]})]})})]})}),s.jsx(on,{value:"blog",className:"mt-6",children:s.jsx(R1e,{password:l})}),s.jsx(on,{value:"settings",className:"mt-6",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900",children:"System Settings"}),s.jsx("p",{className:"text-slate-600 mt-1",children:"Configure platform-wide settings"})]}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center space-x-2",children:[s.jsx(_n,{className:"h-5 w-5"}),s.jsx("span",{children:"Email Settings"})]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"admin-email",children:"Admin Notification Email"}),s.jsx(me,{id:"admin-email",placeholder:"[email protected]",value:R.adminEmail,onChange:Ne=>Y(rt=>({...rt,adminEmail:Ne.target.value}))})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"reply-email",children:"Booking Reply-To Email"}),s.jsx(me,{id:"reply-email",placeholder:"[email protected]",value:R.replyEmail,onChange:Ne=>Y(rt=>({...rt,replyEmail:Ne.target.value}))})]}),s.jsx(B,{onClick:vt,disabled:fe.isPending,className:"w-full",children:fe.isPending?"Saving...":"Save Email Settings"})]})]}),s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center space-x-2",children:[s.jsx(eS,{className:"h-5 w-5"}),s.jsx("span",{children:"Master Password"})]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"master-password",children:"Master Password for Instructor Login"}),s.jsx(me,{id:"master-password",type:"password",placeholder:"Enter master password",value:M,onChange:Ne=>se(Ne.target.value)}),s.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"This password can be used to login as any instructor for support purposes."})]}),s.jsx(B,{onClick:Zt,disabled:fe.isPending,className:"w-full",children:fe.isPending?"Saving...":"Save Master Password"})]})]})]})]})})]})}),s.jsx(Ct,{open:u,onOpenChange:h,children:s.jsxs(St,{children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Create New Instructor"}),s.jsx(yn,{children:"Fill in the details to create a new instructor account."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"new-email",children:"Email"}),s.jsx(me,{id:"new-email",type:"email",value:z.email,onChange:Ne=>O({...z,email:Ne.target.value}),placeholder:"[email protected]"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"new-password",children:"Password"}),s.jsx(me,{id:"new-password",type:"password",value:z.password,onChange:Ne=>O({...z,password:Ne.target.value}),placeholder:"Enter password"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"new-business",children:"Business N
836ame"}),s.jsx(me,{id:"new-business",value:z.businessName,onChange:Ne=>O({...z,businessName:Ne.target.value}),placeholder:"Yoga Studio Name"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"new-instructor",children:"Instructor Name"}),s.jsx(me,{id:"new-instructor",value:z.instructorName,onChange:Ne=>O({...z,instructorName:Ne.target.value}),placeholder:"John Doe"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"new-subdomain",children:"Subdomain"}),s.jsx(me,{id:"new-subdomain",value:z.subdomain,onChange:Ne=>O({...z,subdomain:Ne.target.value}),placeholder:"yoga-studio"})]})]}),s.jsxs(Er,{children:[s.jsx(B,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),s.jsx(B,{onClick:()=>_e.mutate(z),children:"Create Instructor"})]})]})}),s.jsx(Ct,{open:!!P,onOpenChange:()=>S(null),children:s.jsxs(St,{children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Edit Instructor"}),s.jsx(yn,{children:"Update instructor account details."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-email",children:"Email"}),s.jsx(me,{id:"edit-email",type:"email",value:E.email,onChange:Ne=>T({...E,email:Ne.target.value})})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-page-path",children:"Page Path"}),s.jsx(me,{id:"edit-page-path",type:"text",value:E.pagePath,onChange:Ne=>T({...E,pagePath:Ne.target.value}),placeholder:"e.g., yoga-studio",maxLength:30}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Used in the instructor's public URL. Max 30 characters."})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-password",children:"New Password (optional)"}),s.jsx(me,{id:"edit-password",type:"password",value:E.password,onChange:Ne=>T({...E,password:Ne.target.value}),placeholder:"Leave blank to keep current password"})]})]}),s.jsxs(Er,{children:[s.jsx(B,{variant:"outline",onClick:()=>S(null),children:"Cancel"}),s.jsx(B,{onClick:()=>ze.mutate({id:P.id,data:E}),children:"Update Instructor"})]})]})}),s.jsx(Ct,{open:!!p,onOpenChange:()=>v(null),children:s.jsxs(St,{children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Reset Password"}),s.jsx(yn,{children:"Enter a new password for this instructor."})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"new-password-reset",children:"New Password"}),s.jsx(me,{id:"new-password-reset",type:"password",value:y,onChange:Ne=>g(Ne.target.value),placeholder:"Enter new password"})]}),s.jsxs(Er,{children:[s.jsx(B,{variant:"outline",onClick:()=>v(null),children:"Cancel"}),s.jsx(B,{onClick:()=>ue.mutate({id:p,newPassword:y}),children:"Reset Password"})]})]})}),s.jsx(Ct,{open:!!w,onOpenChange:()=>{j(null),C(null)},children:s.jsxs(St,{children:[s.jsxs(kt,{children:[s.jsxs(Pt,{className:"flex items-center space-x-2",children:[s.jsx(Mr,{className:"h-5 w-5 text-red-500"}),s.jsx("span",{children:"Delete Instructor"})]}),s.jsx(yn,{children:N!=null&&N.canDelete?s.jsx("span",{children:"Are you sure you want to delete this instructor? This action cannot be undone."}):s.jsx("span",{className:"text-red-600",children:N==null?void 0:N.reason})})]}),N&&!N.canDelete&&s.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-md p-4",children:[s.jsx("p",{className:"text-sm text-red-800",children:"This instructor cannot be deleted because they have:"}),s.jsxs("ul",{className:"mt-2 text-sm text-red-700 list-disc list-inside",children:[N.clientCount>0&&s.jsxs("li",{children:[N.clientCount," client(s)"]}),N.bookingCount>0&&s.jsxs("li",{children:[N.bookingCount," booking(s)"]})]})]}),s.jsxs(Er,{children:[s.jsx(B,{variant:"outline",onClick:()=>{j(null),C(null)},children:"Cancel"}),(N==null?void 0:N.canDelete)&&s.jsx(B,{variant:"destructive",onClick:We,children:"Delete Instructor"})]})]})}),s.jsx(Ct,{open:!!_,onOpenChange:()=>L(null),children:s.jsxs(St,{children:[s.jsxs(kt,{children:[s.jsxs(Pt,{children:["Edit ",_==null?void 0:_.currency," Pricing"]}),s.jsxs(yn,{children:["Update the monthly subscription price and Stripe Price ID for ",_==null?void 0:_.currency," currency."]})]}),_&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-price",children:"Monthly Price"}),s.jsx(me,{id:"edit-price",type:"number",step:"0.01",value:_.price,onChange:Ne=>L({..._,price:Ne.target.value}),placeholder:"10.00"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"edit-stripe-price-id",children:"Stripe Price ID"}),s.jsx(me,{id:"edit-stripe-price-id",value:_.stripePriceId,onChange:Ne=>L({..._,stripePriceId:Ne.target.value}),placeholder:"price_1234567890abcdef"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:'Get this from your Str
836ipe Dashboard → Products → Price ID (starts with "price_")'})]})]}),s.jsxs(Er,{children:[s.jsx(B,{variant:"outline",onClick:()=>L(null),children:"Cancel"}),s.jsx(B,{onClick:()=>_&&Me.mutate(_),disabled:Me.isPending,children:Me.isPending?"Updating...":"Update Pricing"})]})]})}),s.jsx(Oze,{open:!!q,onOpenChange:Ne=>!Ne&&H(null),children:s.jsxs(EJ,{side:Q?"right":"bottom",className:Q?"sm:max-w-lg overflow-y-auto":"h-[85vh] w-screen max-w-none rounded-t-3xl overflow-y-auto",children:[s.jsx(DJ,{children:s.jsx(AJ,{children:"Instructor Details"})}),q&&be(q)]})})]}):s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:s.jsx(Ce,{className:"w-full max-w-md",children:s.jsxs(Ee,{className:"p-8",children:[s.jsxs("div",{className:"text-center mb-6",children:[s.jsx(jd,{className:"h-12 w-12 text-primary mx-auto mb-4"}),s.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"Superadmin Access"}),s.jsx("p",{className:"text-slate-600 mt-2",children:"Enter superadmin password to manage instructors"})]}),s.jsxs("form",{onSubmit:async Ne=>{Ne.preventDefault(),await le(l)},className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"password",children:"Superadmin Password"}),s.jsx(me,{id:"password",type:"password",value:l,onChange:Ne=>c(Ne.target.value),placeholder:"Enter superadmin password",className:d?"border-red-500":""}),d&&s.jsx("p",{className:"text-red-500 text-sm mt-1",children:d})]}),s.jsx(B,{type:"submit",className:"w-full",children:"Access Superadmin Panel"})]}),s.jsx("div",{className:"mt-6 text-center",children:s.jsx(B,{variant:"link",onClick:()=>window.location.href="/",children:"Back to Main Site"})})]})})})}function rWe(){const{toast:e}=Yt(),{formatPrice:t,currentPrice:n,currentCurrency:r,isLoading:a}=ZN(),[i,o]=f.useState(!1),[l,c]=f.useState(null),[d,m]=f.useState(!0),[u,h]=f.useState(null),[p,v]=f.useState(""),[y,g]=f.useState(""),[x,b]=f.useState("");f.useEffect(()=>{try{const O=localStorage.getItem("admin_session");if(!O){m(!1);return}const D=JSON.parse(O);if(Date.now()>D.expires){localStorage.removeItem("admin_session"),m(!1);return}h(D.instructor),m(!1)}catch(O){console.error("Error reading session:",O),localStorage.removeItem("admin_session"),m(!1)}},[]);const{data:w}=Ue({queryKey:[`/api/instructors/${u==null?void 0:u.id}`],enabled:!!(u!=null&&u.id),staleTime:0,refetchOnWindowFocus:!0});f.useEffect(()=>{w?c(w):u&&c(u)},[w,u]),f.useEffect(()=>{const O=new URLSearchParams(window.location.search),D=O.get("subscription"),k=O.get("session_id");if(D==="success"&&k&&(l!=null&&l.id)){console.log("✅ Stripe payment succeeded, updating subscription status"),Pe("POST","/api/confirm-subscription-payment",{sessionId:k,instructorId:l.id}).then(W=>W.json()).then(W=>{W.success&&(e({title:"Subscription Activated!",description:"Your subscription has been successfully activated."}),window.location.reload())}).catch(W=>{console.error("Error confirming subscription:",W)});const F=window.location.pathname;window.history.replaceState({},document.title,F)}},[l==null?void 0:l.id,e]);const j=xt({mutationFn:async()=>{const O=r||"GBP";console.log("🔄 Using currency from context:",O),console.log("🔄 Currency loading state:",a);let D;typeof window<"u"&&window.endorsely_referral&&(D=window.endorsely_referral,console.log("🔗 Including Endorsely referral:",D));const k={instructorEmail:l==null?void 0:l.email,currency:O};D&&(k.endorsely_referral=D),console.log("🔄 Request data being sent:",k);const F=await Pe("POST","/api/create-instructor-subscription",k),W=await F.json();if(!F.ok&&W.error==="subscription_exists")throw{...W,status:F.status};return W},onSuccess:O=>{O.url&&(window.location.href=O.url)},onError:O=>{if(O.error==="subscription_exists"||O.status===409){e({title:"Subscription Already Exists",description:O.message||"You already have an active subscription. Please manage your existing subscription instead.",variant:"destructive"});return}e({title:"Subscription Error",description:O.message||"Failed to create subscription. Please try again.",variant:"destructive"})}}
836),N=xt({mutationFn:async()=>(await Pe("POST","/api/manage-subscription",{instructorEmail:l==null?void 0:l.email})).json(),onSuccess:O=>{O.url&&(window.location.href=O.url)},onError:O=>{O.message&&O.message.includes("billing portal configuration")?e({title:"Setup Required",description:"Subscription management will be available soon. Contact support if you need help with your subscription.",variant:"destructive"}):e({title:"Portal Error",description:O.message,variant:"destructive"})}}),C=xt({mutationFn:async O=>(await Pe("POST","/api/instructor/change-password",O)).json(),onSuccess:()=>{e({title:"Password updated",description:"Your new password is ready to use."}),v(""),g(""),b("")},onError:O=>{e({title:"Password update failed",description:(O==null?void 0:O.message)||"Unable to change your password.",variant:"destructive"})}});if(d)return s.jsx("div",{className:"flex items-center justify-center min-h-screen",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"})});if(!l)return s.jsx("div",{className:"flex items-center justify-center min-h-screen",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Access Denied"}),s.jsx("p",{className:"text-slate-600",children:"You must be logged in as an instructor to view this page."})]})});const P=O=>{switch(O){case"active":return s.jsx(Je,{className:"bg-green-100 text-green-800",children:"Active"});case"past_due":return s.jsx(Je,{className:"bg-orange-100 text-orange-800",children:"Past Due"});case"canceled":return s.jsx(Je,{className:"bg-red-100 text-red-800",children:"Canceled"});default:return s.jsx(Je,{className:"bg-gray-100 text-gray-800",children:"No Subscription"})}},S=()=>{let O;if(l.trialEndsAt)O=new Date(l.trialEndsAt);else if(l.createdAt)O=new Date(l.createdAt),O.setDate(O.getDate()+30);else return{isActive:!1,daysLeft:0};const D=new Date,k=D<O,F=O.getTime()-D.getTime(),W=Math.max(0,Math.ceil(F/(1e3*60*60*24)));return{isActive:k,daysLeft:W}},{isActive:E,daysLeft:T}=S(),z=O=>{if(O.preventDefault(),!y){e({title:"New password required",description:"Please enter a new password.",variant:"destructive"});return}if(y.length<8){e({title:"Password too short",description:"Password must be at least 8 characters long.",variant:"destructive"});return}if(y!==x){e({title:"Passwords do not match",description:"Please make sure the confirmation matches the new password.",variant:"destructive"});return}C.mutate({currentPassword:p||void 0,newPassword:y})};return s.jsx("div",{className:"min-h-screen bg-gray-50 py-8",children:s.jsxs("div",{className:"max-w-4xl mx-auto px-4",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("div",{className:"flex items-center gap-4 mb-4",children:s.jsxs(B,{variant:"outline",onClick:()=>window.location.href="/admin",className:"flex items-center gap-2",children:[s.jsx(xr,{className:"h-4 w-4"}),"Back to Admin"]})}),s.jsx("h1",{className:"text-3xl font-bold text-slate-900 mb-2",children:"Instructor Profile"}),s.jsx("p",{className:"text-slate-600",children:"Manage your account and subscription settings"})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(mw,{className:"h-5 w-5"}),"Profile Information"]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium text-slate-600",children:"Business Name"}),s.jsx("p",{className:"text-slate-900",children:l.businessName})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium text-slate-600",children:"Instructor Name"}),s.jsx("p",{className:"text-slate-900",children:l.instructorName})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium text-slate-600",children:"Email"}),s.jsx("p",{className:"text-slate-900",children:l.email})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium text-slate-600",children:"Booking Page URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("p",{className:"text-slate-900",children:["classta.co/cal/",l.subdomain]}),s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>{const O=`https://classta.co/cal/${l.subdomain}`;navigator.clipboard.writeText(O),e({title:"URL Copied",description:"Booking page URL has been copied to clipboard."})},className:"h-8 w-8 p-0",title:"Copy booking page URL",children:s.jsx(pr,{className:"h-4 w-4"})}),window.navigator.share&&s.jsx(B,{variant:"outline",size:"sm",onClick:()=>{const O=`https://classta.co/classes/${l.subdomain}`;window.navigator.share?window.navigator.share({title:"My class booking page:",text:"",url:O}).then(()=>{console.log("Successful share")}).catch(D=>{console.error("Error sharing:",D)}):e({title:"Sharing Not Supported",description:"Your browser does not support the Web Share API.",variant:"destructive"})},className:"h-8 w-8 p-0",title:"Share link",children:s.jsx(X9,{className:"h-4 w-4"})})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium text-slate-600",children:"Currency"}),s.jsx("p",{className:"text-slate-900",children:l.currency||"GBP"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium text-slate-600",children:"Timezone"}),s.jsx("p",{className:"text-slate-900",children:l.timezone||"Europe/London"})]}),typeof window<"u"&&window.flutter_inappwebview&&s.jsx("div",{className:"pt-4",children:s.jsx(B,{variant:"destructive",className:"w-full",onClick:async()=>
836{if(window.prompt("Type DELETE to confirm account deletion. This cannot be undone.")!=="DELETE"){e({title:"Confirmation Failed",description:"You must type DELETE to confirm.",variant:"destructive"});return}try{const D=localStorage.getItem("auth_token"),F=await(await fetch("/api/instructor/delete-account",{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${D}`},body:JSON.stringify({instructorId:l.id})})).json();if(F.success)e({title:"Account Deleted",description:"Your account has been deleted."}),localStorage.clear(),window.flutter_inappwebview.callHandler("flutterHandler","logout");else throw new Error(F.message||"Failed to delete account.")}catch(D){e({title:"Delete Failed",description:D.message,variant:"destructive"})}},children:"Delete Account"})})]})]}),l.requiresSubscription&&s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(ti,{className:"h-5 w-5"}),"Subscription Status"]})}),s.jsx(Ee,{className:"space-y-4",children:(()=>{const O=(l.subscriptionStatus||"").toLowerCase(),D=["past_due","incomplete"].includes(O),k=["canceled","unpaid","incomplete_expired"].includes(O);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium text-slate-600",children:"Status"}),P(l.subscriptionStatus||"none")]}),E&&l.subscriptionStatus!=="active"&&s.jsxs("div",{className:"p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Ls,{className:"h-4 w-4 text-blue-600"}),s.jsx("span",{className:"font-medium text-blue-900",children:"Free Trial Active"})]}),s.jsxs("p",{className:"text-sm text-blue-700",children:[T," days remaining in your free trial"]})]}),l.subscriptionStatus==="active"?s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"p-4 bg-green-50 border border-green-200 rounded-lg",children:s.jsx("p",{className:"text-sm text-green-700",children:"Your subscription is active. Thank you for using Classta!"})}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(B,{variant:"outline",onClick:()=>{if(window.flutter_inappwebview){window.flutter_inappwebview.callHandler("flutterHandler","openSubscriptionPage");return}N.mutate()},disabled:N.isPending,className:"w-full",children:N.isPending?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-slate-600 border-t-transparent rounded-full"}),"Loading..."]}):"Manage Subscription"}),s.jsx(B,{onClick:()=>window.location.href="/admin",className:"w-full",children:"Back to Admin Dashboard"})]})]}):D?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"p-4 bg-amber-50 border border-amber-200 rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(cm,{className:"h-4 w-4 text-amber-700"}),s.jsx("span",{className:"font-medium text-amber-900",children:"Payment needed"})]}),s.jsx("p",{className:"text-sm text-amber-800",children:"Your latest invoice needs payment. Please update your payment method to restore full access."})]}),s.jsx(B,{variant:"outline",onClick:()=>{if(window.flutter_inappwebview){window.flutter_inappwebview.callHandler("flutterHandler","openSubscriptionPage");return}N.mutate()},disabled:N.isPending,className:"w-full",children:N.isPending?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-slate-600 border-t-transparent rounded-full"}),"Loading..."]}):"Update payment details"}),s.jsx(B,{onClick:()=>window.location.href="/admin",className:"w-full",variant:"outline",children:"Back to Admin Dashboard"})]}):s.jsxs("div",{className:"space-y-3",children:[!E&&s.jsxs("div",{className:"p-4 bg-orange-50 border border-orange-200 rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(cm,{className:"h-4 w-4 text-orange-600"}),s.jsx("span",{className:"font-medium text-orange-900",children:"Subscription Required"})]}),s.jsx("p",{className:"text-sm text-orange-700",children:k?"Your subscription is inactive. Start a new subscription to continue."
836:"Your trial has expired. Subscribe to continue using Classta."})]}),s.jsx(B,{onClick:()=>{if(window.flutter_inappwebview){window.flutter_inappwebview.callHandler("flutterHandler","openSubscriptionPage");return}j.mutate()},disabled:j.isPending,className:"w-full",children:a?"Loading...":`Subscribe Now - ${t(n)}/month`}),s.jsx(B,{onClick:()=>{localStorage.clear(),window.location.href="/"},variant:"outline",className:"w-full mt-3",children:"Logout"}),E&&window.flutter_inappwebview&&s.jsxs("div",{className:"p-4 bg-gray-50 border border-gray-200 rounded-lg text-sm text-gray-700",children:["To cancel your free trial, please contact us at"," ",s.jsx("a",{href:"mailto:[email protected]",className:"font-medium text-gray-900 hover:underline",children:"[email protected]"})]})]})]})})()})]}),s.jsx(bV,{}),s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(jd,{className:"h-5 w-5"}),"Change Password"]}),s.jsx("p",{className:"text-sm text-slate-500",children:"Update the password you use for email logins."})]}),s.jsx(Ee,{children:s.jsxs("form",{className:"space-y-4",onSubmit:z,children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{htmlFor:"current-password",className:"text-sm font-medium text-slate-600",children:"Current Password"}),s.jsx(me,{id:"current-password",type:"password",autoComplete:"current-password",value:p,onChange:O=>v(O.target.value),placeholder:"Enter your current password"}),s.jsx("p",{className:"text-xs text-slate-500",children:"Leave blank if you signed up with Google, Apple, or Facebook and never set a password before."})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{htmlFor:"new-password",className:"text-sm font-medium text-slate-600",children:"New Password"}),s.jsx(me,{id:"new-password",type:"password",autoComplete:"new-password",value:y,onChange:O=>g(O.target.value),placeholder:"Choose a new password"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{htmlFor:"confirm-password",className:"text-sm font-medium text-slate-600",children:"Confirm New Password"}),s.jsx(me,{id:"confirm-password",type:"password",autoComplete:"new-password",value:x,onChange:O=>b(O.target.value),placeholder:"Re-enter your new password"})]}),s.jsx(B,{type:"submit",className:"w-full",disabled:C.isPending,children:C.isPending?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-slate-600 border-t-transparent rounded-full"}),"Updating..."]}):"Update Password"})]})})]})]}),!l.requiresSubscription&&s.jsx(Ce,{className:"mt-6",children:s.jsx(Ee,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(mw,{className:"h-6 w-6 text-yellow-600"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold text-slate-900",children:"Premium Account"}),s.jsx("p",{className:"text-sm text-slate-600",children:"You have unlimited access to all Classta features."})]})]}),s.jsx(B,{onClick:()=>window.location.href="/admin",className:"ml-4",children:"Go to Admin Dashboard"})]})})})]})})}function aWe({amount:e,currency:t,intent:n,instructorId:r,bookingData:a,onApprove:i,onCancel:o,onError:l}){const c=async()=>{var d,m;try{console.log("PayPal button clicked!");const h=await fetch("/api/paypal/order",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({amount:e,currency:t,intent:n,instructorId:r,bookingData:a})});if(!h.ok)throw new Error(`Failed to create order: ${h.statusText}`);const p=await h.json();if(console.log("Order created:",p),p.id){console.log("Order ID:",p.id);const v=(m=(d=p.links)==null?void 0:d.find(y=>y.rel==="approve"))==null?void 0:m.href;if(v)window.location.href=v;else throw new Error("No approval URL found in PayPal response")}}catch(u){console.error("PayPal payment error:",u),l&&l(u)}};return s.jsx("div",{id:"paypal-button",onClick:c,className:"cursor-pointer bg-blue-600 hover:bg-blue-700 text-white font-semibold py-3 px-6 rounded-lg transition-colors flex items-center justify-center",style:{minHeight:"48px"},children:"Pay with PayPal"})}const zh=e=>{var t,n,r;return e.bookingType==="service"?((t=e.serviceData)==null?void 0:t.name)||"Service":e.bookingType==="event"?((n=e.eventData)==null?void 0:n.title)||"Event":((r=e.classData)==null?void 0:r.name)||"Class"};function zF(e){console.log("Redirecting to custom confirmation URL:",e);try{if(typeof window<"u"&&window.self!==window.top&&window.top){window.top.location.href=e;return}}catch{}window.location.href=e}function Cu(e){var r;const t=((r=e==null?void 0:e.classData)==null?void 0:r.id)||(e==null?void 0:e.classId),n=typeof t=="number"?Pg(t):null;return{bookingAccessCode:(e==null?void 0:e.bookingAccessCode)||n||null,privateLinkToken:(e==null?void 0:e.privateLinkToken)||null}}const sg=e=>{var i,o,l;if(e.bookingType==="service")return new Date(e.classDate).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"});if(e.bookingType==="event")return Ud(((i=e.eventData)==null?void 0:i.startsAt)??null);const t=(o=e.classData)==null?void 0:o.date;if(!t)return"";const n=t.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"});let r="";
836const a=(l=e.classData)==null?void 0:l.startTime;if(typeof a=="string")try{const c=JSON.parse(a);if(typeof c=="object"&&c!==null){const d=t.getDay().toString(),m=c[d];if(m){const[u,h]=m.split(":"),p=new Date;p.setHours(parseInt(u),parseInt(h)),r=p.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}}}catch{r=a}else r=a||"";return`${n} at ${r}`};function iWe(e,t){var a;if(e.bookingType!=="event"||!((a=e.eventData)!=null&&a.bookingInfoFieldEnabled)||e.isFreeBooking||e.isPayOnDoor)return!1;const n=e.amount,r=typeof n=="number"?n:typeof n=="string"?parseFloat(n):NaN;return!(!Number.isNaN(r)&&r===0||t!=null&&typeof t.finalAmount=="number"&&t.finalAmount===0)}function mC(e){e.invalidateQueries({predicate:t=>Array.isArray(t.queryKey)&&typeof t.queryKey[0]=="string"&&t.queryKey[0].includes("/has-booked")})}function Ax(e,t){var i;if(e.bookingType!=="event"||!((i=e.eventData)!=null&&i.bookingInfoFieldEnabled))return;const n=String(e.eventBookingInfo??"").trim();return t.trim()||n||void 0}const qF=e=>(e==null?void 0:e.error)==="DUPLICATE_CLASS_BOOKING"||(e==null?void 0:e.status)===409;let rb={};const oWe=(e,t)=>{const n=t?`${e}_${t}`:e;return console.log("🔍 Stripe setup:",{publicKey:(e==null?void 0:e.substring(0,20))+"...",hasConnectedAccount:!!t}),rb[n]||(t?(console.log("💳 Loading Stripe for Connect account direct charge"),rb[n]=od(e,{stripeAccount:t})):(console.log("💳 Loading Stripe with instructor API keys"),rb[n]=od(e))),rb[n]};function lWe({pendingBooking:e}){var O,D;const[t,n]=f.useState(!1),[r,a]=f.useState(!1),[i,o]=f.useState(!1),[l,c]=f.useState(e.appliedCouponCode||e.couponCode||""),[d,m]=f.useState(!1),u=!!e.couponApplied&&(Number(e.discountAmount)>0||Number(e.finalAmount)===0),[h,p]=f.useState(u?{originalAmount:e.originalAmount||e.amount,finalAmount:e.finalAmount??e.amount,discountAmount:e.discountAmount??0,couponApplied:e.couponApplied||null}:null),[v,y]=f.useState(!1),[g,x]=f.useState(!1),[b,w]=f.useState(null),{toast:j}=Yt(),[N,C]=cn(),P=jn();Cl(!v&&!!e),Cl(g);const S=xt({mutationFn:async k=>(await Pe("POST","/api/confirm-booking",{...k,...Cu(e)})).json(),onSuccess:async k=>{var q,H,_;y(!0),sessionStorage.removeItem("pendingBooking"),P.invalidateQueries({queryKey:["/api/bookings"]}),(q=e==null?void 0:e.clientData)!=null&&q.email&&mC(P),Zs("booking_completed","engagement",(e==null?void 0:e.bookingType)||"single",0),j({title:"Booking Confirmed!",description:"Your free booking has been confirmed successfully."});const F=e.appliedCouponCode||((H=h==null?void 0:h.couponApplied)==null?void 0:H.code)||l,W=(_=e.classData)==null?void 0:_.instructorId;if(F&&W)try{const L=await fetch(`/api/coupons/bundles/info/${W}/${F}`);if(L.ok){const U=await L.json();if(U.remainingSessions&&U.remainingSessions>0){w(U.remainingSessions),x(!0);return}}}catch(L){console.error("Error fetching bundle info:",L)}setTimeout(()=>{typeof window<"u"&&window.self!==window.top&&window.parent.postMessage({type:"CLASSTA_MODAL_CLOSE"},"*"),setTimeout(()=>{var I;const U=(I=e==null?void 0:e.classData)==null?void 0:I.bookingConfirmationRedirectUrl;if(U&&U.trim()){zF(U);return}const J=sessionStorage.getItem("bookingOriginUrl");if(J)console.log("Redirecting to original location:",J),sessionStorage.removeItem("bookingOriginUrl"),window.location.href=J;else{const re=sessionStorage.getItem("currentInstructorSubdomain");re?(console.log("Redirecting to instructor subdomain:",re),window.location.href=`/classes/${re}`):(console.log("No original location stored, redirecting to home"),C("/"))}},300)},2e3)},onError:k=>{var W,q,H,_;if(console.error("Free booking confirmation error:",k),qF(k)&&window.confirm(`${(k==null?void 0:k.message)||"You've already booked this session."}
837
838Click OK to continue with another booking, or Cancel to go back.`)){S.mutate({paymentIntentId:`free_${Date.now()}`,clientData:e.clientData,bookingType:e.bookingType,amount:"0.00",currency:e.currency||"GBP",testMode:e.testMode||!1,couponCode:e.appliedCouponCode||((W=h==null?void 0:h.couponApplied)==null?void 0:W.code)||l||void 0,...e.bookingType==="service"?{serviceId:e.serviceId,classDate:e.classDate}:{classId:e.classData.id,classDate:In(e.classData.date),selectedDates:(q=e.selectedDates)==null?void 0:q.map(U=>In(U)),selectedPackage:e.selectedPackage},allowDuplicateBooking:!0});return}const F=((_=(H=k==null?void 0:k.response)==null?void 0:H.json)==null?void 0:_.message)||(k==null?void 0:k.message)||"There was an error confirming your free booking. Please try again.";j({title:"Booking Failed",description:F,variant:"destructive"}),n(!1)}}),E=async()=>{var F,W,q,H;if(n(!0),e.bookingType==="event"){const _=!!e.isPayOnDoor,L=_?"/api/confirm-pay-on-door-event-order":"/api/confirm-free-event-order";try{const J=await(await Pe("POST",L,{eventId:e.eventId,ticketTypeId:e.ticketTypeId,quantity:e.quantity,clientData:e.clientData,attendees:e.attendees||void 0,bookingInfoResponse:Ax(e,""),couponCode:e.appliedCouponCode||((F=h==null?void 0:h.couponApplied)==null?void 0:F.code)||l||void 0})).json();if(J.success){y(!0),sessionStorage.removeItem("pendingBooking");const I=(W=e.eventData)==null?void 0:W.accountId;I&&P.invalidateQueries({queryKey:["/api/events/public",I]}),j({title:"Tickets confirmed!",description:_?"Your tickets are reserved. Payment is due at the door. Check your email for details.":"Your tickets have been confirmed. Check your email for details."}),Zs("booking_completed","engagement","event",0),setTimeout(()=>{const re=sessionStorage.getItem("bookingOriginUrl");if(re)sessionStorage.removeItem("bookingOriginUrl"),window.location.href=re;else{const R=sessionStorage.getItem("currentInstructorSubdomain");
838window.location.href=R?`/classes/${R}`:"/"}},1500)}else j({title:"Error",description:J.message||"Failed to confirm order",variant:"destructive"}),n(!1)}catch(U){j({title:"Error",description:(U==null?void 0:U.message)||"Failed to confirm order",variant:"destructive"}),n(!1)}return}const k={paymentIntentId:`free_${Date.now()}`,clientData:e.clientData,bookingType:e.bookingType,amount:"0.00",currency:e.currency||"GBP",testMode:e.testMode||!1,couponCode:e.appliedCouponCode||((q=h==null?void 0:h.couponApplied)==null?void 0:q.code)||l||void 0};e.bookingType==="service"?(k.serviceId=e.serviceId,k.classDate=e.classDate):(k.classId=e.classData.id,k.classDate=In(e.classData.date),k.selectedDates=(H=e.selectedDates)==null?void 0:H.map(_=>In(_)),k.selectedPackage=e.selectedPackage),S.mutate(k)};e.bookingType==="service"||(O=e.classData)==null||O.instructor,mt(e.currency||"GBP");const T=(D=e.classData)==null?void 0:D.instructorId,{data:z}=Ue({queryKey:[`/api/instructor/by-id/${T}`],enabled:!!T&&g,queryFn:async()=>{const k=await fetch(`/api/instructor/by-id/${T}`);if(!k.ok)throw new Error("Failed to fetch instructor");return k.json()}});return d1(z),f.useEffect(()=>{a(!0)},[]),s.jsxs("div",{className:"max-w-2xl mx-auto p-6 bg-white",children:[s.jsxs("div",{className:"text-center mb-6",children:[s.jsx(qt,{className:"h-16 w-16 text-green-600 mx-auto mb-4"}),s.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Booking Confirmation"}),s.jsx("p",{className:"text-gray-600",children:"Your booking is ready to be confirmed"})]}),s.jsx(Ct,{open:r,onOpenChange:()=>{},children:s.jsxs(St,{className:"sm:max-w-md [&>button]:hidden",onInteractOutside:k=>{k.preventDefault()},onEscapeKeyDown:k=>{k.preventDefault()},children:[s.jsx(kt,{children:s.jsxs(Pt,{className:"flex items-center gap-2",children:[s.jsx(qt,{className:"h-5 w-5 text-green-600"}),"Confirm Booking"]})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-slate-600",children:["You're about to confirm your booking for"," ",s.jsx("span",{className:"font-semibold",children:zh(e)})," "]}),e.isPayOnDoor&&e.bookingType==="event"?s.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-amber-800 mb-2",children:[s.jsx(qt,{className:"h-4 w-4"}),s.jsxs("span",{className:"font-medium",children:["Total: ",mt(e.currency||"GBP"),(typeof e.amount=="number"?e.amount:parseFloat(String(e.amount||0))||0).toFixed(2)]})]}),s.jsx("p",{className:"text-sm text-amber-700",children:"To be paid on door."})]}):s.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-green-800 mb-2",children:[s.jsx(qt,{className:"h-4 w-4"}),s.jsx("span",{className:"font-medium",children:"Total: FREE"})]}),s.jsx("p",{className:"text-sm text-green-700",children:"No payment required for this booking."})]}),s.jsxs("div",{className:"flex gap-3 pt-4",children:[s.jsx(B,{variant:"outline",className:"flex-1",onClick:()=>o(!0),disabled:t,children:"Cancel"}),s.jsx(B,{className:"flex-1",onClick:E,disabled:t,children:t?"Confirming...":"Confirm Booking"})]})]})]})}),s.jsx(Ct,{open:i,onOpenChange:o,children:s.jsxs(St,{className:"sm:max-w-md",children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Cancel Booking?"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-slate-600",children:"Are you sure you want to cancel your booking? This will return you to the calendar page and your booking will not be confirmed."}),s.jsxs("div",{className:"flex gap-3 pt-4",children:[s.jsx(B,{variant:"outline",className:"flex-1",onClick:()=>{o(!1),a(!0)},children:"No, Keep Booking"}),s.jsx(B,{variant:"destructive",className:"flex-1",onClick:()=>{o(!1),a(!1),sessionStorage.removeItem("pendingBooking");const k=sessionStorage.getItem("bookingOriginUrl");if(k)sessionStorage.removeItem("bookingOriginUrl"),window.location.replace(k);else{const F=sessionStorage.getItem("currentInstructorSubdomain");window.location.replace(F?`/classes/${F}`:"/")}},children:"Yes, Cancel Booking"})]})]})]})}),s.jsx(Ct,{open:g,onOpenChange:x,children:s.jsxs(St,{className:"sm:max-w-md",children:[s.jsx(kt,{children:s.jsxs(Pt,{className:"flex items-center gap-2",children:[s.jsx(qt,{className:"h-5 w-5 text-green-600"}),"Book Another Class"]})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-slate-600",children:["Now book another class, you have"," ",s.jsxs("span",{className:"font-semibold text-lg",children:[b," session",b!==1?"s":""]})," ","left of your bundle."]}),s.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:s.jsx("p",{className:"text-sm text-blue-800",children:"Select a class from the calendar to use another session from your bundle."})}),s.jsxs("div",{className:"flex gap-3 pt-4",children:[s.jsx(B,{variant:"outline",className:"flex-1",onClick:()=>{x(!1),setTimeout(()=>{typeof window<"u"&&window.self!==window.top&&window.parent.postMessage({type:"CLASSTA_MODAL_CLOSE"},"*"),setTimeout(()=>{z!=null&&z.subdomain?window.location.href=`/classes/${z.subdomain}`:window.location.href="/"},300)},0)},children:"Book Another Class"}),s.jsx(B,{className:"flex-1",onClick:()=>{x(!1),setTimeout(()=>{typeof window<"u"&&window.self!==window.top&&window.parent.postMessage({type:"CLASSTA_MODAL_CLOSE"},"*"),setTimeout(()=>{const F=sessionStorage.getItem("bookingOriginUrl");F?(sessionStorage.removeItem("bookingOriginUrl"),window.location.href=F):window.location.href="/"},300)},0)},children:"Close"})]})]})]})})]})}function cWe({pendingBooking:e}){var S,E,T,z;const[t,n]=f.useState(!1),[r,a]=f.useState(!1),[i,o]=f.useState(e.appliedCouponCode||e.couponCode||""),[l,c]=f.useState(!1),d=!!e.couponApplied&&(Number(e.discountAmount)>0||Number(e.finalAmount)===0),[m,u]=f.useState(d?{originalAmount:e.originalAmount||e.amount,finalAmount:e.finalAmount??e.amount,discountAmount:e.discountAmount??0,couponApplied:e.couponApplied||null}:null),[h,p]=f.useState(!1),{toast:v}=Yt(),[y,g]=cn(),x=jn();Cl(!h&&!!e);const b=xt({mutationFn:async O=>(await Pe("POST","/api/confirm-booking",{...O,...Cu(e)})).json(),onSuccess:O=>{var D;p(!0),sessionStorage.removeItem("pendingBooking"),x.invalidateQueries({queryKey:["/api/bookings"]}),(D=e==null?void 0:e.clientData)!=null&&D.email&&mC(x),Zs("booking_completed","engagement",(e==null?void 0:e.bookingType)||"single",e==null?void 0:e.finalAmount),v({title:"Booking Confirmed!",description:"Your cash payment booking has been confirmed. Please bring exact amount on arrival."}),setTimeout(()=>{typeof window<"u"&&window.self!==window.top&&window.parent.postMessage({type:"CLASSTA_MODAL_CLOSE"},"*"),setTimeout(()=>{var q;const F=(q=e==null?void 0:e.classData)==null?void 0:q.bookingConfirmationRedirectUrl;if(F&&F.trim()){zF(F);return}const W=sessionStorage.getItem("bookingOriginUrl");if(W)g(W),sessionStorage.removeItem("bookingOriginUrl");else{const H=sessionStorage.getItem("currentInstructorSubdomain");
838g(H?`/classes/${H}`:"/")}},300)},2e3)},onError:O=>{var D,k;if(qF(O)&&window.confirm(`${(O==null?void 0:O.message)||"You've already booked this session."}
839
840Click OK to continue with another booking, or Cancel to go back.`)){const W={paymentIntentId:`cash_${Date.now()}`,clientData:e.clientData,bookingType:e.bookingType,amount:m?m.finalAmount:w(),couponCode:((D=m==null?void 0:m.couponApplied)==null?void 0:D.code)||i,testMode:!1,paymentMethod:"cash",allowDuplicateBooking:!0};e.bookingType==="service"?(W.serviceId=e.serviceId,W.classDate=e.classDate):(W.classId=e.classData.id,W.classDate=`${e.classData.date.getFullYear()}-${String(e.classData.date.getMonth()+1).padStart(2,"0")}-${String(e.classData.date.getDate()).padStart(2,"0")}`,W.selectedDates=(k=e.selectedDates)==null?void 0:k.map(q=>`${q.getFullYear()}-${String(q.getMonth()+1).padStart(2,"0")}-${String(q.getDate()).padStart(2,"0")}`)),b.mutate(W);return}v({title:"Booking Failed",description:O.message||"Failed to confirm booking. Please try again.",variant:"destructive"})}}),w=()=>{var O;if((m==null?void 0:m.finalAmount)!==void 0)return m.finalAmount;if(e.bookingType==="event")return parseFloat(e.amount||"0");if(e.bookingType==="service"){const D=e.memberPrice||e.amount||"0";return parseFloat(D)}if(e.bookingType==="single"){const D=parseFloat(String(e.amount??""));if(!Number.isNaN(D)&&D>=0)return D;const k=e.memberPrice||((O=e.classData)==null?void 0:O.singlePrice)||"0";return parseFloat(k)}return e.selectedPackage?e.memberPrice!==null&&e.memberPrice!==void 0&&(e.memberPrice===""||e.memberPrice==="0"||parseFloat(e.memberPrice)===0)?0:parseFloat(e.selectedPackage.price||"0"):0},j=()=>{var D,k;n(!0);const O={paymentIntentId:`cash_${Date.now()}`,clientData:e.clientData,bookingType:e.bookingType,amount:m?m.finalAmount:w(),couponCode:((D=m==null?void 0:m.couponApplied)==null?void 0:D.code)||i,testMode:!1,paymentMethod:"cash"};e.bookingType==="service"?(O.serviceId=e.serviceId,O.classDate=e.classDate):(O.classId=e.classData.id,O.classDate=`${e.classData.date.getFullYear()}-${String(e.classData.date.getMonth()+1).padStart(2,"0")}-${String(e.classData.date.getDate()).padStart(2,"0")}`,O.selectedDates=(k=e.selectedDates)==null?void 0:k.map(F=>`${F.getFullYear()}-${String(F.getMonth()+1).padStart(2,"0")}-${String(F.getDate()).padStart(2,"0")}`)),b.mutate(O),a(!1)},N=e.bookingType==="service"?(S=e.serviceData)==null?void 0:S.instructorId:(E=e.classData)==null?void 0:E.instructorId,C=Ue({queryKey:["/api/instructor/by-id",N],queryFn:()=>Pe("GET",`/api/instructor/by-id/${N}`).then(O=>O.json()),enabled:!!N});d1(C.data);const P=mt(((T=C.data)==null?void 0:T.currency)||"USD");return(z=C.data)!=null&&z.terminologySingular,s.jsxs("div",{className:"min-h-screen bg-slate-50",children:[s.jsx("header",{className:"bg-white shadow-sm border-b border-slate-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsx("div",{className:"flex items-center space-x-4",children:s.jsxs(B,{variant:"ghost",onClick:()=>{const O=sessionStorage.getItem("bookingOriginUrl");if(O)g(O);else{const D=sessionStorage.getItem("currentInstructorSubdomain");g(D?`/classes/${D}`:"/")}},className:"flex items-center space-x-2",children:[s.jsx(xr,{className:"h-4 w-4"}),s.jsx("span",{children:"Back to Calendar"})]})}),s.jsx("div",{className:"flex items-center space-x-3",children:s.jsx("h1",{className:"text-xl font-semibold text-slate-900",children:"Cash Payment Checkout"})}),s.jsx("div",{className:"w-24"})]})})}),s.jsx("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsx("div",{children:s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-6",children:"Booking Summary"}),s.jsx("div",{className:"space-y-4 mb-6",children:s.jsxs("div",{className:"flex items-start space-x-4 p-4 bg-slate-50 rounded-lg",children:[s.jsx("div",{className:"w-3 h-3 bg-primary rounded-full mt-2"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"font-semibold text-slate-900",children:zh(e)}),s.jsx("p",{className:"text-slate-600",children:sg(e)}
840)]}),s.jsx("div",{className:"text-right",children:s.jsxs("p",{className:"font-semibold text-slate-900",children:[P,w().toFixed(2)]})})]})}),s.jsx("div",{className:"border-t pt-4",children:s.jsxs("div",{className:"flex justify-between text-lg font-semibold",children:[s.jsx("span",{children:"Total (Cash Payment):"}),s.jsxs("span",{children:[P,m?m.finalAmount.toFixed(2):w().toFixed(2)]})]})})]})})}),s.jsx("div",{children:s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-6",children:"Payment Method"}),s.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 mb-6",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("span",{className:"text-2xl",children:"💵"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-medium text-amber-800",children:"Cash Payment"}),s.jsx("p",{className:"text-sm text-amber-700",children:"Pay on arrival with exact amount"})]})]})}),s.jsx(B,{onClick:()=>a(!0),className:"w-full bg-primary hover:bg-primary/90",disabled:t||b.isPending,children:t||b.isPending?s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Confirming Booking..."]}):`Confirm Cash Payment Booking - ${P}${m?m.finalAmount.toFixed(2):w().toFixed(2)}`})]})})})]})}),s.jsx(Ct,{open:r,onOpenChange:a,children:s.jsxs(St,{children:[s.jsx(kt,{children:s.jsx(Pt,{children:"Confirm Cash Payment Booking"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-slate-600",children:["You're about to confirm your booking with cash payment. Please bring the exact amount of"," ",s.jsxs("span",{className:"font-semibold",children:[P,m?m.finalAmount.toFixed(2):w().toFixed(2)]})," ","when you arrive for your ",e.bookingType==="service"?"session":"class","."]}),s.jsxs("div",{className:"flex space-x-3",children:[s.jsx(B,{variant:"outline",onClick:()=>a(!1),className:"flex-1",children:"Cancel"}),s.jsx(B,{onClick:j,className:"flex-1 bg-primary hover:bg-primary/90",children:"Confirm Booking"})]})]})]})})]})}const dWe=({pendingBooking:e})=>{var P,S;const{toast:t}=Yt(),[n,r]=f.useState(!1),[a,i]=f.useState(e.appliedCouponCode||e.couponCode||""),[o,l]=f.useState(!1),[c,d]=f.useState(!1),[m,u]=f.useState(!1),h=!!e.couponApplied&&(Number(e.discountAmount)>0||Number(e.finalAmount)===0),[p,v]=f.useState(h?{originalAmount:typeof e.originalAmount=="number"?e.originalAmount:typeof e.amount=="number"?e.amount:parseFloat(String(e.amount||0)),finalAmount:typeof e.finalAmount=="number"?e.finalAmount:typeof e.amount=="number"?e.amount:parseFloat(String(e.amount||0)),discountAmount:typeof e.discountAmount=="number"?e.discountAmount:0,couponApplied:e.couponApplied||null}:null),[,y]=cn(),g=jn();Cl(!m&&!!e);const x=e.bookingType==="service"?(P=e.serviceData)==null?void 0:P.instructorId:(S=e.classData)==null?void 0:S.instructorId,{data:b}=Ue({queryKey:[`/api/instructors/${x}`],enabled:!!x}),w=b?mt(b.currency||"GBP"):"£",j=xt({mutationFn:async()=>{var D;const z={clientId:(await(await Pe("POST","/api/clients",{email:e.clientData.email,phone:e.clientData.phone,emergencyContactName:e.clientData.emergencyContactName,emergencyContactPhone:e.clientData.emergencyContactPhone,onboardingData:e.clientData.onboardingData})).json()).id,bookingType:e.bookingType,amount:C()};if(e.bookingType==="service"?(z.serviceId=e.serviceId,z.classDate=e.classDate):(z.classId=e.classData.id,z.classDate=In(e.classData.date),z.selectedDates=(D=e.selectedDates)==null?void 0:D.map(k=>In(k))),console.log("Sending test booking data:",z),(await Pe("POST","/api/test-booking",z)).ok)return{success:!0};throw new Error("Booking failed")},onSuccess:()=>{var E;u(!0),g.invalidateQueries({queryKey:["/api/classes"]}),g.invalidateQueries({queryKey:["/api/bookings"]}),g.invalidateQueries({queryKey:["/api/stats"]}),(E=e==null?void 0:e.clientData)!=null&&E.email&&mC(g),t({title:"Test Booking Confirmed! 🧪",description:"Your test booking has been created successfully."}),sessionStorage.removeItem("pendingBooking"),setTimeout(()=>{y("/")},500)},onError:E=>{t({title:"Booking Failed",description:E.message||"Failed to create booking",variant:"destructive"})}});xt({mutationFn:async E=>(await Pe("POST","/api/confirm-booking",{...E,...Cu(e)})).json(),onSuccess:()=>{u(!0),g.invalidateQueries({queryKey:["/api/bookings"]}),g.invalidateQueries({queryKey:["/api/classes"]}
840),g.invalidateQueries({queryKey:["/api/stats"]}),d(!1),t({title:"Cash Payment Booking Confirmed!",description:"Your booking has been confirmed. Please bring cash to your session."}),sessionStorage.removeItem("pendingBooking"),setTimeout(()=>{y("/")},500)},onError:E=>{console.error("Cash booking error:",E),t({title:"Booking Failed",description:"There was an error confirming your booking. Please try again.",variant:"destructive"})}});const N=async E=>{E.preventDefault(),r(!0);try{await j.mutateAsync()}catch(T){console.error("Test booking error:",T)}finally{r(!1)}},C=()=>{var E;if((p==null?void 0:p.finalAmount)!==void 0)return p.finalAmount;if(e.bookingType==="event")return parseFloat(e.amount||"0");if(e.bookingType==="service"){const T=e.memberPrice||e.amount||"0";return parseFloat(T)}if(e.bookingType==="single"){const T=parseFloat(String(e.amount??""));if(!Number.isNaN(T)&&T>=0)return T;const z=e.memberPrice||((E=e.classData)==null?void 0:E.singlePrice)||"0";return parseFloat(z)}else return e.selectedPackage?parseFloat(e.selectedPackage.price||"0"):0};return s.jsx("div",{className:"min-h-screen bg-slate-50 py-8",children:s.jsx("div",{className:"max-w-2xl mx-auto px-4",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-lg",children:[s.jsxs("div",{className:"bg-gradient-to-r from-primary to-secondary text-white rounded-t-lg p-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs(B,{variant:"ghost",size:"sm",onClick:()=>{sessionStorage.removeItem("pendingBooking");const E=sessionStorage.getItem("bookingOriginUrl");if(E)y(E);else{const T=sessionStorage.getItem("currentInstructorSubdomain");y(T?`/classes/${T}`:"/")}},className:"text-white hover:bg-white/20",children:[s.jsx(xr,{className:"w-4 h-4 mr-2"}),"Back to Calendar"]})}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("h1",{className:"text-xl font-semibold",children:"🧪 Test Checkout"}),s.jsx(Je,{variant:"outline",className:"bg-yellow-50 text-yellow-800 border-yellow-300",children:"Test Mode"})]})]}),s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsxs("div",{className:"p-6 border-2 border-dashed border-yellow-300 bg-yellow-50 rounded-lg text-center",children:[s.jsx("div",{className:"text-4xl mb-3",children:"🧪"}),s.jsx("h3",{className:"font-semibold text-yellow-800 mb-2",children:"Test Mode Active"}),s.jsx("p",{className:"text-sm text-yellow-700",children:"This is a test booking - no real payment will be processed."})]}),s.jsxs("div",{className:"bg-slate-50 rounded-lg p-4 space-y-3",children:[s.jsx("h3",{className:"font-semibold text-slate-900",children:"Booking Summary"}),s.jsxs("div",{className:"space-y-2 text-sm",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:e.bookingType==="service"?"Service:":"Class:"}),s.jsx("span",{className:"font-medium",children:zh(e)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Date & Time:"}),s.jsx("span",{className:"font-medium",children:sg(e)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Booking Type:"}),s.jsx("span",{className:"font-medium capitalize",children:e.bookingType.replace("-"," ")})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Client Email:"}),s.jsx("span",{className:"font-medium",children:e.clientData.email})]}),s.jsxs("div",{className:"flex justify-between pt-2 border-t border-slate-200",children:[s.jsx("span",{className:"text-slate-600",children:"Total:"}),s.jsxs("span",{className:"font-bold text-lg",children:[w,C().toFixed(2)]})]})]})]}),s.jsx("form",{onSubmit:N,children:s.jsx(B,{type:"submit",disabled:n||j.isPending,className:"w-full bg-secondary hover:bg-secondary/90 text-white py-3 text-lg font-semibold",children:n||j.isPending?s.jsxs("div",{className:"flex items-center justify-center",children:[s.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-white border-t-transparent roun
840ded-full mr-2"}),"Creating Test Booking..."]}):`Complete Test Booking - ${w}${C().toFixed(2)}`})})]})]})})})},CX=({pendingBooking:e,savedDiscountInfo:t,stripe:n=null,elements:r=null})=>{var M,se,Q,te,G,Z,ie,A,ge,je,ke,Ie,$e,qe,ft,be;const{toast:a}=Yt(),[,i]=cn(),o=jn(),[l,c]=f.useState(!1),[d,m]=f.useState(!1),[u,h]=f.useState(e.appliedCouponCode||e.couponCode||""),[p,v]=f.useState(!1),[y,g]=f.useState(()=>{const Fe=e==null?void 0:e.selectedPaymentMethod;return Fe&&["stripe","paypal","cash"].includes(Fe)?Fe:"stripe"}),[x,b]=f.useState(!1),w=!!e.couponApplied&&(Number(e.discountAmount)>0||Number(e.finalAmount)===0),[j,N]=f.useState(t||(w?{originalAmount:typeof e.originalAmount=="number"?e.originalAmount:typeof e.amount=="number"?e.amount:parseFloat(String(e.amount||0)),finalAmount:typeof e.finalAmount=="number"?e.finalAmount:typeof e.amount=="number"?e.amount:parseFloat(String(e.amount||0)),discountAmount:typeof e.discountAmount=="number"?e.discountAmount:0,couponApplied:e.couponApplied||null}:null)),C=e.bookingType==="event"?e.eventData:null,P=((M=C==null?void 0:C.bookingInfoFieldLabel)==null?void 0:M.trim())||"Additional information",[S,E]=f.useState(()=>String(e.eventBookingInfo??"")),T=e.bookingType==="event"?(se=e.eventData)==null?void 0:se.accountId:e.bookingType==="service"?(Q=e.serviceData)==null?void 0:Q.instructorId:(te=e.classData)==null?void 0:te.instructorId,{data:z}=Ue({queryKey:[`/api/instructor/by-id/${T}`],enabled:!!T});d1(z);const O=!!((G=e.classData)!=null&&G.allowCashPayments||(Z=e.serviceData)!=null&&Z.allowCashPayments),D=(z==null?void 0:z.paypalEnabled)&&(z==null?void 0:z.paypalClientId),k=!!e.stripePublicKey,F=f.useRef(!1),W=f.useRef(!1);f.useEffect(()=>{z&&e&&!F.current&&(F.current=!0,y==="stripe"&&!k?D?g("paypal"):O&&g("cash"):y==="paypal"&&!D&&(k?g("stripe"):O&&g("cash")))},[z,e,y,k,D,O]),f.useEffect(()=>{!k&&!D&&O&&g("cash")},[k,D,O]),f.useEffect(()=>{if(!n)return;const Fe=new URLSearchParams(window.location.search),_e=Fe.get("payment_intent_client_secret"),ze=Fe.get("payment_intent"),ue=Fe.get("redirect_status");_e&&ze&&(console.log("🔍 Stripe redirect return detected:",{paymentIntentId:ze,redirectStatus:ue}),n.retrievePaymentIntent(_e).then(({paymentIntent:Me,error:pt})=>{var de,fe;if(pt){console.error("Error retrieving payment intent after redirect:",pt),a({title:"Payment Error",description:pt.message||"There was an issue processing your payment.",variant:"destructive"}),window.history.replaceState({},document.title,window.location.pathname);return}if(Me&&Me.status==="succeeded"){if(console.log("✅ Payment succeeded after redirect, completing booking..."),e.bookingType==="event")Pe("POST","/api/confirm-event-order",{paymentIntentId:Me.id,clientData:e.clientData}).then(le=>le.json()).then(le=>{var Ke;if(le.success){m(!0),sessionStorage.removeItem("pendingBooking"),a({title:"Tickets confirmed!",description:"Your tickets have been confirmed. Check your email for details."});const We=(Ke=e.eventData)==null?void 0:Ke.accountId;We&&o.invalidateQueries({queryKey:["/api/events/public",We]}),setTimeout(()=>{const vt=sessionStorage.getItem("bookingOriginUrl");if(vt)i(vt),sessionStorage.removeItem("bookingOriginUrl");else{const Zt=sessionStorage.getItem("currentInstructorSubdomain");i(Zt?`/classes/${Zt}`:"/")}},1500)}else a({title:"Error",description:le.message||"Failed to confirm order",variant:"destructive"})}).catch(le=>{a({title:"Error",description:(le==null?void 0:le.message)||"Failed to confirm order",variant:"destructive"})});else{const le={paymentIntentId:Me.id,clientData:e.clientData,bookingType:e.bookingType,amount:j?j.finalAmount:I(),couponCode:((de=j==null?void 0:j.couponApplied)==null?void 0:de.code)||u};e.bookingType==="service"?(le.serviceId=e.serviceId,le.classDate=e.classDate):(le.classId=e.classData.id,le.classDate=`${e.classData.date.getFullYear()}-${String(e.classData.date.getMonth()+1).padStart(2,"0")}-${String(e.classData.date.getDate()).padStart(2,"0")}`,le.selectedDates=(fe=e.selectedDates)==null?void 0:fe.map(Ke=>`${Ke.getFullYear()}-${String(Ke.getMonth()+1).padStart(2,"0")}-${String(Ke.getDate()).padStart(2,"0")}`)),L.mutate(le)}window.history.replaceState({},document.title,window.location.pathname)}else Me&&Me.status==="requires_payment_method"&&(a({title:"Payment Cancelled",description:"Your payment was not completed. Please try again.",variant:"destructive"}),window.history.replaceState({},document.title,window.location.pathname))}))},[n,e,j,u]),f.useEffect(()=>
840{const Fe=new URLSearchParams(window.location.search),_e=Fe.get("paypal-success"),ze=Fe.get("orderId"),ue=Fe.get("payerId"),Me=Fe.get("webhook-test");if(console.log("🔍 Checking for PayPal success:",{paypalSuccess:_e,orderId:ze,payerId:ue,webhookTest:Me}),console.log("🔍 Current URL:",window.location.href),console.log("🔍 Current search params:",window.location.search),_e==="true"&&ze){if(Me==="true"){console.log("🧪 WEBHOOK TEST MODE: Skipping redirect completion - webhook will handle it"),console.log("🧪 Order ID:",ze),console.log("🧪 Wait for webhook to complete the booking..."),a({title:"Webhook Test Mode",description:`Order ${ze} approved. Waiting for webhook to complete booking. Check server logs.`,duration:1e4}),setTimeout(()=>{window.history.replaceState({},document.title,window.location.pathname)},1e3);return}console.log("🎉 PayPal success detected! Completing booking..."),console.log("🎯 PayPal completion data:",{orderId:ze,payerId:ue}),q(ze),setTimeout(()=>{window.history.replaceState({},document.title,window.location.pathname)},1e3)}else console.log("❌ PayPal success parameters not found or incomplete")},[]);const q=async(Fe,_e)=>{var ze,ue,Me;try{c(!0);const pt=((ze=e==null?void 0:e.classData)==null?void 0:ze.instructorId)||(z==null?void 0:z.id);if(console.log("🔍 PayPal completion - instructor ID:",pt),console.log("🔍 PayPal completion - instructor object:",z),console.log("🔍 PayPal completion - pending booking:",e),!(await Pe("POST",`/api/paypal/order/${Fe}/capture`,{instructorId:pt})).ok)throw new Error("Failed to capture PayPal payment");const fe={paymentIntentId:`paypal_${Fe}`,clientData:e.clientData,bookingType:e.bookingType,amount:(j==null?void 0:j.finalAmount)||I(),couponCode:((ue=j==null?void 0:j.couponApplied)==null?void 0:ue.code)||u};e.bookingType==="service"?(fe.serviceId=e.serviceId,fe.classDate=e.classDate):(fe.classId=e.classData.id,fe.classDate=In(e.classData.date),fe.selectedDates=(Me=e.selectedDates)==null?void 0:Me.map(le=>In(le))),console.log("Completing PayPal booking with data:",fe),L.mutate(fe)}catch(pt){console.error("PayPal booking completion error:",pt),a({title:"Payment Processing Error",description:pt.message||"Failed to complete PayPal booking",variant:"destructive"}),c(!1)}},H=[k,D,O].filter(Boolean).length;console.log("Payment Methods Debug:",{hasInstructor:!!z,paypalEnabled:z==null?void 0:z.paypalEnabled,hasClientId:!!(z!=null&&z.paypalClientId),isPayPalEnabled:D,isStripeAvailable:k,hasStripePublicKey:!!e.stripePublicKey,selectedPaymentMethod:y,availableMethodsCount:H,shouldShowPaymentButtons:H>=2});const _=z?mt(z.currency||"GBP"):"£",L=xt({mutationFn:async Fe=>{const _e=Cu(e),ze={...Fe,bookingAccessCode:Fe.bookingAccessCode??_e.bookingAccessCode,privateLinkToken:Fe.privateLinkToken??_e.privateLinkToken};return console.log("CONFIRM BOOKING - Sending data:",{...ze,bookingAccessCode:ze.bookingAccessCode?"[redacted]":null}),(await Pe("POST","/api/confirm-booking",ze)).json()},onSuccess:()=>{var Fe;m(!0),(Fe=e==null?void 0:e.clientData)!=null&&Fe.email&&mC(o),a({title:"Booking Confirmed!",description:"Your class has been successfully booked. You'll receive a confirmation email shortly."}),Zs("booking_completed","engagement",(e==null?void 0:e.bookingType)||"single",e==null?void 0:e.finalAmount),sessionStorage.removeItem("pendingBooking"),setTimeout(()=>{typeof window<"u"&&window.self!==window.top&&window.parent.postMessage({type:"CLASSTA_MODAL_CLOSE"},"*"),setTimeout(()=>{var Me;const ze=(Me=e==null?void 0:e.classData)==null?void 0:Me.bookingConfirmationRedirectUrl;if(ze&&ze.trim()){zF(ze);return}const ue=sessionStorage.getItem("bookingOriginUrl");if(ue)i(ue),sessionStorage.removeItem("bookingOriginUrl");else{const pt=sessionStorage.getItem("currentInstructorSubdomain");i(pt?`/classes/${pt}`:"/")}},300)},2e3)},onError:(Fe,_e)=>{if(qF(Fe)&&window.confirm(`${(Fe==null?void 0:Fe.message)||"You've already booked this session."}
841
842Click OK to continue with another booking, or Cancel to go back.`)){L.mutate({..._e,allowDuplicateBooking:!0});return}a({title:"Booking Error",description:Fe==null?void 0:Fe.message,variant:"destructive"}),W.current=!1,c(!1)}}),U=async()=>{var ze,ue;const Fe=j?j.finalAmount:I(),_e={paymentIntentId:`free_${Date.now()}`,clientData:e.clientData,bookingType:e.bookingType,amount:Fe,testMode:e.testMode,couponCode:((ze=j==null?void 0:j.couponApplied)==null?void 0:ze.code)||u||void 0};e.bookingType==="service"?(_e.serviceId=e.serviceId,_e.classDate=e.classDate):(_e.classId=e.classData.id,_e.classDate=
842In(e.classData.date),_e.selectedDates=(ue=e.selectedDates)==null?void 0:ue.map(Me=>In(Me)));try{c(!0),await L.mutateAsync(_e)}catch(Me){console.error("Free booking error:",Me),a({title:"Booking Failed",description:"There was an error confirming your free booking. Please try again.",variant:"destructive"}),c(!1)}},J=async()=>{var ze,ue;const Fe=j?j.finalAmount:I(),_e={paymentIntentId:`cash_${Date.now()}`,clientData:e.clientData,bookingType:e.bookingType,amount:Fe,testMode:e.testMode,couponCode:u||void 0};e.bookingType==="service"?(_e.serviceId=e.serviceId,_e.classDate=e.classDate):(_e.classId=e.classData.id,_e.classDate=In(e.classData.date),_e.selectedDates=(ze=e.selectedDates)==null?void 0:ze.map(Me=>In(Me)));try{b(!1),await L.mutateAsync(_e)}catch(Me){console.error("Cash booking error:",Me);let pt="There was an error confirming your cash payment booking. Please try again.";Me!=null&&Me.message?pt=Me.message:(Me==null?void 0:Me.name)==="TypeError"&&((ue=Me==null?void 0:Me.message)!=null&&ue.includes("fetch"))?pt="Network error: Please check your internet connection and try again.":Me!=null&&Me.status&&(pt=`Request failed (${Me.status}). Please try again.`),a({title:"Booking Failed",description:pt,variant:"destructive"})}},I=()=>{var Fe;if((j==null?void 0:j.finalAmount)!==void 0)return j.finalAmount;if(e.bookingType==="event")return parseFloat(e.amount||"0");if(e.bookingType==="service"){const _e=e.memberPrice||e.amount||"0";return parseFloat(_e)}if(e.bookingType==="single"){const _e=parseFloat(String(e.amount??""));if(!Number.isNaN(_e)&&_e>=0)return _e;const ze=e.memberPrice||((Fe=e.classData)==null?void 0:Fe.singlePrice)||"0";return parseFloat(ze)}else return e.selectedPackage?e.memberPrice!==null&&e.memberPrice!==void 0&&(e.memberPrice===""||e.memberPrice==="0"||parseFloat(e.memberPrice)===0)?0:parseFloat(e.selectedPackage.price||"0"):0},re=()=>e.bookingType==="event"?e.ticketTypeName?`${e.ticketTypeName} × ${e.quantity??1}`:"Tickets":e.bookingType==="single"?"Single "+((z==null?void 0:z.terminologySingular)||"Class"):e.selectedPackage?e.selectedPackage.name:"Package",R=async()=>{var Fe,_e,ze,ue,Me,pt,de,fe,le,Ke,We,vt,Zt,Ht,Tt,Ot,Ft,is;if(u.trim()){v(!0);try{let Cs,Ne;if(e.bookingType==="service"){const Qt=((_e=(Fe=e.serviceData)==null?void 0:Fe.instructor)==null?void 0:_e.timezone)||"Europe/London";Cs={bookingType:e.bookingType,serviceId:(ze=e.serviceData)==null?void 0:ze.id,serviceDateTime:e.classDate,clientData:e.clientData,amount:I(),currency:e.currency||((Me=(ue=e.serviceData)==null?void 0:ue.instructor)==null?void 0:Me.currency)||"GBP",couponCode:u.trim().toUpperCase(),testMode:e.testMode,memberPrice:e.memberPrice,metadata:{memberPrice:e.memberPrice,appliedCouponCode:u.trim().toUpperCase(),instructorId:(pt=e.serviceData)==null?void 0:pt.instructorId}},Ne={amount:I(),serviceId:(de=e.serviceData)==null?void 0:de.id,clientEmail:e.clientData.email,bookingType:e.bookingType,serviceDateTime:e.classDate,testMode:e.testMode,pendingBooking:Cs}}else if(e.bookingType==="event")Ne={eventId:e.eventId,ticketTypeId:e.ticketTypeId,quantity:e.quantity,buyerName:((fe=e.clientData)==null?void 0:fe.name)||"",buyerEmail:((le=e.clientData)==null?void 0:le.email)||"",attendees:e.attendees||void 0,couponCode:u.trim().toUpperCase(),bookingInfoResponse:Ax(e,S),clientData:e.clientData};else{const Qt=(Ke=e.selectedDates)==null?void 0:Ke.map(Js=>In(Js)),ts=Cu(e);Cs={bookingType:e.bookingType,classId:e.classData.id,classDate:In(e.classData.date),selectedDates:Qt,selectedPackageId:(We=e.selectedPackage)==null?void 0:We.id,selectedPackage:e.selectedPackage?{id:e.selectedPackage.id,name:e.selectedPackage.name,numberOfWeeks:e.selectedPackage.numberOfWeeks}:void 0,clientData:e.clientData,amount:I(),currency:e.currency||((vt=e.classData.instructor)==null?void 0:vt.currency)||"GBP",couponCode:u.trim().toUpperCase(),testMode:e.testMode,...ts,metadata:{memberPrice:e.memberPrice,appliedCouponCode:u.trim().toUpperCase()}},Ne={amount:I(),classId:e.classData.id,clientEmail:e.clientData.email,bookingType:e.bookingType,classDate:Cs.classDate,testMode:e.testMode,couponCode:u.trim().toUpperCase(),...ts,pendingBooking:Cs}}const rt=e.bookingType==="service"?"/api/create-payment-intent-service":e.bookingType==="event"?"/api/create-payment-intent-event":"/api/create-payment-intent",Mt=await(await Pe("POST",rt,Ne)).json();if(Mt.isFreeBooking){const Qt=e.classData?{...e.classData,date:e.classData.date instanceof Date?e.classData.date.toISOString():e.classData.date}:e.classData,ts=(Zt=e.selectedDates)==null?void 0:Zt.map(Vt=>Vt instanceof Date?Vt.toISOString():Vt),Js=e.serviceData?{...e.serviceData}:e.serviceData,xn={...e,classData:Qt,serviceData:Js,selectedDates:ts,isFreeBooking:!0,finalAmount:Mt.finalAmount,originalAmount:Mt.originalAmount,discountAmount:Mt.discountAmount,couponApplied:Mt.couponApplied,appliedCouponCode:u.trim().toUpperCase(),amount:"0.00",...e.bookingType==="event"&&(C!=null&&C.bookingInfoFieldEnabled)?{eventBookingInfo:Ax(e,S)??""}:{}};let Xs=!1;try{const Vt=JSON.stringify(xn);sessionStorage.setItem("pendingBooking",Vt);const Te=sessionStorage.getItem("pendingBooking");if(!Te)console.warn("⚠️ sessionStorage write verification failed - using URL fallback"),Xs=!0;else try{const at=JSON.parse(Te);at.isFreeBooking?console.log("✅ Verified sessionStorage write - isFreeBooking:",at.isFreeBooking):(console.error("❌ isFreeBooking flag missing after write - using URL fallback"),Xs=!0)}catch(at){console.error("❌ Failed to parse sessionStorage data after write:",at),Xs=!0}}catch(Vt){console.error("❌ sessionStorage write failed:",(Vt==null?void 0:Vt.name)||(Vt==null?void 0:Vt.message),Vt),Xs=!0,((Vt==null?void 0:Vt.name)==="QuotaExceededError"||(Vt==null?void 0:Vt.code)===22)&&console.error("❌ sessionStorage quota exceeded - using URL fallback")}const nn=((Ht=Mt.couponApplied)==null?void 0:Ht.type)==="bundle";if(a({title:nn?"Bundle Credit Applied! 🎉":"Free Coupon Applied! 🎉",description:nn?`Using 1 session from your bundle (${((Tt=Mt.couponApplied)==null?void 0:Tt.remainingSessions)||"N/A"} remaining) - Booking is FREE!`:"This booking is now completely free!"}),Xs){console.log("🎉 Free booking detected - redirecting with URL params (sessionStorage unavailable)");const Vt=new URLSearchParams({free:"true",coupon:u.trim().toUpperCase(),bookingType:e.bookingType});e.bookingType==="event"&&e.eventId!=null?Vt.set("eventId",String(e.eventId)):((Ot=e.classData)==null?void 0:Ot.id)!=null&&Vt.set("classId",String(e.classData.id)),window.location.href=`/checkout?${Vt.toString()}`;return}console.log("🎉 Free booking detected - reloading for free checkout flow"),window.location.reload();return}if(Mt.couponApplied&&Mt.discountAmount>0){N({originalAmount:Mt.originalAmount,finalAmount:Mt.finalAmount,discountAmount:Mt.discountAmount,couponApplied:Mt.couponApplied});const Qt={...e,finalAmount:Mt.finalAmount,originalAmount:Mt.originalAmount,discountAmount:Mt.discountAmount,couponApplied:Mt.couponApplied,appliedCouponCode:u.trim().toUpperCase(),...e.bookingType==="event"&&(C!=null&&C.bookingInfoFieldEnabled)?{eventBookingInfo:Ax(e,S)??""}:{}};sessionStorage.setItem("pendingBooking",JSON.stringify(Qt));const ts=((Ft=Mt.couponApplied)==null?void 0:Ft.type)==="bundle";a({title:ts?"Bundle Credit Applied! 🎉":"Coupon Applied! 🎉",description:ts?`Using 1 session from your bundle (${((is=Mt.couponApplied)==null?void 0:is.remainingSessions)||"N/A"} remaining)`:`You saved ${_}${Mt.discountAmount.toFixed(2)}!`})}else a({title:"Coupon Applied",description:"No discount available for this coupon."})}catch(Cs){a({title:"Invalid Coupon",description:Cs.message||"Please check your coupon code and try again.",variant:"destructive"})}finally{v(!1)}}},Y=async Fe=>{var ze,ue,Me,pt,de,fe,le,Ke,We,vt,Zt,Ht,Tt,Ot;if(Fe.preventDefault(),W.current||l||L.isPending)return;
842W.current=!0,c(!0);const _e=typeof((ze=globalThis.crypto)==null?void 0:ze.randomUUID)=="function"?globalThis.crypto.randomUUID():`attempt_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;if(e.testMode){console.log("=== CHECKOUT: SUBMITTING BOOKING WITH HEALTH DATA ==="),console.log("Full clientData being sent:",JSON.stringify(e.clientData,null,2)),console.log("Onboarding data keys:",Object.keys(e.clientData.onboardingData||{})),console.log("Number of health responses:",Object.keys(e.clientData.onboardingData||{}).length),console.log("SELECTED DATES BEING SENT:",e.selectedDates);const Ft={paymentIntentId:"test_payment_intent_"+Date.now(),clientData:e.clientData,bookingType:e.bookingType,amount:j?j.finalAmount:I(),couponCode:((ue=j==null?void 0:j.couponApplied)==null?void 0:ue.code)||u,testMode:!0};e.bookingType==="service"?(Ft.serviceId=e.serviceId,Ft.classDate=e.classDate):(Ft.classId=e.classData.id,Ft.classDate=`${e.classData.date.getFullYear()}-${String(e.classData.date.getMonth()+1).padStart(2,"0")}-${String(e.classData.date.getDate()).padStart(2,"0")}`,Ft.selectedDates=(Me=e.selectedDates)==null?void 0:Me.map(is=>`${is.getFullYear()}-${String(is.getMonth()+1).padStart(2,"0")}-${String(is.getDate()).padStart(2,"0")}`)),L.mutate(Ft),W.current=!1;return}if(y==="paypal"){a({title:"Payment Method Error",description:"Please use the PayPal button to complete your payment.",variant:"destructive"}),c(!1),W.current=!1;return}if(y==="cash"){b(!0),c(!1),W.current=!1;return}if(!n||!r){a({title:"Payment System Loading",description:"Please wait for the payment form to fully load before submitting.",variant:"destructive"}),c(!1),W.current=!1;return}try{const{error:Ft}=await r.submit();if(Ft){a({title:"Payment Form Error",description:Ft.message,variant:"destructive"}),c(!1),W.current=!1;return}const is=j?j.finalAmount:I();let Cs;if(e.bookingType==="event")Cs=await Pe("POST","/api/create-payment-intent-event",{checkoutAttemptId:_e,eventId:e.eventId,ticketTypeId:e.ticketTypeId,quantity:e.quantity,buyerName:((pt=e.clientData)==null?void 0:pt.name)||"",buyerEmail:((de=e.clientData)==null?void 0:de.email)||"",attendees:e.attendees||void 0,couponCode:((fe=j==null?void 0:j.couponApplied)==null?void 0:fe.code)||u||void 0,bookingInfoResponse:Ax(e,S),clientData:e.clientData});else if(e.bookingType==="service")Cs=await Pe("POST","/api/create-payment-intent-service",{checkoutAttemptId:_e,amount:is,serviceId:e.serviceId,clientEmail:e.clientData.email,bookingType:e.bookingType,serviceDateTime:e.classDate,testMode:e.testMode||!1,pendingBooking:{bookingType:e.bookingType,serviceId:e.serviceId,classDate:e.classDate,clientData:e.clientData,amount:is,currency:(z==null?void 0:z.currency)||"GBP",couponCode:((le=j==null?void 0:j.couponApplied)==null?void 0:le.code)||u||null}});else{const Mt=In((Ke=e.classData)==null?void 0:Ke.date),Qt=(We=e.selectedDates)==null?void 0:We.map(ts=>In(ts));Cs=await Pe("POST","/api/create-payment-intent",{checkoutAttemptId:_e,amount:is,classId:e.classData.id,clientEmail:e.clientData.email,bookingType:e.bookingType,classDate:Mt,testMode:e.testMode||!1,couponCode:((vt=j==null?void 0:j.couponApplied)==null?void 0:vt.code)||u||null,...Cu(e),pendingBooking:{bookingType:e.bookingType,classId:e.classData.id,classDate:Mt,selectedDates:Qt,selectedPackageId:(Zt=e.selectedPackage)==null?void 0:Zt.id,selectedPackage:e.selectedPackage,clientData:e.clientData,amount:is,currency:(z==null?void 0:z.currency)||"GBP",couponCode:((Ht=j==null?void 0:j.couponApplied)==null?void 0:Ht.code)||u||null,testMode:e.testMode||!1,...Cu(e),metadata:{memberPrice:e.memberPrice,instructorId:z==null?void 0:z.id}}})}const{clientSecret:Ne}=await Cs.json();if(!Ne){a({title:"Payment Error",description:"Failed to create payment intent. Please try again.",variant:"destructive"}),c(!1),W.current=!1;return}const{error:rt,paymentIntent:ht}=await n.confirmPayment({elements:r,clientSecret:Ne,redirect:"if_required",confirmParams:{return_url:`${window.location.origin}/checkout`}});if(rt){const Mt=rt.message||"",Qt=Mt.includes("mounted Payment Element")||Mt.includes("mounted Express Checkout Element")||Mt.includes("Invalid value for stripe.confirmPayment()");a(Qt?{title:"Payment Processing Unavailable",description:"There's an issue with the instructor's Stripe account configuration. Please contact the instructor or try again later.",variant:"destructive"}:{title:"Payment Failed",description:rt.message,variant:"destructive"}),c(!1),W.current=!1;return}if(ht&&ht.status==="succeeded"){if(e.bookingType==="event"){const ts=await(await Pe("POST","/api/confirm-event-order",{paymentIntentId:ht.id,clientData:e.clientData})).json();if(ts.success){m(!0),sessionStorage.removeItem("pendingBooking"),a({title:"Tickets confirmed!",description:"Your tickets have been confirmed. Check your email for details."});const Js=T?["/api/events/public",T]:["/api/events/public"];
842o.invalidateQueries({queryKey:Js}),setTimeout(()=>{const xn=sessionStorage.getItem("bookingOriginUrl");if(xn)i(xn),sessionStorage.removeItem("bookingOriginUrl");else{const Xs=sessionStorage.getItem("currentInstructorSubdomain");i(Xs?`/classes/${Xs}`:"/")}},1500)}else a({title:"Error",description:ts.message||"Failed to confirm order",variant:"destructive"});c(!1),W.current=!1;return}const Mt={paymentIntentId:ht.id,clientData:e.clientData,bookingType:e.bookingType,amount:j?j.finalAmount:I(),couponCode:((Tt=j==null?void 0:j.couponApplied)==null?void 0:Tt.code)||u};e.bookingType==="service"?(Mt.serviceId=e.serviceId,Mt.classDate=e.classDate):(Mt.classId=e.classData.id,Mt.classDate=`${e.classData.date.getFullYear()}-${String(e.classData.date.getMonth()+1).padStart(2,"0")}-${String(e.classData.date.getDate()).padStart(2,"0")}`,Mt.selectedDates=(Ot=e.selectedDates)==null?void 0:Ot.map(Qt=>`${Qt.getFullYear()}-${String(Qt.getMonth()+1).padStart(2,"0")}-${String(Qt.getDate()).padStart(2,"0")}`)),L.mutate(Mt)}else a({title:"Payment Processing",description:"Payment is being processed. Please wait..."}),c(!1),W.current=!1}catch(Ft){console.error("Error confirming payment:",Ft);const is=(Ft==null?void 0:Ft.message)||"",Cs=is.includes("mounted Payment Element")||is.includes("mounted Express Checkout Element")||is.includes("Invalid value for stripe.confirmPayment()");a(Cs?{title:"Payment Processing Unavailable",description:"There's an issue with the instructor's Stripe account configuration. Please contact the instructor or try again later.",variant:"destructive"}:{title:"Payment Error",description:is||"An error occurred while processing your payment. Please try again.",variant:"destructive"}),c(!1),W.current=!1}};if(d){const Fe=e.bookingType==="event";return s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center p-4",children:s.jsx(Ce,{className:"max-w-2xl w-full",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx(qt,{className:"h-16 w-16 text-secondary mx-auto mb-6"}),s.jsx("h1",{className:"text-3xl font-bold text-slate-900 mb-4",children:Fe?"Tickets confirmed!":"Booking Confirmed!"}),s.jsxs("p",{className:"text-lg text-slate-600 mb-6",children:[Fe?"Your tickets have been confirmed. You'll receive a confirmation email at ":"Your class has been successfully booked. You'll receive a confirmation email at ",s.jsx("span",{className:"font-medium",children:e.clientData.email})," ","shortly."]}),s.jsx(Ce,{className:"bg-slate-50 mb-6",children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h3",{className:"font-semibold text-slate-900 mb-4",children:Fe?"Order Details":"Booking Details"}),s.jsxs("div",{className:"space-y-2 text-left",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:Fe?"Event:":e.bookingType==="service"?"Service:":"Class:"}),s.jsx("span",{className:"font-medium",children:zh(e)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Date & Time:"}),s.jsx("span",{className:"font-medium",children:sg(e)})]}),!Fe&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Package:"}),s.jsx("span",{className:"font-medium",children:re()})]}),Fe&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Tickets:"}),s.jsx("span",{className:"font-medium",children:re()})]}),j&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Original Price:"}),s.jsxs("span",{className:"line-through text-slate-500",children:[_,j.originalAmount.toFixed(2)]})]}),j&&s.jsxs("div",{className:"flex justify-between",children:[s.jsxs("span",{className:"text-slate-600",children:["Discount (",(ie=j.couponApplied)==null?void 0:ie.name,"):"]}),s.jsxs("span",{className:"text-green-600",children:["-",_,j.discountAmount.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between pt-2 border-t",children:[s.jsx("span",{className:"font-semibold",children:"Total Paid:"}),s.jsxs("span",{className:"font-semibold",children:[_,j?j.finalAmount.toFixed(2):I().toFixed(2)]})]})]})]})}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(B,{onClick:()=>{const _e=sessionStorage.getItem("bookingOriginUrl");if(_e)i(_e),sessionStorage.removeItem("bookingOriginUrl");else{const ze=sessionStorage.getItem("currentInstructorSubdomain");
842i(ze?`/classes/${ze}`:"/")}},className:"w-full bg-primary hover:bg-primary/90",children:Fe?"Back to events":"Book Another Class"}),s.jsx(B,{variant:"outline",onClick:()=>{const _e=sessionStorage.getItem("bookingOriginUrl");if(_e)i(_e),sessionStorage.removeItem("bookingOriginUrl");else{const ze=sessionStorage.getItem("currentInstructorSubdomain");i(ze?`/classes/${ze}`:"/")}},className:"w-full",children:"Return to Home"})]})]})})})}return s.jsxs("div",{className:"min-h-screen bg-slate-50",children:[s.jsx("header",{className:"bg-white shadow-sm border-b border-slate-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsx("div",{className:"flex items-center space-x-4",children:s.jsxs(B,{variant:"ghost",onClick:()=>{const Fe=sessionStorage.getItem("bookingOriginUrl");if(Fe)i(Fe);else{const _e=sessionStorage.getItem("currentInstructorSubdomain");i(_e?`/classes/${_e}`:"/")}},className:"flex items-center space-x-2",children:[s.jsx(xr,{className:"h-4 w-4"}),s.jsx("span",{children:"Back to Calendar"})]})}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("h1",{className:"text-xl font-semibold text-slate-900",children:e.testMode?"🧪 Test Checkout":"Secure Checkout"}),e.testMode&&s.jsx(Je,{variant:"outline",className:"bg-yellow-50 text-yellow-800 border-yellow-300",children:"Test Mode"})]}),s.jsx("div",{className:"w-24"})," "]})})}),s.jsx("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs("div",{children:[s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-6",children:"Booking Summary"}),s.jsx("div",{className:"space-y-4 mb-6",children:s.jsxs("div",{className:"flex items-start space-x-4 p-4 bg-slate-50 rounded-lg",children:[s.jsx("div",{className:"w-3 h-3 bg-primary rounded-full mt-2"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"font-semibold text-slate-900",children:zh(e)}),s.jsx("p",{className:"text-slate-600",children:sg(e)}),e.bookingType!=="service"&&s.jsx(Je,{className:"mt-2 bg-secondary",children:re()})]})]})}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-slate-200",children:[e.bookingType!=="service"&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Package Type"}),s.jsx("span",{className:"font-medium",children:re()})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Client Email"}),s.jsx("span",{className:"font-medium",children:e.clientData.email})]}),j&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Original Price"}),s.jsxs("span",{className:"line-through text-slate-500",children:[_,j.originalAmount.toFixed(2)]})]}),j&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-green-600",children:"Discount"}),s.jsxs("span",{className:"text-green-600",children:["-",_,j.discountAmount.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between text-lg font-semibold pt-3 border-t border-slate-200",children:[s.jsx("span",{children:"Total"}),s.jsxs("span",{children:[_,j?j.finalAmount.toFixed(2):I().toFixed(2)]})]})]})]})}),s.jsx(Ce,{className:"mt-6",children:s.jsxs(Ee,{className:"p-6",children:[s.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[s.jsx(ti,{className:"h-5 w-5 text-slate-600"}),s.jsx("h3",{className:"font-semibold text-slate-900",children:"Secure Payment"})]}),s.jsx("p",{className:"text-sm text-slate-600 mb-3",children:k&&!D?"Your payment is processed securely by Stripe. We never store your card details.":D&&!k?"Your payment is processed securely by PayPal. We never store your payment details.":"Your payment is processed securely. We never store your payment details."}),s.jsxs("div",{className:"flex items-center space-x-2 text-xs text-slate-500",children:[s.jsx("span",{children:"🔒"}),s.jsx("span",{children:"SSL Encrypted"}),s.jsx("span",{children:"•"}),s.jsx("span",{children:"PCI Compliant"})]})]})})]}),s.jsx("div",{children:s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-6",children:"Payment Details"}),s.jsxs("div",{className:"p-4 border border-slate-200 rounded-lg bg-slate-50",children:[s.jsx("h3",{className:"font-medium text-slate-900 mb-3",children:e.bookingType==="event"?"Have a promo code?":"Have a promo code or bundle code?"}),s.jsxs("div",{className:"flex space-x-2",children:[s.jsx(me,{type:"text",placeholder:e.bookingType==="event"?"Enter promo code":"Enter promo or bundle code",value:u,onChange:Fe=>h(Fe.target.value.toUpperCase()),className:"flex-1 font-mono text-center",disabled:p||!!j}
842),s.jsx(B,{type:"button",variant:"outline",onClick:R,disabled:!u.trim()||p||!!j,className:"px-6",children:p?s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-slate-400 border-t-transparent rounded-full mr-2"}),"Applying..."]}):j?"Applied ✓":"Apply"})]}),j&&s.jsxs("div",{className:"mt-4 p-3 bg-green-50 border border-green-200 rounded-lg",children:[s.jsxs("div",{className:"flex items-center mb-2",children:[s.jsx("span",{className:"text-green-600 mr-2",children:"🎉"}),s.jsx("span",{className:"font-medium text-green-800",children:((A=j.couponApplied)==null?void 0:A.type)==="bundle"?"Bundle Credit Applied!":"Coupon Applied!"})]}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Original Price:"}),s.jsxs("span",{className:"line-through text-slate-500",children:[_,j.originalAmount.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-green-600",children:((ge=j.couponApplied)==null?void 0:ge.type)==="bundle"?"Bundle Credit:":"Discount:"}),s.jsx("span",{className:"text-green-600",children:((je=j.couponApplied)==null?void 0:je.type)==="bundle"?"FREE":`-${_}${j.discountAmount.toFixed(2)}`})]}),((ke=j.couponApplied)==null?void 0:ke.type)==="bundle"&&((Ie=j.couponApplied)==null?void 0:Ie.remainingSessions)&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-blue-600 text-xs",children:"Sessions Remaining:"}),s.jsx("span",{className:"text-blue-600 text-xs font-medium",children:j.couponApplied.remainingSessions})]}),s.jsxs("div",{className:"flex justify-between border-t border-green-200 pt-1",children:[s.jsx("span",{className:"font-medium text-green-800",children:"Final Price:"}),s.jsxs("span",{className:"font-medium text-green-800",children:[_,j.finalAmount.toFixed(2),j.finalAmount===0&&s.jsx("span",{className:"ml-1",children:"FREE!"})]})]})]})]})]}),iWe(e,j)&&s.jsxs("div",{className:"mb-6 p-4 border border-slate-200 rounded-lg bg-white",children:[s.jsxs(V,{htmlFor:"checkout-event-info",className:"text-slate-900",children:[P," ",s.jsx("span",{className:"text-slate-400 font-normal",children:"(optional)"})]}),s.jsx(Is,{id:"checkout-event-info",value:S,onChange:Fe=>E(Fe.target.value.slice(0,2e3)),placeholder:"Your answer",rows:3,className:"mt-2"})]}),H>=2&&!e.testMode?s.jsxs("div",{className:"mb-6",children:[s.jsx("h3",{className:"font-medium text-slate-900 mb-3",children:"Choose Payment Method"}),s.jsxs("div",{className:`grid gap-3 ${H===3?"grid-cols-3":"grid-cols-2"}`,children:[k&&s.jsxs("button",{type:"button",onClick:()=>g("stripe"),className:`p-4 border-2 rounded-lg flex items-center justify-center space-x-2 transition-colors ${y==="stripe"?"border-primary bg-primary/5 text-primary":"border-slate-200 hover:border-slate-300"}`,children:[s.jsx(ti,{className:"w-5 h-5"}),s.jsx("div",{className:"text-center",children:s.jsx("div",{className:"font-medium",children:"Credit Card"})})]}),D&&s.jsx("button",{type:"button",onClick:()=>g("paypal"),className:`p-4 border-2 rounded-lg flex items-center justify-center space-x-2 transition-colors ${y==="paypal"?"border-primary bg-primary/5 text-primary":"border-slate-200 hover:border-slate-300"}`,children:s.jsx("span",{className:"text-[#0070ba] font-bold text-lg",children:"PayPal"})}),O&&s.jsxs("button",{type:"button",onClick:()=>b(!0),className:`p-4 border-2 rounded-lg flex items-center justify-center space-x-2 transition-colors ${y==="cash"?"border-primary bg-primary/5 text-primary":"border-slate-200 hover:border-slate-300"}`,children:[s.jsx("span",{className:"text-2xl",children:"💵"}),s.jsx("span",{className:"font-medium",children:"Cash"})]})]})]}):null,s.jsxs("form",{onSubmit:Y,className:"space-y-6",children:[e.testMode?s.jsxs("div",{className:"p-6 border-2 border-dashed border-yellow-300 bg-yellow-50 rounded-lg text-center",children:[s.jsx("div",{className:"text-4xl mb-3",children:"🧪"}
842),s.jsx("h3",{className:"font-semibold text-yellow-800 mb-2",children:"Test Mode Active"}),s.jsx("p",{className:"text-sm text-yellow-700",children:'No real payment will be processed. Click "Complete Test Booking" to simulate a successful payment.'})]}):y==="stripe"&&k||!D&&k&&H===1?s.jsxs("div",{className:"p-4 border border-slate-200 rounded-lg",children:[s.jsx("div",{className:"mb-3 text-sm font-medium text-slate-700",children:"Payment Methods"}),s.jsx(MT,{options:{layout:"tabs"},onReady:()=>console.log("PaymentElement is ready"),onLoadError:Fe=>console.error("PaymentElement load error:",Fe),onChange:Fe=>console.log("PaymentElement change:",Fe.complete)})]}):y==="paypal"&&D?s.jsx("div",{className:"p-4 border border-slate-200 rounded-lg text-center",children:s.jsx(aWe,{amount:(j?j.finalAmount:I()).toFixed(2),currency:(z==null?void 0:z.currency)||"GBP",intent:"capture",instructorId:T,bookingData:{bookingType:e.bookingType,classId:e.bookingType==="service"?null:($e=e.classData)==null?void 0:$e.id,serviceId:e.bookingType==="service"?e.serviceId:null,classDate:e.bookingType==="service"?e.classDate:In((qe=e.classData)==null?void 0:qe.date),selectedDates:(ft=e.selectedDates)==null?void 0:ft.map(Fe=>In(Fe)),clientData:e.clientData,couponCode:((be=j==null?void 0:j.couponApplied)==null?void 0:be.code)||u},onApprove:Fe=>{var ze;const _e={paymentIntentId:Fe.id||"paypal_"+Date.now(),clientData:e.clientData,bookingType:e.bookingType,amount:j?j.finalAmount:I()};e.bookingType==="service"?(_e.serviceId=e.serviceId,_e.classDate=e.classDate):(_e.classId=e.classData.id,_e.classDate=In(e.classData.date),_e.selectedDates=(ze=e.selectedDates)==null?void 0:ze.map(ue=>In(ue))),L.mutate(_e)},onError:Fe=>{a({title:"PayPal Payment Error",description:"There was an issue processing your PayPal payment. Please try again.",variant:"destructive"})}})}):y==="cash"&&O?s.jsxs("div",{className:"p-4 border border-green-200 bg-green-50 rounded-lg text-center",children:[s.jsx("div",{className:"text-green-800 font-medium mb-1",children:"Pay with Cash"}),s.jsxs("div",{className:"text-sm text-green-700 mb-4",children:["Confirm your booking and pay in cash at your"," ",e.bookingType==="service"?"session":((z==null?void 0:z.terminologySingular)||"class").toLowerCase(),"."]}),s.jsx(B,{type:"button",onClick:()=>b(!0),disabled:L.isPending,className:"w-full bg-green-600 hover:bg-green-700 text-white",children:"Confirm Cash Payment"})]}
842):null,s.jsxs("div",{className:"bg-slate-50 rounded-lg p-4",children:[s.jsx("h4",{className:"font-medium text-slate-900 mb-2",children:"Terms & Conditions"}),s.jsx("p",{className:"text-sm text-slate-600",children:"By completing this purchase, you agree to our terms and conditions. You understand that you participate in fitness activities at your own risk."})]}),(y==="stripe"&&k||y==="cash"&&O||e.testMode||(j==null?void 0:j.finalAmount)===0||I()===0||y==="paypal"&&D&&((j==null?void 0:j.finalAmount)===0||I()===0))&&s.jsx(B,{type:"submit",disabled:y==="stripe"&&!n&&!e.testMode||y==="cash"&&!O||l||L.isPending,className:"w-full bg-secondary hover:bg-secondary/90 text-white py-3 text-lg font-semibold",onClick:Fe=>{const _e=(j==null?void 0:j.finalAmount)??I();if(y==="cash"){Fe.preventDefault(),b(!0);return}_e===0&&y!=="stripe"&&(Fe.preventDefault(),U())},children:l||L.isPending?s.jsxs("div",{className:"flex items-center justify-center",children:[s.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-white border-t-transparent rounded-full mr-2"}),(j==null?void 0:j.finalAmount)===0||I()===0?"Confirming Free Booking...":e.testMode?"Creating Test Booking...":"Processing Payment..."]}):(j==null?void 0:j.finalAmount)===0||I()===0?`Complete Free Booking - ${_}0.00`:e.testMode?`Complete Test Booking - ${_}${j?j.finalAmount.toFixed(2):I().toFixed(2)}`:`Complete Payment - ${_}${j?j.finalAmount.toFixed(2):I().toFixed(2)}`}),y==="paypal"&&!e.testMode&&s.jsx(s.Fragment,{children:(j==null?void 0:j.finalAmount)===0||I()===0?s.jsx(B,{type:"button",onClick:U,disabled:l||L.isPending,className:"w-full bg-secondary hover:bg-secondary/90 text-white py-3 text-lg font-semibold",children:l||L.isPending?s.jsxs("div",{className:"flex items-center justify-center",children:[s.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-white border-t-transparent rounded-full mr-2"}),"Confirming Free Booking..."]}):"Confirm Booking"}):s.jsxs("div",{className:"text-center p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[s.jsx("div",{className:"text-blue-800 font-medium mb-1",children:"Complete your payment with PayPal"}),s.jsx("div",{className:"text-sm text-blue-600",children:"Click the PayPal button above to proceed with your payment"})]})})]})]})})})]})}),s.jsx(Ct,{open:x,onOpenChange:b,children:s.jsxs(St,{className:"sm:max-w-md",children:[s.jsx(kt,{children:s.jsx(Pt,{className:"flex items-center gap-2",children:"💵 Cash Payment Confirmation"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:s.jsxs("p",{className:"text-sm text-yellow-800",children:["You have selected cash payment. Please confirm that you will bring",s.jsxs("span",{className:"font-semibold",children:[" ",_,j?j.finalAmount.toFixed(2):I().toFixed(2)]})," ","cash to your"," ",s.jsx("span",{className:"font-semibold",children:e.bookingType==="service"?"session":((z==null?void 0:z.terminologySingular)||"class").toLowerCase()}),"."]})}),s.jsxs("div",{className:"bg-slate-50 rounded-lg p-4",children:[s.jsx("h4",{className:"font-medium text-slate-900 mb-2",children:"Payment Details"}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:e.bookingType==="service"?"Service:":"Booking:"}),s.jsx("span",{children:zh(e)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Date & Time:"}),s.jsx("span",{children:sg(e)})]}),j&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex justify-between text-slate-500",children:[s.jsx("span",{children:"Original Price:"}),s.jsxs("span",{children:[_,j.originalAmount.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between text-green-600",children:[s.jsx("span",{children:"Discount:"}),s.jsxs("span",{children:["-",_,j.discountAmount.toFixed(2)]})]})]}),s.jsxs("div",{className:"flex justify-between font-semibold border-t pt-1",children:[s.jsx("span",{children:"Amount Due (Cash):"}),s.jsxs("span",{children:[_,j?j.finalAmount.toFixed(2):I().toFixed(2)]})]})]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx(B,{variant:"outline",onClick:()=>b(!1),className:"flex-1",children:"Cancel"}),s.jsx(B,{onClick:J,disabled:L.isPending,className:"flex-1 bg-green-600 hover:bg-green-700 text-white",children:L.isPending?s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent roun
842ded-full mr-2"}),"Confirming..."]}):"Confirm Cash Payment"})]})]})]})})]})},uWe=({pendingBooking:e,savedDiscountInfo:t})=>s.jsx(CX,{pendingBooking:e,savedDiscountInfo:t,stripe:null,elements:null}),mWe=({pendingBooking:e,savedDiscountInfo:t})=>{const n=l1(),r=o1();return s.jsx(CX,{pendingBooking:e,savedDiscountInfo:t,stripe:n,elements:r})};function hWe(){var w,j,N,C;const[e,t]=f.useState(null),[,n]=cn(),{toast:r}=Yt(),[a,i]=f.useState(null);Cl(!!e),f.useEffect(()=>{const P=new URLSearchParams(window.location.search),S=P.get("free")==="true",E=sessionStorage.getItem("pendingBooking");if(E)try{const T=JSON.parse(E);S&&!T.isFreeBooking&&(T.isFreeBooking=!0,T.amount="0.00",T.appliedCouponCode=P.get("coupon")||T.appliedCouponCode,console.log("🔄 Restored free booking state from URL params")),T.bookingType==="service"?console.log("CHECKOUT - Service booking detected:",T):T.bookingType==="event"?console.log("CHECKOUT - Event booking detected:",T):T.classData&&(T.classData.date=new Date(T.classData.date),T.selectedDates&&Array.isArray(T.selectedDates)&&(T.selectedDates=T.selectedDates.map(O=>new Date(O)),console.log("CHECKOUT - Restored selectedDates:",T.selectedDates))),console.log("🔍 CHECKOUT - Restored pendingBooking from sessionStorage:",{hasIsFreeBooking:"isFreeBooking"in T,isFreeBooking:T.isFreeBooking,amount:T.amount,appliedCouponCode:T.appliedCouponCode,couponApplied:T.couponApplied}),t(T),T.couponApplied&&(Number(T.discountAmount)>0||Number(T.finalAmount)===0)&&(i({originalAmount:T.originalAmount,finalAmount:T.finalAmount,discountAmount:T.discountAmount??0,couponApplied:T.couponApplied}),console.log("Restored discount info:",{originalAmount:T.originalAmount,finalAmount:T.finalAmount,discountAmount:T.discountAmount,couponApplied:T.couponApplied}))}catch(T){console.error("Failed to parse booking data:",T),n("/")}else S&&(console.error("❌ Free booking URL param but no sessionStorage data - sessionStorage may be blocked"),r({title:"Storage Error",description:"Your browser's storage is blocked or full. Please enable storage or try a different browser.",variant:"destructive"})),n("/")},[n]);const l=(e==null?void 0:e.bookingType)==="event"?(w=e.eventData)==null?void 0:w.accountId:void 0,{data:c}=Ue({queryKey:["/api/instructor/by-id",l],enabled:!!l&&!!e&&e.bookingType==="event"&&!e.stripePublicKey,queryFn:async()=>{const P=await fetch(`/api/instructor/by-id/${l}`);if(!P.ok)throw new Error("Failed to fetch instructor");return P.json()}}),d=(e==null?void 0:e.bookingType)==="service"?(j=e.serviceData)==null?void 0:j.instructorId:(N=e==null?void 0:e.classData)==null?void 0:N.instructorId,{data:m}=Ue({queryKey:["/api/instructor/by-id",d],enabled:!!e&&!!d&&e.bookingType!=="event"&&!e.stripePublicKey,queryFn:async()=>{const P=await fetch(`/api/instructor/by-id/${d}`);if(!P.ok)throw new Error("Failed to fetch instructor");return P.json()}});if(!e)return s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full mx-auto mb-4"}),s.jsx("p",{className:"text-slate-600",children:"Loading checkout..."})]})});if(e.testMode)return s.jsx(dWe,{pendingBooking:e});if(e.cashPaymentOnly)return s.jsx(cWe,{pendingBooking:e});const u=e.bookingType==="event"&&!!e.isPayOnDoor,h=e.isFreeBooking||u||typeof e.amount=="string"&&parseFloat(e.amount)===0||typeof e.amount=="number"&&e.amount===0;if(console.log("🔍 CHECKOUT - Component selection:",{isFreeBooking:e.isFreeBooking,amount:e.amount,amountType:typeof e.amount,calculatedIsFree:h,appliedCouponCode:e.appliedCouponCode}),h)return s.jsx(lWe,{pendingBooking:e});const p=e.stripePublicKey||(e.bookingType==="event"?c==null?void 0:c.stripePublicKey:void 0)||(m==null?void 0:m.stripePublicKey),v=e.stripeAccountId||(e.bookingType==="event"?c==null?void 0:c.stripeConnectAccountId:void 0)||(m==null?void 0:m.stripeConnectAccountId)||(m==null?void 0:m.stripeExpressAccountId),y=p?oWe(p,v):null;if(!y)return e.bookingType==="event"&&l&&!c||e.bookingType!=="event"&&d&&!e.stripePublicKey&&!m?s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent roun
842ded-full mx-auto mb-4"}),s.jsx("p",{className:"text-slate-600",children:"Loading payment..."})]})}):s.jsx(uWe,{pendingBooking:e,savedDiscountInfo:a});const x=(a==null?void 0:a.finalAmount)!==void 0?a.finalAmount:typeof e.amount=="string"?parseFloat(e.amount)||0:typeof e.amount=="number"?e.amount:0,b=(e.currency||"gbp").toLowerCase();return console.log("🔍 Elements initialization (deferred approach):",{publicKey:((C=e.stripePublicKey)==null?void 0:C.substring(0,20))+"...",stripePromise:!!y,hasStripePublicKey:!!e.stripePublicKey,amount:x,currency:b}),s.jsx(yv,{stripe:y,options:{mode:"payment",amount:Math.round(x*100),currency:b,appearance:{theme:"stripe",variables:{colorPrimary:"#6366F1",colorBackground:"#ffffff",colorText:"#1E293B",colorDanger:"#EF4444",fontFamily:"Inter, system-ui, sans-serif",spacingUnit:"4px",borderRadius:"8px"}}},children:s.jsx(mWe,{pendingBooking:e,savedDiscountInfo:a})})}function dL(){function e(){return/twa/.test(navigator.userAgent.toLowerCase())||window.navigator.standalone&&/android/i.test(navigator.userAgent)?!0:window.matchMedia("(display-mode: standalone)").matches&&/android/i.test(navigator.userAgent)}return!e()}const fWe=f.memo(({onSuccess:e,onError:t,referredBy:n})=>s.jsx(oO,{onSuccess:e,onError:t,text:"continue_with",size:"large",theme:"outline",apiEndpoint:"/api/instructor/google-signup",referredBy:n})),pWe=f.memo(({onSuccess:e,onError:t,referredBy:n})=>s.jsx(lO,{onSuccess:e,onError:t,apiEndpoint:"/api/instructor/facebook-signup",referredBy:n}));async function xWe(){try{console.log("🌍 Starting location detection...");const t=await(await fetch("/api/geolocation")).json();if(console.log("🌍 Server geolocation response:",t),t.timezone&&t.currency)return console.log(`🌍 Location detected: ${t.country_code}, ${t.timezone}`),{currency:t.currency,timezone:t.timezone}}catch(e){console.error("🌍 Geolocation detection failed:",e)}return{currency:"GBP",timezone:"Europe/London"}}function gWe(){const e="instructor_signup_exit_intent_seen_at",[r,a]=f.useState(!1),[i,o]=f.useState(!1),[l,c]=f.useState(!1),[d,m]=f.useState(!1),[u,h]=f.useState(!1),[p,v]=f.useState(!1),[y,g]=f.useState(!1),[x,b]=f.useState(!1),{toast:w}=Yt(),[,j]=cn(),{formatPrice:N,currentPrice:C,isLoading:P}=ZN(),[S,E]=f.useState({instructorName:"",email:"",password:"",confirmPassword:"",timezone:"Europe/London",currency:"GBP",referredBy:""});f.useEffect(()=>{(async()=>{const R=await xWe();console.log("🌍 Auto-detected user defaults:",R),E(Y=>({...Y,timezone:R.timezone,currency:R.currency}))})(),Ez();const re=Dz();re&&E(R=>R.referredBy?R:{...R,referredBy:re}),typeof gtag<"u"&&gtag("event","page_view",{event_category:"engagement",event_label:"instructor_signup_page_open",value:1});try{const R=localStorage.getItem(e);R&&Date.now()-Number(R)<2592e6&&v(!0)}catch(R){console.warn("Exit intent localStorage unavailable:",R)}},[]),f.useEffect(()=>{if(document.getElementById("famewall-script"))return;const I=document.createElement("script");return I.id="famewall-script",I.type="text/javascript",I.src="https://embed.famewall.io/newFrame.js",I.defer=!0,document.body.appendChild(I),()=>{const re=document.getElementById("famewall-script");re&&document.body.contains(re)&&document.body.removeChild(re)}},[]);const[T,z]=f.useState({}),O=I=>I.split(" ").map((R,Y)=>{const M=R.replace(/[^a-zA-Z0-9]/g,"");return M.length===0?"":Y===0?M.charAt(0).toLowerCase()+M.slice(1):M.charAt(0).toUpperCase()+M.slice(1)}).join("").substring(0,30);function D(I){let re=I.split("@")[0];return re.includes("+")&&(re=re.split("+")[0]),re.includes(".")?re.split(".").map(R=>R.length>0?R.charAt(0).toUpperCase()+R.slice(1).toLowerCase():"").join(" "):re.includes("_")?re.split("_").map(R=>R.length>0?R.charAt(0).toUpperCase()+R.slice(1).toLowerCase():"").join(" "):/([a-z])([A-Z])/g.test(re)?re.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,R=>R.toUpperCase()):re.charAt(0).toUpperCase()+re.slice(1).toLowerCase()}const k=xt({mutationFn:async()=>{const re=S.email.split("@")[0].replace(/[^a-zA-Z0-9]/g,""),R=D(S.email);let Y=O(re);if(H.includes(Y.toLowerCase())){let se=1,Q=Y+se;for(;H.includes(Q.toLowerCase());)se++,Q=Y+se;Y=Q}return(await Pe("POST","/api/instructor/signup",{...S,instructorName:R,businessName:R,subdomain:Y,description:"Professional instructor providing quality training sessions.",tagline:"Transform your learning journey with us!",primaryColor:"#a13ac9",secondaryColor:"#62a164",logoUrl:null,requiresSubscription:!0,trialEndsAt:new Date(Date.now()+30*24*60*60*1e3),stripeCustomerId:null,stripeSubscriptionId:null,
842subscriptionStatus:"trialing"})).json()},onSuccess:I=>{if(I.requiresVerification){w({title:"Account Created!",description:"Please check your email to verify your account."}),Zs("instructor_signup_pending_verification","engagement","signup",1),typeof window<"u"&&window.clicky&&window.clicky.goal(1549),typeof window<"u"&&window.fbq&&window.fbq("track","Lead",{content_name:"Signup Pending Verification",status:"pending_verification"}),typeof window<"u"&&window.gtag&&window.gtag("event","conversion",{send_to:"AW-17123389975/nv1RCNCXrpYbEJfkiOU_"}),j(`/verify/sent?email=${encodeURIComponent(I.email)}`);return}const re=I.instructor||I;w({title:"Welcome to Classta!",description:"Your account has been created successfully. You have 30 days of free access!"}),localStorage.removeItem("admin_session"),localStorage.removeItem("auth_token");const R=Date.now()+24*60*60*1e3,Y={instructor:re,expires:R};localStorage.setItem("admin_session",JSON.stringify(Y)),typeof window<"u"&&window.fbq&&window.fbq("track","CompleteRegistration"),Zs("instructor_signup","engagement","signup",1),typeof window<"u"&&window.clicky&&window.clicky.goal(1550),typeof window<"u"&&window.gtag&&window.gtag("event","conversion",{send_to:"AW-17123389975/7yj6CKS7y5MbEJfkiOU_"}),window.uetq&&(window.uetq=window.uetq||[],window.uetq.push("event","verified_signup",{})),j("/admin")},onError:I=>{w({title:"Signup Failed",description:I.message||"Something went wrong. Please try again.",variant:"destructive"})}}),F=f.useCallback(I=>{w({title:"Welcome to Classta!",description:"Your account has been created successfully with Google. You have 30 days of free access!"}),localStorage.removeItem("admin_session"),localStorage.removeItem("auth_token"),I.token&&(localStorage.setItem("auth_token",I.token),console.log("💾 GOOGLE SIGNUP - JWT token stored for immediate login"));const re=Date.now()+24*60*60*1e3,R={instructor:I,expires:re};localStorage.setItem("admin_session",JSON.stringify(R)),Zs("instructor_signup","engagement","signup",1),typeof window<"u"&&window.clicky&&window.clicky.goal(1550),typeof window<"u"&&window.fbq&&window.fbq("track","CompleteRegistration"),typeof window<"u"&&window.gtag&&window.gtag("event","conversion",{send_to:"AW-17123389975/7yj6CKS7y5MbEJfkiOU_"}),window.uetq&&(window.uetq=window.uetq||[],window.uetq.push("event","verified_signup",{})),j("/admin")},[j,w]),W=f.useCallback(()=>{w({title:"Google Sign-In Error",description:"Failed to load Google Sign-In. Please try the manual signup form below.",variant:"destructive"})},[w]),q=f.useCallback(()=>{w({title:"Facebook Sign-In Error",description:"Failed to load Facebook Sign-In. Please try the manual signup form below.",variant:"destructive"})},[w]);f.useCallback(()=>w({title:"Apple Sign-In Error",description:"Failed to load Apple Sign-In. Please try the manual signup form below.",variant:"destructive"}),[w]);const H=["admin","administrator","root","system","login","logout","signup","register","user","users","account","accounts","settings","profile","profiles","dashboard","api","auth","authentication","session","sessions","config","configuration","manage","management","superuser","support","help","contact","terms","privacy","legal","about","faq","blog","news","status","billing","payment","payments","invoice","invoices","subscription","subscriptions","webhook","webhooks","stripe","paypal","oauth","callback","token","tokens","password","reset","verify","verification","confirm","confirmation","email","emails","notifications","message","messages","error","errors","404","500","maintenance","static","assets","css","js","images","img","fonts","public","private","uploads","files","file","download","downloads","reports","report","analytics","tracking","track","metrics","media","content","class","classes","package","packages","booking","bookings","schedule","calendar","member","members","membership","memberships","instructor","instructors","teacher","teachers","student","students"],_=()=>{const I={};return S.email.trim()?/\S+@\S+\.\S+/.test(S.email)||(I.email="Please enter a valid email address"):I.email="Email is required",S.password?S.password.length<6?I.password="Password must be at least 6 characters":S.password.length>128?I.password="Password must be no more than 128 characters":(!/[0-9]/.test(S.password)||!/[a-zA-Z]/.test(S.password))&&(I.password="Password must contain at least one letter and one number"):I.password="Password is required",z(I),Object.keys(I).length===0},L=async I=>{I.preventDefault(),b(!0),localStorage.removeItem("admin_session"),localStorage.removeItem("auth_token"),_()&&k.mutate()},U=(I,re)=>{y||g(!0),E(R=>({...R,[I]:re})),T[I]&&z(R=>({...R,[I]:""}))},J=f.useCallback(()=>
842{if(!(d||p||y||x)){m(!0),v(!0);try{localStorage.setItem(e,String(Date.now()))}catch(I){console.warn("Exit intent localStorage unavailable:",I)}Zs("instructor_signup_exit_intent_offer_shown","engagement","signup",1)}},[d,e,p,y,x]);return f.useEffect(()=>{if(p||y||x)return;const I=window.setTimeout(()=>{h(!0)},8e3),re=R=>{u&&R.relatedTarget===null&&(R.clientY>0||J())};return window.addEventListener("mouseout",re),()=>{window.clearTimeout(I),window.removeEventListener("mouseout",re)}},[u,8e3,p,y,x,J]),s.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-purple-50 to-green-50 py-8",children:[s.jsxs("div",{className:"max-w-7xl mx-auto px-4",children:[s.jsx("div",{className:"text-center mb-8",children:s.jsxs(dt,{href:"/",className:"hidden md:inline-flex items-center gap-2 text-slate-400 hover:text-primary/70 text-sm mb-6 transition-colors",tabIndex:0,"aria-label":"Back to Home",children:[s.jsx(xr,{className:"h-4 w-4"}),"Back to Home"]})}),s.jsxs("div",{className:"lg:grid lg:grid-cols-2 lg:gap-12 lg:items-start mb-16",children:[s.jsxs("div",{className:"mb-8 lg:mb-0",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1.5 bg-white/80 backdrop-blur-sm border border-slate-200 rounded-full text-sm font-medium text-slate-700 mb-4",children:[s.jsx(sr,{className:"h-4 w-4 text-primary"}),s.jsx("span",{children:"Trusted by fitness & wellness instructors"})]}),s.jsx("h1",{className:"text-4xl lg:text-5xl font-bold text-slate-900 mb-4",children:"Launch your booking page in 2 minutes"}),s.jsx("p",{className:"text-xl text-slate-600 mb-6",children:"Everything you need to take bookings, collect payments, and manage your classes—all in one place. Start accepting students today."}),s.jsx("div",{className:"bg-gradient-to-r from-green-50 to-emerald-50 border-2 border-green-300 rounded-lg p-4 mb-4 shadow-sm",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"bg-green-500 rounded-full p-2.5 shadow-sm",children:s.jsx(mw,{className:"h-5 w-5 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"font-bold text-slate-900 text-lg mb-1",children:"30-Day Free Trial · Full Access"}),s.jsxs("p",{className:"text-sm text-slate-700",children:[s.jsx("span",{className:"font-semibold text-green-700",children:"No credit card required"})," · ",P?"...":N(C),"/mo after trial · Cancel anytime"]})]})]})}),s.jsxs("div",{className:"space-y-3 mb-6",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"bg-green-100 rounded-full p-1 mt-0.5",children:s.jsx(bn,{className:"h-4 w-4 text-green-600 flex-shrink-0"})}),s.jsxs("div",{children:[s.jsx("span",{className:"text-slate-900 font-semibold block",children:"Accept bookings & payments instantly"}),s.jsx("span",{className:"text-slate-600 text-sm",children:"Students book and pay online—you get paid automatically"})]})]}),s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"bg-green-100 rounded-full p-1 mt-0.5",children:s.jsx(bn,{className:"h-4 w-4 text-green-600 flex-shrink-0"})}),s.jsxs("div",{children:[s.jsx("span",{className:"text-slate-900 font-semibold block",children:"Automated reminders reduce no-shows"}),s.jsx("span",{className:"text-slate-600 text-sm",children:"Email & SMS reminders sent automatically"})]})]}),s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"bg-green-100 rounded-full p-1 mt-0.5",children:s.jsx(bn,{className:"h-4 w-4 text-green-600 flex-shrink-0"})}),s.jsxs("div",{children:[s.jsx("span",{className:"text-slate-900 font-semibold block",children:"Custom forms & health questionnaires"}),s.jsx("span",{className:"text-slate-600 text-sm",children:"Collect waivers, health info, and custom data"})]})]}),s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"bg-green-100 rounded-full p-1 mt-0.5",children:s.jsx(bn,{className:"h-4 w-4 text-green-600 flex-shrink-0"})}),s.jsxs("div",{children:[s.jsx("span",{className:"text-slate-900 font-semibold block",children:"Fully branded booking page"}),s.jsx("span",{className:"text-slate-600 text-sm",children:"Your colors, logo, and branding—looks professional"})]})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4 pt-4 border-t border-slate-200",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[s.jsx(oT,{className:"h-4 w-4 text-green-600"}),s.jsx("span",{children:"Secure & GDPR compliant"})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[s.jsx(Z9,{className:"h-4 w-4 text-primary"}),s.jsx("span",{children:"Set up in 2 minutes"})]})]})]}),s.jsx("div",{className:"lg:sticky lg:top-8",children:s.jsxs(Ce,{className:"md:shadow-sm lg:shadow-sm shadow-xl border-2 border-primary/20 md:border lg:border bg-white md:bg-card lg:bg-card ring-2 ring-primary/10 md:ring-0 lg:ring-0",children:[s.jsxs(gt,{children:[s.jsx(Nt,{className:"text-center text-2xl",children:"Start Your Free Trial"}),s.jsx("p",{className:"text-center text-slate-600 mt-1",children:"No credit card required · Set up in 2 minutes"})]}),s.jsxs(Ee,{children:[s.jsxs("div",{className:"space-y-4 mb-6",children:[s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx(fWe,{onSuccess:F,onError:W,referredBy:S.referredBy}),dL()&&s.jsx(XH,{toast:w,setLocation:j,timezone:S.timezone,currency:S.currency,referredBy:S.referredBy}),dL()&&s.jsx(pWe,{onSuccess:F,onError:q,referredBy:S.referredBy})]}),s.jsxs("div",{className:"flex items-center gap-4 mt-4",children:[s.jsx("div",{className:"flex-1 h-px bg-slate-200"}),s.jsx("span",{className:"text-sm text-slate-500 bg-white px-3",children:"Or continue with email"}),s.jsx("div",{className:"flex-1 h-px bg-slate-200"})]})]}),s.jsxs("form",{onSubmit:L,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",children:"Email Address *"}),s.jsx(me,{id:"email",type:"email",value:S.email,onChange:I=>U("email",I.target.value),placeholder:"[email protected]",className:T.email?"border-red-500":""}),T.email&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:T.email})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"password",children:"Password *"}),s.jsx("div",{className:"mb-2 mt-1 text-xs text-slate-600 font-medium",children:"Password must be at least 6 characters and contain letters and numbers."}),s.jsxs("div",{className:"relative",children:[s.jsx(me,{id:"password",type:r?"text":"password",value:S.password,onChange:I=>U("password",I.target.value),placeholder:"Enter your password",className:T.password?"border-red-500 pr-12":"pr-12",maxLength:128}),s.jsx("button",{type:"button","aria-label":r?"Hide password":"Show password",onClick:()=>a(I=>!I),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-primary focus:outline-none",tabIndex:0,children:r?s.jsx(uc,{className:"w-5 h-5"}):s.jsx(wa,{className:"w-5 h-5"})})]}),T.password&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:T.password})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"referredBy",children:"Did another instructor recommend Classta?"}),s.jsx(me,{id:"referredBy",value:S.referredBy,onChange:I=>U("referredBy",I.target.value),placeholder:"e.g. Sarah from Yoga with Sarah"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Enter their name here (optional)"})]}
842),s.jsx(B,{type:"submit",className:"w-full bg-primary hover:bg-primary/90 text-lg py-6 font-semibold shadow-lg hover:shadow-xl transition-all",disabled:k.isPending,children:k.isPending?"Creating Your Account...":"Start Free Trial Now →"}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-xs text-slate-500",children:[s.jsx("span",{className:"block w-full text-center font-medium",children:"✓ No credit card required · ✓ Full access · ✓ Cancel anytime"}),s.jsx("span",{className:"block w-full text-center text-slate-400 mt-1",children:"Works with Stripe, PayPal, Apple Pay, Google Pay & more"})]}),s.jsxs("p",{className:"text-center text-xs text-slate-500",children:["By signing up you agree to our"," ",s.jsx("button",{type:"button",className:"text-primary hover:text-primary/80 underline focus:outline-none",onClick:()=>o(!0),children:"Terms"})," ","and"," ",s.jsx("button",{type:"button",className:"text-primary hover:text-primary/80 underline focus:outline-none",onClick:()=>c(!0),children:"Privacy Policy"})]}),s.jsx(ZH,{open:i,onOpenChange:o}),s.jsx(eV,{open:l,onOpenChange:c}),s.jsxs("p",{className:"text-center text-sm text-slate-600 mt-2",children:[s.jsx("span",{className:"font-semibold",children:"No credit card required"})," ","• Cancel anytime"]})]})]})]})})]}),s.jsxs("div",{className:"mb-12",children:[s.jsxs("div",{className:"text-center mb-6",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Loved by instructors worldwide"}),s.jsx("p",{className:"text-slate-600",children:"Used by fitness, wellness, and coaching professionals"})]}),s.jsx("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsx("div",{className:"famewall-embed","data-src":"classta","data-format":"grid",style:{width:"100%"}})})]}),s.jsxs(Ce,{className:"mb-8",children:[s.jsxs(gt,{className:"text-center",children:[s.jsxs(Nt,{className:"flex items-center gap-2 justify-center",children:[s.jsx(mw,{className:"h-5 w-5 text-primary"}),"Core Features Included"]}),s.jsx("p",{className:"text-slate-600 mt-2",children:"Trusted by fitness & wellness instructors worldwide"})]}),s.jsxs(Ee,{children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"bg-gray-50 rounded-lg p-6 text-center",children:[s.jsx(bn,{className:"h-8 w-8 text-green-600 mx-auto mb-4"}),s.jsx("h5",{className:"font-semibold text-slate-900 text-lg mb-2",children:"Online Bookings"}),s.jsx("p",{className:"text-slate-600",children:"Students book & pay instantly through your custom booking page"})]}),s.jsxs("div",{className:"bg-gray-50 rounded-lg p-6 text-center",children:[s.jsx(bn,{className:"h-8 w-8 text-green-600 mx-auto mb-4"}),s.jsx("h5",{className:"font-semibold text-slate-900 text-lg mb-2",children:"Secure Payments"}),s.jsx("p",{className:"text-slate-600",children:"Accept cards with Stripe & PayPal - funds go directly to you"})]}),s.jsxs("div",{className:"bg-gray-50 rounded-lg p-6 text-center",children:[s.jsx(bn,{className:"h-8 w-8 text-green-600 mx-auto mb-4"}),s.jsx("h5",{className:"font-semibold text-slate-900 text-lg mb-2",children:"Automated Reminders"}),s.jsx("p",{className:"text-slate-600",children:"Email & SMS notifications sent automatically to reduce no-shows"})]}),s.jsxs("div",{className:"bg-gray-50 rounded-lg p-6 text-center",children:[s.jsx(bn,{className:"h-8 w-8 text-green-600 mx-auto mb-4"}),s.jsx("h5",{className:"font-semibold text-slate-900 text-lg mb-2",children:"Health Forms"}),s.jsx("p",{className:"text-slate-600",children:"Custom enrollment forms to collect health info & waivers"})]}),s.jsxs("div",{className:"bg-gray-50 rounded-lg p-6 text-center",children:[s.jsx(bn,{className:"h-8 w-8 text-green-600 mx-auto mb-4"}),s.jsx("h5",{className:"font-semibold text-slate-900 text-lg mb-2",children:"Memberships"}),s.jsx("p",{className:"text-slate-600",children:"Recurring subscriptions for regular students with member portal"})]}),s.jsxs("div",{className:"bg-gray-50 rounded-lg p-6 text-center",children:[s.jsx(bn,{className:"h-8 w-8 text-green-600 mx-auto mb-4"}),s.jsx("h5",{className:"font-semibold text-slate-900 text-lg mb-2",children:"Your Brand"}),s.jsx("p",{className:"text-slate-600",children:"Fully customizable booking page with your colors & branding"})]})]}),s.jsx("div",{className:"pt-4 text-center",children:s.jsx("p",{className:"text-base text-slate-600 max-w-2xl mx-auto leading-relaxed",children:"Everything you need to manage your classes and automate your bookings. From secure payments and health questionnaires to automated reminders and analytics, Classta streamlines your entire business so you can focus on what you do best – teaching."})}),s.jsx("div",{className:"pt-6 text-center",children:s.jsxs(dt,{href:"/features",className:"inline-flex items-center gap-2 text-primary hover:text-primary/80 font-medium text-base transition-colors",children:["All Features",s.jsx(qn,{
842className:"h-4 w-4"})]})}),s.jsxs("div",{className:"pt-6 mt-2 border-t text-center",children:[s.jsxs("div",{className:"flex items-center justify-center gap-2 text-primary mb-2",children:[s.jsx(Ls,{className:"h-4 w-4"}),s.jsx("span",{className:"font-medium",children:"After Trial"})]}),s.jsx("p",{className:"text-sm text-slate-600 mb-1",children:P?"Loading...":`${N(C)}/month subscription`}),s.jsx("p",{className:"text-xs text-slate-500",children:"Cancel anytime"})]})]})]}),s.jsxs("div",{className:"text-center py-12 bg-gradient-to-br from-primary/5 to-green-50 rounded-2xl border border-primary/10",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-3",children:"Ready to grow your business?"}),s.jsx("p",{className:"text-lg text-slate-600 mb-6 max-w-2xl mx-auto",children:"Streamline your booking process and grow your business with Classta."}),s.jsx(dt,{href:"#",onClick:I=>{var re;I.preventDefault(),(re=document.querySelector("form"))==null||re.scrollIntoView({behavior:"smooth"})},className:"inline-flex items-center px-8 py-4 bg-primary text-white rounded-lg hover:bg-primary/90 transition-all shadow-lg hover:shadow-xl font-semibold text-lg",children:"Start Your Free Trial Now →"}),s.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-6 text-sm text-slate-600",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(bn,{className:"h-4 w-4 text-green-600"}),s.jsx("span",{children:"No credit card required"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(bn,{className:"h-4 w-4 text-green-600"}),s.jsx("span",{children:"30-day free trial"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(bn,{className:"h-4 w-4 text-green-600"}),s.jsx("span",{children:"Cancel anytime"})]})]}),s.jsx("div",{className:"mt-6 pt-6 border-t border-slate-200",children:s.jsxs("p",{className:"text-sm text-slate-500",children:["Not ready yet?"," ",s.jsx(dt,{href:"/free-tools?utm_source=site&utm_medium=signup_page&utm_campaign=free_tools_launch",className:"text-primary hover:text-primary/80 underline font-medium",children:"Try the Free Tools"})," · ","Already have an account?"," ",s.jsx(dt,{href:"/admin",className:"text-primary hover:text-primary/80 underline font-medium",children:"Sign in here"})]})})]})]}),s.jsx(Ct,{open:d,onOpenChange:m,children:s.jsxs(St,{className:"max-w-xl sm:max-w-2xl border border-slate-200 bg-white p-8 sm:p-10",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Not quite ready? That’s OK."}),s.jsxs(yn,{className:"space-y-2 text-slate-600",children:[s.jsx("span",{className:"block",children:"You don’t need to set everything up today. Create your account now and:"}),s.jsxs("span",{className:"block",children:["• Explore Classta with full access",s.jsx("br",{}),"• Set up your booking page later, when you have time",s.jsx("br",{}),"• Get help whenever you need it — real support, not chatbots",s.jsx("br",{}),"• Free setup sessions available"]}),s.jsx("span",{className:"block text-slate-500",children:"Cancel anytime · No credit card required"})]})]}),s.jsxs(Er,{className:"gap-2 sm:gap-0 sm:items-center sm:justify-between",children:[s.jsx("span",{className:"text-xs text-slate-500",children:"Takes under 2 minutes"}),s.jsx(B,{type:"button",variant:"outline",onClick:()=>{m(!1),typeof window<"u"&&window.clicky&&window.clicky.goal(1715),typeof gtag<"u"&&gtag("event","exit_intent_cancel",{event_category:"engagement",event_label:"instructor_signup_exit_intent",value:1})},children:"No thanks"}),s.jsx(B,{type:"button",onClick:()=>{var I;m(!1),typeof window<"u"&&window.clicky&&window.clicky.goal(1714),typeof gtag<"u"&&gtag("event","exit_intent_yes",{event_category:"engagement",event_label:"instructor_signup_exit_intent",value:1}),(I=document.querySelector("form"))==null||I.scrollIntoView({behavior:"smooth"}),window.setTimeout(()=>{const re=document.getElementById("email");re instanceof HTMLInputElement&&re.focus()},250)},children:"Start free — finish setup later"})]})]})})]})}function yWe(){const[e,t]=f.useState(""),[n,r]=f.useState(!1),[a,i]=f.useState(!1),{toast:o}=Yt(),l=async c=>{if(c.preventDefault(),!e){o({title:"Email Required",description:"Please enter your email address.",variant:"destructive"});return}r(!0);try{const d=await Pe("POST","/api/instructor/forgot-password",{email:e.trim()});if(d.ok)i(!0),o({title:"Reset Link Sent",description:"If an account with that email exists, a password reset link has been sent."});else{const m=await d.json();o({title:"Error",description:m.message||"Failed to send reset email.",variant:"destructive"})}}catch{o({title:"Network Error",description:"Please check your connection and try again.",variant:"destructive"})}finally{r(!1)}};return a?s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs(Ce,{className:"w-full max-w-md",children:[s.jsxs(gt,{className:"text-center",children:[s.jsx("div",{className:"mx-auto w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mb-4",children:s.jsx(_n,{className:"h-6 w-6 text-green-600"})}),s.jsx(Nt,{children:"Check Your Email"}),s.jsx(Ys,{children:"We've sent a password reset link to your email address if an account exists."})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-gray-600 text-center",children:"If you don't see the email in your inbox, please check your spam folder."}),s.jsx("div",{className:"text-center",children:s.jsx(dt,{href:"/admin",children:s.jsxs(B,{variant:"outline",className:"w-full",children:[s.jsx(xr,{className:"h-4 w-4 mr-2"}),"Back to Login"]})})})]})]})}):s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs(Ce,{className:"w-full max-w-md",children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Reset Your Password"}),s.jsx(Ys,{children:"Enter your email address and we'll send you a link to reset your password."})]}),s.jsx(Ee,{children:s.jsxs("form",{onSubmit:l,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"email",children:"Email Address"}),s.jsx(me,{id:"email",type:"email",placeholder:"[email protected]",value:e,onCh
842ange:c=>t(c.target.value),required:!0,disabled:n})]}),s.jsx(B,{type:"submit",className:"w-full",disabled:n,children:n?"Sending...":"Send Reset Link"}),s.jsx("div",{className:"text-center",children:s.jsx(dt,{href:"/admin",children:s.jsxs(B,{variant:"ghost",className:"text-sm",children:[s.jsx(xr,{className:"h-4 w-4 mr-2"}),"Back to Login"]})})})]})})]})})}function vWe(){cn();const[e,t]=f.useState(""),[n,r]=f.useState(""),[a,i]=f.useState(""),[o,l]=f.useState(!1),[c,d]=f.useState(!1),[m,u]=f.useState(!1),[h,p]=f.useState(!1),{toast:v}=Yt();f.useEffect(()=>{const x=new URLSearchParams(window.location.search).get("token");x?t(x):v({title:"Invalid Link",description:"This password reset link is invalid or missing the reset token.",variant:"destructive"})},[v]);const y=async g=>{if(g.preventDefault(),!e){v({title:"Invalid Token",description:"Reset token is missing or invalid.",variant:"destructive"});return}if(n.length<6){v({title:"Password Too Short",description:"Password must be at least 6 characters long.",variant:"destructive"});return}if(n.length>128){v({title:"Password Too Long",description:"Password must be no more than 128 characters long.",variant:"destructive"});return}if(n!==a){v({title:"Passwords Don't Match",description:"Please make sure both passwords are identical.",variant:"destructive"});return}u(!0);try{const x=await Pe("POST","/api/instructor/reset-password",{token:e,newPassword:n});if(x.ok)p(!0),v({title:"Password Reset Successful",description:"Your password has been reset. You can now log in with your new password."});else{const b=await x.json();v({title:"Reset Failed",description:b.message||"Failed to reset password.",variant:"destructive"})}}catch{v({title:"Network Error",description:"Please check your connection and try again.",variant:"destructive"})}finally{u(!1)}};return h?s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs(Ce,{className:"w-full max-w-md",children:[s.jsxs(gt,{className:"text-center",children:[s.jsx("div",{className:"mx-auto w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mb-4",children:s.jsx(qt,{className:"h-6 w-6 text-green-600"})}),s.jsx(Nt,{children:"Password Reset Complete"}),s.jsx(Ys,{children:"Your password has been successfully reset. You can now log in with your new password."})]}),s.jsx(Ee,{children:s.jsx(dt,{href:"/admin",children:s.jsx(B,{className:"w-full",children:"Go to Login"})})})]})}):s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs(Ce,{className:"w-full max-w-md",children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Set New Password"}),s.jsx(Ys,{children:"Enter your new password below. Make sure it's at least 6 characters long."})]}),s.jsx(Ee,{children:s.jsxs("form",{onSubmit:y,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"newPassword",children:"New Password"}),s.jsxs("div",{className:"relative",children:[s.jsx(me,{id:"newPassword",type:o?"text":"password",placeholder:"Enter new password",value:n,onChange:g=>r(g.target.value),required:!0,disabled:m,minLength:6,maxLength:128}),s.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>l(!o),disabled:m,children:o?s.jsx(uc,{className:"h-4 w-4"}):s.jsx(wa,{className:"h-4 w-4"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"confirmPassword",children:"Confirm New Password"}),s.jsxs("div",{className:"relative",children:[s.jsx(me,{id:"confirmPassword",type:c?"text":"password",placeholder:"Confirm new password",value:a,onChange:g=>i(g.target.value),required:!0,disabled:m,minLength:6,maxLength:128}),s.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>d(!c),disabled:m,children:c?s.jsx(uc,{className:"h-4 w-4"}):s.jsx(wa,{className:"h-4 w-4"})})]})]}),s.jsx(B,{type:"submit",className:"w-full",disabled:m||!e,children:m?"Resetting...":"Reset Password"}),s.jsx("div",{className:"text-center",children:s.jsx(dt,{href:"/admin",children:s.jsxs(B,{variant:"ghost",className:"text-sm",children:[s.jsx(xr,{className:"h-4 w-4 mr-2"}),"Back to Login"]})})})]})})]})})}function bWe(){cn();const[e,t]=f.useState(""),[n,r]=f.useState(""),[a,i]=f.useState(""),[o,l]=f.useState(!1),[c,d]=f.useState(!1),[m,u]=f.useState(!1),[h,p]=f.useState(!1),[v,y]=f.useState(null),{toast:g}=Yt();f.useEffect(()=>{const w=new URLSearchParams(window.location.search).get("token");w?(t(w),y(null)):(y(!1),g({title:"Invalid Link",description:"This invitation link is invali
842d or missing the token.",variant:"destructive"}))},[g]);const x=async b=>{if(b.preventDefault(),!e){g({title:"Invalid Token",description:"Invitation token is missing or invalid.",variant:"destructive"});return}if(n.length<8){g({title:"Password Too Short",description:"Password must be at least 8 characters long.",variant:"destructive"});return}if(n.length>128){g({title:"Password Too Long",description:"Password must be no more than 128 characters long.",variant:"destructive"});return}if(n!==a){g({title:"Passwords Don't Match",description:"Please make sure both passwords are identical.",variant:"destructive"});return}u(!0);try{const w=await Pe("POST","/api/instructor/team-invite/accept",{token:e,password:n});if(w.ok)p(!0),g({title:"Password Set Successfully",description:"Your account is ready! You can now log in with your email and password."});else{const j=await w.json();g({title:"Setup Failed",description:j.message||"Failed to set password.",variant:"destructive"})}}catch(w){g({title:"Network Error",description:w.message||"Please check your connection and try again.",variant:"destructive"})}finally{u(!1)}};return h?s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 via-white to-green-50 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs(Ce,{className:"w-full max-w-md",children:[s.jsxs(gt,{className:"text-center",children:[s.jsx("div",{className:"mx-auto w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mb-4",children:s.jsx(qt,{className:"h-6 w-6 text-green-600"})}),s.jsx(Nt,{children:"Account Setup Complete!"}),s.jsx(Ys,{children:"Your password has been set successfully. You can now log in to access the admin panel."})]}),s.jsx(Ee,{children:s.jsx(dt,{href:"/admin",children:s.jsx(B,{className:"w-full",children:"Go to Login"})})})]})}):v===!1?s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs(Ce,{className:"w-full max-w-md",children:[s.jsxs(gt,{className:"text-center",children:[s.jsx("div",{className:"mx-auto w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mb-4",children:s.jsx(sr,{className:"h-6 w-6 text-red-600"})}),s.jsx(Nt,{children:"Invalid Invitation Link"}),s.jsx(Ys,{children:"This invitation link is invalid or has expired. Please contact the person who invited you for a new invitation."})]}),s.jsx(Ee,{children:s.jsx(dt,{href:"/admin",children:s.jsxs(B,{variant:"outline",className:"w-full",children:[s.jsx(xr,{className:"h-4 w-4 mr-2"}),"Back to Login"]})})})]})}):s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 via-white to-green-50 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs(Ce,{className:"w-full max-w-md",children:[s.jsxs(gt,{children:[s.jsx("div",{className:"flex items-center justify-center mb-4",children:s.jsx("div",{className:"w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center",children:s.jsx(sr,{className:"h-6 w-6 text-blue-600"})})}),s.jsx(Nt,{className:"text-center",children:"Accept Team Invitation"}),s.jsx(Ys,{className:"text-center",children:"You've been invited to join a team. Set a password below to complete your account setup."})]}),s.jsx(Ee,{children:s.jsxs("form",{onSubmit:x,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"password",children:"Password"}),s.jsxs("div",{className:"relative",children:[s.jsx(me,{id:"password",type:o?"text":"password",placeholder:"Enter password (min 8 characters)",value:n,onChange:b=>r(b.target.value),required:!0,disabled:m,minLength:8,maxLength:128}),s.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>l(!o),disabled:m,children:o?s.jsx(uc,{className:"h-4 w-4"}):s.jsx(wa,{className:"h-4 w-4"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"confirmPassword",children:"Confirm Password"}),s.jsxs("div",{className:"relative",children:[s.jsx(me,{id:"confirmPassword",type:c?"text":"password",placeholder:"Confirm password",value:a,onChange:b=>i(b.target.value),required:!0,disabled:m,minLength:8,maxLength:128}
842),s.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>d(!c),disabled:m,children:c?s.jsx(uc,{className:"h-4 w-4"}):s.jsx(wa,{className:"h-4 w-4"})})]})]}),s.jsx(B,{type:"submit",className:"w-full",disabled:m||!e,children:m?"Setting up...":"Set Password & Accept Invitation"}),s.jsx("div",{className:"text-center",children:s.jsx(dt,{href:"/admin",children:s.jsxs(B,{variant:"ghost",className:"text-sm",children:[s.jsx(xr,{className:"h-4 w-4 mr-2"}),"Back to Login"]})})})]})})]})})}function wWe(){const[,e]=cn(),{toast:t}=Yt(),[n,r]=f.useState(""),[a,i]=f.useState(!1),l=new URLSearchParams(window.location.search).get("email"),c=async()=>{if(!n&&!l){t({title:"Email required",description:"Please enter your email address to resend verification.",variant:"destructive"});return}i(!0);try{const d=await fetch("/api/resend-verification",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:n||l})}),m=await d.json();d.ok?t({title:"Email sent!",description:"Verification email has been sent. Please check your inbox."}):m.alreadyVerified?(t({title:"Already verified",description:"Your email is already verified. You can log in now."}),e("/admin")):t({title:"Error",description:m.message||"Failed to resend verification email.",variant:"destructive"})}catch(d){console.error("Resend verification error:",d),t({title:"Error",description:"Something went wrong. Please try again later.",variant:"destructive"})}finally{i(!1)}};return s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-green-50 flex items-center justify-center p-4",children:s.jsxs(Ce,{className:"w-full max-w-md mx-auto",children:[s.jsxs(gt,{className:"text-center space-y-4",children:[s.jsx("div",{className:"mx-auto w-16 h-16 bg-gradient-to-br from-blue-500 to-green-500 rounded-full flex items-center justify-center",children:s.jsx(_n,{className:"h-8 w-8 text-white"})}),s.jsx(Nt,{className:"text-2xl font-bold",children:"Check Your Email"}),s.jsxs(Ys,{className:"text-gray-600",children:["We've sent a verification link to ",l&&s.jsx("span",{className:"font-medium text-blue-600",children:l}),!l&&"your email address"]})]}),s.jsxs(Ee,{className:"space-y-6",children:[s.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[s.jsx("h3",{className:"font-medium text-blue-900 mb-2",children:"Next steps:"}),s.jsxs("ul",{className:"space-y-1 text-sm text-blue-800",children:[s.jsx("li",{children:"• Check your inbox for an email from Classta"}),s.jsx("li",{children:"• Click the verification link in the email"}),s.jsx("li",{children:"• You'll be redirected to log in"})]})]}),s.jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:s.jsxs("p",{className:"text-sm text-yellow-800",children:[s.jsx("strong",{children:"Don't see the email?"})," Check your spam folder or wait a few minutes for delivery."]})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"text-center",children:s.jsx("span",{className:"text-sm text-gray-600",children:"Didn't receive the email?"})}),!l&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"email",children:"Email address"}),s.jsx(me,{id:"email",type:"email",placeholder:"Enter your email",value:n,onChange:d=>r(d.target.value)})]}),s.jsx(B,{onClick:c,disabled:a,className:"w-full",variant:"outline",children:a?s.jsxs(s.Fragment,{children:[s.jsx(Of,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Of,{className:"h-4 w-4 mr-2"}),"Resend verification email"]})})]}),s.jsx("div",{className:"pt-4 border-t",children:s.jsxs(B,{variant:"ghost",onClick:()=>e("/instructor-signup"),className:"w-full",children:[s.jsx(xr,{className:"h-4 w-4 mr-2"}),"Back to signup"]})})]})]})})}function jWe(){const[,e]=cn(),n=new URLSearchParams(window.location.search).get("reason"),a=(()=>{switch(n){case"invalid_token":return{title:"Invalid Verification Link",description:"The verification link is not valid. It may have been copied incorrectly.",action:"Request a new verification email",actionPath:"/verify/sent"};
842case"token_expired":return{title:"Verification Link Expired",description:"This verification link has expired. Verification links are valid for 24 hours.",action:"Request a new verification email",actionPath:"/verify/sent"};case"server_error":return{title:"Verification Failed",description:"Something went wrong during verification. Please try again.",action:"Try again later",actionPath:"/verify/sent"};default:return{title:"Verification Error",description:"There was a problem verifying your email address.",action:"Request a new verification email",actionPath:"/verify/sent"}}})();return s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-red-50 via-white to-orange-50 flex items-center justify-center p-4",children:s.jsxs(Ce,{className:"w-full max-w-md mx-auto",children:[s.jsxs(gt,{className:"text-center space-y-4",children:[s.jsx("div",{className:"mx-auto w-16 h-16 bg-gradient-to-br from-red-500 to-orange-500 rounded-full flex items-center justify-center",children:s.jsx(Mr,{className:"h-8 w-8 text-white"})}),s.jsx(Nt,{className:"text-2xl font-bold text-red-900",children:a.title}),s.jsx(Ys,{className:"text-gray-600",children:a.description})]}),s.jsxs(Ee,{className:"space-y-6",children:[s.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:[s.jsx("h3",{className:"font-medium text-red-900 mb-2",children:"What you can do:"}),s.jsxs("ul",{className:"space-y-1 text-sm text-red-800",children:[s.jsx("li",{children:"• Request a new verification email"}),s.jsx("li",{children:"• Check that you clicked the correct link"}),s.jsx("li",{children:"• Contact support if the problem persists"})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs(B,{onClick:()=>e(a.actionPath),className:"w-full bg-gradient-to-r from-blue-500 to-green-500 hover:from-blue-600 hover:to-green-600",children:[s.jsx(_n,{className:"h-4 w-4 mr-2"}),a.action]}),s.jsxs(B,{variant:"outline",onClick:()=>e("/instructor-signup"),className:"w-full",children:[s.jsx(xr,{className:"h-4 w-4 mr-2"}),"Back to signup"]})]}),s.jsx("div",{className:"pt-4 border-t text-center",children:s.jsxs("p",{className:"text-sm text-gray-600",children:["Need help? Contact support at"," ",s.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 hover:underline",children:"[email protected]"})]})})]})]})})}function ab(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function uL(e,t,n,r,a=new Date){const i=[],o=new Date(a.getTime());o.setHours(0,0,0,0);let l=!1;if(r.startDate){const h=r.startDate,p=new Date(h+"T12:00:00.000Z");if(p>o&&(o.setTime(p.getTime()),o.setHours(0,0,0,0),l=!0,n==="weekly"&&o.getDay()!==e)){const v=(e-o.getDay()+7)%7;o.setDate(o.getDate()+v)}}let c=r.endDate;const d=ab(a);if(c&&c<d){const h=new Date(a.getTime());h.setMonth(h.getMonth()+6),c=ab(h)}const m=new Date(a.getTime());m.setMonth(m.getMonth()+3);const u=c?new Date(c+"T12:00:00.000Z"):m;if(u<m&&m.setTime(u.getTime()),n==="daily"){let h=[];try{h=r.enabledDays?JSON.parse(r.enabledDays):[1,2,3,4,5]}catch{h=[1,2,3,4,5]}const p=new Date(o.getTime());let v=t||"09:00";try{const w=JSON.parse(t);typeof w=="object"&&w!==null&&(v=w[p.getDay().toString()]||Object.values(w)[0]||"09:00")}catch{}const y=a.getHours(),g=parseInt(v.split(":")[0]||"0",10);y>=g&&o.setDate(o.getDate()+1);let x=0;const b=90;for(;o<=m&&x<b;){const w=o.getDay();h.includes(w)&&(i.push(new Date(o.getTime())),x++),o.setDate(o.getDate()+1)}}else{const h=(e-o.getDay()+7)%7;let p=t||"09:00";const v=a.getHours(),y=parseInt(p.split(":")[0]||"0",10),g=ab(o)===ab(a);!l&&h===0&&g&&v>=y?o.setDate(o.getDate()+7):o.setDate(o.getDate()+h);for(let x=0;x<30&&o<=m;x++)i.push(new Date(o.getTime())),o.setDate(o.getDate()+7)}return i}function NWe(){var z,O,D;const{token:e}=sa(),[t,n]=f.useState(!1),[r,a]=f.useState(null),[i,o]=f.useState([]),[l,c]=f.useState(null),[d,m]=f.useState(null),[u,h]=f.useState(!1),p=async(k,F,W,q)=>{var L;const H=uL(F,q.startTime,q.frequency,q),_=[];try{if(H.length===0)return[];const U=H[0],J=H[H.length-1],I=`${U.getFullYear()}-${String(U.getMonth()+1).padStart(2,"0")}-${String(U.getDate()).padStart(2,"0")}`,re=`${J.getFullYear()}
842-${String(J.getMonth()+1).padStart(2,"0")}-${String(J.getDate()).padStart(2,"0")}`;console.log(`🚀 Using BATCH availability API for private booking - instructor ${W}, class ${k}, dates: ${I} to ${re}`);const R=await fetch(`/api/instructor/${W}/class-availability?startDate=${I}&endDate=${re}`);if(!R.ok)throw new Error(`Batch availability request failed: ${R.status}`);const Y=await R.json();console.log(`🚀 Batch availability received for ${Object.keys(Y).length} classes`);for(const M of H){const se=`${M.getFullYear()}-${String(M.getMonth()+1).padStart(2,"0")}-${String(M.getDate()).padStart(2,"0")}`;let Q=!1;const te=M.getDay();if(q){if(q.exceptionalDates)try{JSON.parse(q.exceptionalDates).find(ie=>ie.new_date===se)&&(Q=!0)}catch(G){console.error("Error parsing exceptionalDates:",G)}if(!Q)if(q.frequency==="daily"){if(q.enabledDays)try{Q=JSON.parse(q.enabledDays).includes(te)}catch(G){console.error("Error parsing enabledDays:",G),Q=!1}}else Q=te===q.dayOfWeek;if(Q){if(q.startDate&&se<q.startDate||q.excludeDates&&q.excludeDates.split(`
843`).map(ie=>ie.trim()).filter(ie=>ie).includes(se))continue;if(q.exceptionalDates)try{if(JSON.parse(q.exceptionalDates).find(A=>A.original_date===se))continue}catch(Z){console.error("Error parsing exceptionalDates:",Z)}const G=(L=Y[k])==null?void 0:L[se];G&&G.availableSpots>0&&_.push(M)}}}return _}catch(U){console.error("🚀 Batch availability failed, falling back to individual calls:",U);for(const J of H)try{const I=`${J.getFullYear()}-${String(J.getMonth()+1).padStart(2,"0")}-${String(J.getDate()).padStart(2,"0")}`;(await(await fetch(`/api/classes/${k}/availability/${I}?t=${Date.now()}`)).json()).availableSpots>0&&_.push(J)}catch(I){console.error("Error checking availability for date:",J,I),_.push(J)}return _}},v=async(k,F)=>{try{const W=`${k.getFullYear()}-${String(k.getMonth()+1).padStart(2,"0")}-${String(k.getDate()).padStart(2,"0")}`,H=await(await fetch(`/api/classes/${F}/availability/${W}?t=${Date.now()}`)).json();return{availableSpots:H.availableSpots,maxCapacity:H.maxCapacity,bookedSpots:H.bookedSpots}}catch(W){return console.error("Error fetching availability for date:",k,W),null}},y=(k,F)=>{if(!k)return"TBD";try{const W=JSON.parse(k);if(typeof W=="object"&&W!==null){if(F){const H=F.getDay().toString(),_=W[H];if(_)return _;const L=Object.values(W)[0];if(L&&typeof L=="string")return L}const q=Object.values(W)[0];if(q&&typeof q=="string")return q}}catch{}return k},{data:g,isLoading:x,error:b}=Ue({queryKey:["/api/private",e],queryFn:async()=>{console.log("🔗 Client: Fetching private link for token:",e);const k=await Pe("GET",`/api/private/${e}`);if(console.log("🔗 Client: Response status:",k.status),!k.ok){const W=await k.json();throw console.log("🔗 Client: Error response:",W),new Error(W.message||"Failed to load private booking link")}const F=await k.json();return console.log("🔗 Client: Success response:",F),F},enabled:!!e}),w=(z=g==null?void 0:g.class)==null?void 0:z.id,{data:j=[]}=Ue({queryKey:[`/api/classes/${w}/packages`],enabled:!!w}),N=f.useMemo(()=>[...j].filter(k=>k.isActive!==!1).sort((k,F)=>k.numberOfWeeks-F.numberOfWeeks),[j]);f.useEffect(()=>{var k;if((k=g==null?void 0:g.instructor)!=null&&k.primaryColor){const F=document.documentElement,W=Cv(g.instructor.primaryColor);F.style.setProperty("--primary",YH(W)),F.style.setProperty("--primary-foreground",Rl(W))}return()=>{const F=document.documentElement;F.style.removeProperty("--primary"),F.style.removeProperty("--primary-foreground")}},[(O=g==null?void 0:g.instructor)==null?void 0:O.primaryColor]),f.useEffect(()=>{var k;r&&((k=g==null?void 0:g.class)!=null&&k.id)&&v(r,g.class.id).then(F=>{F&&(c(F.availableSpots),m(F.maxCapacity))})},[r,(D=g==null?void 0:g.class)==null?void 0:D.id]),f.useEffect(()=>{if(g&&i.length===0&&!u){console.log("🗓️ Checking availability for class:",g.class.id),h(!0);const F=new URLSearchParams(window.location.search).get("date");console.log("🗓️ Date query param from URL:",F),p(g.class.id,g.class.dayOfWeek,g.instructor.id,g.class).then(W=>{console.log("🗓️ Available dates found:",W.length),o(W);let q=!1;if(F&&W.length>0){console.log("🗓️ Looking for query param date:",F),console.log("🗓️ Available date strings:",W.map(_=>{const L=_.getFullYear(),U=String(_.getMonth()+1).padStart(2,"0"),J=String(_.getDate()).padStart(2,"0");return`${L}-${U}-${J}`}));const H=W.find(_=>{const L=_.getFullYear(),U=String(_.getMonth()+1).padStart(2,"0"),J=String(_.getDate()).padStart(2,"0"),I=`${L}-${U}-${J}`;return console.log("🗓️ Comparing:",I,"with",F),I===F});H?(console.log("🗓️ ✅ Found matching date:",H),a(H),q=!0,v(H,g.class.id).then(_=>{_&&(c(_.availableSpots),m(_.maxCapacity))})):console.log("🗓️ ❌ Query param date not found in available dates. Query param:",F)}!q&&W.length>0&&(console.log("🗓️ Setting default date (first available):",W[0]),a(W[0]),v(W[0],g.class.id).then(H=>{H&&(c(H.availableSpots),m(H.maxCapacity))}))}).catch(W=>{console.error("🗓️ Error checking availability:",W);const q=uL(g.class.dayOfWeek,g.class.startTime,g.class.frequency,g.class);o(q),q.length>0&&!r&&a(q[0])}).finally(()=>{h(!1)})}},[g]);const C=f.useMemo(()=>g?y(g.class.startTime,r):"TBD",[g,r]);if(x)return s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-green-50 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent roun
843ded-full mx-auto mb-4"}),s.jsx("p",{className:"text-muted-foreground",children:"Loading private booking link..."})]})});if(b||!g)return s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-green-50 flex items-center justify-center",children:s.jsxs(Ce,{className:"max-w-md mx-auto",children:[s.jsxs(gt,{className:"text-center",children:[s.jsx(Nt,{className:"text-red-600",children:"Access Denied"}),s.jsx(Ys,{children:(b==null?void 0:b.message)||"This private booking link is not available."})]}),s.jsxs(Ee,{className:"text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"The link may have expired, reached its usage limit, or been deactivated."}),s.jsx(B,{variant:"outline",onClick:()=>window.location.href="/",children:"Return to Home"})]})]})});const P=g,{link:S,class:E,instructor:T}=P;return s.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-green-50",style:{background:`linear-gradient(135deg, ${T.primaryColor}10, ${T.secondaryColor}10)`},children:[s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[T.logoUrl&&s.jsx("img",{src:T.logoUrl,alt:T.businessName,className:"h-12 w-12 rounded-full object-cover"}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold",style:{color:T.primaryColor},children:T.businessName}),s.jsx("p",{className:"text-muted-foreground",children:T.tagline})]})]}),S.name&&s.jsx(Je,{variant:"secondary",className:"mb-4",children:S.name})]}),s.jsxs(Ce,{className:"max-w-4xl mx-auto",children:[s.jsx(gt,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(Nt,{className:"text-2xl mb-2",children:E.name}),s.jsx(Ys,{className:"text-base",children:E.description})]}),s.jsxs("div",{className:"text-right ml-4",children:[s.jsx("div",{className:"text-2xl font-bold",style:{color:T.primaryColor},children:_h(parseFloat(E.singlePrice),T.currency)}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"per session"})]})]})}),s.jsxs(Ee,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[s.jsx(Ls,{className:"h-5 w-5 text-primary"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"font-medium mb-1",children:"Select Date"}),g&&!u?s.jsx("div",{className:"space-y-1",children:s.jsxs(Bt,{value:r?r.toISOString():void 0,onValueChange:k=>{var W;const F=new Date(k);a(F),(W=g==null?void 0:g.class)!=null&&W.id&&v(F,g.class.id).then(q=>{q&&(c(q.availableSpots),m(q.maxCapacity))})},children:[s.jsx($t,{className:"w-full",children:s.jsx(Lt,{children:r?r.toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short",year:"numeric"}):"Choose date..."})}),s.jsx(It,{children:i.map((k,F)=>s.jsx(ce,{value:k.toISOString(),children:k.toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short",year:"numeric"})},F))})]})}):s.jsx("div",{className:"w-full h-10 flex items-center px-3 border border-input bg-background rounded-md text-sm text-muted-foreground",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-primary border-t-transparent rounded-full"}),"Loading available dates..."]})})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[s.jsx(ei,{className:"h-5 w-5 text-primary"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:C}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[E.duration," minutes"]})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[s.jsx(si,{className:"h-5 w-5 text-primary"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:"Location"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:E.location})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[s.jsx(sr,{className:"h-5 w-5 text-primary"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:"Availability"}),r&&l!==null&&d!==null?s.jsxs("p",{className:"text-sm text-muted-foreground",children:[l," / ",d," spots available"]}):s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Max ",E.maxCapacity," people"]})]})]})]}),N.length>0&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Package Deals"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:N.map(k=>s.jsx("div",{className:"p-4 border rounded-lg bg-card",children:s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:k.name||`${k.numberOfWeeks} ${E.frequency==="daily"?"Day":"Week"} Package`}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[k.numberOfWeeks," ",E.frequency==="daily"?"days":"sessions"]})]}),s.jsx("div",{className:"text-lg font-bold",style:{color:T.primaryColor},children:_h(parseFloat(k.price),T.currency)})]})},k.id))})]}),(S.usageLimit||S.expiresAt)&&s.jsxs("div",{className:"p-4 bg-muted rounded-lg",children:[s.jsx("h4",{className:"font-medium mb-2",children:"Private Link Details"}),s.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground",children:[S.usageLimit&&s.jsxs("p",{children:["Bookings available: ",S.usageLimit-S.usageCount," of ",S.usageLimit," remaining"]}),S.expiresAt&&s.jsxs("p",{children:["Link expires: ",new Date(S.expiresAt).toLocaleDateString()," at ",new Date(S.expiresAt).toLocaleTimeString()]})]})]}),s.jsx("div",{className:"text-center",children:s.jsx(B,{size:"lg",disabled:u||!r,onClick:async()=>
843{if(r&&P.class){const k=await v(r,P.class.id);k&&(c(k.availableSpots),m(k.maxCapacity))}n(!0)},style:{backgroundColor:u||!r?void 0:T.primaryColor,borderColor:u||!r?void 0:T.primaryColor},className:u||!r?"":"text-white hover:opacity-90",children:u?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full"}),"Loading dates..."]}):"Book Your Session"})})]})]}),E.photoUrl&&s.jsx(Ce,{className:"max-w-4xl mx-auto mt-8",children:s.jsx(Ee,{className:"pt-6",children:s.jsx("img",{src:E.photoUrl,alt:`${E.name} photo`,className:"w-full rounded-lg object-cover"})})}),s.jsxs(Ce,{className:"max-w-4xl mx-auto mt-8",children:[s.jsx(gt,{children:s.jsxs(Nt,{children:["About ",T.businessName]})}),s.jsx(Ee,{children:s.jsxs("div",{className:"flex items-start gap-4",children:[T.logoUrl&&s.jsx("img",{src:T.logoUrl,alt:T.businessName,className:"h-16 w-16 rounded-full object-cover"}),T.description&&s.jsx("p",{className:"min-w-0 flex-1 text-muted-foreground",children:T.description})]})})]})]}),t&&r&&s.jsx($T,{classData:{...g.class,date:r,spotsLeft:l!==null?l:d||g.class.maxCapacity},instructor:g.instructor,onClose:()=>n(!1),privateBooking:!0,privateLinkToken:e})]})}function SX(e,t){const n=e,r=typeof(n==null?void 0:n.message)=="string"&&n.message.length>0?n.message:"";if((n==null?void 0:n.type)==="StripeIdempotencyError"||r.includes("idempotent requests")||r.includes("StripeIdempotencyError"))return"Checkout was interrupted. Please tap Try again to continue.";if(r){const a=r.match(/^\d{3}:\s*(\{[\s\S]+\})$/);if(a)try{const i=JSON.parse(a[1]);if(i.type==="StripeIdempotencyError")return"Checkout was interrupted. Please tap Try again to continue.";if(typeof i.message=="string"&&i.message.length>0)return i.message}catch{}return n.status!=null&&n.status>=500&&/^(An error occurred with our connection to Stripe|Request failed)/i.test(r)?"Payment service is temporarily unavailable. Please try again in a moment.":r}return t}function CWe({membership:e,instructor:t,clientData:n,onSuccess:r,clientSecret:a,isOneTimeCheckout:i}){const o=l1(),l=o1(),{toast:c}=Yt(),[d,m]=f.useState(!1),u=async y=>{var g,x;if(y.preventDefault(),!(!o||!l)){m(!0);try{const b=a?sessionStorage.getItem(`membership_response_${a}`):null;let w=null;if(b){const C=JSON.parse(b);w=C.subscriptionId,console.log("Stored response data:",C)}const{error:j,paymentIntent:N}=await o.confirmPayment({elements:l,confirmParams:{},redirect:"if_required"});if(j){c({title:"Payment Failed",description:j.message,variant:"destructive"});return}if(N&&N.status==="succeeded"){console.log("Payment confirmed, activating membership..."),console.log("Payment intent amount:",N.amount),console.log("Payment intent metadata:",N.metadata);const C=N.client_secret||a,P=C?sessionStorage.getItem(`membership_response_${C}`):null,S=P?JSON.parse(P):{};if(i===!0||S.isOneTimePurchase===!0){if((await Pe("POST",`/api/memberships/${e.id}/activate-subscription`,{paymentIntentId:N.id,isOneTimePurchase:!0,clientData:{name:n.name,email:n.email,phone:n.phone,onboardingData:n.onboardingData}})).ok)window.location.href=`/classes/${t.subdomain}/membership-success?membership_id=${e.id}&client_email=${encodeURIComponent(n.email)}&client_name=${encodeURIComponent(n.name||n.email)}`;else throw new Error("Failed to activate membership");return}if(w=((g=N.metadata)==null?void 0:g.subscription_id)||((x=N.metadata)==null?void 0:x.subscriptionId)||w,!w&&N.client_secret){const T=sessionStorage.getItem(`membership_response_${N.client_secret}`);T&&(w=JSON.parse(T).subscriptionId,console.log("Using subscription ID from stored response:",w))}if(w)if((await Pe("POST",`/api/memberships/${e.id}/activate-subscription`,{subscriptionId:w,clientData:{name:n.name,email:n.email,phone:n.phone,onboardingData:n.onboardingData}})).ok)window.location.href=`/classes/${t.subdomain}/membership-success?membership_id=${e.id}&client_email=${encodeURIComponent(n.email)}&client_name=${encodeURIComponent(n.name||n.email)}`;else throw new Error("Failed to activate membership");else throw new Error("No subscription ID found")}}catch(b){console.error("Payment processing error:",b),c({title:"Payment Failed",description:b.message||"Something went wrong. Please try again.",variant:"destructive"})}finally{m(!1)}}},h=a?sessionStorage.getItem(`membership_response_${a}`):null,p=h?JSON.parse(h):null,v=(p==null?void 0:p.isSetupIntent)===!0;return s.jsxs("form",{onSubmit:u,className:"space-y-4",children:[s.jsx(MT,{}),v&&s.jsxs("div",{className:"text-sm text-slate-600 mb-2 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:[s.jsx("p",{className:"font-semibold text-blue-900 mb-1",children:"Your first payment is free!"}),s.jsx("p",{className:"text-blue-700",children:"We need to collect your payment method for future billing cycles. You won't be charged until your next payment."})]}
843),s.jsx(B,{type:"submit",className:"w-full",disabled:!o||d,style:{backgroundColor:t.primaryColor,borderColor:t.primaryColor},children:d?"Processing...":v?"Confirm Membership (First Payment Free)":i?`Pay for ${(e==null?void 0:e.name)||"Membership"}`:`Subscribe to ${(e==null?void 0:e.name)||"Membership"}`})]})}function mL(){const{subdomain:e}=sa();cn();const[t,n]=f.useState(null),a=new URLSearchParams(window.location.search).get("token")||null,[i,o]=f.useState(()=>{if(typeof window>"u")return{name:"",email:"",phone:""};const R=new URLSearchParams(window.location.search);return{name:R.get("name")??"",email:R.get("email")??"",phone:""}}),[l,c]=f.useState({}),[d,m]=f.useState(null),[u,h]=f.useState(""),[p,v]=f.useState(null),[y,g]=f.useState(null),[x,b]=f.useState(!1),[w,j]=f.useState(null),N=f.useRef(!1),{toast:C}=Yt();jn();const[P,S]=f.useState(""),[E,T]=f.useState(!1),[z,O]=f.useState(null),[D,k]=f.useState(!1),[F,W]=f.useState(0),{data:q}=Ue({queryKey:[`/api/instructor/by-subdomain/${e}`],enabled:!!e});f.useEffect(()=>{if(!(q!=null&&q.id))return;const R=localStorage.getItem(`client_token_${q.id}`);if(R)try{const Y=R.split(".");if(Y.length!==3)return;const M=JSON.parse(atob(Y[1].replace(/-/g,"+").replace(/_/g,"/")));if(!M.email)return;o(se=>{var Q;return(Q=se.email)!=null&&Q.trim()?se:{...se,email:M.email}})}catch{}},[q==null?void 0:q.id]),f.useEffect(()=>{q!=null&&q.stripePublicKey&&m(od(q.stripePublicKey))},[q==null?void 0:q.stripePublicKey]);const{data:H=[]}=Ue({queryKey:[`/api/instructors/${q==null?void 0:q.id}/memberships`,a],queryFn:async()=>{const R=`/api/instructors/${q==null?void 0:q.id}/memberships${a?`?token=${encodeURIComponent(a)}`:""}`;return(await Pe("GET",R)).json()},enabled:!!(q!=null&&q.id)}),{data:_}=Ue({queryKey:[`/api/onboarding-forms/${t==null?void 0:t.onboardingFormId}`],enabled:!!(t!=null&&t.onboardingFormId)});xt({mutationFn:async R=>await Pe("POST",`/api/memberships/${R.membershipId}/purchase`,R),onSuccess:R=>{C({title:"Success!",description:"Check your email for payment confirmation and access details."}),n(null),o({name:"",email:"",phone:""}),c({})},onError:R=>{C({title:"Purchase Failed",description:R.message||"Something went wrong. Please try again.",variant:"destructive"})}});const L=R=>{n(R),h(""),v(null),g(null),b(!1),j(null),N.current=!1,k(!1),W(0),S(""),O(null)};f.useEffect(()=>{if(!D)return;const Y=setTimeout(async()=>{const M=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;if(!t||!i.name||!i.email||!i.phone||!q){h(""),g(null),N.current=!1;return}if(v(null),!M.test(i.email)){h(""),g(null),N.current=!1;return}if(((i.email.split("@")[1]||"").split(".").pop()||"").length<2){h(""),g(null),N.current=!1;return}const te=[t.id,i.email.trim().toLowerCase(),q.id].join("|");if(!(u&&y===te||N.current&&y===te))try{N.current=!0,g(te);const Z=t.billingType==="one_time"?`/api/memberships/${t.id}/create-one-time-payment-intent`:`/api/memberships/${t.id}/create-payment-intent`,ie=await Pe("POST",Z,{checkoutRequestId:te,clientData:{...i,onboardingData:Object.keys(l).length>0?l:void 0},couponCode:z!=null&&z.isValid?P.trim():void 0}),A=await ie.json();if(console.log("Payment intent response:",A),console.log("Response status:",ie.status),console.log("Response error field:",A.error),console.log("Response clientSecret:",A.clientSecret?"present":"missing"),!ie.ok){v(typeof A.message=="string"&&A.message.length>0?A.message:"We couldn’t start checkout. Please try again or contact support."),h(""),g(null),N.current=!1;return}if(A.error==="subscription_exists"||ie.status===409){console.log("✓ Duplicate subscription detected - showing proper error message"),v("This email already has this membership. Please go to My Account or use a different email."),h(""),g(null),N.current=!1;return}if(A.freeMembership===!0){console.log("Free membership detected, will show Confirm button"),b(!0),j(A),h(""),N.current=!1;return}if(b(!1),j(null),A.isOneTimeDiscount&&A.requiresPaymentMethod&&A.clientSecret){console.log("$0 invoice one-time discount - SetupIntent created, will show payment form to collect payment method"),console.log("isSetupIntent flag from server:",A.isSetupIntent),b(!1),j(null),h(A.clientSecret),A.subscriptionId&&(sessionStorage.setItem(`membership_response_${A.clientSecret}`,JSON.stringify({...A,subscriptionId:A.subscriptionId,isOneTimeDiscount:!0,isSetupIntent:A.isSetupIntent===!0,finalPrice
843:0})),console.log("Stored SetupIntent response in sessionStorage:",A.subscriptionId,"isSetupIntent:",A.isSetupIntent)),N.current=!1;return}if(A.clientSecret)h(A.clientSecret),(A.subscriptionId||A.oneTimePurchase)&&(sessionStorage.setItem(`membership_response_${A.clientSecret}`,JSON.stringify({...A,subscriptionId:A.subscriptionId,isOneTimePurchase:A.oneTimePurchase===!0,paymentIntentId:A.paymentIntentId})),console.log("Stored checkout metadata in sessionStorage:",A.subscriptionId||A.paymentIntentId));else throw new Error(A.message||"No client secret returned");N.current=!1}catch(G){console.error("Payment initialization error:",G),console.error("Error details:",{error:G==null?void 0:G.error,status:G==null?void 0:G.status,message:G==null?void 0:G.message});const Z=(G==null?void 0:G.error)==="subscription_exists"||(G==null?void 0:G.status)===409||(G==null?void 0:G.message)&&(G.message.includes("409")||G.message.includes("subscription_exists")||G.message.includes("already have"));console.log("Duplicate check:",{errorField:G==null?void 0:G.error,status:G==null?void 0:G.status,message:G==null?void 0:G.message,isDuplicateSub:Z}),v(Z?"This email already has this membership. Please go to My Account or use a different email.":SX(G,"We couldn’t start checkout. Please check your details or try again.")),h(""),g(null),N.current=!1}},100);return()=>clearTimeout(Y)},[D,F,t==null?void 0:t.id,t==null?void 0:t.billingType,i.name,i.email,i.phone,JSON.stringify(l),q==null?void 0:q.id,P,z==null?void 0:z.isValid]);const U=()=>{if(!i.name||!i.email||!i.phone)return{isValid:!1,message:"Please fill in all required fields (name, email, phone)."};if(_!=null&&_.questions){let R;try{R=typeof _.questions=="string"?JSON.parse(_.questions):_.questions}catch{return{isValid:!0,message:""}}const Y=[];for(const M of R)if(M.required&&M.type!=="info"){const se=l[M.id];M.type==="checkbox"?(!Array.isArray(se)||se.length===0)&&Y.push(M.label):(!se||typeof se=="string"&&se.trim()===""||typeof se=="boolean"&&!se)&&Y.push(M.label)}if(Y.length>0)return{isValid:!1,message:`Please complete these required fields: ${Y.join(", ")}`}}return{isValid:!0,message:""}},J=()=>{if(!(_!=null&&_.questions))return null;let R;try{R=typeof _.questions=="string"?JSON.parse(_.questions):_.questions}catch{return null}return s.jsxs("div",{children:[s.jsx("h5",{className:"font-semibold text-slate-900 mb-4",children:_.name}),s.jsx("div",{className:"space-y-6 p-6 bg-blue-50 border border-blue-200 rounded-lg",children:R.map((Y,M)=>{var se,Q;return s.jsxs("div",{children:[Y.type!=="single-checkbox"&&Y.type!=="info"&&s.jsxs(V,{htmlFor:Y.id,className:"text-sm font-medium",children:[Y.label," ",Y.required?"*":""]}),Y.type==="text"&&s.jsx(me,{id:Y.id,value:l[Y.id]||"",onChange:te=>c(G=>({...G,[Y.id]:te.target.value})),placeholder:Y.placeholder||"",className:"bg-white mt-2",required:Y.required}),Y.type==="date"&&s.jsx(me,{id:Y.id,type:"date",value:l[Y.id]||"",onChange:te=>c(G=>({...G,[Y.id]:te.target.value})),className:"bg-white mt-2",required:Y.required}),Y.type==="textarea"&&s.jsx(Is,{id:Y.id,value:l[Y.id]||"",onChange:te=>c(G=>({...G,[Y.id]:te.target.value})),rows:3,placeholder:Y.placeholder||"",className:"bg-white mt-2",required:Y.required}),Y.type==="select"&&s.jsxs(Bt,{value:l[Y.id]||"",onValueChange:te=>c(G=>({...G,[Y.id]:te})),children:[s.jsx($t,{className:"bg-white mt-2",children:s.jsx(Lt,{placeholder:Y.placeholder})}),s.jsx(It,{children:(se=Y.options)==null?void 0:se.map((te,G)=>s.jsx(ce,{value:te,children:te},G))})]}),Y.type==="radio"&&s.jsx(Sl,{value:l[Y.id]||"",onValueChange:te=>c(G=>({...G,[Y.id]:te})),className:"mt-2",children:(Q=Y.options)==null?void 0:Q.map((te,G)=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($r,{value:te,id:`${Y.id}-${G}`}),s.jsx(V,{htmlFor:`${Y.id}-${G}`,className:"text-sm",children:te})]},G))}),Y.type==="checkbox"&&Y.options&&s.jsx("div",{className:"space-y-2 mt-2",children:Y.options.map((te,G)=>s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(Xt,{id:`${Y.id}-${G}`,checked:Array.isArray(l[Y.id])?l[Y.id].includes(te):!1,onCheckedChange:Z=>{const ie=Array.isArray(l[Y.id])?l[Y.id]:[];let A;Z?A=[...ie,te]:A=ie.filter(ge=>ge!==te),c(ge=>({...ge,[Y.id]:A}))},className:"mt-1"}),s.jsx(V,{htmlFor:`${Y.id}-${G}`,className:"text-sm",children:te})]},G))}),Y.type==="single-checkbox"&&s.jsxs("div",{className:"flex items-start space-x-3 mt-2",children:[s.jsx(Xt,{id:Y.id,checked:l[Y.id]||!1,onCheckedChange:te=>c(G=>({...G,[Y.id]:te})),className:"mt-1"}),s.jsxs(V,{htmlFor:Y.id,className:"text-sm",children:[Y.label," ",Y.required?"*":""]})]}),Y.type==="info"&&s.jsxs("div",{className:"mt-2 p-4 bg-blue-50 border-l-4 border-blue-400 rounded-r",children:[s.jsx("h4",{className:"font-semibold text-blue-900 mb-2",children:Y.label}),Y.content&&s.jsx("div",{className:"text-sm text-blue-800 whitespace-pre-line",children:Y.content})]})]},Y.id||M)})})]})};function I(R){switch(R){case"monthly":return"month";case"four_weekly":return"4 weeks";case"quarterly":return"quarter";case"yearly":return"year";default:return"month"}}function re(R){switch(R){case"never":return"never expires";case"1_month":return"expires after 1 month";case"1_quarter":return"expires after 1 quarter";case"1_year":return"expires after 1 year";default:return"one-time"}}return q?s.jsxs("div",{className:"min-h-screen bg-slate-50",children:[s.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-12",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsxs("h1",{className:"text-3xl font-bold text-slate-900 mb-4",children:[q.businessName," Memberships"]}),s.jsx("p",{className:"text-lg text-slate-600 max-w-2xl mx-auto mb-6",children:"Choose a membership plan. All memberships include access to exclusive classes and content."}),s.jsxs("div",{className:"bg-white border border-slate-200 rounded-lg p-4 max-w-md mx-auto",children:[s.jsx("p",{className:"text-sm text-slate-600 mb-2",children:"Already got an account?"}),s.jsx(B,{variant:"outline",onClick:()=>window.location.href=`/my-account/${q.subdomain}`,className:"text-sm",children:"Login"})]})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:H.map(R=>s.jsxs(Ce,{className:"relative",children:[s.jsxs(gt,{children:[s.jsxs(Nt,{className:"flex items-center justify-between",children:[R.name,s.jsxs(Je,{variant:"secondary",children:[mt(q.currency||"GBP"),R.price,R.billingType==="one_time"?" one-time":`/${I(R.billingFrequency)}`]})]}),R.description&&s.jsx(Ys,{className:"whitespace-pre-line break-words",children:R.description})]}),s.jsx(Ee,{children:s.jsxs("div",{className:"space-y-4",children:[R.usageLimit&&s.jsxs("div",{className:"text-sm text-slate-600",children:[s.jsx("strong",{children:"Includes:"})," ",R.usageLimit," classes per"," ",R.billingType==="one_time"?"period":I(R.billingFrequency)]}),!R.usageLimit&&s.jsxs("div",{className:"text-sm text-slate-600",children:[s.jsx("strong",{children:"Unlimited"})," access to all member classes"]}
843),s.jsx(B,{onClick:()=>L(R),className:"w-full",style:{backgroundColor:q.primaryColor,borderColor:q.primaryColor},children:"Get Started"})]})})]},R.id))}),H.length===0&&s.jsx("div",{className:"text-center py-12",children:s.jsx("p",{className:"text-slate-600",children:"No memberships are currently available."})})]}),s.jsx(Ct,{open:!!t,onOpenChange:()=>n(null),children:s.jsxs(St,{className:"max-w-2xl max-h-[90vh] overflow-hidden flex flex-col w-full mx-2 sm:mx-auto sm:w-auto",onInteractOutside:R=>R.preventDefault(),onPointerDownOutside:R=>R.preventDefault(),children:[s.jsx(kt,{children:s.jsxs(Pt,{children:["Purchase ",t==null?void 0:t.name]})}),s.jsx("div",{className:"overflow-y-auto flex-1 pr-1 pb-4 min-w-0",children:s.jsxs("div",{className:"space-y-6 pl-1",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Contact Information"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"name",children:"Full Name *"}),s.jsx(me,{id:"name",value:i.name,onChange:R=>o(Y=>({...Y,name:R.target.value})),required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"phone",children:"Phone Number *"}),s.jsx(me,{id:"phone",type:"tel",value:i.phone,onChange:R=>o(Y=>({...Y,phone:R.target.value})),required:!0})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",children:"Email Address *"}),s.jsx(me,{id:"email",type:"email",value:i.email,onChange:R=>{const Y=R.target.value;o(M=>({...M,email:Y})),h(""),v(null),g(null),b(!1),j(null),N.current=!1},required:!0}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"You'll receive login details at this email address"})]})]}),J(),s.jsx("div",{className:"border-t pt-4",children:s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold",children:t==null?void 0:t.name}),t!=null&&t.description?s.jsx("p",{className:"text-sm text-slate-600 mt-2 whitespace-pre-line break-words",children:t.description}):null,s.jsxs("p",{className:"text-sm text-slate-600 mt-2",children:[mt((q==null?void 0:q.currency)||"GBP"),t==null?void 0:t.price,(t==null?void 0:t.billingType)==="one_time"?s.jsxs(s.Fragment,{children:[" ","one-time",s.jsx("span",{className:"block text-xs text-slate-500 mt-1",children:re(t==null?void 0:t.oneTimeExpiresAfter)})]}):s.jsxs(s.Fragment,{children:[" ","per"," ",I((t==null?void 0:t.billingFrequency)||"monthly")]})]}),(t==null?void 0:t.billingType)!=="one_time"&&(t==null?void 0:t.renewalDayOfMonth)!=null&&s.jsx("p",{className:"text-xs text-slate-500 mt-1.5",children:(t==null?void 0:t.proRateExistingSubscribers)!==!1?"Your first payment will be pro-rated for the current period.":`Your first payment will be the full amount. You'll renew on the ${t.renewalDayOfMonth}${t.renewalDayOfMonth===1?"st":t.renewalDayOfMonth===2?"nd":t.renewalDayOfMonth===3?"rd":"th"} of each month.`})]})})}),s.jsxs("div",{className:"border-t pt-4",children:[s.jsx(V,{htmlFor:"couponCode",children:"Coupon Code (Optional)"}),s.jsxs("div",{className:"flex gap-2 mt-2",children:[s.jsx(me,{id:"couponCode",value:P,onChange:R=>S(R.target.value.toUpperCase()),placeholder:"Enter coupon code",className:"flex-1"}),s.jsx(B,{type:"button",variant:"outline",onClick:async()=>{var R;if(!(!P.trim()||!t)){T(!0);try{const M=await(await Pe("POST",`/api/memberships/${t.id}/validate-coupon`,{couponCode:P.trim()})).json();O(M),M.isValid?(C({title:"Coupon Applied",description:`Discount of ${mt((q==null?void 0:q.currency)||"GBP")}${(R=M.discountAmount)==null?void 0:R.toFixed(2)} applied!`}),h(""),g(null),b(!1),j(null),N.current=!1):C({title:"Invalid Coupon",description:M.message||"This coupon code is not valid",variant:"destructive"})}catch{C({title:"Error",description:"Failed to validate coupon code",variant:"destructive"})}finally{T(!1)}}},disabled:E||!P.trim(),children:E?"Validating...":"Apply"})]}),(z==null?void 0:z.isValid)&&!x&&s.jsx("div",{className:"mt-2 p-3 bg-green-50 border border-green-200 rounded-lg",children:(()=>{var se,Q,te,G,Z,ie;const R=(t==null?void 0:t.billingType)==="one_time",Y=I((t==null?void 0:t.billingFrequency)||"monthly"),M=R?"one-time":`per ${Y}`;return z.membershipDiscountType==="one_time"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx("span",{className:"text-green-800",children:"Original Price:"}),s.jsxs("span",{className:"font-semibold text-green-900",children:[mt((q==null?void 0:q.currency)||"GBP"),(se=z.originalAmount)==null?void 0:se.toFixed(2)," ",M]})]}),s.jsxs("div",{className:"flex items-center justify-between text-sm mt-1",children:[s.jsx("span",{className:"text-green-800",children:"Discount:"}),s.jsxs("span",{className:"font-semibold text-green-900",children:["-",mt((q==null?void 0:q.currency)||"GBP"),(Q=z.discountAmount)==null?void 0:Q.toFixed(2)]})]}),s.jsxs("div",{className:"flex items-center justify-between text-sm mt-1",children:[s.jsx("span",{className:"text-green-800",children:R?"You pay:":"First Payment:"}),s.jsxs("span",{className:"font-semibold text-green-900",children:[mt((q==null?void 0:q.currency)||"GBP"),(te=z.finalAmount)==null?void 0:te.toFixed(2)]})]}),!R&&s.jsxs("div",{className:"flex items-center justify-between text-sm mt-1 pt-1 border-t border-green-200",children:[s.jsx("span",{className:"text-green-800",children:"Subsequent Payments:"}),s.jsxs("span",{className:"font-semibold text-green-900",children:[mt((q==null?void 0:q.currency)||"GBP"),(G=z.originalAmount)==null?void 0:G.toFixed(2)," per ",Y]})]}),s.jsx("p",{className:"text-xs text-green-700 mt-2 italic",children:R?"* Discount applied to this one-time purchase":"* Discount applies only to your first payment"})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx("span",{className:"text-green-800",children:"Discount Applied:"}),s.jsxs("span",{className:"font-semibold text-green-900",children:["-",mt((q==null?void 0:q.currency)||"GBP"),(Z=z.discountAmount)==null?void 0:Z.toFixed(2)]})]}),s.jsxs("div",{className:"flex items-center justify-between text-sm mt-1",children:[s.jsx("span",{className:"text-green-800",children:"Price:"}),s.jsxs("span",{className:"font-semibold text-green-900",children:[mt((q==null?void 0:q.currency)||"GBP"),(ie=z.finalAmount)==null?void 0:ie.toFixed(2)," ",M]})]}),s.jsx("p",{className:"text-xs text-green-700 mt-2 italic",children:R?"* Discount applies to this purchase":"* Discount applies to all payments"})]})})()}),z&&!z.isValid&&s.jsx("p",{className:"text-sm text-red-600 mt-2",children:z.message})]}),(()=>{const R=U();if(!R.isValid)return s.jsx("div",{className:"border-t pt-4",children:s.jsx("p",{className:"text-sm text-red-600 text-center py-4",children:R.message})});if(p){const Y=p.includes("already has this membership");return s.jsx("div",{className:"border-t pt-4",children:s.jsxs("div",{className:`mb-4 rounded-lg border p-4 ${Y?"border-amber-200 bg-amber-50 text-amber-900":"border-red-200 bg-red-50 text-red-900"}`,children:[s.jsx("div",{className:"font-semibold",children:Y?"You already have this membership":"Unable to process checkout"}),s.jsx("p",{className:"text-sm mt-1",children:p}),s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[Y&&s.jsx(B,{variant:"secondary",onClick:()=>window.location.href=`/my-account/${e}`,className:"border-amber-300 text-amber-900 hover:bg-amber-100",children:"Go to My Account"}),s.jsx(B,{variant:"outline",onClick:()=>{v(null),h(""),g(null),N.current=!1,W(M=>M+1),Y&&k(!1)},className:Y?"border-amber-200 text-amber-900 hover:bg-amber-100":"border-red-200 text-red-900 hover:bg-red-100",children:Y?"Try another email":"Try again"})]})]})})}return D?s.jsx("div",{className:"border-t pt-4",children:x?s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:w!=null&&w.isOneTimeDiscount?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-sm text-green-800 font-semibold mb-2",children:"🎉 Your first payment is free with this coupon code!"}),w&&s.jsxs("div",{className:"text-sm text-green-700 space-y-1",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Original Price:"}),s.jsxs("span",{children:[mt((q==null?void 0:q.currency)||"GBP"),(typeof w.originalPrice=="number"?w.originalPrice
843:parseFloat(w.originalPrice||"0")).toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"First Payment Discount:"}),s.jsxs("span",{children:["-",mt((q==null?void 0:q.currency)||"GBP"),(typeof w.discountAmount=="number"?w.discountAmount:parseFloat(w.discountAmount||"0")).toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between font-semibold pt-2 border-t border-green-200",children:[s.jsx("span",{children:"First Payment:"}),s.jsxs("span",{children:[mt((q==null?void 0:q.currency)||"GBP"),"0.00"]})]}),s.jsxs("div",{className:"flex justify-between text-xs pt-1 text-green-600",children:[s.jsx("span",{children:"Subsequent Payments:"}),s.jsxs("span",{children:[mt((q==null?void 0:q.currency)||"GBP"),(typeof w.originalPrice=="number"?w.originalPrice:parseFloat(w.originalPrice||"0")).toFixed(2)," per ",(t==null?void 0:t.billingFrequency)==="monthly"?"month":t==null?void 0:t.billingFrequency]})]}),s.jsx("p",{className:"text-xs text-green-600 mt-2 italic",children:"* Discount applies only to your first payment"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-sm text-green-800 font-semibold mb-2",children:"🎉 This membership is free with your coupon code!"}),w&&s.jsxs("div",{className:"text-sm text-green-700 space-y-1",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Original Price:"}),s.jsxs("span",{children:[mt((q==null?void 0:q.currency)||"GBP"),(typeof w.originalPrice=="number"?w.originalPrice:parseFloat(w.originalPrice||"0")).toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Discount:"}),s.jsxs("span",{children:["-",mt((q==null?void 0:q.currency)||"GBP"),(typeof w.discountAmount=="number"?w.discountAmount:parseFloat(w.discountAmount||"0")).toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between font-semibold pt-2 border-t border-green-200",children:[s.jsx("span",{children:"Total:"}),s.jsxs("span",{children:[mt((q==null?void 0:q.currency)||"GBP"),"0.00"]})]}),s.jsx("p",{className:"text-xs text-green-600 mt-2 italic",children:"* Discount applies to all payments"})]})]})}),s.jsx(B,{onClick:async()=>{try{const Y=await Pe("POST",`/api/memberships/${t.id}/activate-subscription`,{isFreeMembership:!0,subscriptionId:w==null?void 0:w.subscriptionId,couponCode:P.trim(),clientData:{name:i.name,email:i.email,phone:i.phone,onboardingData:Object.keys(l).length>0?l:void 0}});if(Y.ok)window.location.href=`/classes/${q.subdomain}/membership-success?membership_id=${t.id}&client_email=${encodeURIComponent(i.email)}&client_name=${encodeURIComponent(i.name||i.email)}`;else{const M=await Y.json();C({title:"Activation Failed",description:M.message||"Something went wrong. Please try again.",variant:"destructive"})}}catch(Y){C({title:"Activation Failed",description:Y.message||"Something went wrong. Please try again.",variant:"destructive"})}},className:"w-full",style:{backgroundColor:q.primaryColor,borderColor:q.primaryColor},children:w!=null&&w.isOneTimeDiscount?"Confirm Membership (First Payment Free)":"Confirm Free Membership"})]}):u?d&&q?s.jsxs("div",{className:"space-y-4",children:[s.jsx(yv,{stripe:d,options:{clientSecret:u,appearance:{theme:"stripe",variables:{colorPrimary:q.primaryColor||"#3B82F6"}}},children:s.jsx(CWe,{membership:t,instructor:q,clientData:{...i,onboardingData:Object.keys(l).length>0?l:void 0},clientSecret:u,isOneTimeCheckout:(t==null?void 0:t.billingType)==="one_time",onSuccess:()=>{n(null),o({name:"",email:"",phone:""}),c({})}})}),s.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"w-full text-muted-foreground",onClick:()=>{k(!1),h(""),g(null),N.current=!1},children:"← Back to edit details"})]}):null:s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-4",children:[s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"}),s.jsx("span",{className:"ml-2",children:"Preparing payment..."})]}),s.jsx(B,{type:"button",variant:"ghost",size:"sm",onClick:()=>{k(!1),h(""),g(null),N.current=!1},children:"← Back to edit details"})]})}
843):s.jsx("div",{className:"border-t pt-4",children:s.jsx(B,{type:"button",className:"w-full",onClick:()=>k(!0),style:{backgroundColor:q==null?void 0:q.primaryColor,borderColor:q==null?void 0:q.primaryColor},children:"Continue to payment"})})})()]})})]})})]}):s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"})})}function hL(){const[,e]=cn(),[t,n]=f.useState(null),[r,a]=f.useState(!0),[i,o]=f.useState(null);return f.useEffect(()=>{let l=!1;async function c(){const d=localStorage.getItem("membershipSuccessData");if(d){try{const p=JSON.parse(d);localStorage.removeItem("membershipSuccessData"),l||n(p)}finally{l||a(!1)}return}const m=new URLSearchParams(window.location.search),u=m.get("membership_id"),h=m.get("client_email");if(u&&h)try{const p=await fetch(`/api/memberships/${u}/success-details`);if(!p.ok){l||o("Unable to load confirmation details.");return}const v=await p.json();l||n({instructorName:v.instructorName??"",businessName:v.businessName??"",membershipName:v.membershipName??"",clientEmail:decodeURIComponent(h),amount:v.amount??"0",currency:v.currency??"GBP"})}catch{l||o("Unable to load confirmation details.")}finally{l||a(!1)}else l||a(!1)}return c(),()=>{l=!0}},[]),r?s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:s.jsx(Ce,{className:"max-w-md mx-4",children:s.jsx(Ee,{className:"p-6 text-center",children:s.jsx("p",{className:"text-slate-600",children:"Loading confirmation details..."})})})}):i||!t?s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:s.jsx(Ce,{className:"max-w-md mx-4",children:s.jsxs(Ee,{className:"p-6 text-center",children:[s.jsx("p",{className:"text-slate-600",children:i??"No confirmation details available."}),s.jsx(B,{variant:"outline",className:"mt-4",onClick:()=>e("/"),children:"Go home"})]})})}):s.jsx("div",{className:"min-h-screen bg-slate-50 py-8 px-4",children:s.jsx("div",{className:"max-w-2xl mx-auto",children:s.jsxs(Ce,{className:"mb-6",children:[s.jsxs(gt,{className:"text-center",children:[s.jsx("div",{className:"flex justify-center mb-4",children:s.jsx(qt,{className:"h-16 w-16 text-green-500"})}),s.jsxs(Nt,{className:"text-2xl text-green-700",children:["Welcome to ",t.membershipName,"!"]})]}),s.jsxs(Ee,{className:"space-y-6",children:[s.jsxs("div",{className:"text-center",children:[s.jsxs("p",{className:"text-lg text-slate-700 mb-2",children:["Thank you for joining ",t.businessName]}),s.jsx("p",{className:"text-slate-600",children:"Your subscription has been successfully activated."})]}),s.jsxs("div",{className:"bg-slate-50 p-4 rounded-lg",children:[s.jsx("h3",{className:"font-semibold text-slate-900 mb-2",children:"Subscription Details"}),s.jsxs("div",{className:"space-y-2 text-sm",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Membership:"}),s.jsx("span",{className:"font-medium",children:t.membershipName})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Amount:"}),s.jsxs("span",{className:"font-medium",children:[mt(t.currency),t.amount," / month"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-slate-600",children:"Email:"}),s.jsx("span",{className:"font-medium",children:t.clientEmail})]})]})]}),s.jsx("div",{className:"bg-blue-50 border border-blue-200 p-4 rounded-lg",children:s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(_n,{className:"h-5 w-5 text-blue-600 mt-0.5"}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold text-blue-900 mb-1",children:"Check Your Email"}),s.jsxs("p",{className:"text-blue-800 text-sm",children:["We've sent login details and next steps to ",s.jsx("strong",{children:t.clientEmail}),". If you don't see it within a few minutes, please check your spam folder."]})]})]})}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"text-center p-4 bg-white rounded-lg border",children:[s.jsx(sr,{className:"h-8 w-8 text-blue-600 mx-auto mb-2"}),s.jsx("h4",{className:"font-semibold text-slate-900 mb-1",children:"Member Portal"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Access exclusive content and resources"})]}),s.jsxs("div",{className:"text-center p-4 bg-white rounded-lg border",children:[s.jsx(Ls,{className:"h-8 w-8 text-green-600 mx-auto mb-2"}),s.jsx("h4",{className:"font-semibold text-slate-900 mb-1",children:"Book Classes"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Reserve your spot in member-only sessions"})]}),s.jsxs("div",{className:"text-center p-4 bg-white rounded-lg border",children:[s.jsx(_n,{className:"h-8 w-8 text-purple-600 mx-auto mb-2"}),s.jsx("h4",{className:"font-semibold text-slate-900 mb-1",children:"Direct Support"}),s.jsxs("p",{className:"text-sm text-slate-600",children:["Get personalized guidance from ",t.instructorName]})]})]}),s.jsxs("div",{className:"text-center space-y-3",children:[s.jsxs(B,{onClick:()=>{const c=window.location.pathname.split("/").find(d=>d&&d!=="classes"&&d!=="membership-success");if(c)e(`/classes/${c}`);else{const d=sessionStorage.getItem("currentInstructorSubdomain");
843e(d?`/classes/${d}`:"/")}},className:"w-full sm:w-auto",children:["Back to ",t.businessName]}),s.jsxs("p",{className:"text-sm text-slate-500",children:["Questions? Contact ",t.instructorName," directly through your member portal."]})]})]})]})})})}function fL(){const{subdomain:e}=sa(),{data:t,isLoading:n}=Ue({queryKey:[`/api/instructor/by-subdomain/${e}`],enabled:!!e});return n?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-gray-900 mx-auto"}),s.jsx("p",{className:"mt-4 text-gray-600",children:"Loading..."})]})}):t?s.jsx("div",{className:"min-h-screen bg-gray-50 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsxs("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:[t.businessName||t.instructorName,"'s Bundles"]}),s.jsx("p",{className:"text-gray-600",children:"Purchase session bundles to save on your bookings"})]}),s.jsx(Pw,{instructorId:t.id})]})}):s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Instructor Not Found"}),s.jsx("p",{className:"text-gray-600",children:"The instructor you're looking for doesn't exist."})]})})}function kX({instructor:e}){const[,t]=cn(),{toast:n}=Yt(),[r,a]=f.useState(""),[i,o]=f.useState(!1),[l,c]=f.useState("magic"),[d,m]=f.useState(""),[u,h]=f.useState(!1);f.useEffect(()=>{if(!e)return;const y=localStorage.getItem(`member_token_${e.id}`);if(y)try{const g=JSON.parse(y);if(g.token&&new Date().getTime()<=g.expires){const b=window.location.pathname.match(/^\/(?:classes|cal)\/([^\/]+)\//),w=b?b[1]:e.subdomain;w&&t(`/classes/${w}/member-area`);return}}catch{localStorage.removeItem(`member_token_${e.id}`)}},[e,t]);const p=async y=>{if(y.preventDefault(),!!r){o(!0);try{if((await Pe("POST",`/api/instructors/${e.id}/member-login`,{email:r,loginMethod:"magic"})).ok)n({title:"Magic Link Sent!",description:"Check your email for a secure login link."});else throw new Error("Failed to send magic link")}catch(g){n({title:"Login Failed",description:g.message||"Unable to send magic link. Please try again.",variant:"destructive"})}finally{o(!1)}}},v=async y=>{if(y.preventDefault(),!(!r||!d)){o(!0);try{const g=await Pe("POST",`/api/instructors/${e.id}/member-login`,{email:r,password:d,loginMethod:"password"});if(g.ok){const x=await g.json(),b=new Date().getTime()+24*60*60*1e3,w={token:x.token,expires:b};if(localStorage.setItem(`member_token_${e.id}`,JSON.stringify(w)),new URLSearchParams(window.location.search).get("returnTo")==="booking")window.close(),setTimeout(()=>{t("/"),n({title:"Member Login Successful!",description:"You can now see your special member pricing when booking classes.",variant:"default"})},100);else{const P=window.location.pathname.match(/^\/(?:classes|cal)\/([^\/]+)\//),S=P?P[1]:e.subdomain;S&&t(`/classes/${S}/member-area`)}}else throw new Error("Invalid email or password")}catch(g){n({title:"Login Failed",description:g.message||"Invalid email or password.",variant:"destructive"})}finally{o(!1)}}};return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"max-w-md w-full space-y-8",children:[s.jsxs("div",{className:"text-center",children:[e.logoUrl&&s.jsx("img",{src:e.logoUrl,alt:e.businessName,className:"mx-auto h-16 w-auto mb-4"}),s.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Member Login"}),s.jsxs("p",{className:"mt-2 text-gray-600 dark:text-gray-400",children:["Access your ",e.businessName," membership"]})]}),s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Welcome Back!"}),s.jsx(Ys,{children:"Choose your preferred login method"})]}),s.jsxs(Ee,{className:"space-y-6",children:[s.jsxs("div",{className:"flex rounded-lg bg-gray-100 dark:bg-gray-800 p-1",children:[s.jsx("button",{type:"button",onClick:()=>c("magic"),className:`flex-1 py-2 px-3 rounded-md text-sm font-medium transition-colors ${l==="magic"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:"Magic Link"}),s.jsx("button",{type:"button",onClick:()=>c("password"),className:`flex-1 py-2 px-3 rounded-md text-sm font-medium transition-colors ${l==="password"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:"Password"})]}),l==="magic"?s.jsxs("form",{onSubmit:p,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",children:"Email Address"}),s.jsx(me,{id:"email",type:"email",value:r,onChange:y=>a(y.target.value),placeholder:"Enter your email",required:!0})]}
843),s.jsx(B,{type:"submit",className:"w-full",disabled:i||!r,style:{backgroundColor:e.primaryColor},children:i?"Sending...":"Send Magic Link"}),s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 text-center",children:"We'll send you a secure link to access your membership area"})]}):s.jsxs("form",{onSubmit:v,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",children:"Email Address"}),s.jsx(me,{id:"email",type:"email",value:r,onChange:y=>a(y.target.value),placeholder:"Enter your email",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"password",children:"Password"}),s.jsxs("div",{className:"relative mt-1",children:[s.jsx(me,{id:"password",type:u?"text":"password",value:d,onChange:y=>m(y.target.value),placeholder:"Enter your password",className:"pr-10",required:!0}),s.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>h(y=>!y),"aria-label":u?"Hide password":"Show password",children:u?s.jsx(uc,{className:"h-4 w-4"}):s.jsx(wa,{className:"h-4 w-4"})})]})]}),s.jsx(B,{type:"submit",className:"w-full",disabled:i||!r||!d,style:{backgroundColor:e.primaryColor},children:i?"Signing In...":"Sign In"}),s.jsx("div",{className:"text-center",children:s.jsx("button",{type:"button",onClick:()=>c("magic"),className:"text-sm text-gray-600 dark:text-gray-400 hover:underline",children:"Don't have a password? Use magic link instead"})})]})]})]}),s.jsx("div",{className:"text-center",children:s.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Not a member yet?"," ",s.jsx("button",{onClick:()=>t(`/classes/${e.subdomain}/memberships`),className:"font-medium hover:underline",style:{color:e.primaryColor},children:"View Membership Options"})]})})]})})}function pL(){const{subdomain:e}=sa(),{data:t,isLoading:n,error:r}=Ue({queryKey:[`/api/instructor/by-subdomain/${e}`],enabled:!!e});return n?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"})}):r||!t?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Instructor Not Found"}),s.jsx("p",{className:"text-gray-600",children:"The instructor page you're looking for doesn't exist."})]})}):s.jsx(kX,{instructor:t})}function SWe({instructor:e}){var D;const{toast:t}=Yt(),n=jn(),[r,a]=f.useState(null),[i,o]=f.useState(!1),[l,c]=f.useState(""),[d,m]=f.useState(""),[u,h]=f.useState(!1),[p,v]=f.useState(null);f.useEffect(()=>{const k=localStorage.getItem(`member_token_${e.id}`);if(k)try{const F=JSON.parse(k),W=new Date().getTime();F.expires&&W<F.expires?a(F.token):localStorage.removeItem(`member_token_${e.id}`)}catch{localStorage.removeItem(`member_token_${e.id}`)}},[e.id]);const{data:y,isLoading:g}=Ue({queryKey:[`/api/member/${e.id}/data`],queryFn:async()=>{console.log("🔑 Frontend: Making member data request with token:",r?"Present":"Missing"),console.log("🔑 Frontend: Token value:",(r==null?void 0:r.substring(0,20))+"...");const k=await fetch(`/api/member/${e.id}/data`,{headers:{Authorization:`Bearer ${r}`,"Cache-Control":"no-cache"}});if(console.log("🔑 Frontend: Response status:",k.status),!k.ok)throw new Error(`${k.status}: ${k.statusText}`);const F=await k.json();return console.log("🔑 Frontend: Response data:",JSON.stringify(F,null,2)),F},enabled:!!r,retry:!1,staleTime:0}),{data:x,isLoading:b}=Ue({queryKey:[`/api/member/${e.id}/membership-posts`,p],queryFn:async()=>{const k=await fetch(`/api/member/${e.id}/membership-posts?membershipId=${p}`,{headers:{Authorization:`Bearer ${r}`}});if(!k.ok)throw new Error(`${k.status}: ${k.statusText}`);return k.json()},enabled:!!r&&!!p,retry:!1}),w=()=>{localStorage.removeItem(`member_token_${e.id}`),a(null),window.location.href=`/classes/${e.subdomain}`},j=()=>{o(!0)},N=async()=>{if(l.length<8){t({title:"Password Too Short",description:"Password must be at least 8 characters long.",variant:"destructive"});return}if(l.length>128){t({title:"Password Too Long",description:"Password must be no more than 128 characters long.",variant:"destructive"});return}if(l!==d){t({title:"Passwords Don't Match",description:"Please make sure both password fields match.",variant:"destructive"});return}h(!0);try{const k=await fetch(`/api/member/${e.id}/set-password`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({password:l})});if(k.ok)t({title:"Password Set Successfully!",description:"You can now log in with your email and password."}),o(!1),c(""),m("");else{const F=await k.json();throw new Error(F.message||"Failed to set password")}}catch(k){t({title:"Error Setting Password",description:k.message||"Unable to set password. Please try again.",variant:"destructive"})}finally{h(!1)}};if(!r)return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:s.jsxs(Ce,{className:"max-w-md w-full",children:[s.jsxs(gt,{className:"text-center",children:[s.jsx(Nt,{children:"Access Denied"}),s.jsx(Ys,{children:"Please log in to access your membership area"})]}),s.jsx(Ee,{children:s.jsx(B,{onClick:()=>window.location.href=`/classes/${e.subdomain}/member-login`,className:"w-full",style:{backgroundColor:e.primaryColor},children:"Go to Login"})})]})});if(g||p&&b)return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent roun
843ded-full mx-auto mb-4"}),s.jsx("p",{children:"Loading your membership area..."})]})});const C=(y==null?void 0:y.subscriptions)||[],P=x||[],S=async k=>{try{(await Pe("POST",`/api/member/${e.id}/cancel-subscription`,{subscriptionId:k})).ok&&(t({title:"Subscription Cancelled",description:"Your subscription has been cancelled. You'll retain access until the end of your billing period."}),n.invalidateQueries({queryKey:[`/api/instructors/${e.id}/member-data`]}))}catch{t({title:"Error",description:"Failed to cancel subscription. Please try again.",variant:"destructive"})}},E=k=>{if(!k)return"<p>No content available</p>";try{const F=JSON.parse(k);return T(F)}catch{return k}},T=k=>k.map(F=>{if(F.type==="paragraph")return`<p class="mb-4">${z(F.children)}</p>`;if(F.type==="heading-one")return`<h1 class="text-2xl font-bold mb-4">${z(F.children)}</h1>`;if(F.type==="heading-two")return`<h2 class="text-xl font-semibold mb-4">${z(F.children)}</h2>`;if(F.type==="link"){const W=z(F.children);return`<a href="${F.url}" class="text-blue-600 underline hover:text-blue-800" target="_blank" rel="noopener noreferrer">${W}</a>`}else{if(F.type==="bulleted-list")return`<ul class="list-disc pl-5 mb-4">${F.children.map(q=>`<li class="mb-1">${z(q.children)}</li>`).join("")}</ul>`;if(F.type==="numbered-list")return`<ol class="list-decimal pl-5 mb-4">${F.children.map(q=>`<li class="mb-1">${z(q.children)}</li>`).join("")}</ol>`;if(F.type==="image"){const W=F.width?`width="${F.width}"`:"",q=`<img src="${F.url}" ${W} style="max-width: 100%; height: auto;" alt="" class="rounded mb-4" />`;return F.linkUrl?`<a href="${F.linkUrl}" target="_blank" rel="noopener noreferrer">${q}</a>`:q}else if(F.type==="video")return`<iframe src="${F.url}" width="560" height="315" frameborder="0" allowfullscreen style="max-width: 100%;" class="rounded mb-4"></iframe>`}return""}).join(""),z=k=>k.map(F=>{if(F.type==="link"){const W=z(F.children);return`<a href="${F.url}" class="text-blue-600 underline hover:text-blue-800" target="_blank" rel="noopener noreferrer">${W}</a>`}else{let W=F.text||"";return F.bold&&(W=`<strong>${W}</strong>`),F.italic&&(W=`<em>${W}</em>`),F.underline&&(W=`<u>${W}</u>`),W}}).join(""),O=k=>s.jsxs(Ce,{className:"mb-4",children:[s.jsx(gt,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Nt,{className:"text-lg",children:k.title}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("span",{className:"text-sm text-gray-500",children:new Date(k.createdAt).toLocaleDateString()})})]})}),s.jsx(Ee,{children:s.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:E(k.content)}})})]},k.id);return s.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[s.jsx("header",{className:"bg-white dark:bg-gray-800 shadow-sm border-b",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[s.jsx("div",{className:"py-2 border-b border-gray-200 dark:border-gray-700",children:s.jsx("a",{href:`/classes/${e.subdomain}`,className:"inline-flex items-center gap-2 text-sm text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 transition-colors",children:"← Back to Classes"})}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-4 sm:py-6 gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.logoUrl&&s.jsx("img",{src:e.logoUrl,alt:e.businessName,className:"h-6 sm:h-8 w-auto flex-shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h1",{className:"text-xl sm:text-2xl font-bold truncate",children:e.businessName}),s.jsx("p",{className:"text-sm sm:text-base text-gray-600 dark:text-gray-400",children:"Member Area"})]})]}),s.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-shrink-0",children:[s.jsxs(B,{onClick:j,variant:"outline",size:"sm",className:"text-xs sm:text-sm px-2 sm:px-3",children:[s.jsx("span",{className:"hidden sm:inline",children:"Set Password"}),s.jsx("span",{className:"sm:hidden",children:"Password"})]}),s.jsx(B,{onClick:w,variant:"outline",size:"sm",className:"text-xs sm:text-sm px-2 sm:px-3",children:"Logout"})]})]})]})}),s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:p?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 sm:gap-4",children:[s.jsxs(B,{variant:"outline",onClick:()=>v(null),className:"flex items-center gap-2 w-fit text-sm sm:text-base px-3 py-2",size:"sm",children:["← ",s.jsx("span",{className:"hidden xs:inline",children:"Back to Memberships"}),s.jsx("span",{className:"xs:hidden",children:"Back"})]}),s.jsx("div",{className:"min-w-0 flex-1",children:s.jsxs("h2",{className:"text-xl sm:text-2xl font-bold break-words",children:[(D=C.find(k=>k.membershipId===p))==null?void 0:D.membershipName," Posts"]})})]}),P.length===0?s.jsx(Ce,{children:s.jsxs(Ee,{className:"text-center py-12",children:[s.jsx(ad,{
843className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Posts Yet"}),s.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"No posts have been shared for this membership yet. Check back soon!"})]})}):s.jsx("div",{className:"space-y-4",children:P.map(O)})]}):s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Your Memberships"}),s.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"Click on a membership to view its content and posts"})]}),C.length===0?s.jsx(Ce,{children:s.jsxs(Ee,{className:"text-center py-12",children:[s.jsx(hw,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Active Memberships"}),s.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"You don't have any active memberships yet."})]})}):s.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:C.map(k=>s.jsxs(Ce,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>v(k.membershipId),children:[s.jsx(gt,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Nt,{className:"text-lg",children:k.membershipName}),s.jsx(Je,{variant:k.status==="active"?"default":k.status==="canceled"?"destructive":"secondary",className:"capitalize",children:k.status})]})}),s.jsxs(Ee,{children:[s.jsxs("div",{className:"space-y-2 text-sm text-gray-600 dark:text-gray-400",children:[!k.neverExpires&&k.currentPeriodEnd&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ls,{className:"h-4 w-4"}),k.status==="canceled"?`Access until: ${new Date(k.currentPeriodEnd).toLocaleDateString()}`:`${h1(k.stripeSubscriptionId)?"Renews":"Expires"}: ${new Date(k.currentPeriodEnd).toLocaleDateString()}`]}),k.usageLimit&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ei,{className:"h-4 w-4"}),"Usage: ",k.usageCount||0," / ",k.usageLimit]})]}),s.jsxs("div",{className:"mt-4 flex gap-2",children:[s.jsx(B,{variant:"outline",size:"sm",onClick:F=>{F.stopPropagation(),v(k.membershipId)},children:"View Posts"}),k.status==="cancelled"&&s.jsxs("div",{className:"text-xs text-orange-600 dark:text-orange-400 font-medium",children:["Subscription cancelled - access until ",new Date(k.currentPeriodEnd).toLocaleDateString()]}),k.status==="active"&&s.jsxs(Zi,{children:[s.jsx(dO,{asChild:!0,children:s.jsx(B,{variant:"outline",size:"sm",onClick:F=>F.stopPropagation(),children:"Cancel"})}),s.jsxs(bi,{className:"max-w-md",children:[s.jsxs(wi,{children:[s.jsx(Ni,{children:"Cancel Subscription?"}),s.jsx(Ci,{asChild:!0,children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"text-left",children:[s.jsx("div",{className:"font-medium mb-2",children:"You're about to cancel:"}),s.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-lg p-3 space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Membership:"}),s.jsx("span",{className:"font-medium",children:k.membershipName})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Price:"}),s.jsxs("span",{className:"font-medium",children:["£",k.membershipPrice,"/",k.membershipBillingFrequency]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Next billing:"}),s.jsx("span",{className:"font-medium",children:new Date(k.currentPeriodEnd).toLocaleDateString()})]})]})]}),s.jsxs("div",{className:"text-left",children:[s.jsx("div",{className:"font-medium mb-2 text-amber-600 dark:text-amber-400",children:"What you'll lose:"}),s.jsxs("ul",{className:"text-sm space-y-1 text-gray-600 dark:text-gray-400",children:[s.jsx("li",{children:"• Access to exclusive membership content"}),s.jsx("li",{children:"• New posts and updates"}),s.jsx("li",{children:"• Member-only resources and materials"}),s.jsxs("li",{children:["• Direct access to ",e.instructorName]})]})]}),s.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3 text-left",children:s.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200",children:[s.jsx("strong",{children:"Good news:"})," If you cancel now, you'll keep access until ",new Date(k.currentPeriodEnd).toLocaleDateString()," - no immediate loss of access!"]})}),s.jsx("div",{className:"text-sm font-medium",children:"Are you sure you want to cancel your subscription?"})]})})]}),s.jsxs(ji,{className:"flex-col sm:flex-row gap-2",children:[s.jsx(to,{className:"w-full sm:w-auto",children:"Keep My Subscription"}),s.jsx(eo,{onClick:()=>S(k.id),className:"w-full sm:w-auto bg-red-600 hover:bg-red-700 text-white",children:"Yes, Cancel Subscription"})]})]})]})]})]})]},k.id))})]})}),s.jsx(Ct,{open:i,onOpenChange:o,children:s.jsxs(St,{className:"sm:max-w-md",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Set Up Password"}),s.jsx(yn,{children:"Create a password for easier login in the future. You'll still be able to use magic links."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"password",children:"Password"}
843),s.jsx(me,{id:"password",type:"password",value:l,onChange:k=>c(k.target.value),placeholder:"Enter password (min 8 characters)",disabled:u,maxLength:128})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"confirmPassword",children:"Confirm Password"}),s.jsx(me,{id:"confirmPassword",type:"password",value:d,onChange:k=>m(k.target.value),placeholder:"Confirm your password",disabled:u,maxLength:128})]}),s.jsxs("div",{className:"flex gap-2 pt-4",children:[s.jsx(B,{variant:"outline",onClick:()=>o(!1),disabled:u,className:"flex-1",children:"Cancel"}),s.jsx(B,{onClick:N,disabled:u||!l||!d,className:"flex-1",style:{backgroundColor:e.primaryColor},children:u?"Setting...":"Set Password"})]})]})]})})]})}function xL(){const{subdomain:e}=sa(),{toast:t}=Yt(),[n,r]=f.useState(!1),[a,i]=f.useState(!1),{data:o,isLoading:l,error:c}=Ue({queryKey:[`/api/instructor/by-subdomain/${e}`],enabled:!!e});return f.useEffect(()=>{if(!o)return;const m=new URLSearchParams(window.location.search).get("token");m?(i(!0),localStorage.removeItem(`member_token_${o.id}`),localStorage.removeItem(`member_data_${o.id}`),r(!1),Pe("GET",`/api/instructors/${o.id}/validate-magic-token?token=${m}`).then(u=>(console.log("🔍 Magic link validation response status:",u.status),u.json())).then(u=>{if(console.log("🔍 Magic link validation data:",u),u.success){console.log("🔍 Storing session token and setting authenticated");const h={token:u.sessionToken,expires:new Date().getTime()+7*24*60*60*1e3};localStorage.setItem(`member_token_${o.id}`,JSON.stringify(h)),localStorage.setItem(`member_data_${o.id}`,JSON.stringify(u.member)),r(!0);const p=window.location.pathname;window.history.replaceState({},"",p),t({title:"Login Successful!",description:"Welcome to your membership area."})}else console.log("🔍 Magic link validation failed:",u.message),t({title:"Login Failed",description:u.message||"Invalid or expired login link.",variant:"destructive"})}).catch(u=>{console.error("Token validation error:",u),t({title:"Login Failed",description:"Unable to validate login link. Please try again.",variant:"destructive"})}).finally(()=>{i(!1)})):localStorage.getItem(`member_token_${o.id}`)&&r(!0)},[o,t]),l||a?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full mb-4"}),s.jsx("p",{className:"text-gray-600",children:l?"Loading...":"Validating login..."})]})}):c||!o?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Instructor Not Found"}),s.jsx("p",{className:"text-gray-600",children:"The instructor page you're looking for doesn't exist."})]})}):n?s.jsx(SWe,{instructor:o}):s.jsx(kX,{instructor:o})}function gL(){const{subdomain:e}=sa(),[,t]=cn(),{toast:n}=Yt(),[r,a]=f.useState(""),[i,o]=f.useState(""),[l,c]=f.useState(!1),d=localStorage.getItem("memberSessionToken"),m=async h=>{if(h.preventDefault(),!d){n({title:"Session Expired",description:"Please log in again to set up your password.",variant:"destructive"}),t(`/classes/${e}/member-login`);return}if(r.length<8){n({title:"Password Too Short",description:"Password must be at least 8 characters long.",variant:"destructive"});return}if(r.length>128){n({title:"Password Too Long",description:"Password must be no more than 128 characters long.",variant:"destructive"});return}if(r!==i){n({title:"Passwords Don't Match",description:"Please make sure both password fields match.",variant:"destructive"});return}c(!0);try{const p=await fetch("/api/member/set-password",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`},body:JSON.stringify({password:r})});if(p.ok)n({title:"Password Set Successfully",description:"You can now use your email and password to log in."}),t(`/classes/${e}/member-area`);else{const v=await p.json();throw new Error(v.message||"Failed to set password")}}catch(p){console.error("Error setting password:",p),n({title:"Error",description:p.message||"Failed to set password. Please try again.",variant:"destructive"})}finally{c(!1)}},u=()=>{t(`/classes/${e}/member-area`)};return s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 flex items-center justify-center p-4",children:s.jsxs(Ce,{className:"w-full max-w-md",children:[s.jsxs(gt,{className:"text-center",children:[s.jsx(Nt,{className:"text-2xl font-bold text-gray-900",children:"Set Up Your Password"}),s.jsx(Ys,{className:"text-gray-600",children:"Create a password to make future logins easier"})]}),s.jsxs(Ee,{children:[s.jsxs("form",{onSubmit:m,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"password",children:"Password"}),s.jsx(me,{id:"password",type:"password",value:r,onChange:h=>a(h.target.value),placeholder:"Enter your password",required:!0,disabled:l,maxLength:128}),s.jsx("p",{className:"text-sm text-gray-500",children:"Must be at least 8 characters long"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(V,{htmlFor:"confirmPassword",children:"Confirm Password"}),s.jsx(me,{id:"confirmPassword",type:"password",value:i,onChange:h=>o(h.target.value),placeholder:"Confirm your password",required:!0,disabled:l,maxLength:128})]}
vendor: 2,509 bytes, line 843
843),s.jsxs("div",{className:"space-y-3 pt-4",children:[s.jsx(B,{type:"submit",className:"w-full",disabled:l||!r||!i,children:l?"Setting Password...":"Set Password"}),s.jsx(B,{type:"button",variant:"outline",className:"w-full",onClick:u,disabled:l,children:"Skip for Now"})]})]}),s.jsx("div",{className:"mt-6 text-center",children:s.jsx("p",{className:"text-sm text-gray-500",children:"You can always set up a password later from your member area"})})]})]})})}var hC="Collapsible",[kWe]=ua(hC),[PWe,WF]=kWe(hC),PX=f.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:a,disabled:i,onOpenChange:o,...l}=e,[c,d]=yi({prop:r,defaultProp:a??!1,onChange:o,caller:hC});return s.jsx(PWe,{scope:n,disabled:i,contentId:pi(),open:c,onOpenToggle:f.useCallback(()=>d(m=>!m),[d]),children:s.jsx(ms.div,{"data-state":VF(c),"data-disabled":i?"":void 0,...l,ref:t})})});PX.displayName=hC;var EX="CollapsibleTrigger",DX=f.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,a=WF(EX,n);return s.jsx(ms.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":VF(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...r,ref:t,onClick:At(e.onClick,a.onOpenToggle)})});DX.displayName=EX;var HF="CollapsibleContent",AX=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=WF(HF,e.__scopeCollapsible);return s.jsx(Na,{present:n||a.open,children:({present:i})=>s.jsx(EWe,{...r,ref:t,present:i})})});AX.displayName=HF;var EWe=f.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:a,...i}=e,o=WF(HF,n),[l,c]=f.useState(r),d=f.useRef(null),m=Us(t,d),u=f.useRef(0),h=u.current,p=f.useRef(0),v=p.current,y=o.open||l,g=f.useRef(y),x=f.useRef(void 0);return f.useEffect(()=>{const b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),ea(()=>{const b=d.current;if(b){x.current=x.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const w=b.getBoundingClientRect();u.current=w.height,p.current=w.width,g.current||(b.style.transitionDuration=x.current.transitionDuration,b.style.animationName=x.current.animationName),c(r)}},[o.open,r]),s.jsx(ms.div,{"data-state":VF(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!y,...i,ref:m,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style},children:y&&a})});function VF(e){return e?"open":"closed"}var DWe=PX;
843const AWe=DWe,TWe=DX,OWe=AX,FWe="Europe/London";function _We(e,t=FWe){if(typeof e=="string"){const r=e.match(/^(\d{4}-\d{2}-\d{2})/);if(r)return r[1]}const n=TX(e instanceof Date?e:new Date(e),t);return`${n.year}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}function TX(e,t){var a,i,o,l,c;const r=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(e);return{year:parseInt(((a=r.find(d=>d.type==="year"))==null?void 0:a.value)||"0",10),month:parseInt(((i=r.find(d=>d.type==="month"))==null?void 0:i.value)||"0",10),day:parseInt(((o=r.find(d=>d.type==="day"))==null?void 0:o.value)||"0",10),hour:parseInt(((l=r.find(d=>d.type==="hour"))==null?void 0:l.value)||"0",10),minute:parseInt(((c=r.find(d=>d.type==="minute"))==null?void 0:c.value)||"0",10)}}function MWe(e){return Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,0)}function $We(e,t){let n=e||"00:00";if(typeof n=="string"&&n.trim().startsWith("{"))try{const r=JSON.parse(n);if(typeof r=="object"&&r!==null){const[a,i,o]=t.split("-").map(Number),l=new Date(Date.UTC(a,i-1,o)).getUTCDay();n=r[l.toString()]||Object.values(r)[0]||"00:00"}}catch{}return n}function IWe(e){const[t,n]=e.split(":").map(Number);return{hours:t||0,minutes:n||0}}function RWe(e,t,n){const a=_We(e,n),i=$We(t,a),{hours:o,minutes:l}=IWe(i),[c,d,m]=a.split("-").map(Number);return Date.UTC(c,d-1,m,o,l,0)}function BWe(e,t=new Date){return MWe(TX(t,e))}function LWe(e){const t=e.instructorTimezone,n=e.now??new Date,r=RWe(e.classDate,e.classStartTime,t),a=BWe(t,n);if(r<=a)return!1;if(e.cancellationDaysBefore===null||e.cancellationDaysBefore===void 0)return!0;const i=typeof e.cancellationDaysBefore=="string"?parseFloat(e.cancellationDaysBefore):Number(e.cancellationDaysBefore);return isNaN(i)?!0:(r-a)/(1e3*60*60*24)>i}function UWe(e){return e.allowClientCancellation?LWe({classDate:e.classDate,classStartTime:e.classStartTime,cancellationDaysBefore:e.cancellationDaysBefore,instructorTimezone:e.instructorTimezone,now:e.now}):!1}function VD(e){if(!e||e.includes("{"))return"";const[t,n]=e.split(":"),r=parseInt(t,10),a=parseInt(n,10);if(Number.isNaN(r)||Number.isNaN(a))return"";const i=r%12||12,o=r>=12?"PM":"AM";return`${i}:${String(a).padStart(2,"0")} ${o}`}function zWe(e){const t=VD(e);return t?` · ${t}`:""}function KD(e){const t=(e||"").split("T")[0],[n,r,a]=t.split("-").map(i=>parseInt(i,10));return!n||!r||!a?null:new Date(n,r-1,a)}function qWe(e,t){let n=t||"";if(n.startsWith("{"))try{const i=JSON.parse(n),o=KD(e);if(o&&i&&typeof i=="object"&&!Array.isArray(i)){const l=i[String(o.getDay())];n=typeof l=="string"?l:""}}catch{n=""}const r=VD(n);if(r)return r;const a=(e||"").match(/T(\d{2}):(\d{2})/);return a?VD(`${a[1]}:${a[2]}`):""}function WWe({membership:e,instructor:t,clientData:n,onSuccess:r,isOneTimeCheckout:a}){const i=l1(),o=o1(),{toast:l}=Yt(),[c,d]=f.useState(!1),m=async u=>{var h,p;if(u.preventDefault(),!(!i||!o)){d(!0);try{const{error:v,paymentIntent:y}=await i.confirmPayment({elements:o,confirmParams:{},redirect:"if_required"});if(v){l({title:"Payment Failed",description:v.message,variant:"destructive"});return}if(y&&y.status==="succeeded"){console.log("Payment succeeded, activating membership..."),console.log("Payment intent metadata:",y.metadata);const g=y.client_secret,x=g?sessionStorage.getItem(`membership_response_${g}`):null,b=x?JSON.parse(x):{};if(a===!0||b.isOneTimePurchase===!0){if((await Pe("POST",`/api/memberships/${e.id}/activate-subscription`,{paymentIntentId:y.id,isOneTimePurchase:!0,clientData:{name:n.name,email:n.email,phone:n.phone,onboardingData:n.onboardingData}})).ok)l({title:"Success!",description:"Your membership has been activated successfully."}),r();else throw new Error("Failed to activate membership");return}let j=((h=y.metadata)==null?void 0:h.subscription_id)||((p=y.metadata)==null?void 0:p.subscriptionId);if(!j&&y.client_secret){const N=sessionStorage.getItem(`membership_response_${y.client_secret}`);N&&(j=JSON.parse(N).subscriptionId,console.log("Using subscription ID from stored response:",j))}if(j)if((await Pe("POST",`/api/memberships/${e.id}/activate-subscription`,{subscriptionId:j,clientData:{name:n.name,email:n.email,phone:n.phone,onboardingData:n.onboardingData}})).ok)l({title:"Success!",description:"Your subscription has been activated successfully."}),r();else throw new Error("Failed to activate membership");else throw new Error("No subscription ID found")}}catch(v){console.error("Payment processing error:",v),l({title:"Payment Failed",description:v.message||"Something went wrong. Please try again.",variant:"destructive"})}finally{d(!1)}}};return s.jsxs("form",{onSubmit:m,className:"space-y-4",children:[s.jsx(MT,{}
843),s.jsx(B,{type:"submit",className:"w-full",disabled:!i||c,style:{backgroundColor:t.primaryColor,borderColor:t.primaryColor,color:`hsl(${Rl(t.primaryColor)})`},children:c?"Processing...":a?`Pay for ${(e==null?void 0:e.name)||"Membership"}`:`Subscribe to ${(e==null?void 0:e.name)||"Membership"}`})]})}function HWe({instructorId:e}){const{data:t=[],isLoading:n}=Ue({queryKey:[`/api/client/waitlist/${e}`],queryFn:async()=>{if(!e)return[];const r=await Pe("GET",`/api/client/waitlist/${e}`);if(!r.ok)throw new Error("Failed to fetch waitlist");return r.json()},enabled:!!e});return n?s.jsx("div",{className:"p-4",children:"Loading waitlist..."}):t.length===0?s.jsx("div",{className:"p-8 text-center text-slate-500",children:s.jsx("p",{children:"You're not on any waitlists at the moment."})}):s.jsx("div",{className:"space-y-4",children:t.map(r=>s.jsx(Ce,{children:s.jsx(Ee,{className:"p-4",children:s.jsx("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("h3",{className:"font-semibold text-lg",children:"Waitlist Entry"}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Ls,{className:"w-4 h-4"}),new Date(r.classDate+"T00:00:00").toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(ei,{className:"w-4 h-4"}),r.classTime]}),r.notifiedAt&&s.jsxs(Je,{variant:"outline",className:"w-fit",children:["Notified ",new Date(r.notifiedAt).toLocaleDateString()]})]})})})},r.id))})}function VWe(){var Vt,Te,at,ss,ps,bs,Ss,xs,hs,gs,Os,cs,Tr,rr;new URLSearchParams(window.location.pathname.split("/").pop()||"");const e=window.location.pathname.split("/").pop(),{toast:t}=Yt(),n=jn();JH();const[r,a]=f.useState(!1),[i,o]=f.useState(null),[l,c]=f.useState({email:"",password:""}),[d,m]=f.useState("magic"),[u,h]=f.useState(!1),[p,v]=f.useState(""),[y,g]=f.useState(""),[x,b]=f.useState(null),[w,j]=f.useState(!1),[N,C]=f.useState(!1),[P,S]=f.useState(null),[E,T]=f.useState([]),[z,O]=f.useState(""),[D,k]=f.useState(null),[F,W]=f.useState(!1),[q,H]=f.useState(!1),[_,L]=f.useState(null),[U,J]=f.useState(!1),[I,re]=f.useState(!1),[R,Y]=f.useState({name:"",email:"",subject:"",message:""}),[M,se]=f.useState(null),[Q,te]=f.useState({name:"",email:"",phone:""}),[G,Z]=f.useState({}),[ie,A]=f.useState(null),[ge,je]=f.useState(""),[ke,Ie]=f.useState(!1),[$e,qe]=f.useState(null),[ft,be]=f.useState(!1),[Fe,_e]=f.useState("google"),ze=xe=>{if(!xe)return"";if(xe.startsWith("/objects/"))return xe;const He=xe.indexOf("/objects/");return He>=0?xe.slice(He):xe},{data:ue,isLoading:Me}=Ue({queryKey:[`/api/instructor/by-subdomain/${e}`],enabled:!!e});f.useEffect(()=>{if(ue!=null&&ue.primaryColor){const xe=document.documentElement,He=Cv(ue.primaryColor);xe.style.setProperty("--primary",YH(He)),xe.style.setProperty("--primary-foreground",Rl(He))}return()=>{if(ue!=null&&ue.primaryColor){const xe=document.documentElement;xe.style.removeProperty("--primary"),xe.style.removeProperty("--primary-foreground")}}},[ue==null?void 0:ue.primaryColor]);const pt=xe=>{try{const He=xe.split(".");if(He.length!==3)return console.log("🔒 Token validation: Invalid token format (not 3 parts)"),!0;const tt=JSON.parse(atob(He[1]));if(!tt.exp)return console.log("🔒 Token validation: No expiration claim, assuming not expired"),!1;const Jt=tt.exp*1e3,ds=Date.now(),zs=new Date(Jt),De=new Date(ds),we=ds>=Jt;return console.log("🔒 Token expiration check:",{exp:tt.exp,expirationTime:Jt,expirationDate:zs.toISOString(),now:ds,nowDate:De.toISOString(),isExpired:we,secondsUntilExpiry:Math.floor((Jt-ds)/1e3)}),we}catch(He){return console.error("🔒 Error checking token expiration:",He),!0}};f.useEffect(()=>{if(ue!=null&&ue.id){const He=new URLSearchParams(window.location.search).get("token");if(He)Pe("POST","/api/client/validate-token",{token:He,instructorId:ue.id}).then(tt=>tt.json()).then(tt=>{if(tt.success&&tt.token){o(tt.token),a(!0),localStorage.setItem(`client_token_${ue.id}`,tt.token);const Jt=window.location.pathname;window.history.replaceState({},"",Jt),t({title:"Login Successful!",description:"Welcome to your account."})}else t({title:"Invalid Link",description:"This login link has expired or is invali
843d.",variant:"destructive"})}).catch(tt=>{console.error("Token validation error:",tt),t({title:"Login Failed",description:"Unable to verify login link.",variant:"destructive"})});else{const tt=localStorage.getItem(`client_token_${ue.id}`);tt?pt(tt)?(localStorage.removeItem(`client_token_${ue.id}`),o(null),a(!1),n.removeQueries({queryKey:[`/api/client/my-account/${ue==null?void 0:ue.id}`]}),console.log("🔒 Stored token has expired, cleared from localStorage and state")):(console.log("✅ Stored token is valid, setting authenticated state"),o(tt),a(!0)):(o(null),a(!1))}}},[ue==null?void 0:ue.id]),f.useEffect(()=>{ue!=null&&ue.stripePublicKey&&A(od(ue.stripePublicKey))},[ue==null?void 0:ue.stripePublicKey]),f.useEffect(()=>{if(!ke)return;const He=setTimeout(async()=>{var tt;if(!M||!Q.name||!Q.email||!Q.phone||!ue){je("");return}try{const ds=(M==null?void 0:M.billingType)==="one_time"?`/api/memberships/${M.id}/create-one-time-payment-intent`:`/api/memberships/${M.id}/create-payment-intent`,zs=await Pe("POST",ds,{checkoutRequestId:`${M.id}|${Q.email.trim().toLowerCase()}|${ue.id}`,clientData:{...Q,onboardingData:Object.keys(G).length>0?G:void 0},clientId:(tt=le==null?void 0:le.client)==null?void 0:tt.id}),De=await zs.json();if(console.log("Payment intent response:",De),!zs.ok){t({title:"Checkout unavailable",description:typeof De.message=="string"&&De.message.length>0?De.message:`Could not start payment (${zs.status}). Please try again.`,variant:"destructive"});return}if(De.error==="subscription_exists"){t({title:"Subscription Already Exists",description:De.message||"You already have an active subscription for this membership.",variant:"destructive"});return}if(De.clientSecret)je(De.clientSecret),(De.subscriptionId||De.oneTimePurchase)&&(sessionStorage.setItem(`membership_response_${De.clientSecret}`,JSON.stringify({...De,isOneTimePurchase:De.oneTimePurchase===!0,paymentIntentId:De.paymentIntentId})),console.log("Stored checkout metadata in sessionStorage:",De.subscriptionId||De.paymentIntentId));else throw new Error(De.message||"No client secret returned")}catch(Jt){console.error("Payment initialization error:",Jt),t({title:"Error",description:SX(Jt,"Failed to initialize payment. Please try again."),variant:"destructive"})}},100);return()=>clearTimeout(He)},[ke,M==null?void 0:M.id,M==null?void 0:M.billingType,Q.name,Q.email,Q.phone,JSON.stringify(G),ue==null?void 0:ue.id]);const de=()=>{a(!1),o(null),ue!=null&&ue.id&&localStorage.removeItem(`client_token_${ue.id}`),c({email:"",password:""}),n.removeQueries({queryKey:[`/api/client/my-account/${ue==null?void 0:ue.id}`]}),t({title:"Session expired",description:"Your session has expired. Please log in again.",variant:"destructive"})},{data:fe}=Ue({queryKey:[`/api/client/calendar-uuid/${ue==null?void 0:ue.id}`,i],enabled:!!r&&!!(ue!=null&&ue.id)&&!!i&&!pt(i??""),queryFn:async()=>{const xe=await fetch(`/api/client/calendar-uuid/${ue.id}`,{headers:{Authorization:`Bearer ${i}`}});if(!xe.ok){const He=await xe.json().catch(()=>({}));throw new Error((He==null?void 0:He.message)||"Failed to load calendar link")}return xe.json()},retry:1}),{data:le,isLoading:Ke,refetch:We,error:vt}=Ue({queryKey:[`/api/client/my-account/${ue==null?void 0:ue.id}`,i],enabled:!!r&&!!(ue!=null&&ue.id)&&!!i&&(!i||!pt(i)),queryFn:async()=>{if(!i||pt(i))throw de(),new Error("Authentication failed - session expired");const xe=await fetch(`/api/client/my-account/${ue.id}`,{headers:{Authorization:`Bearer ${i}`,"Cache-Control":"no-cache"}});if(xe.status===401)throw de(),new Error("Authentication failed - session expired");if(!xe.ok)throw new Error(`Failed to fetch account data: ${xe.status}`);return xe.json()},retry:!1,staleTime:0,gcTime:0,refetchOnMount:!0,refetchOnWindowFocus:!1,placeholderData:void 0});f.useEffect(()=>{var xe,He;if(vt){const tt=vt;((tt==null?void 0:tt.status)===401||(xe=tt==null?void 0:tt.message)!=null&&xe.includes("Authentication")||(He=tt==null?void 0:tt.message)!=null&&He.includes("session expired"))&&de()}},[vt,ue==null?void 0:ue.id]),f.useEffect(()=>{var xe;if((xe=le==null?void 0:le.client)!=null&&xe.profilePictureUrl){const He=ze(le.client.profilePictureUrl);qe(He)}else qe(null)},[(Vt=le==null?void 0:le.client)==null?void 0:Vt.profilePictureUrl]),f.useEffect(()=>{if(le!=null&&le.bundles&&(ue!=null&&ue.id)&&r)try{const xe=`classta_bundles_${ue.id}`,He=le.bundles.filter(tt=>!(tt.expiresAt&&new Date(tt.expiresAt)<new Date||!(tt.sessionCount&&tt.sessionCount>0))).map(tt=>tt.code).filter(tt=>tt);He.length>0?(localStorage.setItem(xe,JSON.stringify(He)),console.log(`✅ Synced ${He.length} active bundle(s) to localStorage for instructor ${ue.id}`)):localStorage.removeItem(xe)}catch(xe){console.error("Error syncing bundles to localStorage:",xe)}},[le==null?void 0:le.bundles,ue==null?void 0:ue.id,r]),f.useEffect(()=>{if(le!=null&&le.client&&r)try{const xe={name:le.client.name||"",email:le.client.email||"",phone:le.client.phone||"",emergencyContactName:le.client.emergencyContactName||"",emergencyContactPhone:le.client.emergencyContactPhone||""};xe.name&&xe.email&&(localStorage.setItem("classta-user-data",JSON.stringify(xe)),console.log("✅ Synced client data (name, email) to localStorage"))}catch(xe){console.error("Error syncing client data to localStorage:",xe)}},[le==null?void 0:le.client,r]),f.useEffect(()=>{M&&(le!=null&&le.client)&&!ke&&te({name:le.client.name||"",email:le.client.email||"",phone:le.client.phone||""})},[M,le==null?void 0:le.client,ke]);const{data:Zt,isLoading:Ht}=Ue({queryKey:[`/api/member/${ue==null?void 0:ue.id}/membership-posts`,x],enabled:!!x&&!!i&&!!(ue!=null&&ue.id),queryFn:async()=>{const xe=await fetch(`/api/member/${ue.id}/membership-posts?membershipId=${x}`,{headers:{Authorization:`Bearer ${i}`,"Cache-Control":"no-cache"}});if(xe.status===401)throw de(),new Error("Authentication failed - session expired");if(!xe.ok)throw new Error("Failed to fetch posts");return xe.json()},retry:!1,staleTime:0}),Tt=async xe=>{if(xe.preventDefault(),!l.email||d==="password"&&!l.password){t({title:"Missing Information",description:d==="password"?"Please enter both email and password":"Please enter your email",variant:"destructive"});return}try{if(d==="magic"){await Ot();return}const tt=await(await Pe("POST","/api/client/login",{email:l.email.toLowerCase().trim(),password:l.password,loginMethod:"password",instructorId:ue.id})).json();if(console.log("Login response:",tt),tt!=null&&tt.success&&(tt!=null&&tt.token))o(tt.token),a(!0),localStorage.setItem(`client_token_${ue.id}`,tt.token),new URLSearchParams(window.location.search).get("returnTo")==="booking"?(window.close(),setTimeout(()=>{t({title:"Login Successful!",description:"You can now see your member pricing when booking classes."})},100)):t({title:"Login successful",description:"Welcome to your account"});else throw console.error("Login failed - invalid response:",tt),new Error("Login failed - invalid response")}
843catch(He){t({title:"Login failed",description:He.message||"Invalid email or password",variant:"destructive"})}},Ot=async()=>{if(!l.email){t({title:"Email required",description:"Please enter your email address",variant:"destructive"});return}try{await Pe("POST","/api/client/magic-link",{email:l.email.toLowerCase().trim(),instructorId:ue.id}),t({title:"Magic link sent",description:"Check your email for a login link"})}catch(xe){t({title:"Failed to send magic link",description:xe.message,variant:"destructive"})}},Ft=async xe=>{if(xe.preventDefault(),j(!0),p!==y){t({title:"Passwords don't match",description:"Please make sure both passwords are the same",variant:"destructive"}),j(!1);return}if(p.length<8){t({title:"Password too short",description:"Password must be at least 8 characters long",variant:"destructive"}),j(!1);return}if(p.length>128){t({title:"Password too long",description:"Password must be no more than 128 characters long",variant:"destructive"}),j(!1);return}try{await Pe("POST","/api/client/set-password",{token:i,password:p,instructorId:ue.id}),t({title:"Password changed successfully",description:"Your password has been updated"}),v(""),g(""),C(!1)}catch(He){t({title:"Failed to change password",description:He.message,variant:"destructive"})}finally{j(!1)}},is=async xe=>{if(ue!=null&&ue.id)try{await Pe("POST","/api/client/cancel-subscription",{subscriptionId:xe,instructorId:ue.id}),We(),t({title:"Subscription cancelled",description:"Your subscription has been cancelled successfully"})}catch(He){t({title:"Failed to cancel subscription",description:He.message,variant:"destructive"})}},Cs=async(xe,He)=>{if(!(ue!=null&&ue.id))return;const tt=xe.stripeSubscriptionId;if(!tt||tt.startsWith("manual_")||tt.startsWith("free_"))return;const Jt=He?"/api/client/subscription-portal/payment-method-update":"/api/client/subscription-portal";try{const zs=await(await Pe("POST",Jt,{subscriptionId:xe.id,instructorId:ue.id})).json();if(zs!=null&&zs.url)window.location.href=zs.url;else throw new Error("No portal URL returned")}catch(ds){t({title:"Failed to open billing portal",description:(ds==null?void 0:ds.message)||"Please try again or contact the instructor.",variant:"destructive"})}},Ne=async(xe,He,tt)=>{console.log("📱 Generating available dates for booking:",tt),console.log("📱 Auth token:",i?"Present":"Missing"),console.log("📱 Auth token value:",(i==null?void 0:i.substring(0,20))+"..."),console.log("📱 Is authenticated:",r),W(!0);try{const Jt=await fetch(`/api/client/bookings/${tt}/smart-dates?limit=30&offset=0&forReschedule=true`,{headers:{Authorization:`Bearer ${i}`,"Cache-Control":"no-cache"}});if(Jt.status===401)throw de(),new Error("Authentication failed - session expired");if(!Jt.ok)throw console.error("📱 Smart dates API failed:",Jt.status,Jt.statusText),new Error(`Failed to fetch available dates: ${Jt.status}`);const ds=await Jt.json();console.log("📱 Smart dates response:",ds);const zs=ds.availableDates||[];console.log("📱 Parsed available dates:",zs),T(zs)}catch(Jt){console.error("📱 Error fetching smart dates:",Jt),t({title:"Error",description:"Failed to load available dates",variant:"destructive"}),T([])}finally{W(!1)}},rt=async xe=>{console.log("📱 Opening reschedule dialog for booking:",xe),S(xe),O(""),k(null);try{await Ne(xe.classId,xe.classDate,xe.id),console.log("📱 Available dates loaded successfully")}catch(He){console.error("📱 Error loading available dates:",He),t({title:"Error",description:"Failed to load available dates. Please try again.",variant:"destructive"})}},ht=async()=>{var xe,He;if(!(!z||!P||q)){H(!0);try{if(P.classAllowReschedule){const tt=E.find(De=>D?De.date===z&&De.classId===D:De.date===z),Jt={newDate:z,token:i};D&&D!==P.classId?Jt.newClassId=D:tt!=null&&tt.classId&&tt.classId!==P.classId&&(Jt.newClassId=tt.classId);const ds=Jt.newClassId||P.classId,zs=Pg(ds);zs&&(Jt.bookingAccessCode=zs),await Pe("PUT",`/api/bookings/${P.id}/reschedule`,Jt),t({title:"Booking rescheduled",description:tt!=null&&tt.className&&tt.classId!==P.classId?`Your booking has been successfully rescheduled to ${tt.className}. A confirmation email has been sent.`:"Your booking has been successfully rescheduled. A confirmation email has been sent."}),S(null),O(""),k(null),T([]),await n.invalidateQueries({queryKey:[`/api/client/my-account/${ue==null?void 0:ue.id}`]}),await We()}else await Pe("POST","/api/request-booking-change",{bookingId:P.id,currentDate:P.classDate,requestedDate:z,clientEmail:(xe=le==null?void 0:le.client)==null?void 0:xe.email,clientName:(He=le==null?void 0:le.client)==null?void 0:He.name,className:P.className,instructorId:ue.id}),t({title:"Change request sent",description:"Your booking change request has been sent to the instructor"}),S(null),O(""),k(null),T([])}catch(tt){console.error("Error processing request:",tt),t({title:"Error",description:tt.message||(P.classAllowReschedule?"Failed to reschedule booking. Please try again.":"Failed to send change request. Please try again."),variant:"destructive",duration:6e3})}finally{H(!1)}}},Mt=xt({mutationFn:async xe=>(await Pe("POST","/api/instructor-contact",{instructorId:ue==null?void 0:ue.id,name:xe.name,email:xe.email,subject:xe.subject,message:xe.message})).json(),onSuccess:()=>{t({title:"Message Sent!",description:"Your message has been sent successfully. The instructor will get back to you soon."}),re(!1),Y({name:"",email:"",subject:"",message:""})},onError:xe=>{t({title:"Error",description:xe.message||"Failed to send message. Please try again.",variant:"destructive"})}}),Qt=xe=>UWe({allowClientCancellation:xe.classAllowCancellation,classDate:xe.classDate,classStartTime:xe.classStartTime||xe.classTime,cancellationDaysBefore:xe.classCancellationDaysBefore,instructorTimezone:(ue==null?void 0:ue.timezone)||"Europe/London"}),ts=async()=>
843{if(!(!_||U)){J(!0);try{console.log("🚀 Cancelling booking:",_.id);const xe=await fetch(`/api/bookings/${_.id}/cancel`,{method:"POST",headers:{"Content-Type":"application/json",...i?{Authorization:`Bearer ${i}`}:{}}});console.log("📥 Response status:",xe.status,xe.ok);const He=await xe.json();if(console.log("📥 Response data:",He),He.success)t({title:"Booking Cancelled",description:He.message||"Your booking has been cancelled successfully."}),n.invalidateQueries({queryKey:[`/api/client/my-account/${ue==null?void 0:ue.id}`]}),We(),L(null);else throw console.error("❌ Cancellation failed - response indicates failure:",He),new Error(He.message||"Failed to cancel booking")}catch(xe){console.error("❌ Cancellation error:",xe),t({title:"Cancellation Failed",description:xe.message||"Failed to cancel booking. Please try again.",variant:"destructive"})}finally{J(!1)}}},Js=()=>{a(!1),o(null),ue!=null&&ue.id&&localStorage.removeItem(`client_token_${ue.id}`),c({email:"",password:""}),n.removeQueries({queryKey:[`/api/client/my-account/${ue==null?void 0:ue.id}`]}),t({title:"Logged out",description:"You have been logged out successfully"})},xn=xe=>{if(!xe)return"<p>No content available</p>";try{const He=JSON.parse(xe);return Xs(He)}catch{return xe}},Xs=xe=>xe.map(He=>{if(He.type==="paragraph")return`<p class="mb-4">${nn(He.children)}</p>`;if(He.type==="heading-one")return`<h1 class="text-2xl font-bold mb-4">${nn(He.children)}</h1>`;if(He.type==="heading-two")return`<h2 class="text-xl font-semibold mb-4">${nn(He.children)}</h2>`;if(He.type==="link"){const tt=nn(He.children);return`<a href="${He.url}" class="text-blue-600 underline hover:text-blue-800" target="_blank" rel="noopener noreferrer">${tt}</a>`}else{if(He.type==="bulleted-list")return`<ul class="list-disc pl-5 mb-4">${He.children.map(Jt=>`<li class="mb-1">${nn(Jt.children)}</li>`).join("")}</ul>`;if(He.type==="numbered-list")return`<ol class="list-decimal pl-5 mb-4">${He.children.map(Jt=>`<li class="mb-1">${nn(Jt.children)}</li>`).join("")}</ol>`;if(He.type==="image"){const tt=He.width?`width="${He.width}"`:"",Jt=`<img src="${He.url}" ${tt} style="max-width: 100%; height: auto;" alt="" class="rounded mb-4" />`;return He.linkUrl?`<a href="${He.linkUrl}" target="_blank" rel="noopener noreferrer">${Jt}</a>`:Jt}else if(He.type==="video")return`<iframe src="${He.url}" width="560" height="315" frameborder="0" allowfullscreen style="max-width: 100%;" class="rounded mb-4"></iframe>`}return""}).join(""),nn=xe=>xe.map(He=>{let tt=He.text||"";return He.bold&&(tt=`<strong>${tt}</strong>`),He.italic&&(tt=`<em>${tt}</em>`),He.underline&&(tt=`<u>${tt}</u>`),He.code&&(tt=`<code class="bg-gray-100 px-1 rounded">${tt}</code>`),tt}).join("");if(Me||x&&Ht)return s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"})});if(!ue)return s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(Ce,{className:"w-full max-w-md",children:s.jsxs(gt,{children:[s.jsx(Nt,{children:"Instructor not found"}),s.jsx(Ys,{children:"The instructor page you're looking for doesn't exist."})]})})});if(x){const xe=(Te=le==null?void 0:le.memberships)==null?void 0:Te.find(tt=>tt.membershipId===x),He=Zt||[];return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx("header",{className:"bg-white dark:bg-gray-900 shadow-sm",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"py-4 sm:py-6",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[ue.logoUrl&&s.jsx("img",{src:ue.logoUrl,alt:ue.businessName,className:"h-6 sm:h-8 w-auto flex-shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h1",{className:"text-xl sm:text-2xl font-bold truncate",children:ue.businessName}),s.jsx("p",{className:"text-sm sm:text-base text-gray-600 dark:text-gray-400",children:"My Account"})]})]}),s.jsx("div",{className:"flex justify-start items-center gap-2",children:s.jsx(B,{variant:"outline",size:"sm",asChild:!0,className:"flex items-center gap-2",children:s.jsxs("a",{href:`/cal/${ue.subdomain}`,children:[s.jsx(Ls,{className:"w-4 h-4"}),"View ",ue.terminologyPlural||"Classes"]}
843)})})]})})}),s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 sm:gap-4",children:[s.jsxs(B,{variant:"outline",onClick:()=>b(null),className:"flex items-center gap-2 w-fit text-sm sm:text-base px-3 py-2",size:"sm",children:[s.jsx(xr,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden xs:inline",children:"Back to My Account"}),s.jsx("span",{className:"xs:hidden",children:"Back"})]}),s.jsx("div",{className:"min-w-0 flex-1",children:s.jsxs("h2",{className:"text-xl sm:text-2xl font-bold break-words",children:[xe==null?void 0:xe.membershipName," Posts"]})})]}),He.length===0?s.jsx(Ce,{children:s.jsxs(Ee,{className:"text-center py-12",children:[s.jsx(hw,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Posts Yet"}),s.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"No content has been posted to this membership yet."})]})}):s.jsx("div",{className:"space-y-6",children:He.map(tt=>s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(Nt,{className:"text-lg sm:text-xl break-words",children:tt.title}),s.jsxs(Ys,{className:"text-sm",children:["Posted on ",Sr(new Date(tt.createdAt),"PPP")]})]})})}),s.jsx(Ee,{children:s.jsx("div",{className:"prose prose-sm sm:prose max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:xn(tt.content)}})})]},tt.id))})]})})]})}return r?Ke?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx("header",{className:"bg-white dark:bg-gray-900 shadow-sm",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"py-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[ue.logoUrl&&s.jsx("img",{src:ue.logoUrl,alt:ue.businessName,className:"h-8 w-auto"}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl sm:text-2xl font-bold",children:ue.businessName}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"My Account"})]})]}),r&&(le==null?void 0:le.client)&&s.jsxs("div",{className:"flex flex-col items-start sm:items-end gap-1 text-left sm:text-right",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"Logged in as:"}),s.jsx("p",{className:"text-sm font-medium text-foreground break-all sm:break-normal",children:le.client.email}),le.client.name&&s.jsx("p",{className:"text-sm text-muted-foreground",children:le.client.name})]})]}),s.jsxs("div",{className:"flex justify-between items-center gap-2",children:[s.jsx(B,{variant:"outline",size:"sm",asChild:!0,className:"flex items-center gap-2",children:s.jsxs("a",{href:`/cal/${ue.subdomain}`,children:[s.jsx(Ls,{className:"w-4 h-4"}),"View ",ue.terminologyPlural||"Classes"]})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(yP,{}),s.jsxs(B,{variant:"outline",size:"sm",onClick:Js,className:"flex items-center gap-2",children:[s.jsx(Tre,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Logout"})]})]})]})]})})}),s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-2 md:py-8",children:s.jsxs(sc,{defaultValue:"bookings",className:"space-y-6",children:[s.jsx("div",{className:"hidden md:block",children:s.jsxs(Hi,{className:"grid w-full grid-cols-6",children:[s.jsx(Ts,{value:"bookings",children:"My Bookings"}),s.jsx(Ts,{value:"bundles",children:"My Bundles"}),s.jsx(Ts,{value:"memberships",children:"My Memberships"}),s.jsx(Ts,{value:"waitlist",children:"Waitlist"}),s.jsx(Ts,{value:"achievements",children:"My Achievements"}),s.jsx(Ts,{value:"profile",children:"Profile"})]})}),s.jsx("div",{className:"md:hidden overflow-x-auto",children:s.jsxs(Hi,{className:"inline-flex w-auto min-w-full bg-transparent h-auto p-0",children:[s.jsx(Ts,{value:"bookings",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent roun
843ded-none py-4 text-sm whitespace-nowrap flex-shrink-0",children:"My Bookings"}),s.jsx(Ts,{value:"bundles",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-sm whitespace-nowrap flex-shrink-0",children:"My Bundles"}),s.jsx(Ts,{value:"memberships",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-sm whitespace-nowrap flex-shrink-0",children:"My Memberships"}),s.jsx(Ts,{value:"waitlist",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-sm whitespace-nowrap flex-shrink-0",children:"Waitlist"}),s.jsx(Ts,{value:"achievements",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-sm whitespace-nowrap flex-shrink-0",children:"My Achievements"}),s.jsx(Ts,{value:"profile",className:"data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:bg-transparent rounded-none py-4 text-sm whitespace-nowrap flex-shrink-0",children:"Profile"})]})}),s.jsxs(on,{value:"bookings",className:"space-y-6",children:[(fe==null?void 0:fe.calendarUuid)&&s.jsx(AWe,{defaultOpen:!1,children:s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-0",children:[s.jsxs(TWe,{className:"flex w-full items-center gap-2 p-4 text-left hover:bg-muted/50 transition-colors rounded-lg [&[data-state=open]_svg.chevron]:rotate-180",children:[s.jsx(iT,{className:"h-5 w-5 shrink-0",style:{color:ue==null?void 0:ue.primaryColor}}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium",children:"Add your bookings to your calendar"}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Subscribe in Google Calendar, Apple Calendar, or another app"})]}),s.jsx(vi,{className:"h-5 w-5 shrink-0 text-muted-foreground chevron transition-transform duration-200"})]}),s.jsx(OWe,{children:s.jsxs("div",{className:"px-4 pb-4 pt-0 space-y-4 border-t border-border/50",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-4",children:[s.jsx(me,{readOnly:!0,value:`${typeof window<"u"?window.location.origin:""}/client-calendar/${fe.calendarUuid}.ics`,className:"flex-1 bg-muted text-sm font-mono"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(B,{variant:"outline",size:"sm",onClick:async xe=>{xe.preventDefault();const He=`${window.location.origin}/client-calendar/${fe.calendarUuid}.ics`;try{await navigator.clipboard.writeText(He),be(!0),t({title:"Copied!",description:"Calendar URL copied to clipboard"}),setTimeout(()=>be(!1),2e3)}catch{t({title:"Failed to copy",variant:"destructive"})}},children:[s.jsx(pr,{className:"h-4 w-4 mr-1"}),ft?"Copied!":"Copy"]}),s.jsxs(B,{variant:"outline",size:"sm",onClick:xe=>{xe.preventDefault(),window.open(`${window.location.origin}/client-calendar/${fe.calendarUuid}.ics`,"_blank")},children:[s.jsx(Lr,{className:"h-4 w-4 mr-1"}),"Open"]})]})]}),s.jsxs("div",{className:"text-xs text-muted-foreground space-y-2",children:[s.jsx("p",{className:"font-medium",children:"How to add to your calendar:"}),s.jsxs(Bt,{value:Fe,onValueChange:_e,children:[s.jsx($t,{className:"w-48 h-8",children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"google",children:"Google Calendar"}),s.jsx(ce,{value:"apple_mac",children:"Apple Mac Calendar"}),s.jsx(ce,{value:"apple_iphone",children:"iPhone Calendar"}),s.jsx(ce,{value:"other",children:"Other"})]})]}),s.jsxs("div",{className:"bg-muted/50 p-3 rounded-md text-xs space-y-1",children:[Fe==="google"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-medium",children:"Google Calendar"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 ml-1",children:[s.jsx("li",{children:"Open Google Calendar (calendar.google.com)"}),s.jsxs("li",{children:["Click the ",s.jsx("strong",{children:"+"}),' next to "Other calendars"']}),s.jsxs("li",{children:["Select ",s.jsx("strong",{children:"From URL"})]}),s.jsxs("li",{children:["Paste the calendar URL and click ",s.jsx("strong",{children:"Add calendar"})]})]}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Not available in the Google Calendar mobile app — use the website."})]}),Fe==="apple_mac"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-medium",children:"Apple Mac Calendar"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 ml-1",children:[s.jsx("li",{children:"Open Apple Calendar"}),s.jsxs("li",{children:["File → ",s.jsx("strong",{children:"New Calendar Subscription"})]}),s.jsxs("li",{children:["Paste the calendar URL and click ",s.jsx("strong",{children:"Subscribe"})]})]})]}),Fe==="apple_iphone"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-medium",children:"iPhone Calendar"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 ml-1",children:[s.jsx("li",{children:"Settings → Calendar → Accounts → Add Account"}),s.jsxs("li",{children:["Tap ",s.jsx("strong",{children:"Other"})," → ",s.jsx("strong",{children:"Add Subscribed Calendar"})]}),s.jsx("li",{children:"Enter the calendar URL and save"})]})]}),Fe==="other"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-medium",children:"Other 
843calendars"}),s.jsx("p",{children:'Look for "Add calendar", "Subscribe to calendar", or "From URL" and paste the link.'})]})]})]})]})})]})})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Upcoming Bookings"}),((at=le==null?void 0:le.bookings)==null?void 0:at.length)>0?s.jsx("div",{className:"space-y-4",children:le.bookings.sort((xe,He)=>new Date(He.classDate).getTime()-new Date(xe.classDate).getTime()).map(xe=>s.jsx(Ce,{children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold text-lg",children:xe.className}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(si,{className:"w-4 h-4"}),xe.classLocation&&!xe.classLocation.toLowerCase().includes("online")&&!xe.classLocation.toLowerCase().includes("zoom")&&!xe.classLocation.toLowerCase().includes("virtual")&&xe.classLocation!=="Location TBD"?s.jsx("a",{href:`https://maps.google.com/maps?q=${encodeURIComponent(xe.classLocation)}`,target:"_blank",rel:"noopener noreferrer",className:"hover:underline",style:{color:QP(ue.primaryColor)?`hsl(${Rl(ue.primaryColor)})`:ue.primaryColor},children:xe.classLocation}):s.jsx("span",{children:xe.classLocation})]})]}),s.jsxs("div",{className:"flex flex-col xs:flex-row xs:items-center gap-2 xs:gap-4 text-sm text-muted-foreground",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Ls,{className:"w-4 h-4"}),(()=>{const He=xe.classDate.split("T")[0],[tt,Jt,ds]=He.split("-");return new Date(parseInt(tt),parseInt(Jt)-1,parseInt(ds)).toLocaleDateString("en-GB",{weekday:"short",year:"numeric",month:"short",day:"numeric"})})()]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ei,{className:"w-4 h-4"}),(()=>{if(xe.classStartTime)try{let He=xe.classStartTime;if(typeof He=="string"&&He.startsWith("{")){const we=JSON.parse(He);if(typeof we=="object"&&we!==null){const ot=new Date(xe.classDate);if(!isNaN(ot.getTime())){const _t=ot.getDay();He=we[_t.toString()]||Object.values(we)[0]||"09:00"}}}const[tt,Jt]=He.split(":"),ds=parseInt(tt);if(isNaN(ds)||isNaN(parseInt(Jt)))return"TBD";const zs=ds===0?12:ds>12?ds-12:ds,De=ds>=12?"PM":"AM";return`${zs}:${Jt} ${De}`}catch(He){return console.error("Error parsing booking time:",He),"TBD"}try{const He=new Date(xe.classDate);if(!isNaN(He.getTime()))return He.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{}return"TBD"})()]})]}),xe.classInstructor&&xe.classInstructor!=="Instructor TBD"&&s.jsxs("div",{className:"text-sm",children:[s.jsxs("span",{className:"text-muted-foreground",children:["Instructor:"," "]}),s.jsx("span",{className:"font-medium",children:xe.classInstructor})]})]}),s.jsx("div",{className:"text-right flex-shrink-0",children:s.jsxs("div",{className:"flex flex-col items-end gap-2",children:[s.jsx(Je,{variant:xe.status==="confirmed"?"default":"secondary",children:xe.status}),s.jsx("p",{className:"text-sm text-muted-foreground",children:_h(xe.amount,(ue==null?void 0:ue.currency)||"GBP")}),xe.status==="confirmed"&&new Date(xe.classDate)>new Date&&s.jsxs("div",{className:"flex gap-2",children:[xe.classAllowReschedule&&s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>rt(xe),className:"text-xs",children:[s.jsx(Y2,{className:"w-3 h-3 mr-1"}),"Reschedule"]}),Qt(xe)&&s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>L(xe),className:"text-xs text-red-600 hover:text-red-700 hover:bg-red-50",children:[s.jsx(ja,{className:"w-3 h-3 mr-1"}),"Cancel"]}),!xe.classAllowReschedule&&!Qt(xe)&&s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>rt(xe),className:"text-xs",children:[s.jsx(Y2,{className:"w-3 h-3 mr-1"}),"Request change"]})]})]})})]})})},xe.id))}):s.jsx(Ce,{children:s.jsxs(Ee,{className:"text-center py-12",children:[s.jsx(Ls,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No bookings yet"}),s.jsx("p",{className:"text-muted-foreground",children:"You haven't made any bookings yet."})]})})]})]}),s.jsx(on,{value:"bundles",className:"space-y-6",children:s.jsxs("div",{children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"My Bundles"}),((ss=le==null?void 0:le.bundles)==null?void 0:ss.length)>0?s.jsx("div",{className:"space-y-4",children:le.bundles.map(xe=>{const He=xe.expiresAt&&new Date(xe.expiresAt)<new Date,tt=xe.sessionCount&&xe.sessionCount>0,Jt=!He&&tt;return s.jsx(Ce,{children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(jg,{className:"w-5 h-5",style:{color:QP(ue.primaryColor)?`hsl(${Rl(ue.primaryColor)})`:ue.primaryColor}}),s.jsx("h3",{className:"font-semibold text-lg",children:xe.name}),s.jsx(Je,{variant:Jt?"default":"secondary",className:"ml-2",children:Jt?"Active":He?"Expired":"Used Up"})]}),xe.description&&s.jsx("p",{className:"text-sm text-muted-foreground",children:xe.description}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-foreground",children:"Code:"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"px-2 py-1 bg-muted rounded font-mono text-sm font-semibold",children:xe.code}),s.jsx(B,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>{navigator.clipboard.writeText(xe.code),t({title:"Copied!",description:"Bundle code copied to clipboard"})},children:s.jsx(pr,{className:"w-3 h-3"})})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-foreground",children:"Sessions Remaining:"}),s.jsxs("span",{className:"font-semibold",children:[xe.sessionCount||0," / ",xe.usageLimit||xe.sessionCount||0]})]}),xe.expiresAt?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-foreground",children:"Expires:"}),s.jsxs("span",{className:He?"text-red-600 font-medium":"",children:[Sr(new Date(xe.expiresAt),"PPP"),He&&s.jsx(Ux,{className:"w-4 h-4 inline ml-1"})]})]}):xe.expiresAfterFirstUse&&xe.expiresAfterValue&&xe.expiresAfterUnit?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-foreground",children:"Expires:"}),s.jsxs("span",{children:[xe.expiresAfterValue," ",xe.expiresAfterUnit==="days"?"day":xe.expiresAfterUnit==="weeks"?"week":"month",xe.expiresAfterValue!==1?"s":""," after first use"]})]}):null]}),xe.usageCount>0&&s.jsxs("div",{className:"text-sm text-muted-foreground",children:["Used ",xe.usageCount," ",xe.usageCount===1?"session":"sessions"]})]}),s.jsxs("div",{className:"flex flex-col items-end gap-2",children:[Jt&&s.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[s.jsx(jre,{className:"w-4 h-4"}),s.jsx("span",{className:"text-sm font-medium",children:"Ready to use"})]}),!Jt&&!He&&s.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[s.jsx(Ux,{className:"w-4 h-4"}),s.jsx("span",{className:"text-sm",children:"All sessions used"})]}),He&&s.jsxs("div",{className:"flex items-center gap-1 text-red-600",children:[s.jsx(Ux,{className:"w-4 h-4"}),s.jsx("span",{className:"text-sm",children:"Expired"})]})]})]})})},xe.id)})}):s.jsx(Ce,{children:s.jsxs(Ee,{className:"text-center py-12",children:[s.jsx(jg,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No bundles yet"}),s.jsx("p",{className:"text-muted-foreground",children:"You haven't purchased any session bundles yet."})]})})]})}),s.jsxs(on,{value:"memberships",className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Active Memberships"}),((ps=le==null?void 0:le.memberships)==null?void 0:ps.length)>0?s.jsx("div",{className:"space-y-4",children:le.memberships.map(xe=>s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"font-medium",children:xe.membershipName}),!xe.neverExpires&&xe.currentPeriodEnd&&s.jsx("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mt-1",children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Ls,{className:"w-4 h-4"}),h1(xe.stripeSubscriptionId)?"Renews":"Expires",":"," ",Sr(new Date(xe.currentPeriodEnd),"PP")]})}),xe.usageLimit!=null&&s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1",children:[s.jsx(ei,{className:"w-4 h-4"}),"Usage: ",xe.usageCount??0," / ",xe.usageLimit," classes",xe.usageLimitPeriod==="month"&&" this month",xe.usageLimitPeriod==="week"&&" this week",xe.usageLimitPeriod==="quarter"&&" this quarter",xe.usageLimitPeriod==="year"&&" this year",xe.usageLimitPeriod==="billing_period"&&" this billing period"]}
843),xe.showCardInClientPortal&&xe.publicId&&s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mt-2 flex-wrap",children:[s.jsx("span",{className:"font-mono",children:xe.membershipNumber||xe.publicId}),s.jsx("a",{href:e?`/my-account/${e}/membership-card/${xe.publicId}`:"#",className:"text-primary hover:underline",children:"View membership card"})]})]}),s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsx(Je,{variant:xe.status==="active"?"default":"secondary",children:xe.status}),xe.memberBenefitsEligible===!1&&s.jsx(Je,{variant:"destructive",title:xe.ineligibleReason||void 0,children:xe.ineligibleReason==="unpaid_for_month"?"Payment required this month":xe.ineligibleReason==="unpaid_for_billing_period"?"Payment required for current period":xe.ineligibleReason==="past_due"?"Payment past due":"Benefits paused"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>b(xe.membershipId),children:[s.jsx(wa,{className:"w-4 h-4 mr-2"}),"View Posts"]}),xe.status==="active"&&xe.stripeSubscriptionId&&!String(xe.stripeSubscriptionId).startsWith("manual_")&&!String(xe.stripeSubscriptionId).startsWith("free_")&&s.jsxs(s.Fragment,{children:[s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>Cs(xe,!0),children:[s.jsx(ti,{className:"w-4 h-4 mr-2"}),"Update payment method"]}),s.jsxs(B,{variant:"outline",size:"sm",onClick:()=>Cs(xe),children:[s.jsx(Lr,{className:"w-4 h-4 mr-2"}),"Manage subscription"]})]}),xe.status==="active"&&s.jsxs(Zi,{children:[s.jsx(dO,{asChild:!0,children:s.jsx(B,{variant:"outline",size:"sm",children:"Cancel"})}),s.jsxs(bi,{className:"max-w-md",children:[s.jsxs(wi,{children:[s.jsx(Ni,{children:"Cancel Subscription?"}),s.jsx(Ci,{asChild:!0,children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"text-left",children:[s.jsx("div",{className:"font-medium mb-2",children:"You're about to cancel:"}),s.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-lg p-3 space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Membership:"}),s.jsx("span",{className:"font-medium",children:xe.membershipName})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Price:"}),s.jsxs("span",{className:"font-medium",children:[_h(xe.membershipPrice,(ue==null?void 0:ue.currency)||"GBP"),"/",xe.membershipBillingFrequency==="monthly"?"month":xe.membershipBillingFrequency]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Next billing:"}),s.jsx("span",{className:"font-medium",children:Sr(new Date(xe.currentPeriodEnd),"PP")})]})]})]}),s.jsxs("div",{className:"text-left",children:[s.jsx("div",{className:"font-medium mb-2 text-amber-600 dark:text-amber-400",children:"What you'll lose:"}),s.jsxs("ul",{className:"text-sm space-y-1 text-gray-600 dark:text-gray-400",children:[s.jsx("li",{children:"• Access to exclusive membership content"}),s.jsx("li",{children:"• New posts and updates"}),s.jsx("li",{children:"• Member-only resources and materials"}),s.jsxs("li",{children:["• Direct access to"," ",ue.instructorName]})]})]}),s.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3 text-left",children:s.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200",children:[s.jsx("strong",{children:"Good news:"})," If you cancel now, you'll keep access until"," ",Sr(new Date(xe.currentPeriodEnd),"PP")," ","- no immediate loss of access!"]})}),s.jsx("div",{className:"text-sm font-medium",children:"Are you sure you want to cancel your subscription?"})]})})]}),s.jsxs(ji,{className:"flex-col sm:flex-row gap-2",children:[s.jsx(to,{className:"w-full sm:w-auto",children:"Keep My Subscription"}),s.jsx(eo,{onClick:()=>is(xe.id),className:"w-full sm:w-auto bg-red-600 hover:bg-red-700 text-white",children:"Yes, Cancel Subscription"})]})]})]})]})]})},xe.id))}):s.jsx(Ce,{children:s.jsxs(Ee,{className:"text-center py-12",children:[s.jsx(ti,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No active memberships"}),s.jsx("p",{className:"text-muted-foreground",children:"You don't have any active memberships yet."})]})})]}),((bs=le==null?void 0:le.availableMemberships)==null?void 0:bs.length)>0&&s.jsxs("div",{children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Available Memberships"}),s.jsx("div",{className:"space-y-4",children:le.availableMemberships.map(xe=>s.jsx(Ce,{children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"font-medium",children:xe.name}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1 whitespace-pre-line break-words",children:xe.description})]}),s.jsxs("div",{className:"text-right",children:[s.jsxs("p",{className:"font-medium",children:[_h(xe.price,(ue==null?void 0:ue.currency)||"GBP"),"/",xe.billingFrequency==="monthly"?"month":xe.billingFrequency==="four_weekly"?"4 weeks":xe.billingFrequency]}),s.jsx(B,{size:"sm",className:"mt-2",onClick:()=>{se(xe),Ie(!1),je("")},children:"Subscribe"})]})]})})},xe.id))})]})]}),s.jsx(on,{value:"waitlist",className:"space-y-6",children:s.jsxs("div",{children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"My Waitlist"}),s.jsx(HWe,{instructorId:ue==null?void 0:ue.id})]})}),s.jsx(on,{value:"achievements",className:"space-y-6",children:s.jsxs("div",{children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"My A
843chievements"}),le!=null&&le.achievements&&le.achievements.length>0?s.jsx("div",{className:"space-y-4",children:[...le.achievements||[]].sort((xe,He)=>new Date(He.achievementDate).getTime()-new Date(xe.achievementDate).getTime()).map(xe=>s.jsx(Ce,{children:s.jsx(Ee,{className:"p-4",children:s.jsx("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold text-lg",children:xe.name}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Ls,{className:"w-4 h-4"}),new Date(xe.achievementDate).toLocaleDateString()]})]}),xe.description&&s.jsx("p",{className:"text-sm text-slate-600",children:xe.description})]})})})},xe.id))}):s.jsx(Ce,{children:s.jsx(Ee,{className:"p-8 text-center",children:s.jsx("p",{className:"text-slate-500",children:"No achievements recorded yet."})})})]})}),s.jsxs(on,{value:"profile",className:"space-y-6",children:[s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Profile Information"}),s.jsxs(Ys,{children:["Your account details with ",ue.businessName]})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Profile Picture"}),s.jsxs("div",{className:"mt-2 space-y-4",children:[($e||((Ss=le==null?void 0:le.client)==null?void 0:Ss.profilePictureUrl))&&s.jsxs("div",{className:"flex items-center gap-4",children:[$e||(xs=le==null?void 0:le.client)!=null&&xs.profilePictureUrl?s.jsx("div",{className:"h-24 w-16 flex-shrink-0 rounded overflow-hidden bg-slate-200",children:s.jsx("img",{src:ze($e||((hs=le==null?void 0:le.client)==null?void 0:hs.profilePictureUrl)),alt:"Profile picture",className:"w-full h-full object-cover",onError:xe=>{var He;console.error("Failed to load profile picture:",$e||((He=le==null?void 0:le.client)==null?void 0:He.profilePictureUrl)),xe.currentTarget.style.display="none"}})}):s.jsx("div",{className:"h-24 w-16 flex-shrink-0 rounded bg-slate-200 flex items-center justify-center",children:s.jsx(Dr,{className:"h-10 w-10 text-slate-600"})}),s.jsx("div",{className:"text-sm text-muted-foreground",children:"Current profile picture"})]}),s.jsxs("div",{children:[s.jsx(zV,{onUpload:async xe=>{const He=await fetch("/api/client/profile-picture/upload-url",{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"}});if(He.status===401)throw de(),new Error("Authentication failed - session expired");if(!He.ok){const we=await He.json();throw new Error(we.message||"Failed to get upload URL")}const{uploadURL:tt}=await He.json();if(!(await fetch(tt,{method:"PUT",headers:{"Content-Type":xe.type},body:xe})).ok)throw new Error("Failed to upload image to storage");const ds=await fetch("/api/client/profile-picture",{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify({profilePictureUrl:tt})});if(ds.status===401)throw de(),new Error("Authentication failed - session expired");if(!ds.ok){const we=await ds.json();throw new Error(we.message||"Failed to update profile picture")}const zs=await ds.json(),De=ze(zs.profilePictureUrl);qe(De),n.invalidateQueries({queryKey:[`/api/client/my-account/${ue==null?void 0:ue.id}`]}),await We(),t({title:"Success!",description:"Profile picture uploaded successfully."})},buttonClassName:"w-fit",children:$e||(gs=le==null?void 0:le.client)!=null&&gs.profilePictureUrl?"Change Profile Picture":"Upload Profile Picture"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Photos will be cropped to passport photo format (2:3 ratio) for membership cards. Maximum file size: 5MB."})]})]})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Name"}),s.jsx("p",{className:"mt-1",children:(Os=le==null?void 0:le.client)==null?void 0:Os.name})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Email"}),s.jsx("p",{className:"mt-1",children:(cs=le==null?void 0:le.client)==null?void 0:cs.email})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Phone"}),s.jsx("p",{className:"mt-1",children:((Tr=le==null?void 0:le.client)==null?void 0:Tr.phone)||"Not provided"})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Member Since"}),s.jsx("p",{className:"mt-1",children:(rr=le==null?void 0:le.client)!=null&&rr.memberSince?Sr(new Date(le.client.memberSince),"PPP"):"Not available"})]})]})]}),s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(jd,{className:"h-5 w-5"}),"Change Password"]}),s.jsx(Ys,{children:"Update the password you use for email logins."})]}),s.jsx(Ee,{children:s.jsxs(Ct,{open:N,onOpenChange:C,children:[s.jsx(Jr,{asChild:!0,children:s.jsxs(B,{variant:"outline",children:[s.jsx(jd,{className:"w-4 h-4 mr-2"}),"Change Password"]})}),s.jsxs(St,{children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:"Change Password"}),s.jsx(yn,{children:"Enter a new password for your account"})]}),s.jsxs("form",{onSubmit:Ft,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"newPassword",children:"New Password"}),s.jsx(me,{id:"newPassword",type:"password",value:p,onChange:xe=>v(xe.target.value),placeholder:"Enter new password",className:"mt-1",required:!0,maxLength:128})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"confirmPassword",children:"Confirm Password"}),s.jsx(me,{id:"confirmPassword",type:"password",value:y,onChange:xe=>g(xe.target.value),placeholder:"Confirm password",className:"mt-1",maxLength:128,required:!0})]}),s.jsxs("div",{className:"flex gap-3 pt-4",children:[s.jsx(Jr,{asChild:!0,children:s.jsx(B,{t
843ype:"button",variant:"outline",className:"flex-1",children:"Cancel"})}),s.jsx(B,{type:"submit",className:"flex-1",disabled:w,children:w?"Changing...":"Change Password"})]})]})]})]})})]})]})]})}),s.jsx(Ct,{open:!!M,onOpenChange:xe=>{xe||(se(null),Ie(!1),je(""))},children:s.jsxs(St,{className:"max-w-2xl max-h-[90vh] overflow-hidden flex flex-col w-full mx-2 sm:mx-auto sm:w-auto",children:[s.jsx(kt,{children:s.jsxs(Pt,{children:["Purchase ",M==null?void 0:M.name]})}),s.jsx("div",{className:"overflow-y-auto flex-1 pr-1 pb-4 min-w-0",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Contact Information"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"name",children:"Full Name *"}),s.jsx(me,{id:"name",value:Q.name,onChange:xe=>te(He=>({...He,name:xe.target.value})),required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"phone",children:"Phone Number *"}),s.jsx(me,{id:"phone",type:"tel",value:Q.phone,onChange:xe=>te(He=>({...He,phone:xe.target.value})),required:!0})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",children:"Email Address *"}),s.jsx(me,{id:"email",type:"email",value:Q.email,readOnly:!0,className:"bg-gray-50 text-gray-600",required:!0}),s.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Using your account email address"})]})]}),s.jsx("div",{className:"border-t pt-4",children:s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold",children:M==null?void 0:M.name}),M!=null&&M.description?s.jsx("p",{className:"text-sm text-slate-600 mt-2 whitespace-pre-line break-words",children:M.description}):null,s.jsxs("p",{className:"text-sm text-slate-600 mt-2",children:[mt((ue==null?void 0:ue.currency)||"GBP"),M==null?void 0:M.price,(M==null?void 0:M.billingType)==="one_time"?s.jsxs(s.Fragment,{children:[" ","one-time",s.jsx("span",{className:"block text-xs text-slate-500 mt-1",children:(M==null?void 0:M.oneTimeExpiresAfter)==="never"?"Never expires":(M==null?void 0:M.oneTimeExpiresAfter)==="1_month"?"Expires after 1 month":(M==null?void 0:M.oneTimeExpiresAfter)==="1_quarter"?"Expires after 1 quarter":(M==null?void 0:M.oneTimeExpiresAfter)==="1_year"?"Expires after 1 year":null})]}):s.jsxs(s.Fragment,{children:[" ","per"," ",(M==null?void 0:M.billingFrequency)==="monthly"?"month":(M==null?void 0:M.billingFrequency)==="four_weekly"?"4 weeks":M==null?void 0:M.billingFrequency]})]}),(M==null?void 0:M.billingType)!=="one_time"&&(M==null?void 0:M.renewalDayOfMonth)!=null&&s.jsx("p",{className:"text-xs text-slate-500 mt-1.5",children:(M==null?void 0:M.proRateExistingSubscribers)!==!1?"Your first payment will be pro-rated for the current period.":`Your first payment will be the full amount. You'll renew on the ${M.renewalDayOfMonth}${M.renewalDayOfMonth===1?"st":M.renewalDayOfMonth===2?"nd":M.renewalDayOfMonth===3?"rd":"th"} of each month.`})]})})}),!Q.name||!Q.email||!Q.phone?s.jsx("div",{className:"border-t pt-4",children:s.jsx("p",{className:"text-sm text-gray-600 text-center py-4",children:"Please fill in all required fields above to continue with payment"})}):ke?s.jsx("div",{className:"border-t pt-4",children:ge?ie&&ue?s.jsxs("div",{className:"space-y-4",children:[s.jsx(yv,{stripe:ie,options:{clientSecret:ge,appearance:{theme:"stripe",variables:{colorPrimary:ue.primaryColor||"#3B82F6"}}},children:s.jsx(WWe,{membership:M,instructor:ue,isOneTimeCheckout:(M==null?void 0:M.billingType)==="one_time",clientData:{...Q,onboardingData:Object.keys(G).length>0?G:void 0},onSuccess:()=>{se(null),te({name:"",email:"",phone:""}),Z({}),Ie(!1),We()}})}),s.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"w-full text-muted-foreground",onClick:()=>{Ie(!1),je("")},children:"← Back to edit details"})]}):null:s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-4",children:[s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent roun
843ded-full"}),s.jsx("span",{className:"ml-2",children:"Preparing payment..."})]}),s.jsx(B,{type:"button",variant:"ghost",size:"sm",onClick:()=>{Ie(!1),je("")},children:"← Back to edit details"})]})}):s.jsx("div",{className:"border-t pt-4",children:s.jsx(B,{type:"button",className:"w-full",onClick:()=>Ie(!0),style:{backgroundColor:ue==null?void 0:ue.primaryColor,borderColor:ue==null?void 0:ue.primaryColor},children:"Continue to payment"})})]})})]})}),s.jsx(Ct,{open:!!P,onOpenChange:()=>{try{S(null),O(""),T([])}catch(xe){console.error("📱 Error closing dialog:",xe)}},children:s.jsxs(St,{className:"max-w-[95vw] sm:max-w-md mx-2 sm:mx-auto",children:[s.jsxs(kt,{children:[s.jsx(Pt,{children:P!=null&&P.classAllowReschedule?"Reschedule Booking":"Request Booking Change"}),s.jsxs(yn,{children:['Select a new date for your "',P==null?void 0:P.className,'" booking.',P!=null&&P.classAllowReschedule?" Your booking will be updated immediately.":" A change request will be sent to your instructor."]})]}),s.jsxs("div",{className:"space-y-4",children:[P!=null&&P.classAllowRescheduleToDifferentClasses?s.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:s.jsxs("p",{className:"text-sm text-blue-900 dark:text-blue-100",children:[s.jsx("strong",{children:"Note:"})," You can reschedule to the same class or to other classes with the same price value. The class name will be shown next to each date. If you don't see the date or class you want, please contact your instructor using the button below."]})}):s.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:s.jsxs("p",{className:"text-sm text-blue-900 dark:text-blue-100",children:[s.jsx("strong",{children:"Note:"})," This allows you to change the date for your current class booking. You cannot change to a different class. If you don't see the date you want, please contact your instructor using the button below."]})}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium",children:"Current booking date"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:P&&(()=>{const xe=KD(P.classDate),He=qWe(P.classDate,P.classStartTime);return xe?He?`${Sr(xe,"PPP")} at ${He}`:Sr(xe,"PPP"):P.classDate})()})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"new-date",className:"text-sm font-medium",children:"Select new date"}),F?s.jsxs("div",{className:"flex items-center justify-center py-4",children:[s.jsx("div",{className:"animate-spin w-6 h-6 border-2 border-primary border-t-transparent rounded-full"}),s.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading available dates..."})]}):s.jsxs(Bt,{value:z&&D?`${D}-${z}`:z||"",onValueChange:xe=>{const He=xe.split("-");let tt,Jt=null;if(He.length>=4?(Jt=parseInt(He[0]),tt=He.slice(1).join("-")):tt=xe,O(tt),Jt)k(Jt);else{const ds=E.find(zs=>zs.date===tt);ds!=null&&ds.classId?k(ds.classId):k(null)}},children:[s.jsx($t,{className:"w-full",children:s.jsx(Lt,{placeholder:"Choose a new date"})}),s.jsx(It,{children:E.length>0?E.slice(0,20).map(xe=>{const He=xe.classId&&xe.classId!==(P==null?void 0:P.classId),tt=KD(xe.date),Jt=tt?Sr(tt,"PPP"):xe.date,zs=(P!=null&&P.classAllowRescheduleToDifferentClasses||He)&&xe.className?` - ${xe.className}`:"",De=zWe(xe.time),we=xe.classId?`${xe.classId}-${xe.date}`:xe.date;return s.jsxs(ce,{value:we,children:[Jt,zs,De]},we)}):s.jsx(ce,{value:"no-dates",disabled:!0,children:"No available dates found"})})]})]}),s.jsx("div",{className:"pt-2",children:s.jsxs(B,{type:"button",variant:"outline",className:"w-full",onClick:()=>{var xe,He;Y({name:((xe=le==null?void 0:le.client)==null?void 0:xe.name)||"",email:((He=le==null?void 0:le.client)==null?void 0:He.email)||"",subject:`Booking change request for ${P==null?void 0:P.className}`,message:`Hi, I'd like to discuss changing my booking for ${P==null?void 0:P.className} on ${P?Sr(new Date(P.classDate),"PPP 'at' p"):""}. Could you help me with alternative dates or options?`}),re(!0)},children:[s.jsx(_n,{className:"w-4 h-4 mr-2"}),"Contact Instructor"]})})]}),s.jsxs(Er,{className:"flex gap-2",children:[s.jsx(B,{variant:"outline",onClick:()=>{try{S(null),O(""),k(null),T([])}catch(xe){console.error("📱 Error canceling dialog:",xe)}},children:"Cancel"}),s.jsx(B,{onClick:ht,disabled:!z||F||q,children:q?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent roun
843ded-full mr-2"}),"Processing..."]}):P!=null&&P.classAllowReschedule?"Reschedule":"Send Request"})]})]})}),s.jsx(Zi,{open:!!_,onOpenChange:xe=>!xe&&L(null),children:s.jsxs(bi,{children:[s.jsxs(wi,{children:[s.jsx(Ni,{children:"Cancel Booking"}),s.jsx(Ci,{children:_&&s.jsxs(s.Fragment,{children:["Are you sure you want to cancel your booking for"," ",s.jsx("strong",{children:_.className})," on"," ",Sr(new Date(_.classDate),"PPP 'at' p"),"?",_.classAutoRefundStripe&&s.jsxs("div",{className:"mt-2 p-2 bg-green-50 border border-green-200 rounded text-sm",children:[s.jsx("strong",{children:"Note:"})," Your payment will be automatically refunded to your original payment method."]}),!_.classAutoRefundStripe&&_.stripePaymentIntentId&&s.jsxs("div",{className:"mt-2 p-2 bg-amber-50 border border-amber-200 rounded text-sm",children:[s.jsx("strong",{children:"Note:"})," Refunds must be processed manually by your instructor. Please contact them if you need a refund."]})]})})]}),s.jsxs(ji,{children:[s.jsx(to,{disabled:U,children:"Keep Booking"}),s.jsx(eo,{onClick:ts,disabled:U,className:"bg-red-600 hover:bg-red-700",children:U?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Cancelling..."]}):"Yes, Cancel Booking"})]})]})}),s.jsx(Ct,{open:I,onOpenChange:re,children:s.jsxs(St,{className:"max-w-md",children:[s.jsx(kt,{children:s.jsxs(Pt,{className:"flex items-center gap-2",children:[s.jsx(_n,{className:"h-5 w-5"}),"Contact ",(ue==null?void 0:ue.instructorName)||(ue==null?void 0:ue.businessName)]})}),s.jsxs("form",{onSubmit:xe=>{xe.preventDefault(),R.name&&R.email&&R.subject&&R.message&&Mt.mutate(R)},className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"contact-name",children:"Your Name *"}),s.jsx(me,{id:"contact-name",value:R.name,onChange:xe=>Y({...R,name:xe.target.value}),required:!0,placeholder:"Enter your full name"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"contact-email",children:"Your Email *"}),s.jsx(me,{id:"contact-email",type:"email",value:R.email,onChange:xe=>Y({...R,email:xe.target.value}),required:!0,placeholder:"[email protected]"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"contact-subject",children:"Subject *"}),s.jsx(me,{id:"contact-subject",value:R.subject,onChange:xe=>Y({...R,subject:xe.target.value}),required:!0,placeholder:"What is this about?"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"contact-message",children:"Message *"}),s.jsx(Is,{id:"contact-message",value:R.message,onChange:xe=>Y({...R,message:xe.target.value}),required:!0,placeholder:"Your message...",rows:5})]}),s.jsxs(Er,{children:[s.jsx(B,{type:"button",variant:"outline",onClick:()=>re(!1),children:"Cancel"}),s.jsx(B,{type:"submit",disabled:Mt.isPending,children:Mt.isPending?"Sending...":"Send Message"})]})]})]})})]}):s.jsx("div",{className:"min-h-screen bg-gradient-to-b from-background to-secondary/20 flex items-center justify-center p-4",children:s.jsxs(Ce,{className:"w-full max-w-md",children:[s.jsxs(gt,{className:"text-center",children:[ue.logoUrl&&s.jsx("img",{src:ue.logoUrl,alt:ue.businessName,className:"mx-auto h-16 w-auto mb-4"}),s.jsx(Nt,{className:"text-2xl",children:"My Account"}),s.jsxs(Ys,{children:["Access your account with ",ue.businessName," to view your bookings and memberships"]})]}),s.jsx(Ee,{className:"space-y-6",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex rounded-lg bg-gray-100 dark:bg-gray-800 p-1",children:[s.jsx("button",{type:"button",onClick:()=>m("magic"),className:`flex-1 py-2 px-3 rounded-md text-sm font-medium transition-colors ${d==="magic"?"text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,style:d==="magic"?{backgroundColor:ue.primaryColor,color:`hsl(${Rl(ue.primaryColor)})`}:{},children:"Magic Link"}),s.jsx("button",{type:"button",onClick:()=>m("password"),className:`flex-1 py-2 px-3 rounded-md text-sm font-medium transition-colors ${d==="password"?"text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,style:d==="password"?{backgroundColor:ue.primaryColor,color:`hsl(${Rl(ue.primaryColor)})`}:{},children:"Password"})]}),s.jsxs("form",{onSubmit:Tt,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",className:"text-sm font-medium",children:"Email"}),s.jsx(me,{id:"email",type:"email",value:l.email,onChange:xe=>c(He=>({...He,email:xe.target.value})),placeholder:"Enter your email",className:"mt-1",required:!0})]}),d==="password"&&s.jsxs("div",{children:[s.jsx(V,{htmlFor:"password",className:"text-sm font-medium",children:"Password"}),s.jsxs("div",{className:"relative mt-1",children:[s.jsx(me,{id:"password",type:u?"text":"password",value:l.password,onChange:xe=>c(He=>({...He,password:xe.target.value})),placeholder:"Enter your password",className:"pr-10",required:d==="password"}
843),s.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>h(xe=>!xe),"aria-label":u?"Hide password":"Show password",children:u?s.jsx(uc,{className:"h-4 w-4"}):s.jsx(wa,{className:"h-4 w-4"})})]})]}),s.jsx("button",{type:"submit",className:"w-full py-2 px-4 rounded-md text-sm font-medium transition-colors hover:opacity-90 disabled:opacity-50",style:{backgroundColor:ue.primaryColor,color:`hsl(${Rl(ue.primaryColor)})`},children:d==="magic"?"Send Magic Link":"Login with Password"})]})]})})]})})}function KWe(){return f.useEffect(()=>{window.scrollTo(0,0)},[]),s.jsxs("div",{className:"min-h-screen bg-slate-50",children:[s.jsx("header",{className:"bg-white shadow-sm border-b border-slate-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsx("div",{className:"flex items-center space-x-2 sm:space-x-4",children:s.jsx(dt,{href:"/",children:s.jsxs("div",{className:"flex items-center space-x-2 cursor-pointer",children:[s.jsx(zx,{className:"text-primary text-xl sm:text-2xl w-6 h-6 sm:w-8 sm:h-8"}),s.jsx("span",{className:"text-lg sm:text-xl font-bold text-slate-900",children:"Classta"})]})})}),s.jsx("div",{className:"flex items-center space-x-2 sm:space-x-4",children:s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{size:"sm",className:"bg-primary text-white hover:bg-primary/90 text-xs sm:text-sm px-2 sm:px-4",children:[s.jsx("span",{className:"hidden sm:inline",children:"Start Teaching"}),s.jsx("span",{className:"sm:hidden",children:"Teach"})]})})})]})})}),s.jsx("div",{className:"py-12",children:s.jsx("div",{className:"container mx-auto px-4 max-w-4xl",children:s.jsxs(Ce,{className:"shadow-lg",children:[s.jsxs(gt,{className:"text-center pb-8",children:[s.jsx(Nt,{className:"text-3xl font-bold bg-gradient-to-r from-blue-600 to-green-600 bg-clip-text text-transparent",children:"Terms & Conditions"}),s.jsx("p",{className:"text-gray-600 dark:text-gray-300 mt-2",children:"Last updated: 13 February 2026"})]}),s.jsxs(Ee,{className:"prose prose-gray dark:prose-invert max-w-none space-y-6",children:[s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"1. Acceptance of Terms"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:'By accessing or using Classta ("the Platform", "we", "us", "our"), you agree to be bound by these Terms & Conditions. If you do not agree, you must not use the Platform.'}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"These Terms apply to all users, including instructors, organisers and clients."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"2. Description of Service"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:'Classta is an online booking and payments platform that enables instructors, organisers and service providers ("Instructors") to create and manage classes, sessions, events and related activities, and allows clients ("Clients") to discover and book those services.'}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"Features may include:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"Class and event creation and scheduling"}),s.jsx("li",{children:"Ticket and booking management"}),s.jsx("li",{children:"Online payment processing"}),s.jsx("li",{children:"Automated emails and reminders"}),s.jsx("li",{children:"Public booking pages"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:"Classta provides technology services only. We are not the organiser, operator, or provider of any class, event or activity listed on the Platform."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"3. Accounts and Registration"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"To use certain features, you must create an account."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"You agree to:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"Provide accurate and complete information"}),s.jsx("li",{children:"Maintain the security of your login details"}),s.jsx("li",{children:"Accept responsibility for activity under your account"}),s.jsx("li",{children:"Notify us immediately of any unauthorised use"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:"We may suspend or terminate accounts that provide false information or misuse the Platform."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"4. Bookings and Payments"}),s.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-2",children:"4.1 Bookings"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mb-3",children:[s.jsx("li",{children:"All bookings and ticket purchases are subject to availability as determined by the Instructor."}),s.jsx("li",{children:"A booking is confirmed once payment has been successfully processed and a confirmation email has been issued."})]}),s.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-2",children:"4.2 Payments"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"Payments are processed through third-party payment providers (such as Stripe or PayPal). Classta does not store full payment card details."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-3",children:"By making a payment, you also agree to the terms of the relevant payment provider."}),s.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-2",children:"4.3 Cancellations and Refunds"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Cancellation and refund policies are set by individual Instructors."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Classta is not responsible for refund decisions, service delivery, or cancellations made by Instructors."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"5. Instructor Responsibilities"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"Instructors agree to:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"Provide accurate descriptions, pricing and scheduling information"}),s.jsx("li",{children:"Maintain appropriate qualifications, licences and insurance"}),s.jsx("li",{children:"Deliver services safely and professionally"}),s.jsx("li",{children:"Comply with all applicable laws and regulations"}),s.jsx("li",{children:"Pay applicable subscription or service fees"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:"Instructors are solely responsible for the services they offer."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"6. Content and External Links"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"Instructors may upload content including descriptions, images, and external links."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"Classta does not verify or endorse third-party websites or external 
843content."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"We reserve the right, at our sole discretion and without prior notice, to remove or disable:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"Events or classes"}),s.jsx("li",{children:"External links"}),s.jsx("li",{children:"Images or other uploaded content"}),s.jsx("li",{children:"User accounts"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:"where we consider content to be inappropriate, misleading, unlawful, harmful, in breach of these Terms, or in conflict with the interests of the Platform."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"7. Acceptable Use"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"You must not:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"Use the Platform for illegal or fraudulent purposes"}),s.jsx("li",{children:"Upload harmful, misleading, defamatory or inappropriate content"}),s.jsx("li",{children:"Interfere with the Platform's operation, security or infrastru
843cture"}),s.jsx("li",{children:"Attempt to copy, reverse engineer or exploit the Platform"}),s.jsx("li",{children:"Violate the rights of other users"})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"8. Health, Safety and Participation Risk"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"Participation in classes, sessions or events may involve risk."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"Clients acknowledge that:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"They participate at their own risk"}),s.jsx("li",{children:"Classta does not supervise or control activities"}),s.jsx("li",{children:"Classta is not responsible for injuries or losses arising from participation"}),s.jsx("li",{children:"Participants should seek appropriate professional advice where necessary."})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"9. Limitation of Liability"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"Classta acts solely as a technology platform connecting Instructors and Clients."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"To the fullest extent permitted by law, Classta is not liable for:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"The quality, safety, legality or delivery of services"}),s.jsx("li",{children:"Injuries, losses or damages arising from participation"}),s.jsx("li",{children:"Disputes between Instructors and Clients"}),s.jsx("li",{children:"Content or external links provided by users"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:"Nothing in these Terms excludes liability where it cannot legally be excluded."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"10. Fees and Subscriptions"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Instructors may be required to pay subscription or service fees to use the Platform."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Fees are charged as described at the time of purchase."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"We reserve the right to update pricing with reasonable notice."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"11. Fair Use"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"Classta operates on a simple, flat monthly subscription model intended for typical use by individual instructors and small-to-medium organisations."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"While we do not charge per booking or per user, we reserve the right to review accounts whose usage is materially excessive, automated, or outside normal expected use of the Platform."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"Where usage significantly impacts platform performance, infrastructure costs, or other users, we may:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"Contact the account holder to discuss usage"}),s.jsx("li",{children:"Require migration to a custom or enterprise arrangement"}),s.jsx("li",{children:"Impose reasonable usage limits"}),s.jsx("li",{children:"Suspend or terminate the account if necessary"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:"We will aim to act reasonably and transparently."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"12. Suspension and Termination"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"We may suspend or terminate accounts at our discretion, including where:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"These Terms are breached"}),s.jsx("li",{children:"Content is inappropriate or unlawful"}),s.jsx("li",{children:"Continued use presents risk to the Platform"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:"Users may delete their accounts at any time."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"13. Changes to the Platform or Terms"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"We may update or modify the Platform or these Terms at any time."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Where changes are significant, we will notify users via email or platform notification."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Continued use of the Platform constitutes acceptance of the updated Terms."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"14. Governing Law"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"These Terms are governed by the laws of England and Wales."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Any disputes shall be subject to the exclusive jurisdiction of the courts of England and Wales."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"15. Contact"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"If you have questions regarding these Terms, please contact:"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:s.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 dar
843k:text-blue-400 hover:underline",children:"[email protected]"})})]})]})]})})})]})}function GWe(){return f.useEffect(()=>{window.scrollTo(0,0)},[]),s.jsxs("div",{className:"min-h-screen bg-slate-50",children:[s.jsx("header",{className:"bg-white shadow-sm border-b border-slate-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsx("div",{className:"flex items-center space-x-2 sm:space-x-4",children:s.jsx(dt,{href:"/",children:s.jsxs("div",{className:"flex items-center space-x-2 cursor-pointer",children:[s.jsx(zx,{className:"text-primary text-xl sm:text-2xl w-6 h-6 sm:w-8 sm:h-8"}),s.jsx("span",{className:"text-lg sm:text-xl font-bold text-slate-900",children:"Classta"})]})})}),s.jsx("div",{className:"flex items-center space-x-2 sm:space-x-4",children:s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{size:"sm",className:"bg-primary text-white hover:bg-primary/90 text-xs sm:text-sm px-2 sm:px-4",children:[s.jsx("span",{className:"hidden sm:inline",children:"Start Teaching"}),s.jsx("span",{className:"sm:hidden",children:"Teach"})]})})})]})})}),s.jsx("div",{className:"py-12",children:s.jsx("div",{className:"container mx-auto px-4 max-w-4xl",children:s.jsxs(Ce,{className:"shadow-lg",children:[s.jsxs(gt,{className:"text-center pb-8",children:[s.jsx(Nt,{className:"text-3xl font-bold bg-gradient-to-r from-blue-600 to-green-600 bg-clip-text text-transparent",children:"Privacy Policy"}),s.jsx("p",{className:"text-gray-600 dark:text-gray-300 mt-2",children:"Last updated: 13 February 2026"})]}),s.jsxs(Ee,{className:"prose prose-gray dark:prose-invert max-w-none space-y-6",children:[s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"1. Introduction"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:'Classta ("we", "us", "our") operates an online booking and payments platform that enables instructors and organisers to manage classes, sessions and events.'}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"We are committed to protecting your personal data and complying with applicable data protection laws, including the UK GDPR and Data Protection Act 2018."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"This Privacy Policy explains how we collect, use and protect your information."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"2. Who We Are"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"For most personal data processed in connection with the operation of the Classta platform, MJT Net Ltd is the data controller."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"However:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"Instructors are independent data controllers in relation to client information collected for their classes or events."}),s.jsx("li",{children:"Classta acts as a data processor when processing client data on behalf of instructors."})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"3. Information We Collect"}),s.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-2",children:"3.1 Information You Provide"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"This may include:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mb-3",children:[s.jsx("li",{children:"Name, email address, phone number"}),s.jsx("li",{children:"Account login credentials"}),s.jsx("li",{children:"Profile photos and business information (for instructors)"}),s.jsx("li",{children:"Booking details"}),s.jsx("li",{children:"Emergency contact information"}),s.jsx("li",{children:"Health or participation information (if collected via instructor forms)"}),s.jsx("li",{children:"Payment details (processed securely via third-party providers such as Stripe or PayPal)"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-3",children:"Classta does not store full payment card details."}),s.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-2",children:"3.2 Automatically Collected Information"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"We may collect:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mb-3",children:[s.jsx("li",{children:"IP address"}),s.jsx("li",{children:"Device and browser information"}),s.jsx("li",{children:"Usage data (pages visited, time spent, interactions)"}),s.jsx("li",{children:"Referring URLs"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-3",children:"We use tools such as Google Analytics to analyse usage trends."}),s.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-2",children:"3.3 Cookies"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"We use cookies and similar technologies to:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"Maintain sessions"}),s.jsx("li",{children:"Improve performance"}),s.jsx("li",{children:"Analyse platform usage"}),s.jsx("li",{children:"Support marketing (where consent is provided)"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:"You may control cookies through your browser settings."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"4. Lawful Basis for Processing (UK GDPR)"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"We process personal data on the following lawful bases:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Contract"})," – to provide booking and payment services"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Legitimate Interests"})," – to improve and secure the platform"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Legal Obligation"})," – to comply with tax and accounting laws"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Consent"})," – for marketing communications"]})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"5. How We Use Your Information"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"We use personal data to:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"Provide and operate the platform"}),s.jsx("li",{children:"Process bookings and payments"}),s.jsx("li",{children:"Send confirmations and reminders"}),s.jsx("li",{children:"Provide customer support"}),s.jsx("li",{children:"Improve platform performance"}),s.jsx("li",{children:"Prevent fraud and ensure security"}),s.jsx("li",{children:"Comply with legal obligations"}),s.jsx("li",{children:"Send marketing communications (where permitted)"})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"6. Information Sharing"}),s.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-2",children:"6.1 With Instru
843ctors"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"When a client books a class or event, relevant personal data is shared with the instructor responsible for that service."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-3",children:"Instructors are responsible for how they use client information."}),s.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-2",children:"6.2 Service Providers"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"We use trusted third-party providers including:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mb-3",children:[s.jsx("li",{children:"Stripe and PayPal (payment processing)"}),s.jsx("li",{children:"Postmark (email delivery)"}),s.jsx("li",{children:"Twilio (SMS notifications)"}),s.jsx("li",{children:"Google Analytics (analytics)"}),s.jsx("li",{children:"Cloud hosting providers (data storage)"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-3",children:"These providers process data under contractual safeguards."}),s.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-2",children:"6.3 Legal Disclosure"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"We may disclose information if required to do so by law or to protect our legal rights."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"7. Data Security"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"We implement appropriate technical and organisational measures, including:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"Encryption in transit (HTTPS)"}),s.jsx("li",{children:"Secure hosting infrastructure"}),s.jsx("li",{children:"Access controls and authentication"}),s.jsx("li",{children:"Regular software updates"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:"No system can guarantee absolute security."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"8. Data Retention"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"We retain personal data only as long as necessary."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"Typical retention periods:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"Account information: Until account deletion"}),s.jsx("li",{children:"Financial and booking records: Up to 7 years (for legal and tax purposes)"}),s.jsx("li",{children:"Marketing data: Until consent is withdrawn"}),s.jsx("li",{children:"Analytics data: In accordance with provider retention policies"})]}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:"If you delete your account, we will remove or anonymise personal data except where retention is legally required."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"9. Your Rights"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"Under UK GDPR, you have the right to:"}),s.jsxs("ul",{className:"list-disc list-inside text-gray-700 dark:text-gray-300 ml-4 mt-2",children:[s.jsx("li",{children:"Access your data"}),s.jsx("li",{children:"Correct inaccurate data"}
843),s.jsx("li",{children:"Request deletion (subject to legal obligations)"}),s.jsx("li",{children:"Restrict processing"}),s.jsx("li",{children:"Object to processing"}),s.jsx("li",{children:"Withdraw consent"}),s.jsx("li",{children:"Lodge a complaint with the Information Commissioner's Office (ICO)"})]}),s.jsxs("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:["To exercise your rights, contact"," ",s.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 dark:text-blue-400 hover:underline",children:"[email protected]"})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"10. Children's Data"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Classta is not intended for children under 16."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Instructors are responsible for obtaining appropriate parental consent where required for minors attending classes or events."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"11. International Transfers"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Some of our service providers may process data outside the UK."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Where this occurs, we ensure appropriate safeguards such as standard contractual clauses are in place."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"12. External Links"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Our platform may contain links to third-party websites. We are not responsible for the privacy practices of those websites."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"13. Changes to This Policy"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"We may update this Privacy Policy periodically."}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"Where changes are significant, we will notify users via email or platform notification."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"14. Contact Information"}),s.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-2",children:"If you have questions about this Privacy Policy or wish to exercise your rights, contact:"}),s.jsxs("div",{className:"mt-3 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg",children:[s.jsxs("p",{className:"text-gray-700 dark:text-gray-300",children:[s.jsx("strong",{children:"Email:"})," ",s.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 dark:text-blue-400 hover:underline",children:"[email protected]"})]}),s.jsxs("p",{className:"text-gray-700 dark:text-gray-300 mt-2",children:[s.jsx("strong",{children:"For data protection matters:"})," ",s.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 dark:text-blue-400 hover:underline",children:"[email protected]"})]})]})]})]})]})})})]})}var OX={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},yL=he.createContext&&he.createContext(OX),YWe=["attr","size","title"];function QWe(e,t){if(e==null)return{};var n=JWe(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function JWe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Kj(){return Kj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Kj.apply(this,arguments)}function vL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Gj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
843t%2?vL(Object(n),!0).forEach(function(r){XWe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function XWe(e,t,n){return t=ZWe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZWe(e){var t=eHe(e,"string");return typeof t=="symbol"?t:t+""}function eHe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function FX(e){return e&&e.map((t,n)=>he.createElement(t.tag,Gj({key:n},t.attr),FX(t.child)))}function tHe(e){return t=>he.createElement(sHe,Kj({attr:Gj({},e.attr)},t),FX(e.child))}function sHe(e){var t=n=>{var{attr:r,size:a,title:i}=e,o=QWe(e,YWe),l=a||n.size||"1em",c;return n.className&&(c=n.className),e.className&&(c=(c?c+" ":"")+e.className),he.createElement("svg",Kj({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:c,style:Gj(Gj({color:e.color||n.color},n.style),e.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),i&&he.createElement("title",null,i),e.children)};return yL!==void 0?he.createElement(yL.Consumer,null,n=>t(n)):t(OX)}function nHe(e){return tHe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z"},child:[]}]})(e)}const Qo=e=>{try{return`https://www.google.com/s2/favicons?sz=32&domain=${new URL(e).hostname}`}catch{return null}},Xm={displayName:"@marcustettmar",bio:"CTO, Entrepreneur, Nerd, Musician, Dad. Some things I've created/contributed to.",profileImage:"https://ugc.production.linktr.ee/wB4GNlaRACZF4WiQe2p4_DdHRD391Q5EH06De?io=true&size=avatar-v3_0",links:[{title:"Run for Dad",description:"Raising £2,500 for Marie Curie",url:"https://runfordad.co.uk",featured:!0,favicon:Qo("https://runfordad.co.uk")},{title:"Live Music for Marie Curie • 28/11/2026",description:"Tickets for the live music event",url:"https://classta.co/events/jamarca/71",featured:!0,favicon:Qo("https://runfordad.co.uk")},{title:"Caravan Auction",description:"3-night stay – 100% to Marie Curie",url:"https://www.jumblebee.co.uk/runfordad-caravan",featured:!0,favicon:Qo("https://www.jumblebee.co.uk/runfordad-caravan")},{title:"Classta",description:"Book and manage your classes online",url:"https://classta.co/",featured:!0,favicon:Qo("https://classta.co/")},{title:"Nerdle",description:"The daily numbers game",url:"https://nerdlegame.com/",favicon:Qo("https://nerdlegame.com/")},{title:"LeaderboardLe",description:"One place to track all your -le game scores and compete in leagues with friends",url:"https://www.leaderboardle.com/",favicon:Qo("https://www.leaderboardle.com/")},{title:"untied",description:"The UK's personal tax app - the easiest way to do your taxes",url:"https://www.untied.io/",favicon:Qo("https://www.untied.io/")},{title:"Macro Scheduler",description:"RPA tool - automate any Windows process",url:"https://www.mjtnet.com/",favicon:Qo("https://www.mjtnet.com/")},{title:"Jamarca",description:"My band - funk/groove 4 piece - book us for your party",url:"http://jamarca.band/",favicon:Qo("http://jamarca.band/")},{title:"Free Tools for Instructors",description:"Forms, AI Social Media Posts, QR Codes",url:"https://classta.co/free-tools",favicon:Qo("https://classta.co/")}],social:[{platform:"Instagram",url:"https://instagram.com/marcustettmar",icon:s.jsx(kre,{className:"h-5 w-5"})},{platform:"LinkedIn",url:"https://linkedin.com/in/marcustettmar",icon:s.jsx(Dre,{className:"h-5 w-5"})},{platform:"Email",url:"mailto:[email protected]",icon:s.jsx(_n,{className:"h-5 w-5"})},{platform:"X",url:"https://x.com/marcustettmar",icon:s.jsx(nHe,{className:"h-5 w-5"})}]};function rHe(){const{username:e}=sa(),[t,n]=f.useState(null);if(e!=="marcustettmar")return s.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-4",children:"Page Not Found"}),s.jsx(dt,{to:"/",children:s.jsx(B,{children:"Return Home"})})]})});const{data:r}=Ue({queryKey:["/api/geolocation"],staleTime:1e3*60*60});f.useEffect(()=>{r&&n(r)},[r]);const{data:a=[]}=Ue({queryKey:["/api/classes/featured"]}),i=(o,l)=>{window.open(o,"_blank","noopener,noreferrer")};return s.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white",children:[s.jsx("header",{className:"bg-white border-b border-slate-200 sticky top-0 z-50",children:s.jsx("div",{className:"max-w-6xl mx-auto px-4 py-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(dt,{to:"/",children:s.jsx(Ia,{className:"h-8"})}),s.jsxs("div",{className:"text-sm text-slate-600",children:["Powered by"," ",s.jsx("span",{className:"font-semibold text-emerald-600",children:"Classta"})]})]})})}),s.jsxs("main",{className:"max-w-md mx-auto px-4 py-8",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("div",{className:"w-24 h-24 mx-auto mb-4 rounded-full overflow-hidden border-4 border-white shadow-lg",children:s.jsx("img",{src:Xm.profileImage,alt:Xm.displayName,className:"w-full h-full object-cover"})}),s.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:Xm.displayName}),s.jsx("p",{className:"text-slate-600 leading-relaxed",children:Xm.bio})]}),s.jsx("div",{className:"flex justify-center gap-4 mb-8",children:Xm.social.map(o=>s.jsx(B,{variant:"outline",size:"icon",className:"w-12 h-12 rounded-full border-2 hover:bg-emerald-50 hover:border-emerald-200 transition-colors",onClick:()=>i(o.url,o.platform),children:o.icon},o.platform))}),s.jsx("div",{className:"space-y-4 mb-12",children:Xm.links.map((o,l)=>
843s.jsx(Ce,{className:`cursor-pointer transition-all duration-200 hover:shadow-lg hover:-translate-y-1 ${o.featured?"ring-2 ring-emerald-200 bg-emerald-50":"hover:shadow-md"}`,onClick:()=>i(o.url,o.title),children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[o.favicon&&s.jsx("img",{src:o.favicon,alt:`${o.title} favicon`,className:"w-8 h-8 rounded-sm flex-shrink-0",onError:c=>{c.currentTarget.style.display="none"}}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("h3",{className:"font-semibold text-slate-900 min-w-0",children:o.title}),o.featured&&s.jsx(Je,{variant:"secondary",className:"bg-emerald-100 text-emerald-800 text-xs flex-shrink-0",children:"Featured"})]}),s.jsx("p",{className:"text-sm text-slate-600",children:o.description})]})]}),s.jsx(Lr,{className:"h-5 w-5 text-slate-400 ml-3 flex-shrink-0"})]})})},l))}),a.length>0&&s.jsxs("div",{className:"mb-12",children:[s.jsx("h2",{className:"text-xl font-bold text-slate-900 mb-6 text-center",children:"Featured Classes on Classta"}),s.jsx("div",{className:"space-y-4",children:a.slice(0,3).map(o=>{var l;return s.jsx(Ce,{className:"hover:shadow-md transition-shadow",children:s.jsxs(Ee,{className:"p-4",children:[s.jsxs("div",{className:"flex justify-between items-start mb-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold text-slate-900 mb-1",children:o.name}),s.jsx("p",{className:"text-sm text-slate-600 font-medium",children:o.classType||"Class"})]}),s.jsxs(Je,{variant:"outline",className:"bg-emerald-50 text-emerald-700 border-emerald-200",children:[(t==null?void 0:t.currency)==="USD"?"$":"£",o.singlePrice]})]}),s.jsxs("div",{className:"flex items-center gap-4 text-xs text-slate-500 mb-3",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ei,{className:"h-3 w-3"}),s.jsxs("span",{children:[o.duration," min"]})]}),o.location&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(si,{className:"h-3 w-3"}),s.jsx("span",{className:"truncate",children:o.location.split(",")[0]})]})]}),s.jsx(dt,{to:(l=o.instructor)!=null&&l.subdomain?`/classes/${o.instructor.subdomain}`:"#",children:s.jsx(B,{size:"sm",className:"w-full bg-emerald-600 hover:bg-emerald-700 text-white",children:"View Classes"})})]})},o.id)})}),s.jsx("div",{className:"text-center mt-6",children:s.jsx(dt,{to:"/",children:s.jsx(B,{variant:"outline",className:"border-emerald-200 text-emerald-700 hover:bg-emerald-50",children:"View All Classes"})})})]}),s.jsx(Ce,{className:"bg-gradient-to-r from-emerald-50 to-blue-50 border-emerald-200",children:s.jsxs(Ee,{className:"p-6 text-center",children:[s.jsx(Ia,{className:"h-8 mx-auto mb-3"}),s.jsx("h3",{className:"font-semibold text-slate-900 mb-2",children:"Create Your Own Class Booking Page"}),s.jsx("p",{className:"text-sm text-slate-600 mb-4",children:"Join thousands of instructors using Classta to manage their classes and create beautiful branded pages."}),s.jsx(dt,{to:"/instructor-signup",children:s.jsx(B,{className:"bg-emerald-600 hover:bg-emerald-700 text-white",children:"Get Started Free"})})]})})]}),s.jsx("footer",{className:"bg-slate-50 border-t border-slate-200 py-8 mt-12",children:s.jsx("div",{className:"max-w-md mx-auto px-4 text-center",children:s.jsx(Ia,{className:"h-6 mx-auto"})})})]})}var Rv={},aHe=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},_X={},Ai={};let KF;const iHe=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Ai.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};Ai.getSymbolTotalCodewords=function(t){return iHe[t]};Ai.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};Ai.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');KF=t};Ai.isKanjiModeEnabled=function(){return typeof KF<"u"};Ai.toSJIS=function(t){return KF(t)};var fC={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};
vendor: 24,943 bytes, lines 843-850
843function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,a){if(e.isValid(r))return r;try{return t(r)}catch{return a}}})(fC);function MX(){this.buffer=[],this.length=0}MX.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var oHe=MX;function Bv(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}Bv.prototype.set=function(e,t,n,r){const a=e*this.size+t;this.data[a]=n,r&&(this.reservedBit[a]=!0)};Bv.prototype.get=function(e,t){return this.data[e*this.size+t]};Bv.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n};Bv.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var lHe=Bv,$X={};(function(e){const t=Ai.getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const a=Math.floor(r/7)+2,i=t(r),o=i===145?26:Math.ceil((i-13)/(2*a-2))*2,l=[i-7];for(let c=1;c<a-1;c++)l[c]=l[c-1]-o;return l.push(6),l.reverse()},e.getPositions=function(r){const a=[],i=e.getRowColCoords(r),o=i.length;for(let l=0;l<o;l++)for(let c=0;c<o;c++)l===0&&c===0||l===0&&c===o-1||l===o-1&&c===0||a.push([i[l],i[c]]);return a}})($X);var IX={};const cHe=Ai.getSymbolSize,bL=7;IX.getPositions=function(t){const n=cHe(t);return[[0,0],[n-bL,0],[0,n-bL]]};var RX={};(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(a){return a!=null&&a!==""&&!isNaN(a)&&a>=0&&a<=7},e.from=function(a){return e.isValid(a)?parseInt(a,10):void 0},e.getPenaltyN1=function(a){const i=a.size;let o=0,l=0,c=0,d=null,m=null;for(let u=0;u<i;u++){l=c=0,d=m=null;for(let h=0;h<i;h++){let p=a.get(u,h);p===d?l++:(l>=5&&(o+=t.N1+(l-5)),d=p,l=1),p=a.get(h,u),p===m?c++:(c>=5&&(o+=t.N1+(c-5)),m=p,c=1)}l>=5&&(o+=t.N1+(l-5)),c>=5&&(o+=t.N1+(c-5))}return o},e.getPenaltyN2=function(a){const i=a.size;let o=0;for(let l=0;l<i-1;l++)for(let c=0;c<i-1;c++){const d=a.get(l,c)+a.get(l,c+1)+a.get(l+1,c)+a.get(l+1,c+1);(d===4||d===0)&&o++}return o*t.N2},e.getPenaltyN3=function(a){const i=a.size;let o=0,l=0,c=0;for(let d=0;d<i;d++){l=c=0;for(let m=0;m<i;m++)l=l<<1&2047|a.get(d,m),m>=10&&(l===1488||l===93)&&o++,c=c<<1&2047|a.get(m,d),m>=10&&(c===1488||c===93)&&o++}return o*t.N3},e.getPenaltyN4=function(a){let i=0;const o=a.data.length;for(let c=0;c<o;c++)i+=a.data[c];return Math.abs(Math.ceil(i*100/o/5)-10)*t.N4};function n(r,a,i){switch(r){case e.Patterns.PATTERN000:return(a+i)%2===0;case e.Patterns.PATTERN001:return a%2===0;case e.Patterns.PATTERN010:return i%3===0;case e.Patterns.PATTERN011:return(a+i)%3===0;case e.Patterns.PATTERN100:return(Math.floor(a/2)+Math.floor(i/3))%2===0;case e.Patterns.PATTERN101:return a*i%2+a*i%3===0;case e.Patterns.PATTERN110:return(a*i%2+a*i%3)%2===0;case e.Patterns.PATTERN111:return(a*i%3+(a+i)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(a,i){const o=i.size;for(let l=0;l<o;l++)for(let c=0;c<o;c++)i.isReserved(c,l)||i.xor(c,l,n(a,c,l))},e.getBestMask=function(a,i){const o=Object.keys(e.Patterns).length;let l=0,c=1/0;for(let d=0;d<o;d++){i(d),e.applyMask(d,a);const m=e.getPenaltyN1(a)+e.getPenaltyN2(a)+e.getPenaltyN3(a)+e.getPenaltyN4(a);e.applyMask(d,a),m<c&&(c=m,l=d)}return l}})(RX);var pC={};const md=fC,ib=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],ob=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];pC.getBlocksCount=function(t,n){switch(n){case md.L:return ib[(t-1)*4+0];case md.M:return ib[(t-1)*4+1];case md.Q:return ib[(t-1)*4+2];case md.H:return ib[(t-1)*4+3];default:return}};pC.getTotalCodewordsCount=function(t,n){switch(n){case md.L:return ob[(t-1)*4+0];case md.M:return ob[(t-1)*4+1];case md.Q:return ob[(t-1)*4+2];case md.H:return ob[(t-1)*4+3];default:return}};var BX={},xC={};const ng=new Uint8Array(512),Yj=new Uint8Array(256);(function(){let t=1;for(let n=0;n<255;n++)ng[n]=t,Yj[t]=n,t<<=1,t&256&&(t^=285);for(let n=255;n<512;n++)ng[n]=ng[n-255]})();xC.log=function(t){if(t<1)throw new Error("log("+t+")");return Yj[t]};xC.exp=function(t){return ng[t]};xC.mul=function(t,n){return t===0||n===0?0:ng[Yj[t]+Yj[n]]};(function(e){const t=xC;e.mul=function(r,a){const i=new Uint8Array(r.length+a.length-1);for(let o=0;o<r.length;o++)for(let l=0;l<a.length;l++)i[o+l]^=t.mul(r[o],a[l]);return i},e.mod=function(r,a){let i=new Uint8Array(r);for(;i.length-a.length>=0;){const o=i[0];for(let c=0;c<a.length;c++)i[c]^=t.mul(a[c],o);let l=0;for(;l<i.length&&i[l]===0;)l++;i=i.slice(l)}return i},e.generateECPolynomial=function(r){let a=new Uint8Array([1]);for(let i=0;i<r;i++)a=e.mul(a,new Uint8Array([1,t.exp(i)]));return a}})(BX);const LX=BX;function GF(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}GF.prototype.initialize=function(t){this.degree=t,this.genPoly=LX.generateECPolynomial(this.degree)};GF.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const n=new Uint8Array(t.length+this.degree);n.set(t);const r=LX.mod(n,this.genPoly),a=this.degree-r.length;if(a>0){const i=new Uint8Array(this.degree);return i.set(r,a),i}return r};var dHe=GF,UX={},Xd={},YF={};YF.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var Al={};const zX="[0-9]+",uHe="[A-Z $%*+\\-./:]+";let Ey="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ey=Ey.replace(/u/g,"\\u");const mHe="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ey+`)(?:.|[\r
844]))+`;Al.KANJI=new RegExp(Ey,"g");Al.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Al.BYTE=new RegExp(mHe,"g");Al.NUMERIC=new RegExp(zX,"g");Al.ALPHANUMERIC=new RegExp(uHe,"g");const hHe=new RegExp("^"+Ey+"$"),fHe=new RegExp("^"+zX+"$"),pHe=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Al.testKanji=function(t){return hHe.test(t)};Al.testNumeric=function(t){return fHe.test(t)};Al.testAlphanumeric=function(t){return pHe.test(t)};(function(e){const t=YF,n=Al;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(i,o){if(!i.ccBits)throw new Error("Invalid mode: "+i);if(!t.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?i.ccBits[0]:o<27?i.ccBits[1]:i.ccBits[2]},e.getBestModeForData=function(i){return n.testNumeric(i)?e.NUMERIC:n.testAlphanumeric(i)?e.ALPHANUMERIC:n.testKanji(i)?e.KANJI:e.BYTE},e.toString=function(i){if(i&&i.id)return i.id;throw new Error("Invalid mode")},e.isValid=function(i){return i&&i.bit&&i.ccBits};function r(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+a)}}e.from=function(i,o){if(e.isValid(i))return i;try{return r(i)}catch{return o}}})(Xd);(function(e){const t=Ai,n=pC,r=fC,a=Xd,i=YF,o=7973,l=t.getBCHDigit(o);function c(h,p,v){for(let y=1;y<=40;y++)if(p<=e.getCapacity(y,v,h))return y}function d(h,p){return a.getCharCountIndicator(h,p)+4}function m(h,p){let v=0;return h.forEach(function(y){const g=d(y.mode,p);v+=g+y.getBitsLength()}),v}function u(h,p){for(let v=1;v<=40;v++)if(m(h,v)<=e.getCapacity(v,p,a.MIXED))return v}e.from=function(p,v){return i.isValid(p)?parseInt(p,10):v},e.getCapacity=function(p,v,y){if(!i.isValid(p))throw new Error("Invalid QR Code version");typeof y>"u"&&(y=a.BYTE);const g=t.getSymbolTotalCodewords(p),x=n.getTotalCodewordsCount(p,v),b=(g-x)*8;if(y===a.MIXED)return b;const w=b-d(y,p);switch(y){case a.NUMERIC:return Math.floor(w/10*3);case a.ALPHANUMERIC:return Math.floor(w/11*2);case a.KANJI:return Math.floor(w/13);case a.BYTE:default:return Math.floor(w/8)}},e.getBestVersionForData=function(p,v){let y;const g=r.from(v,r.M);if(Array.isArray(p)){if(p.length>1)return u(p,g);if(p.length===0)return 1;y=p[0]}else y=p;return c(y.mode,y.getLength(),g)},e.getEncodedBits=function(p){if(!i.isValid(p)||p<7)throw new Error("Invalid QR Code version");let v=p<<12;for(;t.getBCHDigit(v)-l>=0;)v^=o<<t.getBCHDigit(v)-l;return p<<12|v}})(UX);var qX={};const GD=Ai,WX=1335,xHe=21522,wL=GD.getBCHDigit(WX);qX.getEncodedBits=function(t,n){const r=t.bit<<3|n;let a=r<<10;for(;GD.getBCHDigit(a)-wL>=0;)a^=WX<<GD.getBCHDigit(a)-wL;return(r<<10|a)^xHe};var HX={};const gHe=Xd;function cp(e){this.mode=gHe.NUMERIC,this.data=e.toString()}cp.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};cp.prototype.getLength=function(){return this.data.length};cp.prototype.getBitsLength=function(){return cp.getBitsLength(this.data.length)};cp.prototype.write=function(t){let n,r,a;for(n=0;n+3<=this.data.length;n+=3)r=this.data.substr(n,3),a=parseInt(r,10),t.put(a,10);const i=this.data.length-n;i>0&&(r=this.data.substr(n),a=parseInt(r,10),t.put(a,i*3+1))};var yHe=cp;const vHe=Xd,Dk=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function dp(e){this.mode=vHe.ALPHANUMERIC,this.data=e}dp.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};dp.prototype.getLength=function(){return this.data.length};dp.prototype.getBitsLength=function(){return dp.getBitsLength(this.data.length)};dp.prototype.write=function(t){let n;for(n=0;n+2<=this.data.length;n+=2){let r=Dk.indexOf(this.data[n])*45;r+=Dk.indexOf(this.data[n+1]),t.put(r,11)}this.data.length%2&&t.put(Dk.indexOf(this.data[n]),6)};var bHe=dp;const wHe=Xd;function up(e){this.mode=wHe.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}up.getBitsLength=function(t){return t*8};up.prototype.getLength=function(){return this.data.length};up.prototype.getBitsLength=function(){return up.getBitsLength(this.data.length)};up.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)};var jHe=up;const NHe=Xd,CHe=Ai;function mp(e){this.mode=NHe.KANJI,this.data=e}mp.getBitsLength=function(t){return t*13};mp.prototype.getLength=function(){return this.data.length};mp.prototype.getBitsLength=function(){return mp.getBitsLength(this.data.length)};mp.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=CHe.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
845Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}};var SHe=mp,VX={exports:{}};(function(e){var t={single_source_shortest_paths:function(n,r,a){var i={},o={};o[r]=0;var l=t.PriorityQueue.make();l.push(r,0);for(var c,d,m,u,h,p,v,y,g;!l.empty();){c=l.pop(),d=c.value,u=c.cost,h=n[d]||{};for(m in h)h.hasOwnProperty(m)&&(p=h[m],v=u+p,y=o[m],g=typeof o[m]>"u",(g||y>v)&&(o[m]=v,l.push(m,v),i[m]=d))}if(typeof a<"u"&&typeof o[a]>"u"){var x=["Could not find a path from ",r," to ",a,"."].join("");throw new Error(x)}return i},extract_shortest_path_from_predecessor_list:function(n,r){for(var a=[],i=r;i;)a.push(i),n[i],i=n[i];return a.reverse(),a},find_path:function(n,r,a){var i=t.single_source_shortest_paths(n,r,a);return t.extract_shortest_path_from_predecessor_list(i,a)},PriorityQueue:{make:function(n){var r=t.PriorityQueue,a={},i;n=n||{};for(i in r)r.hasOwnProperty(i)&&(a[i]=r[i]);return a.queue=[],a.sorter=n.sorter||r.default_sorter,a},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var a={value:n,cost:r};this.queue.push(a),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(VX);var kHe=VX.exports;(function(e){const t=Xd,n=yHe,r=bHe,a=jHe,i=SHe,o=Al,l=Ai,c=kHe;function d(x){return unescape(encodeURIComponent(x)).length}function m(x,b,w){const j=[];let N;for(;(N=x.exec(w))!==null;)j.push({data:N[0],index:N.index,mode:b,length:N[0].length});return j}function u(x){const b=m(o.NUMERIC,t.NUMERIC,x),w=m(o.ALPHANUMERIC,t.ALPHANUMERIC,x);let j,N;return l.isKanjiModeEnabled()?(j=m(o.BYTE,t.BYTE,x),N=m(o.KANJI,t.KANJI,x)):(j=m(o.BYTE_KANJI,t.BYTE,x),N=[]),b.concat(w,j,N).sort(function(P,S){return P.index-S.index}).map(function(P){return{data:P.data,mode:P.mode,length:P.length}})}function h(x,b){switch(b){case t.NUMERIC:return n.getBitsLength(x);case t.ALPHANUMERIC:return r.getBitsLength(x);case t.KANJI:return i.getBitsLength(x);case t.BYTE:return a.getBitsLength(x)}}function p(x){return x.reduce(function(b,w){const j=b.length-1>=0?b[b.length-1]:null;return j&&j.mode===w.mode?(b[b.length-1].data+=w.data,b):(b.push(w),b)},[])}function v(x){const b=[];for(let w=0;w<x.length;w++){const j=x[w];switch(j.mode){case t.NUMERIC:b.push([j,{data:j.data,mode:t.ALPHANUMERIC,length:j.length},{data:j.data,mode:t.BYTE,length:j.length}]);break;case t.ALPHANUMERIC:b.push([j,{data:j.data,mode:t.BYTE,length:j.length}]);break;case t.KANJI:b.push([j,{data:j.data,mode:t.BYTE,length:d(j.data)}]);break;case t.BYTE:b.push([{data:j.data,mode:t.BYTE,length:d(j.data)}])}}return b}function y(x,b){const w={},j={start:{}};let N=["start"];for(let C=0;C<x.length;C++){const P=x[C],S=[];for(let E=0;E<P.length;E++){const T=P[E],z=""+C+E;S.push(z),w[z]={node:T,lastCount:0},j[z]={};for(let O=0;O<N.length;O++){const D=N[O];w[D]&&w[D].node.mode===T.mode?(j[D][z]=h(w[D].lastCount+T.length,T.mode)-h(w[D].lastCount,T.mode),w[D].lastCount+=T.length):(w[D]&&(w[D].lastCount=T.length),j[D][z]=h(T.length,T.mode)+4+t.getCharCountIndicator(T.mode,b))}}N=S}for(let C=0;C<N.length;C++)j[N[C]].end=0;return{map:j,table:w}}function g(x,b){let w;const j=t.getBestModeForData(x);if(w=t.from(b,j),w!==t.BYTE&&w.bit<j.bit)throw new Error('"'+x+'" cannot be encoded with mode '+t.toString(w)+`.
846 Suggested mode is: `+t.toString(j));switch(w===t.KANJI&&!l.isKanjiModeEnabled()&&(w=t.BYTE),w){case t.NUMERIC:return new n(x);case t.ALPHANUMERIC:return new r(x);case t.KANJI:return new i(x);case t.BYTE:return new a(x)}}e.fromArray=function(b){return b.reduce(function(w,j){return typeof j=="string"?w.push(g(j,null)):j.data&&w.push(g(j.data,j.mode)),w},[])},e.fromString=function(b,w){const j=u(b,l.isKanjiModeEnabled()),N=v(j),C=y(N,w),P=c.find_path(C.map,"start","end"),S=[];for(let E=1;E<P.length-1;E++)S.push(C.table[P[E]].node);return e.fromArray(p(S))},e.rawSplit=function(b){return e.fromArray(u(b,l.isKanjiModeEnabled()))}})(HX);const gC=Ai,Ak=fC,PHe=oHe,EHe=lHe,DHe=$X,AHe=IX,YD=RX,QD=pC,THe=dHe,Qj=UX,OHe=qX,FHe=Xd,Tk=HX;function _He(e,t){const n=e.size,r=AHe.getPositions(t);for(let a=0;a<r.length;a++){const i=r[a][0],o=r[a][1];for(let l=-1;l<=7;l++)if(!(i+l<=-1||n<=i+l))for(let c=-1;c<=7;c++)o+c<=-1||n<=o+c||(l>=0&&l<=6&&(c===0||c===6)||c>=0&&c<=6&&(l===0||l===6)||l>=2&&l<=4&&c>=2&&c<=4?e.set(i+l,o+c,!0,!0):e.set(i+l,o+c,!1,!0))}}function MHe(e){const t=e.size;for(let n=8;n<t-8;n++){const r=n%2===0;e.set(n,6,r,!0),e.set(6,n,r,!0)}}function $He(e,t){const n=DHe.getPositions(t);for(let r=0;r<n.length;r++){const a=n[r][0],i=n[r][1];for(let o=-2;o<=2;o++)for(let l=-2;l<=2;l++)o===-2||o===2||l===-2||l===2||o===0&&l===0?e.set(a+o,i+l,!0,!0):e.set(a+o,i+l,!1,!0)}}function IHe(e,t){const n=e.size,r=Qj.getEncodedBits(t);let a,i,o;for(let l=0;l<18;l++)a=Math.floor(l/3),i=l%3+n-8-3,o=(r>>l&1)===1,e.set(a,i,o,!0),e.set(i,a,o,!0)}function Ok(e,t,n){const r=e.size,a=OHe.getEncodedBits(t,n);let i,o;for(i=0;i<15;i++)o=(a>>i&1)===1,i<6?e.set(i,8,o,!0):i<8?e.set(i+1,8,o,!0):e.set(r-15+i,8,o,!0),i<8?e.set(8,r-i-1,o,!0):i<9?e.set(8,15-i-1+1,o,!0):e.set(8,15-i-1,o,!0);e.set(r-8,8,1,!0)}function RHe(e,t){const n=e.size;let r=-1,a=n-1,i=7,o=0;for(let l=n-1;l>0;l-=2)for(l===6&&l--;;){for(let c=0;c<2;c++)if(!e.isReserved(a,l-c)){let d=!1;o<t.length&&(d=(t[o]>>>i&1)===1),e.set(a,l-c,d),i--,i===-1&&(o++,i=7)}if(a+=r,a<0||n<=a){a-=r,r=-r;break}}}function BHe(e,t,n){const r=new PHe;n.forEach(function(c){r.put(c.mode.bit,4),r.put(c.getLength(),FHe.getCharCountIndicator(c.mode,e)),c.write(r)});const a=gC.getSymbolTotalCodewords(e),i=QD.getTotalCodewordsCount(e,t),o=(a-i)*8;for(r.getLengthInBits()+4<=o&&r.put(0,4);r.getLengthInBits()%8!==0;)r.putBit(0);const l=(o-r.getLengthInBits())/8;for(let c=0;c<l;c++)r.put(c%2?17:236,8);return LHe(r,e,t)}function LHe(e,t,n){const r=gC.getSymbolTotalCodewords(t),a=QD.getTotalCodewordsCount(t,n),i=r-a,o=QD.getBlocksCount(t,n),l=r%o,c=o-l,d=Math.floor(r/o),m=Math.floor(i/o),u=m+1,h=d-m,p=new THe(h);let v=0;const y=new Array(o),g=new Array(o);let x=0;const b=new Uint8Array(e.buffer);for(let P=0;P<o;P++){const S=P<c?m:u;y[P]=b.slice(v,v+S),g[P]=p.encode(y[P]),v+=S,x=Math.max(x,S)}const w=new Uint8Array(r);let j=0,N,C;for(N=0;N<x;N++)for(C=0;C<o;C++)N<y[C].length&&(w[j++]=y[C][N]);for(N=0;N<h;N++)for(C=0;C<o;C++)w[j++]=g[C][N];return w}function UHe(e,t,n,r){let a;if(Array.isArray(e))a=Tk.fromArray(e);else if(typeof e=="string"){let d=t;if(!d){const m=Tk.rawSplit(e);d=Qj.getBestVersionForData(m,n)}a=Tk.fromString(e,d||40)}else throw new Error("Invalid data");const i=Qj.getBestVersionForData(a,n);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=i;else if(t<i)throw new Error(`
847The chosen QR Code version cannot contain this amount of data.
848Minimum version required to store current data is: `+i+`.
849`);const o=BHe(t,n,a),l=gC.getSymbolSize(t),c=new EHe(l);return _He(c,t),MHe(c),$He(c,t),Ok(c,n,0),t>=7&&IHe(c,t),RHe(c,o),isNaN(r)&&(r=YD.getBestMask(c,Ok.bind(null,c,n))),YD.applyMask(r,c),Ok(c,n,r),{modules:c,version:t,errorCorrectionLevel:n,maskPattern:r,segments:a}}_X.create=function(t,n){if(typeof t>"u"||t==="")throw new Error("No input text");let r=Ak.M,a,i;return typeof n<"u"&&(r=Ak.from(n.errorCorrectionLevel,Ak.M),a=Qj.from(n.version),i=YD.from(n.maskPattern),n.toSJISFunc&&gC.setToSJISFunction(n.toSJISFunc)),UHe(t,a,r,i)};var KX={},QF={};(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(i){return[i,i]}))),r.length===6&&r.push("F","F");const a=parseInt(r.join(""),16);return{r:a>>24&255,g:a>>16&255,b:a>>8&255,a:a&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const a=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,i=r.width&&r.width>=21?r.width:void 0,o=r.scale||4;return{width:i,scale:i?4:o,margin:a,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,a){return a.width&&a.width>=r+a.margin*2?a.width/(r+a.margin*2):a.scale},e.getImageWidth=function(r,a){const i=e.getScale(r,a);return Math.floor((r+a.margin*2)*i)},e.qrToImageData=function(r,a,i){const o=a.modules.size,l=a.modules.data,c=e.getScale(o,i),d=Math.floor((o+i.margin*2)*c),m=i.margin*c,u=[i.color.light,i.color.dark];for(let h=0;h<d;h++)for(let p=0;p<d;p++){let v=(h*d+p)*4,y=i.color.light;if(h>=m&&p>=m&&h<d-m&&p<d-m){const g=Math.floor((h-m)/c),x=Math.floor((p-m)/c);y=u[l[g*o+x]?1:0]}r[v++]=y.r,r[v++]=y.g,r[v++]=y.b,r[v]=y.a}}})(QF);(function(e){const t=QF;function n(a,i,o){a.clearRect(0,0,i.width,i.height),i.style||(i.style={}),i.height=o,i.width=o,i.style.height=o+"px",i.style.width=o+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(i,o,l){let c=l,d=o;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),o||(d=r()),c=t.getOptions(c);const m=t.getImageWidth(i.modules.size,c),u=d.getContext("2d"),h=u.createImageData(m,m);return t.qrToImageData(h.data,i,c),n(u,d,m),u.putImageData(h,0,0),d},e.renderToDataURL=function(i,o,l){let c=l;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),c||(c={});const d=e.render(i,o,c),m=c.type||"image/png",u=c.rendererOpts||{};return d.toDataURL(m,u.quality)}})(KX);var GX={};const zHe=QF;function jL(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function Fk(e,t,n){let r=e+t;return typeof n<"u"&&(r+=" "+n),r}function qHe(e,t,n){let r="",a=0,i=!1,o=0;for(let l=0;l<e.length;l++){const c=Math.floor(l%t),d=Math.floor(l/t);!c&&!i&&(i=!0),e[l]?(o++,l>0&&c>0&&e[l-1]||(r+=i?Fk("M",c+n,.5+d+n):Fk("m",a,0),a=0,i=!1),c+1<t&&e[l+1]||(r+=Fk("h",o),o=0)):a++}return r}GX.render=function(t,n,r){const a=zHe.getOptions(n),i=t.modules.size,o=t.modules.data,l=i+a.margin*2,c=a.color.light.a?"<path "+jL(a.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",d="<path "+jL(a.color.dark,"stroke")+' d="'+qHe(o,i,a.margin)+'"/>',m='viewBox="0 0 '+l+" "+l+'"',h='<svg xmlns="http://www.w3.org/2000/svg" '+(a.width?'width="'+a.width+'" height="'+a.width+'" ':"")+m+' shape-rendering="crispEdges">'+c+d+`</svg>
850`;return typeof r=="function"&&r(null,h),h};const WHe=aHe,JD=_X,YX=KX,HHe=GX;function JF(e,t,n,r,a){const i=[].slice.call(arguments,1),o=i.length,l=typeof i[o-1]=="function";if(!l&&!WHe())throw new Error("Callback required as last argument");if(l){if(o<2)throw new Error("Too few arguments provided");o===2?(a=n,n=t,t=r=void 0):o===3&&(t.getContext&&typeof a>"u"?(a=r,r=void 0):(a=r,r=n,n=t,t=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(n=t,t=r=void 0):o===2&&!t.getContext&&(r=n,n=t,t=void 0),new Promise(function(c,d){try{const m=JD.create(n,r);c(e(m,t,r))}catch(m){d(m)}})}try{const c=JD.create(n,r);a(null,e(c,t,r))}catch(c){a(c)}}Rv.create=JD.create;Rv.toCanvas=JF.bind(null,YX.render);Rv.toDataURL=JF.bind(null,YX.renderToDataURL);Rv.toString=JF.bind(null,function(e,t,n){return HHe.render(e,n)});function VHe(){const e=sa(),t=f.useRef(null),n=e.bookingId,{data:r,isLoading:a,error:i}=Ue({queryKey:["/api/bookings",n,"public"],queryFn:()=>fetch(`/api/bookings/${n}/public`).then(m=>{if(!m.ok)throw new Error("Booking not found");return m.json()}),enabled:!!n});if(f.useEffect(()=>{if(t.current&&n&&r&&!a){const m=`https://classta.co/admin/booking/${n}`;Rv.toCanvas(t.current,m,{width:300,margin:2,color:{dark:"#000000",light:"#ffffff"}},u=>{u&&console.error("QR Code generation error:",u)}),Zs("qr_checkin_generated","engagement",n,1)}},[n,r,a]),!n)return s.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Invalid Check-In Link"}),s.jsx("p",{className:"text-gray-600",children:"This check-in link is not valid."})]})});if(a)return s.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-600",children:"Loading check-in details..."})]})});if(i||!r)return s.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Booking Not Found"}),s.jsx("p",{className:"text-gray-600",children:"This check-in link is not val
850id or the booking doesn't exist."})]})});const o=m=>new Date(m).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"}),l=m=>{if(!m||m==="undefined"||m==="NaN:NaN")return"TBD";const[u,h]=m.split(":"),p=parseInt(u),v=p===0?12:p>12?p-12:p,y=p>=12?"PM":"AM";return isNaN(p)||isNaN(parseInt(h))?"TBD":`${v}:${h} ${y}`},c=m=>{const u=new Date(m),h=new Date;return u.getFullYear()===h.getFullYear()&&u.getMonth()===h.getMonth()&&u.getDate()===h.getDate()},d=m=>{const u=new Date(m);u.setHours(0,0,0,0);const h=new Date;return h.setHours(0,0,0,0),u>h};return s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-green-50 flex items-center justify-center p-4",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-8 max-w-md w-full text-center",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Class Check-In"}),s.jsx("p",{className:"text-gray-600",children:"Show this QR code to your instructor"})]}),s.jsxs("div",{className:"mb-6 p-4 bg-gray-50 rounded-lg",children:[s.jsx("h2",{className:"font-semibold text-gray-900 mb-3",children:(r==null?void 0:r.className)||"Loading..."}),s.jsxs("div",{className:"text-sm text-gray-600 space-y-2",children:[(r==null?void 0:r.classDate)&&s.jsxs("div",{children:[s.jsx("p",{className:"font-medium mb-1",children:"Date:"}),s.jsxs("p",{className:"text-lg font-bold text-gray-900",children:[o(r.classDate),c(r.classDate)&&s.jsx("span",{className:"ml-2 px-2 py-1 bg-green-100 text-green-800 rounded text-sm font-bold",children:"TODAY"})]}),d(r.classDate)&&!c(r.classDate)&&s.jsxs("p",{className:"mt-1 text-orange-600 font-medium text-xs",children:["NOT VALID UNTIL ",o(r.classDate)]})]}),s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Time:"})," ",r!=null&&r.classTime?l(r.classTime):"TBD"]}),(r==null?void 0:r.location)&&s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Location:"})," ",r.location]})]})]}),s.jsx("div",{className:"mb-6 flex justify-center",children:s.jsx("div",{className:"p-4 bg-white border-2 border-gray-200 rounded-lg",children:s.jsx("canvas",{ref:t,className:"block mx-auto",width:300,height:300})})}),s.jsxs("div",{className:"text-xs text-gray-500 space-y-1",children:[s.jsx("p",{children:"Your instructor will scan this code to mark your attendance"}),s.jsx("p",{children:"Keep this page open until scanned"})]}),s.jsx("div",{className:"mt-6 pt-4 border-t border-gray-200",children:s.jsxs("p",{className:"text-xs text-gray-400",children:["Booking ID: #",n]})})]})})}function KHe(){const{token:e}=sa(),{data:t,isLoading:n,error:r}=Ue({queryKey:["/api/event-order/by-token",e],queryFn:async()=>{const i=await fetch(`/api/event-order/by-token/${e}`);if(!i.ok)throw new Error("Ticket not found");return i.json()},enabled:!!e});if(!e)return s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center p-4",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Invalid link"}),s.jsx("p",{className:"text-slate-600",children:"This ticket link is not valid."})]})});if(n)return s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center p-4",children:s.jsx("div",{className:"text-slate-600",children:"Loading ticket…"})});if(r||!t)return s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center p-4",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Ticket not found"}),s.jsx("p",{className:"text-slate-600",children:"This ticket may have been cancelled or the link is incorrect."})]})});const a=t.event.startsAt?Ud(t.event.startsAt):"";return s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-md bg-white rounded-xl shadow-lg border border-slate-200 overflow-hidden",children:[s.jsxs("div",{className:"bg-primary text-white px-6 py-5 text-center",children:[s.jsx("h1",{className:"text-xl font-bold",children:"Event ticket"}),s.jsx("p",{className:"mt-1 text-white/90 text-lg",children:t.event.title})]}),s.jsxs("div",{className:"px-6 py-6 space-y-5",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide",children:"Date & time"}),s.jsx("p",{className:"mt-1 text-lg text-slate-900",children:a})]}),t.event.location&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide",children:"Location"}),s.jsx("p",{className:"mt-1 text-lg text-slate-900",children:t.event.location})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide",children:"Ticket type"}),s.jsx("p",{className:"mt-1 text-2xl font-semibold text-slate-900",children:t.order.ticketTypeName})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide",children:"Quantity"}),s.jsx("p",{className:"mt-1 text-2xl font-semibold text-slate-900",children:t.order.quantity})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide",children:"Attendees"}),s.jsx("p",{className:"mt-1 text-lg text-slate-900",children:[t.order.buyerName,...t.order.attendees].filter(
850Boolean).join(", ")})]})]}),s.jsx("div",{className:"px-6 pb-6 pt-2 border-t border-slate-100",children:s.jsx("p",{className:"text-center text-sm text-slate-500",children:"Present this page at the door to verify your ticket."})})]})})}const GHe="#3B82F6",YHe="#10B981";function QHe(e,t,n,r){const a=e||GHe,i=t||YHe,o=`hsl(${Rl(a)})`;return{heroGradient:QH(a,i,n,r),buttonPrimary:{backgroundColor:a,color:o}}}function NL(){var re;const{subdomain:e,eventId:t}=sa(),[n,r]=f.useState(null),[a,i]=f.useState(!1),[o,l]=f.useState(!1),[c,d]=f.useState(null),[m,u]=f.useState(""),[h,p]=f.useState({name:"",email:"",subject:"",message:""}),{toast:v}=Yt(),{data:y,isLoading:g,error:x}=Ue({queryKey:[`/api/instructor/by-subdomain/${e}`],enabled:!!e}),{data:b}=Ue({queryKey:[`/api/public/classes?subdomain=${e}&v=${(y==null?void 0:y.classesVersion)||1}`],enabled:!!e&&!!y}),w=Array.isArray(b)&&b.length>0,j=t?parseInt(t,10):void 0,N=!!j&&!isNaN(j),{data:C,isLoading:P,isError:S}=Ue({queryKey:["/api/events/public",y==null?void 0:y.id,j],queryFn:async()=>{const R=`/api/events/public?instructorId=${y==null?void 0:y.id}${N?`&eventId=${j}`:"&forMainBookingPage=false"}`,Y=await Pe("GET",R);if(!Y.ok){const se=await Y.json().catch(()=>({}));throw new Error(se.message||"Event not found")}return await Y.json()},enabled:!!(y!=null&&y.id)&&!!e}),E=xt({mutationFn:async R=>{const Y=await Pe("POST","/api/instructor-contact",{instructorId:y==null?void 0:y.id,name:R.name,email:R.email,subject:R.subject,message:R.message});if(!Y.ok)throw new Error("Failed to send");return Y.json()},onSuccess:()=>{v({title:"Message Sent!",description:"Your message has been sent. The instructor will get back to you soon."}),l(!1),d(null),u(""),p({name:"",email:"",subject:"",message:""})},onError:R=>{v({title:"Error",description:R.message||"Failed to send message.",variant:"destructive"})}}),T=Array.isArray(C)?C:C&&typeof C=="object"&&"ticketTypes"in C?[C]:[],z=N&&!P&&T.length===0&&(S||C!=null&&typeof C=="object"&&!("ticketTypes"in C)),O=Array.isArray(y==null?void 0:y.featureFlags)&&y.featureFlags.includes("events"),D=e&&!y&&!g&&((re=x==null?void 0:x.message)==null?void 0:re.toLowerCase().includes("not found")),k=(y==null?void 0:y.eventsPageTitle)??null,F=!!(k&&k.trim()),W=F?k.trim():(y==null?void 0:y.businessName)??"Events",q=F?W:y?`Welcome to ${y.businessName}`:"Events",H=(y==null?void 0:y.eventsPageDescription)??(y==null?void 0:y.description)??"",_=QHe(y==null?void 0:y.primaryColor,y==null?void 0:y.secondaryColor,y==null?void 0:y.heroColor,y==null?void 0:y.heroGradientStyle),L=(y==null?void 0:y.eventsPageLogoUrl)??null,U=(y==null?void 0:y.logoUrl)??null,J=L&&L.trim()?L:U,I=J?J.startsWith("http")?J:`${typeof window<"u"?window.location.origin:""}${J}`:null;return D?s.jsx(jW,{}):e?s.jsxs("div",{className:"min-h-screen bg-slate-50",children:[s.jsx("header",{className:"bg-white shadow-sm border-b border-slate-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsx("div",{className:"flex items-center space-x-2 sm:space-x-4 min-w-0",children:s.jsxs(dt,{href:`/classes/${e}`,className:"flex items-center space-x-2 min-w-0",children:[I?s.jsx("img",{src:I,alt:"",className:"h-6 w-6 sm:h-8 sm:w-8 object-cover rounded shrink-0"}):s.jsx(Ia,{className:"text-slate-700 h-6 w-6 sm:h-8 sm:w-8 shrink-0"}),s.jsx("span",{className:"text-lg sm:text-xl font-bold text-slate-900 truncate",children:W})]})}),s.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 shrink-0",children:[s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{size:"sm",className:"text-white hover:opacity-90 text-xs sm:text-sm px-2 sm:px-4",style:_.buttonPrimary,children:[s.jsx("span",{className:"hidden sm:inline",children:"Get your own booking page"}),s.jsx("span",{className:"sm:hidden",children:"Get your page"})]})}),w&&s.jsx(dt,{href:`/classes/${e}`,children:s.jsx(B,{size:"sm",variant:"outline",className:"text-xs sm:text-sm",children:"View classes"})})]})]})})}),s.jsx("section",{className:"relative",style:_.heroGradient,children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 sm:py-10 lg:py-14",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-bold mb-3 sm:mb-4 leading-tight",style:{color:(y==null?void 0:y.heroTextColor)||"#fff"},children:q}),s.jsx("p",{className:"text-base sm:text-lg md:text-xl max-w-3xl mx-auto leading-relaxed px-2",style:{color:(y==null?void 0:y.heroTextColor)||"rgba(255,255,255,0.9)"},children:H||"Book tickets for upcoming events and workshops."})]})})}),s.jsxs("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 sm:py-16",children:[!O&&y&&s.jsx("div",{className:"text-center py-12 text-slate-600",children:"Events are not available for this page."}),O&&P&&s.jsx("div",{className:"text-center py-12 text-slate-600",children:"Loading events…"}),O&&z&&s.jsx("div",{className:"text-center py-12 text-slate-600",children:"Event not found or no longer available."}),O&&!P&&!z&&T.length===0&&s.jsx("div",{className:"text-center py-12 text-slate-600",children:"No upcoming events at the moment."}),O&&!P&&T.length>0&&s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:T.map(R=>s.jsxs(Ce,{className:"hover:shadow-lg transition-shadow flex flex-col overflow-hidden bg-white",children:[R.imageUrl&&s.jsx("div",{className:"aspect-video w-full bg-slate-100 shrink-0",children:s.jsx("img",{src:R.imageUrl.startsWith("http")?R.imageUrl:`${window.location.origin}${R.imageUrl}`,alt:R.title,className:"h-full w-full object-cover"})}),s.jsx(gt,{children:s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:R.title}),R.description&&s.jsx(aO,{text:R.description,linkClassName:"text-sky-600 hover:underline break-all",preserveLineBreaks:!0,className:"[&_p]:text-black"})]}),s.jsx(um,{className:"h-5 w-5 text-slate-400 shrink-0"})]})}),s.jsxs(Ee,{className:"flex-1 flex flex-col",children:[s.jsxs("div",{className:"space-y-2 text-sm text-black mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ls,{className:"h-4 w-4 shrink-0"}),Ud(R.startsAt)]}),R.location&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(si,{className:"h-4 w-4 shrink-0"}),R.location]})]}),s.jsxs("div",{className:"mt-auto space-y-1",children:[R.startsAt&&R.ticketTypes.map(Y=>s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{children:Y.name}),s.jsxs("span",{children:[Y.price_minor===0?"Free":`${mt(R.currency||(y==null?void 0:y.currency)||"GBP")}${(Y.price_minor/100).toFixed(2)}`,Y.remaining<10&&s.jsxs("span",{className:"text-amber-600 ml-1",children:["(",Y.remaining," left)"]})]})]},Y.id)),s.jsx(B,{className:"w-full mt-4 text-white border-0 hover:opacity-90",style:_.buttonPrimary,onClick:()=>{R.startsAt?(r(R),i(!0)):(d(R),u(""),p(Y=>({...Y,subject:`Interest in: ${R.title} (date TBC)`})),l(!0))},children:R.startsAt?"Buy tickets":"Register interest"})]})]})]},R.id))})]}),s.jsx("section",{className:"w-full",style:{backgroundColor:"#f7f7f7"},children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-[70px] sm:py-20",children:s.jsxs("div",{className:"flex flex-col items-center text-center",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-slate-500",children:"Powered by Classta"}),s.jsx("h2",{className:"mt-4 text-xl sm:text-2xl font-bold text-slate-900",children:"Run your own events like this."}),s.jsx("p",{className:"mt-4 text-base text-slate-600 max-w-md",children:"Sell tickets online, manage capacity and create your own branded booking page in minutes."}),s.jsx("a",{href:Pz(e),target:"_blank",rel:"noopener noreferrer",className:"mt-6 inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium text-white bg-slate-900 rounded-md hover:bg-slate-800 transition-colors",children:"Create your own booking page →"})]})})}),n&&a&&s.jsx(BT,{event:n,instructor:y?{id:y.id,stripePublicKey:y.stripePublicKey,stripeConnectAccountId:y.stripeConnectAccountId,currency:y.currency}:null,onClose:()=>{i(!1),r(null)}}),s.jsx(Ct,{open:o,onOpenChange:R=>{l(R),R||(d(null),u(""))},children:s.jsxs(St,{className:"max-w-md max-h-[85vh] overflow-y-auto",children:[s.jsx(kt,{children:s.jsxs(Pt,{className:"flex items-center gap-2",children:[s.jsx(_n,{className:"h-5 w-5"}),"Contact ",W]})}),s.jsxs("form",{onSubmit:R=>{R.preventDefault(),h.name&&h.email&&h.subject&&h.message&&E.mutate({...h,message:LT(h.message,{enabled:c==null?void 0:c.bookingInfoFieldEnabled,label:c==null?void 0:c.bookingInfoFieldLabel},m)})},className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"contact-name",children:"Your Name *"}),s.jsx(me,{id:"contact-name",value:h.name,onChange:R=>p({...h,name:R.target.value}),required:!0,placeholder:"Enter your full name"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"contact-email",children:"Your Email *"}),s.jsx(me,{id:"contact-email",type:"email",value:h.email,onChange:R=>p({...h,email:R.target.value}),required:!0,placeholder:"[email protected]"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"contact-subject",children:"Subject *"}),s.jsx(me,{id:"contact-subject",value:h.subject,onChange:R=>p({...h,subject:R.target.value}),required:!0,placeholder:"What's this about?"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"contact-message",children:"Message *"}),s.jsx(Is,{id:"contact-message",value:h.message,onChange:R=>p({...h,message:R.target.value}),required:!0,rows:4,placeholder:"Your message..."})]}),s.jsx(UT,{id:"interest-booking-info",enabled:!!(c!=null&&c.bookingInfoFieldEnabled),label:c==null?void 0:c.bookingInfoFieldLabel,value:m,onChange:u}),s.jsxs("div",{className:"flex gap-3 pt-4",children:[s.jsx(B,{t
850ype:"button",variant:"outline",onClick:()=>l(!1),className:"flex-1",children:"Cancel"}),s.jsx(B,{type:"submit",disabled:E.isPending||!h.name||!h.email||!h.subject||!h.message,className:"flex-1",children:E.isPending?"Sending...":"Send Message"})]})]})]})})]}):s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:s.jsx("p",{className:"text-slate-600",children:"No instructor specified."})})}function JHe(){const e=sa(),[t,n]=cn(),{toast:r}=Yt(),a=e.bookingId,[i,o]=f.useState(null),[l,c]=f.useState(!0),d=()=>{try{const g=localStorage.getItem("admin_session");if(!g)return null;const x=JSON.parse(g);return Date.now()>x.expires?(localStorage.removeItem("admin_session"),null):x.instructor}catch(g){return console.error("Error reading session:",g),localStorage.removeItem("admin_session"),null}};f.useEffect(()=>{console.log("Checking for existing session...");const g=d(),x=localStorage.getItem("auth_token");g||x?(o(g||{token:x}),console.log("Session found:",g||{token:x}),Zs("admin_booking_attendance","engagement","view",1)):console.log("No session found"),c(!1)},[]);const{data:m,isLoading:u,error:h}=Ue({queryKey:[`/api/admin/booking/${a}`],enabled:!!a&&!!i}),p=xt({mutationFn:async()=>(await Pe("POST",`/api/admin/booking/${a}/attendance`)).json(),onSuccess:()=>{Ms.invalidateQueries({queryKey:[`/api/admin/booking/${a}`]}),r({title:"Attendance Marked",description:"Student has been successfully marked as attended."}),Zs("admin_booking_attendance","engagement","mark",1)},onError:g=>{r({title:"Error",description:g.message||"Failed to mark attendance. Please try again.",variant:"destructive"})}});if(f.useEffect(()=>{!l&&!i&&localStorage.setItem("redirectAfterLogin",t)},[i,l,t]),l)return s.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-600",children:"Checking authentication..."})]})});if(!i)return s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-green-50 flex items-center justify-center p-4",children:s.jsxs(Ce,{className:"w-full max-w-md",children:[s.jsxs(gt,{className:"text-center",children:[s.jsx("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:s.jsx(Dr,{className:"w-8 h-8 text-blue-600"})}),s.jsx(Nt,{children:"Instructor Login Required"}),s.jsx(Ys,{children:"You need to be logged in as an instructor to mark student attendance from this QR code scan."})]}),s.jsxs(Ee,{className:"text-center space-y-4",children:[s.jsx(B,{onClick:()=>n("/admin"),className:"w-full",size:"lg",children:"Go to Instructor Login"}),s.jsx("p",{className:"text-xs text-gray-500",children:"This page is for instructors to mark student attendance after scanning QR codes."}),a&&s.jsxs("p",{className:"text-xs text-gray-400 pt-2 border-t",children:["Booking ID: #",a]})]})]})});if(u)return s.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-600",children:"Loading booking details..."})]})});if(h||!m)return s.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:s.jsxs(Ce,{className:"w-full max-w-md",children:[s.jsxs(gt,{className:"text-center",children:[s.jsx(Nt,{className:"text-red-600",children:"Booking Not Found"}),s.jsx(Ys,{children:"This booking doesn't exist or you don't have permission to view it."})]}),s.jsx(Ee,{className:"text-center",children:s.jsx(B,{onClick:()=>n("/admin"),variant:"outline",children:"Back to Admin"})})]})});const v=g=>new Date(g).toLocaleDateString("en-GB",{weekday:"long",year:"numeric",month:"long",day:"numeric"}),y=g=>g;return s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-green-50 p-4",children:s.jsxs("div",{className:"max-w-2xl mx-auto",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"Attendance Check-In"}),s.jsx("p",{className:"text-gray-600",children:"Review booking details and mark attendance"})]}),s.jsxs(Ce,{className:"mb-6",children:[s.jsx(gt,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Nt,{className:"text-xl",children:"Booking Details"}),s.jsx(Je,{variant:m.attended?"default":"secondary",className:m.attended?"bg-green-600":"",children:m.attended?s.jsxs(s.Fragment,{children:[s.jsx(qt,{className:"w-4 h-4 mr-1"})," Attended"]}):s.jsxs(s.Fragment,{children:[s.jsx(ei,{className:"w-4 h-4 mr-1"})," Not Attended"]})})]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Dr,{className:"w-5 h-5 text-gray-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold text-lg",children:m.clientName}),s.jsx("p",{className:"text-sm text-gray-600",children:m.clientEmail})]})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ls,{className:"w-5 h-5 text-gray-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold",children:m.className}),s.jsx("p",{className:"text-sm text-gray-600",children:v(m.classDate)})]})]}),m.classTime&&s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Rre,{className:"w-5 h-5 text-gray-500"}),s.jsx("p",{className:"text-sm text-gray-600",children:y(m.classTime)})]}),m.location&&s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(si,{className:"w-5 h-5 text-gray-500"}),s.jsx("p",{className:"text-sm text-gray-600",children:m.location})]}),m.paymentMethod&&s.jsxs("div",{className:`flex items-center space-x-3 ${m.paymentMethod==="cash"?"bg-yellow-50 p-3 rounded-lg border border-yellow-200":""}`,children:[s.jsx(Ph,{className:`w-5 h-5 ${m.paymentMethod==="cash"?"text-yellow-600":"text-gray-500"}`}),s.jsxs("div",{children:[s.jsxs("p",{className:`font-semibold ${m.paymentMethod==="cash"?"text-yellow-800":"text-gray-900"}`,children:["Payment Method:"," ",s.jsx("span",{className:"capitalize",children:m.paymentMethod==="cash"?"Cash (Needs Collection)":m.paymentMethod==="str
850ipe"?"Card (Stripe)":m.paymentMethod==="paypal"?"PayPal":m.paymentMethod==="bundle"?"Bundle":"Free"})]}),m.paymentMethod==="cash"&&s.jsx("p",{className:"text-sm text-yellow-700 mt-1",children:"⚠️ Please collect cash payment from the client"})]})]}),s.jsx("div",{className:"pt-4 border-t border-gray-200",children:s.jsxs("p",{className:"text-xs text-gray-500",children:["Booking ID: #",m.id," | Booking Type:"," ",m.bookingType]})})]})]}),s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{children:"Mark Attendance"}),s.jsx(Ys,{children:m.attended?"This student has already been marked as attended for this class.":"Click the button below to mark this student as attended."})]}),s.jsx(Ee,{children:s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs(B,{onClick:()=>p.mutate(),disabled:m.attended||p.isPending,className:"w-full h-12",size:"lg",children:[p.isPending?s.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}):m.attended?s.jsx(qt,{className:"w-4 h-4 mr-2"}):null,m.attended?"Already Attended":"Mark as Attended"]}),s.jsx(B,{onClick:()=>n("/admin"),variant:"outline",className:"w-full h-12",size:"lg",children:"Back to Admin"})]})})]})]})})}function XHe(){const[,e]=cn(),{accessLevel:t}=iO(),n=t==="bookings_only",[r,a]=f.useState(null),[i,o]=f.useState({});f.useEffect(()=>{const c=localStorage.getItem("print_class_register_data");if(c)try{const d=JSON.parse(c);a(d),localStorage.removeItem("print_class_register_data"),setTimeout(()=>{window.print()},500)}catch(d){console.error("Error parsing print data:",d),e("/admin")}else e("/admin")},[e]);const l=c=>{o(d=>({...d,[c]:!d[c]}))};return r?s.jsxs("div",{className:"print-container p-8 max-w-4xl mx-auto",children:[s.jsx("style",{children:`
851        @media print {
852          body {
853            margin: 0;
854            padding: 0;
855          }
856          .print-container {
857            padding: 20px;
858          }
859          .no-print {
860            display: none;
861          }
862          input[type="checkbox"] {
863            -webkit-appearance: checkbox !important;
864            -moz-appearance: checkbox !important;
865            appearance: checkbox !important;
866            width: 18px !important;
867            height: 18px !important;
868            border: 2px solid #000 !important;
869            border-radius: 2px !important;
870            margin: 0 !important;
871            cursor: default !important;
872          }
873          @page {
874            margin: 1cm;
875          }
876        }
877        @media screen {
878          .print-container {
879            background: white;
880            min-height: 100vh;
881          }
882        }
883      `}),s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Class Register"}),s.jsxs("div",{className:"text-lg",children:[s.jsx("div",{className:"font-semibold",children:r.className}),s.jsx("div",{className:"text-slate-600",children:r.date}),s.jsx("div",{className:"text-slate-600",children:r.time})]})]}),s.jsxs("table",{className:"w-full border-collapse border border-slate-300 mb-6",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-slate-100",children:[s.jsx("th",{className:"border border-slate-300 px-4 py-2 text-left font-semibold",children:"Name"}),s.jsx("th",{className:"border border-slate-300 px-4 py-2 text-left font-semibold",children:"Contact Info"}),s.jsx("th",{className:"border border-slate-300 px-4 py-2 text-left font-semibold",children:"Memberships"}),s.jsx("th",{className:"w-[100px] border border-slate-300 px-4 py-2 text-left font-semibold",children:"Payment Method"}),!n&&s.jsx("th",{className:"border border-slate-300 px-4 py-2 text-right font-semibold",children:"Amount Paid"}),s.jsx("th",{className:"border border-slate-300 px-4 py-2 text-right font-semibold",children:"Attended"})]})}),s.jsxs("tbody",{children:[r.bookings.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:n?5:6,className:"border border-slate-300 px-4 py-4 text-center text-slate-500",children:"No bookings found"})}):r.bookings.map((c,d)=>{var m,u;return s.jsxs("tr",{className:d%2===0?"bg-white":"bg-slate-50",children:[s.jsx("td",{className:"border border-slate-300 px-4 py-2",children:c.clientName}),s.jsx("td",{className:"border border-slate-300 px-4 py-2",children:c.clientEmail||(m=c.clientPhone)!=null&&m.trim()?s.jsxs(s.Fragment,{children:[c.clientEmail&&s.jsx("div",{children:c.clientEmail}),((u=c.clientPhone)==null?void 0:u.trim())&&s.jsx("div",{children:c.clientPhone.trim()})]}):"-"}),s.jsx("td",{className:"border border-slate-300 px-4 py-2",children:c.memberships||"-"}),s.jsx("td",{className:"border border-slate-300 px-4 py-2",children:c.paymentMethod||"-"}),!n&&s.jsx("td",{className:"border border-slate-300 px-4 py-2 text-right",children:c.amount?`${mt(r.currency)}${c.amount}`:"-"}),s.jsx("td",{className:"border border-slate-300 px-4 py-2 text-right",children:s.jsx("input",{type:"checkbox",checked:i[d]||!1,onChange:()=>l(d),className:"w-5 h-5 cursor-pointer ml-auto",style:{accentColor:"#3b82f6"}})})]},d)}),Array.from({length:3}).map((c,d)=>s.jsxs("tr",{children:[s.jsx("td",{className:"border border-slate-300 px-4 py-2",children:" "}),s.jsx("td",{className:"border border-slate-300 px-4 py-2"}),s.jsx("td",{className:"border border-slate-300 px-4 py-2"}),s.jsx("td",{className:"border border-slate-300 px-4 py-2"}),!n&&s.jsx("td",{className:"border border-slate-300 px-4 py-2 text-right"}),s.jsx("td",{className:"border border-slate-300 px-4 py-2 text-center"})]},d))]})]}),r.bookings.length>0&&s.jsxs("div",{className:"mt-6 pt-4 border-t border-slate-300",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("div",{className:"font-semibold",children:"Total Attendees:"}),s.jsx("div",{className:"text-lg",children:r.bookings.length})]}),r.bookings.some(c=>c.amount)&&s.jsxs("div",{className:"flex justify-between items-center mt-2",children:[s.jsx("div",{className:"font-semibold",children:"Total Amount:"}),s.jsxs("div",{className:"text-lg",children:[mt(r.currency),r.bookings.reduce((c,d)=>c+(d.amount?parseFloat(d.amount):0),0).toFixed(2)]})]}),r.bookings.filter(c=>c.paymentMethod==="Cash").length>0&&s.jsxs("div",{className:"flex justify-between items-center mt-2",children:[s.jsx("div",{className:"font-semibold",children:"Cash to Collect:"}),s.jsxs("div",{className:"text-lg",children:[mt(r.currency),r.bookings.filter(c=>c.paymentMethod==="Cash").reduce((c,d)=>c+(d.amount?parseFloat(d.amount):0),0).toFixed(2)]})]})]}),r.bookings.some(c=>c.notes&&c.notes.trim())&&s.jsxs("div",{className:"mt-6 pt-4",children:[s.jsx("h2",{className:"text-lg font-semibold mb-2 border-b border-slate-300 pb-1",children:"Notes"}),s.jsx("div",{className:"space-y-3",children:r.bookings.filter(c=>c.notes&&c.notes.trim()).map((c,d)=>s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-slate-700",children:c.clientName}),s.jsx("div",{className:"text-sm text-slate-600 whitespace-pre-wrap pl-2 border-l-2 border-slate-200",children:c.notes.trim()})]},d))})]}),s.jsxs("div",{className:"no-print mt-8 text-center",children:[s.jsx("button",{onClick:()=>window.print(),className:"px-6 py-2 bg-primary text-white rounded-lg hover:bg-primary/90",children:"Print"}),s.jsx("button",{onClick:()=>window.close(),className:"ml-4 px-6 py-2 bg-slate-200 text-slate-700 rounded-lg hover:bg-slate-300",children:"Close"})]})]}):s.jsx("div",{className:"p-8 text-center",children:s.jsx("p",{children:"Loading..."})})}const ZHe="https://classta.co";function CL(e){return e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim()}function eVe(e,t,n){const r=[e];return t&&r.push("",t),r.push("",n),r.join(`
884`)}function tVe(e){var t;return(t=navigator.clipboard)!=null&&t.writeText?navigator.clipboard.writeText(e).then(()=>!0,()=>SL(e)):Promise.resolve(SL(e))}function SL(e){try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}function sVe(){return s.jsx("svg",{viewBox:"0 0 24 24",className:"h-4 w-4",fill:"
884currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M13.5 22v-8.16h2.74l.41-3.18h-3.15V8.62c0-.92.25-1.55 1.58-1.55h1.68V4.22c-.29-.04-1.29-.13-2.45-.13-2.42 0-4.08 1.48-4.08 4.2v2.34H7.5v3.18h2.73V22h3.27z"})})}function nVe(){return s.jsx("svg",{viewBox:"0 0 24 24",className:"h-4 w-4",fill:"currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M14.15 10.35 21.1 2h-1.65l-6.04 7.25L8.6 2H3l7.3 10.96L3 22h1.65l6.38-7.66L15.4 22H21l-6.85-11.65zm-2.26 2.71-.74-1.09L5.24 3.3h2.53l4.74 6.99.74 1.09 6.2 9.15h-2.53l-5.03-7.47z"})})}function rVe(){return s.jsxs("svg",{viewBox:"0 0 24 24",className:"h-4 w-4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M19 7.5c-1.333-3-3.667-4.5-7-4.5-5 0-8 2.5-8 9s3.5 9 8 9 8-2.5 8-9c0-2.5-1.5-4.5-4-4.5"}),s.jsx("path",{d:"M8 12c0 2.5 1.5 4.5 4 4.5s4-2 4-4.5-1.5-4.5-4-4.5"})]})}function aVe(){return s.jsx("svg",{viewBox:"0 0 24 24",className:"h-4 w-4",fill:"currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M6.5 9.5H4V20h2.5V9.5zM5.25 4C4.42 4 3.75 4.67 3.75 5.5S4.42 7 5.25 7 6.75 6.33 6.75 5.5 6.08 4 5.25 4zM20 20h-2.5v-5.6c0-1.33-.03-3.04-1.85-3.04-1.85 0-2.13 1.45-2.13 2.94V20H11V9.5h2.4v1.43h.03c.33-.63 1.15-1.3 2.37-1.3 2.54 0 3.01 1.67 3.01 3.84V20z"})})}function iVe(){return s.jsx("svg",{viewBox:"0 0 24 24",className:"h-4 w-4",fill:"currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M12.04 3.5A8.45 8.45 0 0 0 3.6 11.96c0 1.49.39 2.94 1.13 4.22L3.5 20.5l4.45-1.17a8.46 8.46 0 0 0 4.09 1.05h.01A8.45 8.45 0 0 0 20.5 12 8.47 8.47 0 0 0 12.04 3.5zm0 15.47h-.01a7.02 7.02 0 0 1-3.58-.98l-.26-.15-2.64.69.7-2.57-.17-.26a7.02 7.02 0 0 1-1.08-3.74 7.05 7.05 0 0 1 7.04-7.04A7.05 7.05 0 0 1 19.04 12a7.05 7.05 0 0 1-7 6.97zm3.86-5.26c-.21-.11-1.25-.62-1.44-.69-.19-.07-.33-.11-.47.11-.14.21-.54.69-.66.83-.12.14-.24.16-.45.05-.21-.11-.88-.32-1.68-1.03-.62-.55-1.04-1.24-1.16-1.45-.12-.21-.01-.32.09-.43.09-.09.21-.24.32-.36.11-.12.14-.21.21-.35.07-.14.04-.26-.02-.37-.05-.11-.47-1.13-.64-1.55-.17-.41-.34-.35-.47-.36h-.4c-.14 0-.37.05-.56.26-.19.21-.74.72-.74 1.76s.76 2.04.86 2.18c.11.14 1.49 2.28 3.61 3.2.5.22.9.35 1.2.45.51.16.97.14 1.34.08.41-.06 1.25-.51 1.43-1 .18-.49.18-.91.12-1-.05-.08-.19-.14-.4-.25z"})})}function Zm({href:e,label:t,icon:n,compact:r}){const a=e.startsWith("mailto:");return s.jsxs(vT,{children:[s.jsx(bT,{asChild:!0,children:s.jsx(B,{asChild:!0,variant:"outline",size:"sm",className:r?"h-8 w-8 p-0":"h-9 w-9 p-0",children:s.jsx("a",{href:e,target:a?void 0:"_blank",rel:a?void 0:"noopener noreferrer","aria-label":t,children:n})})}),s.jsx(KN,{children:t})]})}function XD({title:e,excerpt:t="",slug:n,variant:r="full"}){const{toast:a}=Yt(),[i,o]=f.useState(!1),[l,c]=f.useState(!1),d=f.useMemo(()=>CL(e),[e]),m=f.useMemo(()=>CL(t),[t]),u=`${ZHe}/blog/${encodeURIComponent(n)}`,h=f.useMemo(()=>eVe(d,m,u),[d,m,u]),p=f.useMemo(()=>{if(!m)return d;const T=`${d}
885
886${m}`;return T.length<=220?T:d},[d,m]),v=f.useMemo(()=>{const E=m?`${d}
887
888${m}`:d;return E.length<=450?E:`${E.slice(0,447).trimEnd()}...`},[d,m]),y=`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(u)}`,g=`https://twitter.com/intent/tweet?text=${encodeURIComponent(p)}&url=${encodeURIComponent(u)}`,x=`https://www.threads.com/intent/post?text=${encodeURIComponent(v)}&url=${encodeURIComponent(u)}`,b=`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(u)}`,w=`https://api.whatsapp.com/send?text=${encodeURIComponent(h)}`,j=`mailto:?subject=${encodeURIComponent(d)}&body=${encodeURIComponent(h)}`;f.useEffect(()=>{c(typeof navigator.share=="function")},[]),f.useEffect(()=>{if(!i)return;const E=window.setTimeout(()=>o(!1),2e3);return()=>window.clearTimeout(E)},[i]);const N=async()=>{await tVe(h)?(o(!0),a({title:"Copied title, excerpt and link",description:"Paste it into Instagram, Facebook, email, or anywhere else."})):a({title:"Could not copy",description:"Please copy the link from the address bar instead.",variant:"destructive"})},C=async()=>{try{await navigator.share({title:d,text:m||d,url:u})}
888catch(E){if((E instanceof Error?E.name:"")==="AbortError")return;a({title:"Could not open share sheet",description:"Copy the details or use a share button instead."})}},P=r==="compact",S=s.jsxs("div",{className:P?"flex flex-wrap items-center gap-2":"flex flex-nowrap items-center gap-2",children:[s.jsx(Zm,{href:y,label:"Share on Facebook",icon:s.jsx(sVe,{}),compact:P}),s.jsx(Zm,{href:g,label:"Share on X",icon:s.jsx(nVe,{}),compact:P}),s.jsx(Zm,{href:x,label:"Share on Threads",icon:s.jsx(rVe,{}),compact:P}),s.jsx(Zm,{href:b,label:"Share on LinkedIn",icon:s.jsx(aVe,{}),compact:P}),s.jsx(Zm,{href:w,label:"Share on WhatsApp",icon:s.jsx(iVe,{}),compact:P}),s.jsx(Zm,{href:j,label:"Share by email",icon:s.jsx(_n,{className:"h-4 w-4"}),compact:P})]});return s.jsxs("div",{className:P?"":"border-t border-slate-200 pt-6",children:[!P&&s.jsx("p",{className:"text-sm font-medium text-slate-700 mb-3",children:"Share this post"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l&&s.jsxs(B,{type:"button",variant:P?"outline":"default",size:"sm",className:P?"h-8 w-8 p-0":"h-9 px-3",onClick:C,title:"Share via your device","aria-label":"Share via your device",children:[s.jsx(Ff,{className:"h-4 w-4"}),!P&&s.jsx("span",{children:"Share"})]}),s.jsxs(B,{type:"button",variant:"outline",size:"sm",className:P?"h-8 w-8 p-0":"h-9 px-3",onClick:N,title:"Copy title, excerpt and link","aria-label":"Copy title, excerpt and link",children:[i?s.jsx(bn,{className:"h-4 w-4"}):s.jsx(pr,{className:"h-4 w-4"}),!P&&s.jsx("span",{children:i?"Copied":"Copy details"})]}),S]})]})}function oVe(e){return new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})}function lVe(){const[e,t]=f.useState(!1),[n,r]=f.useState(!1),[a,i]=f.useState(!1);f.useEffect(()=>{const d=()=>{var m;try{const u=JSON.parse(localStorage.getItem("instructorSession")||"{}"),h=JSON.parse(localStorage.getItem("admin_session")||"{}"),p=localStorage.getItem("auth_token"),v=!!(u.token||(m=h.instructor)!=null&&m.token||p);i(v)}catch{i(!1)}};return d(),window.addEventListener("storage",d),()=>window.removeEventListener("storage",d)},[]),f.useEffect(()=>{const d=document.createElement("script");d.id="helpscout-beacon-bootstrap",d.type="text/javascript",d.async=!0,d.innerHTML='!function(e,t,n){function a(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,a){e.Beacon.readyQueue.push({method:t,options:n,data:a})},n.readyQueue=[],"complete"===t.readyState)return a();e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}(window,document,window.Beacon||function(){});';const m=document.createElement("script");return m.id="helpscout-beacon-init",m.type="text/javascript",m.innerHTML="window.Beacon('init', '4c0a64a0-dadd-4aa9-a084-27ca6e6cb029');",document.body.appendChild(d),document.body.appendChild(m),()=>{document.body.contains(d)&&document.body.removeChild(d),document.body.contains(m)&&document.body.removeChild(m);const u=window.Beacon;if(u)try{u("destroy")}catch{}}},[]),f.useEffect(()=>{const d=m=>{n&&(m.target.closest("header")||r(!1))};return document.addEventListener("click",d),()=>document.removeEventListener("click",d)},[n]);const{data:o=[],isLoading:l,error:c}=Ue({queryKey:["/api/blog/posts"]});return l?s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:s.jsx("div",{className:"max-w-4xl mx-auto px-6 py-12",children:s.jsxs("div",{className:"text-center py-12",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-2 border-primary border-t-transparent rounded-full mx-auto mb-4"}),s.jsx("p",{className:"text-slate-600",children:"Loading latest posts..."})]})})}):c?s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:s.jsx("div",{className:"max-w-4xl mx-auto px-6 py-12",children:s.jsxs("div",{className:"text-center py-12",children:[s.jsx("p",{className:"text-red-600 mb-4",children:"Unable to load blog posts"}),s.jsx("p",{className:"text-slate-600",children:"Please try again later or contact support."})]})})}):s.jsxs(s.Fragment,{children:[s.jsxs(zo,{children:[s.jsx("title",{children:"Classta Blog | Tips and Updates for Class Instru
888ctors"}),s.jsx("meta",{name:"description",content:"Stay updated with the latest features, tips, and insights to make running your classes easier. Read our blog for instructor advice and platform updates.","data-rh":"true"}),s.jsx("meta",{name:"keywords",content:"class booking blog, instructor tips, fitness business advice, class management, booking system updates, instructor resources","data-rh":"true"}),s.jsx("meta",{name:"author",content:"Classta","data-rh":"true"}),s.jsx("meta",{name:"robots",content:"index, follow"}),s.jsx("meta",{property:"og:type",content:"website","data-rh":"true"}),s.jsx("meta",{property:"og:url",content:"https://classta.co/blog","data-rh":"true"}),s.jsx("meta",{property:"og:title",content:"Classta Blog | Tips and Updates for Class Instructors","data-rh":"true"}),s.jsx("meta",{property:"og:description",content:"Stay updated with the latest features, tips, and insights to make running your classes easier. Read our blog for instructor advice and platform updates.","data-rh":"true"}),s.jsx("meta",{property:"og:image",content:"https://classta.co/new-og-image.png","data-rh":"true"}),s.jsx("meta",{property:"og:image:width",content:"1200","data-rh":"true"}),s.jsx("meta",{property:"og:image:height",content:"630","data-rh":"true"}),s.jsx("meta",{property:"og:site_name",content:"Classta","data-rh":"true"}),s.jsx("meta",{property:"twitter:card",content:"summary_large_image","data-rh":"true"}),s.jsx("meta",{property:"twitter:url",content:"https://classta.co/blog","data-rh":"true"}),s.jsx("meta",{property:"twitter:title",content:"Classta Blog | Tips and Updates for Class Instructors","data-rh":"true"}),s.jsx("meta",{property:"twitter:description",content:"Stay updated with the latest features, tips, and insights to make running your classes easier.","data-rh":"true"}),s.jsx("meta",{property:"twitter:image",content:"https://classta.co/new-og-image.png","data-rh":"true"}),s.jsx("link",{rel:"canonical",href:"https://classta.co/blog","data-rh":"true"}),s.jsx("meta",{name:"language",content:"English"}),s.jsx("meta",{name:"revisit-after",content:"7 days"}),s.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"Blog",name:"Classta Blog",description:"Tips, updates, and insights for class instructors using Classta booking platform",url:"https://classta.co/blog",publisher:{"@type":"Organization","@id":"https://classta.co/#organization",name:"Classta",url:"https://classta.co",description:"Professional class booking platform for all types of instructors",sameAs:["https://www.facebook.com/classtaco","https://www.instagram.com/classta.co"]},mainEntityOfPage:{"@type":"WebPage","@id":"https://classta.co/blog"}})})]}),s.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:[s.jsx("header",{className:"bg-white/80 backdrop-blur-sm border-b border-slate-200 sticky top-0 z-50",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsxs(dt,{href:"/",className:"flex items-center space-x-3",children:[s.jsx(Ia,{className:"text-primary",size:"md"}),s.jsx("span",{className:"text-xl font-bold text-slate-900",children:"Classta"})]}),s.jsxs("div",{className:"hidden md:flex items-center space-x-4",children:[s.jsxs("div",{className:"relative",children:[s.jsxs(B,{variant:"ghost",size:"sm",onClick:()=>t(!e),className:"flex items-center space-x-1",children:[s.jsx("span",{children:"Solutions"}),s.jsx(vi,{className:"w-4 h-4"})]}),e&&s.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-slate-200 rounded-lg shadow-lg z-50 min-w-52",children:[s.jsx("a",{href:"/class-booking-system.html",className:"block px-4 py-2 text-sm text-slate-700 hover:bg-slate-50 first:rounded-t-lg",children:"Class Booking System"}),s.jsx("a",{href:"/yoga-booking-system.html",className:"block px-4 py-2 text-sm text-slate-700 hover:bg-slate-50",children:"Yoga Booking System"}),s.jsx("a",{href:"/pilates-booking-software.html",className:"block px-4 py-2 text-sm text-slate-700 hover:bg-slate-50 last:rounded-b-lg",children:"Pilates Booking Softw
888are"})]})]}),s.jsx(dt,{href:"/instructor-signup",children:s.jsx(B,{variant:"outline",size:"sm",children:"Start Free Trial"})}),a?s.jsx(dt,{href:"/admin",children:s.jsxs(B,{variant:"ghost",size:"sm",children:[s.jsx(Dd,{className:"w-4 h-4 mr-2"}),"Admin"]})}):s.jsx(dt,{href:"/admin",children:s.jsxs(B,{variant:"ghost",size:"sm",children:[s.jsx(Nd,{className:"w-4 h-4 mr-2"}),"Log In"]})}),s.jsx("a",{href:"https://help.classta.co/",children:s.jsx(B,{variant:"ghost",size:"sm",children:"Help"})})]}),s.jsx("div",{className:"md:hidden",children:s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>r(!n),className:"p-2",children:n?s.jsx(ja,{className:"w-5 h-5"}):s.jsx(MN,{className:"w-5 h-5"})})})]}),n&&s.jsx("div",{className:"md:hidden border-t border-slate-200 bg-white/95 backdrop-blur-sm",children:s.jsxs("div",{className:"px-2 pt-2 pb-3 space-y-1",children:[s.jsxs("div",{className:"px-3 py-2",children:[s.jsx("p",{className:"text-xs font-medium text-slate-500 uppercase tracking-wider mb-2",children:"Solutions"}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("a",{href:"/class-booking-system.html",className:"block px-3 py-2 text-sm text-slate-700 hover:bg-slate-50 rounded-md",children:"Class Booking System"}),s.jsx("a",{href:"/yoga-booking-system.html",className:"block px-3 py-2 text-sm text-slate-700 hover:bg-slate-50 rounded-md",children:"Yoga Booking System"}),s.jsx("a",{href:"/pilates-booking-software.html",className:"block px-3 py-2 text-sm text-slate-700 hover:bg-slate-50 rounded-md",children:"Pilates Booking Software"})]})]}),s.jsx(dt,{href:"/instructor-signup",children:s.jsx("div",{className:"flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",children:"Start Free Trial"})}),a?s.jsx(dt,{href:"/admin",children:s.jsxs("div",{className:"flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",children:[s.jsx(Dd,{className:"w-4 h-4 mr-3"}),"Admin"]})}):s.jsx(dt,{href:"/admin",children:s.jsxs("div",{className:"flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",children:[s.jsx(Nd,{className:"w-4 h-4 mr-3"}),"Log In"]})}),s.jsx("a",{href:"https://help.classta.co/",children:s.jsx("div",{className:"flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",children:"Help"})})]})})]})}),s.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-12",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h1",{className:"text-4xl font-bold text-slate-900 mb-4",children:"Classta Blog"}),s.jsx("p",{className:"text-lg text-slate-600 max-w-2xl mx-auto",children:"Stay updated with the latest features, tips, and insights to make running your classes easier."})]}),o.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx("p",{className:"text-slate-600 mb-4",children:"No blog posts available yet."}),s.jsx("p",{className:"text-slate-500 text-sm",children:"Check back soon for updates!"})]}):s.jsx("div",{className:"space-y-8",children:o.map(d=>s.jsx(Ce,{className:"overflow-hidden hover:shadow-lg transition-shadow",children:s.jsxs(Ee,{className:"p-8",children:[s.jsxs("div",{className:"flex items-center space-x-4 text-sm text-slate-500 mb-4",children:[s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(Ls,{className:"h-4 w-4"}),s.jsx("span",{children:oVe(d.publishedAt)})]}),d.author&&s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(Dr,{className:"h-4 w-4"}),s.jsx("span",{children:d.author})]})]}),s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-4 hover:text-primary transition-colors",children:s.jsx(dt,{href:`/blog/${d.slug}`,children:s.jsx("span",{className:"cursor-pointer",children:d.title})})}),d.excerpt&&s.jsx("div",{className:"text-slate-600 mb-6 leading-relaxed",children:d.excerpt}),d.categories&&d.categories.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2 mb-6",children:d.categories.map((m,u)=>s.jsx(Je,{variant:"secondary",className:"text-xs",children:m},u))}),s.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[s.jsx(dt,{href:`/blog/${d.slug}`,children:s.jsxs("div",{className:"inline-flex items-center space-x-2 text-primary hover:text-primary/80 transition-colors cursor-pointer font-medium",children:[s.jsx("span",{children:"Read more"}
888),s.jsx(qn,{className:"h-4 w-4"})]})}),s.jsx(XD,{title:d.title,excerpt:d.excerpt,slug:d.slug,variant:"compact"})]})]})},d.id))}),o.length>0&&s.jsxs("div",{className:"text-center mt-12 pt-8 border-t border-slate-200",children:[s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-4",children:"Ready to make running your classes easier?"}),s.jsx("p",{className:"text-slate-600 mb-6",children:"Be part of a growing community of instructors using Classta to simplify bookings, payments, and attendance."}),s.jsx(dt,{href:"/instructor-signup",children:s.jsxs("div",{className:"inline-flex items-center space-x-2 bg-primary text-white px-6 py-3 rounded-lg hover:bg-primary/90 transition-colors cursor-pointer font-medium",children:[s.jsx("span",{children:"Start Free Trial"}),s.jsx(qn,{className:"h-4 w-4"})]})})]})]})]})]})}function cVe(e){return new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})}const Bl=e=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return e.replace(/[&<>"']/g,n=>t[n])},dVe=e=>e.replace(/<h1([^>]*)>/gi,'<h1$1 class="!mt-10 !mb-5">').replace(/<h2([^>]*)>/gi,'<h2$1 class="!mt-10 !mb-5">').replace(/<h3([^>]*)>/gi,'<h3$1 class="!mt-8 !mb-4">').replace(/<h4([^>]*)>/gi,'<h4$1 class="!mt-6 !mb-3">').replace(/<p([^>]*)>/gi,(t,n)=>n&&n.includes("class=")?t.replace(/class="([^"]*)"/,'class="$1 !mb-6"'):'<p class="!mb-6"'+(n||"")+">").replace(/<ul([^>]*)>/gi,(t,n)=>n&&n.includes("class=")?t.replace(/class="([^"]*)"/,'class="$1 !mb-6"'):'<ul class="!mb-6"'+(n||"")+">").replace(/<ol([^>]*)>/gi,(t,n)=>n&&n.includes("class=")?t.replace(/class="([^"]*)"/,'class="$1 !mb-6"'):'<ol class="!mb-6"'+(n||"")+">").replace(/<li([^>]*)>/gi,(t,n)=>n&&n.includes("class=")?t.replace(/class="([^"]*)"/,(r,a)=>`class="${a.replace(/mb-\d+/g,"").trim()} mb-2"`.replace(/\s+/g," ")):'<li class="mb-2"'+(n||"")+">"),uVe=e=>e.replace(/<pre[^>]*><code[^>]*>([\s\S]*?)<\/code><\/pre>/gi,(t,n)=>{const r=Bl(n),a=t.match(/<pre[^>]*>/),i=t.match(/<code[^>]*>/),o=a?a[0]:"<pre>",l=i?i[0]:"<code>";return`${o}${l}${r}</code></pre>`}),mVe=e=>{if(!e)return"<p>No content available</p>";try{const t=JSON.parse(e);return hVe(t)}catch{const t=uVe(e);return dVe(t)}},hVe=e=>e.map(t=>{if(t.type==="paragraph")return`<p class="mb-6">${mu(t.children)}</p>`;if(t.type==="heading-one")return`<h1 class="text-2xl font-bold mt-8 mb-4">${mu(t.children)}</h1>`;if(t.type==="heading-two")return`<h2 class="text-xl font-semibold mt-8 mb-4">${mu(t.children)}</h2>`;if(t.type==="link"){const n=mu(t.children);return`<a href="${Bl(t.url)}" class="text-blue-600 underline hover:text-blue-800" target="_blank" rel="noopener noreferrer">${n}</a>`}else{if(t.type==="bulleted-list")return`<ul class="list-disc pl-5 !mb-6">${t.children.map(r=>`<li class="mb-2">${mu(r.children)}</li>`).join("")}</ul>`;if(t.type==="numbered-list"){const n=t.children.map(a=>`<li class="mb-2">${mu(a.children)}</li>`).join("");return`<ol${t.start&&t.start>1?` start="${t.start}"`:""} class="list-decimal pl-5 !mb-6">${n}</ol>`}else if(t.type==="image"){const n=t.width?`width="${t.width}"`:"",r=`<img src="${Bl(t.url)}" ${n} style="max-width: 100%; height: auto;" alt="" class="rounded mb-4" />`;return t.linkUrl?`<a href="${Bl(t.linkUrl)}" target="_blank" rel="noopener noreferrer">${r}</a>`:r}else{if(t.type==="video")return`<iframe src="${Bl(t.url)}" width="560" height="315" frameborder="0" allowfullscreen style="max-width: 100%;" class="rounded mb-4"></iframe>`;if(t.type==="code-block"){const n=Bl(t.children.map(a=>a.text||"").join(""));return`<pre style="background-color: #0f172a; color: #f1f5f9; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; margin: 1.5rem 0;" class="!bg-slate-900 !text-slate-100 !p-4 !rounded-lg !overflow-x-auto !my-6"><code${t.language?` class="language-${Bl(t.language)}"`:""} style="color: #f1f5f9;">${n}</code></pre>`}}}return""}).join(""),mu=e=>e.map(t=>{if(t.type==="link"){const n=mu(t.children);return`<a href="${Bl(t.url)}" class="text-blue-600 underline hover:text-blue-800" target="_blank" rel="noopener noreferrer">${n}</a>`}else{let n=Bl(t.text||"");return t.bold&&(n=`<strong>${n}</strong>`),t.italic&&(n=`<em>${n}</em>`),t.underline&&(n=`<u>${n}</u>`),n}}).join("");function fVe(){var o,l;const[e,t]=Ese("/blog/:slug"),n=t==null?void 0:t.slug,{data:r,isLoading:a,error:i}=Ue({queryKey:[`/api/blog/posts/${n}`],enabled:!!n});return a?s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:s.jsx("div",{className:"max-w-4xl mx-auto px-6 py-12",children:s.jsxs("div",{className:"text-center py-12",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-2 border-primary border-t-transparent roun
888ded-full mx-auto mb-4"}),s.jsx("p",{className:"text-slate-600",children:"Loading post..."})]})})}):i||!r?s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:s.jsx("div",{className:"max-w-4xl mx-auto px-6 py-12",children:s.jsxs("div",{className:"text-center py-12",children:[s.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-4",children:"Post Not Found"}),s.jsx("p",{className:"text-slate-600 mb-6",children:"The blog post you're looking for doesn't exist or has been removed."}),s.jsx(dt,{href:"/blog",children:s.jsxs("div",{className:"inline-flex items-center space-x-2 text-primary hover:text-primary/80 transition-colors cursor-pointer font-medium",children:[s.jsx(xr,{className:"h-4 w-4"}),s.jsx("span",{children:"Back to Blog"})]})})]})})}):s.jsxs(s.Fragment,{children:[s.jsxs(zo,{children:[s.jsxs("title",{children:[r.title," | Classta"]}),s.jsx("meta",{name:"description",content:r.excerpt||r.content.replace(/<[^>]*>/g,"").substring(0,160)}),s.jsx("meta",{name:"keywords",content:((o=r.categories)==null?void 0:o.join(", "))||""}),s.jsx("meta",{name:"author",content:r.author}),s.jsx("link",{rel:"canonical",href:`https://classta.co/blog/${r.slug}`}),s.jsx("meta",{property:"og:type",content:"article"}),s.jsx("meta",{property:"og:url",content:`https://classta.co/blog/${r.slug}`}),s.jsx("meta",{property:"og:title",content:r.title}),s.jsx("meta",{property:"og:description",content:r.excerpt||r.content.replace(/<[^>]*>/g,"").substring(0,160)}),s.jsx("meta",{property:"og:image",content:"https://classta.co/new-og-image.png"}),s.jsx("meta",{property:"og:image:width",content:"1200"}),s.jsx("meta",{property:"og:image:height",content:"630"}),s.jsx("meta",{property:"og:site_name",content:"Classta Blog"}),s.jsx("meta",{property:"twitter:card",content:"summary_large_image"}),s.jsx("meta",{property:"twitter:url",content:`https://classta.co/blog/${r.slug}`}),s.jsx("meta",{property:"twitter:title",content:r.title}),s.jsx("meta",{property:"twitter:description",content:r.excerpt||r.content.replace(/<[^>]*>/g,"").substring(0,160)}),s.jsx("meta",{property:"twitter:image",content:"https://classta.co/new-og-image.png"}),s.jsx("meta",{property:"article:author",content:r.author}),s.jsx("meta",{property:"article:published_time",content:r.publishedAt}),s.jsx("meta",{property:"article:modified_time",content:r.updatedAt}),(l=r.categories)==null?void 0:l.map((c,d)=>s.jsx("meta",{property:"article:tag",content:c},d)),s.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"BlogPosting",headline:r.title,description:r.excerpt||r.content.replace(/<[^>]*>/g,"").substring(0,160),author:{"@type":"Person",name:r.author},datePublished:r.publishedAt,dateModified:r.updatedAt,publisher:{"@type":"Organization",name:"Classta",url:"https://classta.co"},mainEntityOfPage:{"@type":"WebPage","@id":`https://classta.co/blog/${r.slug}`}})})]}),s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:s.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-12",children:[s.jsx("div",{className:"mb-8",children:s.jsx(dt,{href:"/blog",children:s.jsxs("div",{className:"inline-flex items-center space-x-2 text-slate-600 hover:text-primary transition-colors cursor-pointer",children:[s.jsx(xr,{className:"h-4 w-4"}),s.jsx("span",{children:"Back to Blog"})]})})}),s.jsxs("article",{className:"bg-white rounded-lg shadow-sm p-8 mb-8",children:[s.jsxs("div",{className:"flex items-center space-x-4 text-sm text-slate-500 mb-6",children:[s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(Ls,{className:"h-4 w-4"}),s.jsx("span",{children:cVe(r.publishedAt)})]}),r.author&&s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(Dr,{className:"h-4 w-4"}),s.jsx("span",{children:r.author})]})]}),s.jsx("h1",{className:"text-4xl font-bold text-slate-900 mb-6 leading-tight",children:r.title}),r.categories&&r.categories.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2 mb-6",children:r.categories.map((c,d)=>s.jsx(Je,{variant:"secondary",className:"text-sm",children:c},d))}),s.jsx("div",{className:"mb-8",children:s.jsx(XD,{title:r.title,excerpt:r.excerpt,slug:r.slug})}),s.jsx("div",{className:`prose prose-lg max-w-none prose-slate
889              prose-headings:text-slate-900 prose-headings:font-semibold 
890              prose-headings:!mt-10 prose-headings:!mb-5 prose-h1:!mt-10 prose-h2:!mt-10 prose-h3:!mt-8
891              prose-p:text-slate-700 prose-p:leading-relaxed prose-p:!mb-6
892              prose-a:text-primary prose-a:font-medium hover:prose-a:text-primary/80
893              prose-strong:text-slate-900 prose-strong:font-semibold
894              prose-ul:text-slate-700 prose-ol:text-slate-700 prose-ul:!mb-6 prose-ol:!mb-6
895              prose-li:text-slate-700 prose-li:leading-relaxed prose-li:!mb-2
896              prose-blockquote:border-primary prose-blockquote:text-slate-600 prose-blockquote:!my-6
897              prose-code:text-primary prose-code:bg-slate-100 prose-code:px-1 prose-code:py-0.5 prose-code:rounded
898              prose-pre:!bg-slate-900 prose-pre:!text-slate-100 prose-pre:!p-4 prose-pre:!rounded-lg prose-pre:!overflow-x-auto prose-pre:!my-6
899              [&>h1]:!mt-10 [&>h1]:!mb-5 [&>h2]:!mt-10 [&>h2]:!mb-5 [&>h3]:!mt-8 [&>h3]:!mb-4
900              [&>p]:!mb-6 [&>ul]:!mb-6 [&>ol]:!mb-6
901              [&>pre]:!bg-slate-900 [&>pre]:!text-slate-100 [&>pre]:!p-4 [&>pre]:!rounded-lg [&>pre]:!overflow-x-auto [&>pre]:!my-6
902              [&>pre>code]:!text-slate-100 [&>pre>code]:!bg-transparent [&>pre>code]:!p-0`,dangerouslySetInnerHTML:{__html:mVe(r.content)}}),s.jsx("div",{className:"mt-10",children:s.jsx(XD,{title:r.title,excerpt:r.excerpt,slug:r.slug})})]}),s.jsxs("div",{className:"text-center bg-white rounded-lg shadow-sm p-8",children:[s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-4",children:"Ready to start your fitness business?"}),s.jsx("p",{className:"text-slate-600 mb-6",children:"Join thousands of instructors using Classta to manage their classes and grow their business."}
902),s.jsx(dt,{href:"/instructor-signup",children:s.jsx("div",{className:"inline-flex items-center space-x-2 bg-primary text-white px-6 py-3 rounded-lg hover:bg-primary/90 transition-colors cursor-pointer font-medium",children:s.jsx("span",{children:"Start Free Trial"})})})]})]})})]})}function yC({isOpen:e,onClose:t,onEmailCaptured:n,guestSessionId:r,toolType:a}){const[i,o]=f.useState(""),[l,c]=f.useState(""),{toast:d}=Yt(),m=xt({mutationFn:async()=>await Pe("POST","/api/free-tools/capture-email",{guestSessionId:r,email:i,name:l,toolType:a}),onSuccess:()=>{d({title:"Email Captured Successfully",description:"Check your email for access links and full-resolution assets."}),n(i),o(""),c("")},onError:v=>{d({title:"Error",description:v.message||"Please try again.",variant:"destructive"})}}),u=v=>{v.preventDefault(),i.trim()&&(m.mutate(),typeof window<"u"&&window.gtag&&window.gtag("event","conversion",{send_to:"AW-17123389975/Vf97CKTQupMbEJfkiOU_"}))},p=a.toLowerCase().includes("form")?{title:"Get Your Form Link",description:"Enter your email to receive a shareable link for your form and access to response data.",benefit:`• Shareable form URL
903• Email notifications for new responses
904• Response management dashboard
905• 200 total responses included`}:a.toLowerCase().includes("timetable")?{title:"Download High-Res Images",description:"Enter your email to receive full-resolution, watermark-free images for your social media.",benefit:`• Full-resolution images
906• All social media formats
907• No watermarks
908• Professional quality`}:a.toLowerCase().includes("ticket")||a.toLowerCase().includes("qr")?{title:"Get Your QR Ticket",description:"Enter your email to receive your QR code ticket and public display link.",benefit:`• High-quality QR code
909• Professional ticket design
910• Secure access links
911• 30-day validity`}:{title:"Get Access",description:"Enter your email to receive your download and access links.",benefit:`• Full access to your work
912• Professional quality exports
913• Email delivery included`};return p?s.jsx(Ct,{open:e,onOpenChange:t,children:s.jsxs(St,{className:"max-w-md",children:[s.jsx(kt,{children:s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("div",{className:"h-10 w-10 bg-blue-100 rounded-full flex items-center justify-center",children:s.jsx(_n,{className:"h-5 w-5 text-blue-600"})}),s.jsx("div",{children:s.jsx(Pt,{children:p.title})})]})}),s.jsxs("div",{className:"space-y-6",children:[s.jsx("p",{className:"text-slate-600 text-sm",children:p.description}),s.jsxs("div",{className:"bg-blue-50 p-4 rounded-lg",children:[s.jsxs("h4",{className:"font-medium text-slate-900 mb-2 flex items-center gap-2",children:[s.jsx(jl,{className:"h-4 w-4 text-blue-600"}),"What you'll get:"]}),s.jsx("pre",{className:"text-sm text-slate-700 font-normal whitespace-pre-line",children:p.benefit})]}),s.jsxs("form",{onSubmit:u,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"email",children:"Email Address *"}),s.jsx(me,{id:"email",type:"email",value:i,onChange:v=>o(v.target.value),placeholder:"[email protected]",required:!0})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"name",children:"Name (Optional)"}),s.jsx(me,{id:"name",value:l,onChange:v=>c(v.target.value),placeholder:"Your name"})]}),s.jsxs("div",{className:"flex gap-3 pt-4",children:[s.jsx(B,{type:"button",variant:"outline",onClick:t,className:"flex-1",children:"Cancel"}),s.jsx(B,{type:"submit",disabled:!i.trim()||m.isPending,className:"flex-1",children:m.isPending?"Sending...":"Get Access"})]})]}),s.jsx("p",{className:"text-xs text-slate-500 text-center",children:"We'll send you a magic link to access your tools dashboard. No spam, just useful content."})]})]})}):null}function pVe({guestSessionId:e,isAuthenticated:t=!1,userEmail:n}){const[r,a]=f.useState([]),[i,o]=f.useState(null),[l,c]=f.useState("New Form"),[d,m]=f.useState(""),[u,h]=f.useState([]),[p,v]=f.useState(!1),[y,g]=f.useState(!1),[x,b]=f.useState(null),[w,j]=f.useState(!1),[N,C]=f.useState(""),[P,S]=f.useState(""),[E,T]=f.useState({isOpen:!1,formId:null,formName:"",responseCount:0}),{toast:z}=Yt(),{data:O,isLoading:D}=Ue({queryKey:["/api/free-tools/forms",e],enabled:!!e});f.useEffect(()=>{O&&a(Array.isArray(O)?O:[])},[O]);const k=()=>
913{if(((u==null?void 0:u.length)||0)>=15){z({title:"Field Limit Reached",description:"Free forms are limited to 15 fields. Upgrade to Classta for unlimited fields.",variant:"destructive"});return}const M={id:`field_${Date.now()}`,type:"text",label:"New Question",required:!1};h([...u,M])},F=(M,se)=>{const Q=u.map((te,G)=>G===M?{...te,...se}:te);h(Q)},W=M=>{h(u.filter((se,Q)=>Q!==M))},q=(M,se)=>{se<0||se>=((u==null?void 0:u.length)||0)||h(Q=>{const te=[...Q],[G]=te.splice(M,1);return te.splice(se,0,G),te})},H=xt({mutationFn:async M=>await(await Pe("POST","/api/free-tools/forms",M)).json(),onSuccess:M=>{Zs("tool_executed","free_tools","form_created"),Ms.invalidateQueries({queryKey:["/api/free-tools/forms",e]}),o(null),c("New Form"),m(""),h([])},onError:M=>{z({title:"Error Saving Form",description:M.message||"Please try again.",variant:"destructive"})}}),_=xt({mutationFn:async()=>await(await Pe("POST","/api/free-tools/ai-generate-form",{description:N,businessType:P,guestSessionId:e})).json(),onSuccess:M=>{Zs("tool_executed","free_tools","ai_form_generated"),c(M.formName),h(M.questions),j(!1),C(""),S(""),M.truncated?z({title:"Form Generated Successfully",description:`AI generated ${M.totalGenerated} fields, but we've limited it to 15 for the free version. Upgrade to Classta for unlimited fields.`,variant:"destructive"}):z({title:"Form Generated Successfully",description:`Your form with ${M.questions.length} fields is ready to customize.`})},onError:M=>{z({title:"Generation Failed",description:M.message||"Please try again.",variant:"destructive"})}}),L=xt({mutationFn:async M=>{if(!e)throw new Error("Session not available");const se=await Pe("DELETE",`/api/free-tools/forms/${M}?sessionId=${e}`);if(!se.ok)throw new Error("Failed to delete form");return se.json()},onSuccess:()=>{var M;z({title:"Form deleted",description:"Form and all responses have been deleted successfully."}),Ms.invalidateQueries({queryKey:["/api/free-tools/forms",e]}),Ms.invalidateQueries({queryKey:["/api/free-tools/forms"]}),i!==null&&((M=r[i])==null?void 0:M.id)===E.formId&&(o(null),c("New Form"),m(""),h([]))},onError:M=>{z({title:"Delete failed",description:"Failed to delete form. Please try again.",variant:"destructive"})}}),U=(M,se,Q)=>{T({isOpen:!0,formId:M,formName:se,responseCount:Q})},J=()=>{E.formId&&L.mutate(E.formId),T({isOpen:!1,formId:null,formName:"",responseCount:0})},I=()=>{if(r.length>=5&&i===null){z({title:"Form Limit Reached",description:"Free accounts are limited to 5 forms. Delete an existing form or upgrade to Classta.",variant:"destructive"});return}t&&n?re():(b({type:"save"}),g(!0))},re=()=>{var se;const M={guestSessionId:e,name:l,description:d,questions:JSON.stringify(u),slug:l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")};i!==null&&((se=r[i])!=null&&se.id)&&(M.id=r[i].id),H.mutate(M)},R=M=>{b({type:"export",data:M}),g(!0)},Y=()=>s.jsxs("div",{className:"space-y-6 max-h-[60vh] overflow-y-auto bg-white p-6 rounded-lg border",children:[s.jsxs("div",{className:"text-center border-b pb-4",children:[s.jsx("h2",{className:"text-xl font-bold text-slate-900",children:l}),d&&s.jsx("p",{className:"text-sm text-slate-600 mt-2",children:d})]}),u.map((M,se)=>{var Q,te,G;return s.jsxs("div",{className:"space-y-2",children:[s.jsxs(V,{className:"text-sm font-medium",children:[M.label," ",M.required&&s.jsx("span",{className:"text-red-500",children:"*"})]}),M.type==="text"&&s.jsx(me,{placeholder:M.placeholder,className:"w-full",disabled:!0}),M.type==="email"&&s.jsx(me,{type:"email",placeholder:M.placeholder,className:"w-full",disabled:!0}),M.type==="date"&&s.jsx(me,{type:"date",className:"w-full",disabled:!0}),M.type==="textarea"&&s.jsx(Is,{placeholder:M.placeholder,className:"w-full",rows:3,disabled:!0}),M.type==="select"&&s.jsxs(Bt,{disabled:!0,children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"Please select..."})}),s.jsx(It,{children:(Q=M.options)==null?void 0:Q.map((Z,ie)=>s.jsx(ce,{value:Z,children:Z},ie))})]}),M.type==="radio"&&s.jsx("div",{className:"space-y-2",children:(te=M.options)==null?void 0:te.map((Z,ie)=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"radio",disabled:!0,className:"h-4 w-4"}),s.jsx(V,{className:"text-sm",children:Z})]},ie))}),M.type==="checkbox"&&s.jsx("div",{className:"space-y-2",children:(G=M.options)==null?void 0:G.map((Z,ie)=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{disabled:!0}),s.jsx(V,{className:"text-sm",children:Z})]},ie))})]},M.id)})]});return p?s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Form Preview"}),s.jsx(B,{variant:"outline",onClick:()=>v(!1),children:"Back to Editor"})]}),s.jsx(Y,{})]}):s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h1",{className:"text-3xl font-bold text-slate-900 mb-2",children:"Free Forms Builder"}),s.jsx("p",{className:"text-slate-600",children:"Create custom forms for your fitness business. Build up to 5 forms with 15 fields each."})]}),s.jsxs("div",{className:"grid lg:grid-cols-3 gap-8",children:[s.jsx("div",{className:"lg:col-span-1",children:s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(Ng,{className:"h-5 w-5"}),"Your Forms (",r.length,"/5)"]})}),s.jsxs(Ee,{className:"space-y-4",children:[r.map((M,se)=>s.jsxs("div",{className:"p-4 border rounded-lg space-y-2",children:[s.jsx("h3",{className:"font-medium",children:M.name}),s.jsxs("p",{className:"text-sm text-slate-600",children:[M.responseCount||0," responses"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(B,{size:"sm",variant:"outline",onClick:()=>{o(se),c(M.name),m(M.description||""),h(JSON.parse(M.questions))},children:"Edit"}),s.jsx(B,{size:"sm",variant:"outline",onClick:()=>R(M),children:s.jsx(Lr,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"outline",onClick:()=>U(M.id,M.name,M.responseCount||0),className:"text-red-600 hover:text-red-700 hover:bg-red-50",title:`Delete form${M.responseCount>0?` and ${M.responseCount} responses`:""}`,children:s.jsx(ln,{className:"h-4 w-4"})})]})]},M.id)),r.length<5&&s.jsxs(B,{onClick:()=>{o(null),c("New Form"),m(""),h([])},className:"w-full",variant:"outline",children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"New Form"]})]})]})}),s.jsx("div",{className:"lg:col-span-2",children:s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Form Editor"})}),s.jsxs(Ee,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"formTitle",children:"Form Title"}
913),s.jsx(me,{id:"formTitle",value:l,onChange:M=>c(M.target.value),placeholder:"e.g., Health Assessment Form"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"formDescription",children:"Description (Optional)"}),s.jsx(Is,{id:"formDescription",value:d,onChange:M=>m(M.target.value),placeholder:"Brief description of what this form is for",rows:2})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[s.jsxs(V,{className:"text-base font-medium",children:["Form Fields (",(u==null?void 0:u.length)||0,"/15)"]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[s.jsxs(B,{onClick:()=>j(!0),variant:"outline",className:"bg-gradient-to-r from-purple-500 to-pink-500 text-white border-0 hover:from-purple-600 hover:to-pink-600 text-sm sm:text-base",size:"sm",children:[s.jsx(lr,{className:"h-4 w-4 mr-2"}),"AI Wizard"]}),s.jsxs(B,{onClick:k,disabled:((u==null?void 0:u.length)||0)>=15,size:"sm",className:"text-sm sm:text-base",children:[s.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Add Field"]})]})]}),(u||[]).map((M,se)=>{var Q;return s.jsx(Ce,{className:"p-4",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(V,{className:"font-medium",children:["Field ",se+1]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(B,{size:"sm",variant:"outline",onClick:()=>q(se,se-1),disabled:se===0,children:s.jsx(ON,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"outline",onClick:()=>q(se,se+1),disabled:se===((u==null?void 0:u.length)||0)-1,children:s.jsx(vi,{className:"h-4 w-4"})}),s.jsx(B,{size:"sm",variant:"destructive",onClick:()=>W(se),children:s.jsx(ln,{className:"h-4 w-4"})})]})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{children:"Field Type"}),s.jsxs(Bt,{value:M.type,onValueChange:te=>F(se,{type:te,options:te==="select"||te==="radio"||te==="checkbox"?["Option 1"]:void 0}),children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsxs(It,{children:[s.jsx(ce,{value:"text",children:"Text Input"}),s.jsx(ce,{value:"email",children:"Email"}),s.jsx(ce,{value:"textarea",children:"Text Area"}),s.jsx(ce,{value:"select",children:"Dropdown"}),s.jsx(ce,{value:"radio",children:"Radio Buttons"}),s.jsx(ce,{value:"checkbox",children:"Checkboxes"}),s.jsx(ce,{value:"date",children:"Date"})]})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{checked:M.required,onCheckedChange:te=>F(se,{required:!!te})}),s.jsx(V,{children:"Required field"})]})]}),s.jsxs("div",{children:[s.jsx(V,{children:"Question Label"}),s.jsx(me,{value:M.label,onChange:te=>F(se,{label:te.target.value}),placeholder:"What would you like to ask?"})]}),(M.type==="text"||M.type==="email"||M.type==="textarea")&&s.jsxs("div",{children:[s.jsx(V,{children:"Placeholder Text (Optional)"}),s.jsx(me,{value:M.placeholder||"",onChange:te=>F(se,{placeholder:te.target.value}),placeholder:"Hint text for the user"})]}),(M.type==="select"||M.type==="radio"||M.type==="checkbox")&&s.jsxs("div",{children:[s.jsx(V,{children:"Options (one per line)"}),s.jsx(Is,{value:((Q=M.options)==null?void 0:Q.join(`
914`))||"",onChange:te=>{const G=te.target.value.split(`
915`).filter(Z=>Z.trim());F(se,{options:G})},placeholder:`Option 1
916Option 2
917Option 3`,rows:3})]})]})},M.id)}),((u==null?void 0:u.length)||0)===0&&s.jsxs("div",{className:"text-center py-12 text-slate-500",children:[s.jsx(Ng,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),s.jsx("p",{className:"mb-4",children:"No fields added yet. Get started by:"}),s.jsxs("div",{className:"flex flex-col items-center gap-2 text-sm",children:[s.jsxs("p",{children:["✨ Using the ",s.jsx("span",{className:"font-medium text-purple-600",children:"AI Wizard"})," to generate a complete form"]}),s.jsx("p",{children:"➕ Or manually adding fields one by one"})]})]})]}),s.jsxs("div",{className:"flex gap-4 pt-6 border-t",children:[s.jsxs(B,{onClick:()=>v(!0),variant:"outline",disabled:((u==null?void 0:u.length)||0)===0,children:[s.jsx(wa,{className:"h-4 w-4 mr-2"}),"Preview"]}),s.jsxs(B,{onClick:I,disabled:!(l!=null&&l.trim())||((u==null?void 0:u.length)||0)===0||H.isPending,children:[s.jsx(J9,{className:"h-4 w-4 mr-2"}),H.isPending?"Saving...":"Save Form"]})]})]})]})})]}),w&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsx("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-y-auto",children:s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mx-auto w-12 h-12 bg-gradient-to-r from-purple-500 to-pink-500 rounded-full flex items-center justify-center mb-4",children:s.jsx(lr,{className:"h-6 w-6 text-white"})}),s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-2",children:"AI Form Wizard"}),s.jsx("p",{className:"text-slate-600",children:"Describe what kind of form you need and AI will generate it for you"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"businessType",children:"Business Type"}),s.jsxs(Bt,{value:P,onValueChange:S,children:[s.jsx($t,{children:s.jsx(Lt,{placeholder:"Select your business type"})}),s.jsxs(It,{children:[s.jsx(ce,{value:"fitness",children:"Fitness Studio"}),s.jsx(ce,{value:"yoga",children:"Yoga Studio"}),s.jsx(ce,{value:"pilates",children:"Pilates Studio"}),s.jsx(ce,{value:"dance",children:"Dance Studio"}),s.jsx(ce,{value:"martial-arts",children:"Martial Arts"}),s.jsx(ce,{value:"wellness",children:"Wellness Center"}),s.jsx(ce,{value:"personal-training",children:"Personal Training"}),s.jsx(ce,{value:"other",children:"Other"})]})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"aiDescription",children:"Form Requirements"}),s.jsx(Is,{id:"aiDescription",value:N,onChange:M=>C(M.target.value),placeholder:"Describe what kind of form you need. For example: 'I need a health questionnaire for new clients joining my HIIT classes' or 'Create an intake form for prenatal yoga classes'",rows:4})]}),s.jsxs("div",{className:"bg-purple-50 p-4 rounded-lg",children:[s.jsxs("h4",{className:"font-medium text-slate-900 mb-2 flex items-center gap-2",children:[s.jsx(jl,{className:"h-4 w-4 text-purple-600"}),"AI will generate:"]}),s.jsxs("ul",{className:"text-sm text-slate-700 space-y-1",children:[s.jsx("li",{children:"• Contact fields (name, email, phone)"}),s.jsx("li",{children:"• Health & safety questions"}),s.jsx("li",{children:"• Liability and consent fields"}),s.jsx("li",{children:"• Custom questions based on your description"}),s.jsx("li",{children:"• Up to 15 fields total (free limit)"})]})]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx(B,{variant:"outline",onClick:()=>j(!1),className:"flex-1",children:"Cancel"}),s.jsx(B,{onClick:()=>_.mutate(),disabled:!N.trim()||_.isPending,className:"flex-1 bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-600 hover:to-pink-600",children:_.isPending?"Generating...":s.jsxs(s.Fragment,{children:[s.jsx(jl,{className:"h-4 w-4 mr-2"}),"Generate Form"]})})]})]})})}),s.jsx(Zi,{open:E.isOpen,onOpenChange:M=>{M||T({isOpen:!1,formId:null,formName:"",responseCount:0})},children:s.jsxs(bi,{children:[s.jsxs(wi,{children:[s.jsx(Ni,{children:"Delete Form"}),s.jsxs(Ci,{children:['Are you sure you want to delete "',E.formName,'"?',E.responseCount>0&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{}),s.jsx("strong",{children:"Warning:"})," This will also delete ",E.responseCount," ",E.responseCount===1?"response":"responses",". This action cannot be undone."]})]})]}),s.jsxs(ji,{children:[s.jsx(to,{children:"Cancel"}),s.jsx(eo,{onClick:J,className:"bg-red-600 hover:bg-red-700",disabled:L.isPending,children:L.isPending?"Deleting...":"Delete"})]})]})}),s.jsx(yC,{isOpen:y,onClose:()=>{g(!1),b(null)},onEmailCaptured:()=>{g(!1),(x==null?void 0:x.type)==="save"?(re(),z({title:"Form Saved & Link Sent",description:"Your form is saved! Check your email for the shareable form link."})):(x==null?void 0:x.type)==="export"&&z({title:"Form Link Sent",description:"Check your email for the shareable form link and responses dashboard."}),b(null)},guestSessionId:e,toolType:"forms"})]})}const xVe=[{value:"30",label:"30 minutes"},{value:"45",label:"45 minutes"},{value:"60",label:"1 hour"},{value:"75",label:"1 hour 15 minutes"},{value:"90",label:"1 hour 30 minutes"},{value:"120",label:"2 hours"}],_k=[{value:"energetic",label:"Energetic & Motivational"},{value:"calm",label:"Calm & Peaceful"},{value:"friendly",label:"Friendly & Welcoming"},{value:"professional",label:"Professional & Clean"},{value:"fun",label:"Fun & Playful"},{value:"bold",label:"Bold & Dynamic"}];function gVe({guestSessionId:e,onExport:t}){const[n,r]=f.useState({name:"",time:"",date:"",duration:"",location:"",spots:"",description:""}),[a,i]=f.useState(""),[o,l]=f.useState(""),[c,d]=f.useState(_k[0]),[m,u]=f.useState(!1),[h,p]=f.useState(null),[v,y]=f.useState(null),[g,x]=f.useState(null),[b,w]=f.useState(""),[j,N]=f.useState(!1),C=async()=>
917{if(!n.name||!n.time||!n.date){alert("Please fill in class name, time, and date");return}N(!0);try{await Promise.all([P(),S()])}catch(O){console.error("Error generating post:",O)}finally{N(!1)}},P=async()=>{try{const O=`Create a simple, clean ${c.value} fitness/wellness background image for "${a||"fitness classes"}". Style: ${c.label} aesthetic. No text, just a beautiful background that captures the ${c.value} mood for a ${n.name} class. Instagram square format. Minimalist, professional, suitable as background for social media post.`,D=await fetch("/api/free-tools/generate-timetable-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:O,businessName:a||"Your Business Name",classEvent:n,mood:c,guestSessionId:e})});if(D.ok){const k=await D.json();return Zs("tool_executed","free_tools","ai_image_generated"),p(k.imageUrl),y(k.downloadUrl),x(k.fileId),console.log("✅ AI image generated successfully"),k}else throw new Error("Failed to generate AI image")}catch(O){throw console.error("Error generating AI image:",O),O}},S=async()=>{try{const D=new Date(n.date).toLocaleDateString("en-GB",{weekday:"long",day:"numeric",month:"long"});let k=`${n.name}
918`;if(k+=`📅 ${D}
919`,k+=`🕐 ${n.time}`,n.duration){const F=xVe.find(q=>q.value===n.duration),W=(F==null?void 0:F.label)||n.duration;k+=` (${W})`}n.location&&(k+=`
920📍 ${n.location}`),n.spots&&(k+=`
921👥 ${n.spots} spots available`);try{const F=await fetch("/api/free-tools/generate-social-caption",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({className:n.name,description:n.description||"",mood:c.value,businessName:a,basicInfo:k,bookingUrl:o,guestSessionId:e})});if(F.ok){const W=await F.json();return Zs("tool_executed","free_tools","ai_caption_generated"),w(W.caption),W.caption}else throw new Error("Failed to generate AI caption")}catch(F){console.log("AI caption generation failed, using basic format:",F);let W=k;return n.description&&(W+=`
922
923${n.description}`),o&&(W+=`
924
925🔗 Book your spot: ${o}`),w(W),W}}catch(O){throw console.error("Error generating caption:",O),O}},E=async()=>{try{if((await fetch("/api/free-tools/social-timetable-email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({timetableData:{businessName:a||"Your Business Name",bookingUrl:o||"",classEvent:n,mood:c,caption:b,aiImageUrl:h},guestSessionId:e,downloadUrl:v,fileId:g})})).ok)u(!1),console.log("✅ Post email sent successfully");else throw new Error("Failed to send email")}catch(O){console.error("Error sending email:",O)}},T=n.name&&n.time&&n.date&&a.trim(),z=T&&h&&b;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(Ff,{className:"h-5 w-5"}),"Social Media Post Maker"]}),s.jsx("p",{className:"text-sm text-slate-600",children:"Create a beautiful social media post for your class with AI-generated image and polished caption"})]}),s.jsxs(Ee,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"businessName",children:"Business Name"}),s.jsx(me,{id:"businessName",value:a,onChange:O=>i(O.target.value),placeholder:"Your business name"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"bookingUrl",children:"Booking URL"}),s.jsx(me,{id:"bookingUrl",value:o,onChange:O=>l(O.target.value),placeholder:"https://your-booking-link.com"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Class Details"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"className",children:"Class Name"}),s.jsx(me,{id:"className",value:n.name,onChange:O=>r({...n,name:O.target.value}),placeholder:"e.g., HIIT Training"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"classDate",children:"Date"}),s.jsx(me,{id:"classDate",type:"date",value:n.date,onChange:O=>r({...n,date:O.target.value})})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"classTime",children:"Time"}),s.jsx(me,{value:n.time,onChange:O=>r({...n,time:O.target.value}),placeholder:"e.g. 9:00 AM, 18:30, 2:30 PM"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"classDuration",children:"Duration"}),s.jsx(me,{value:n.duration,onChange:O=>r({...n,duration:O.target.value}),placeholder:"e.g. 60 minutes, 1.5 hours, 45 mins"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"classLocation",children:"Location (optional)"}),s.jsx(me,{id:"classLocation",value:n.location,onChange:O=>r({...n,location:O.target.value}),placeholder:"e.g., Studio A"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"classSpots",children:"Available Spots (optional)"}),s.jsx(me,{id:"classSpots",value:n.spots,onChange:O=>r({...n,spots:O.target.value}),placeholder:"e.g., 12"})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"classDescription",children:"Description (optional)"}),s.jsx(Is,{id:"classDescription",value:n.description,onChange:O=>r({...n,description:O.target.value}),placeholder:"Brief class description...",rows:2})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"mood",children:"Post Mood"}),s.jsxs(Bt,{value:c.value,onValueChange:O=>{const D=_k.find(k=>k.value===O);D&&d(D)},children:[s.jsx($t,{children:s.jsx(Lt,{})}),s.jsx(It,{children:_k.map(O=>s.jsx(ce,{value:O.value,children:O.label},O.value))})]})]}),s.jsx(B,{onClick:C,disabled:!T||j,className:"w-full bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-600 hover:to-pink-600 text-white",size:"lg",children:j?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent roun
925ded-full"}),"Generating..."]}):s.jsxs(s.Fragment,{children:[s.jsx(lr,{className:"h-4 w-4 mr-2"}),"Create Post with AI"]})})]})]}),(h||b)&&s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{children:"Generated Post Preview"})}),s.jsxs(Ee,{className:"space-y-4",children:[h&&s.jsx("div",{className:"relative",children:s.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-slate-100",children:[s.jsxs("div",{className:"relative max-w-xs mx-auto",children:[s.jsx("img",{src:h,alt:"AI Generated Post Background (Preview)",className:"w-full h-auto opacity-75 blur-[2px] select-none pointer-events-none",style:{maxWidth:"300px",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},onContextMenu:O=>O.preventDefault(),onDragStart:O=>O.preventDefault()}),s.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-20 rounded-lg pointer-events-none"}),s.jsx("div",{className:"absolute top-2 right-2 bg-red-600 text-white px-2 py-1 rounded text-xs font-bold pointer-events-none",children:"PREVIEW"}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:s.jsx("div",{className:"transform rotate-45 bg-white bg-opacity-90 px-6 py-3 text-lg font-bold text-gray-800 border-2 border-gray-300 rounded",children:"CLASSTA"})}),s.jsx("div",{className:"absolute bottom-2 left-2 bg-blue-600 text-white px-2 py-1 rounded text-xs font-bold pointer-events-none",children:"WATERMARK"})]}),s.jsxs("div",{className:"mt-3 text-center",children:[s.jsx("p",{className:"text-sm font-medium text-red-600",children:"🔒 PREVIEW ONLY - Reduced quality with watermarks"}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Full HD quality (1024×1024) without watermarks sent via email"})]})]})}),b&&s.jsxs("div",{className:"bg-slate-50 p-4 rounded-lg",children:[s.jsx("h4",{className:"font-semibold mb-2",children:"Caption Preview:"}),s.jsxs("div",{className:"whitespace-pre-line text-sm text-slate-700 relative",children:[s.jsx("div",{className:"blur-sm select-none pointer-events-none",children:b}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-transparent via-transparent to-slate-50"}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsxs("div",{className:"bg-white border-2 border-blue-200 rounded-lg px-4 py-2 shadow-lg",children:[s.jsx("p",{className:"text-sm font-medium text-blue-700",children:"🔒 Full caption with hashtags"}),s.jsx("p",{className:"text-xs text-blue-600",children:"Available via email"})]})})]}),s.jsx("div",{className:"mt-2 text-center",children:s.jsx("p",{className:"text-xs text-gray-500",children:"Caption preview blurred - Full text with hashtags sent via email"})})]}),z&&s.jsxs(B,{onClick:()=>u(!0),className:"w-full",size:"lg",variant:"outline",children:[s.jsx(Li,{className:"h-4 w-4 mr-2"}),"Email Me the Hi-Res Image & Caption"]})]})]}),s.jsx(yC,{isOpen:m,onClose:()=>u(!1),onEmailCaptured:E,guestSessionId:e,toolType:"social-post"})]})}const kL=[{name:"Classic",primary:"#1f2937",secondary:"#f9fafb",accent:"#3b82f6"},{name:"Elegant",primary:"#6b21a8",secondary:"#faf5ff",accent:"#a85
9255f7"},{name:"Vibrant",primary:"#dc2626",secondary:"#fef2f2",accent:"#f59e0b"},{name:"Nature",primary:"#166534",secondary:"#f0fdf4",accent:"#22c55e"},{name:"Ocean",primary:"#0c4a6e",secondary:"#f0f9ff",accent:"#0ea5e9"},{name:"Sunset",primary:"#9a3412",secondary:"#fff7ed",accent:"#ea580c"}];function yVe({guestSessionId:e}){const[t,n]=f.useState({eventName:"",eventDate:"",eventTime:"",location:"",organizer:"",price:"",additionalInfo:"",attendeeName:""}),[r,a]=f.useState(kL[0]),[i,o]=f.useState(!1),[l,c]=f.useState(!1),{toast:d}=Yt(),m=(y,g)=>{n(x=>({...x,[y]:g}))},u=t.eventName&&t.eventDate&&t.organizer,h=()=>{u&&o(!0)},p=async y=>{c(!0);try{const x=await(await fetch("/api/free-tools/generate-qr-ticket",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guestSessionId:e,instructorEmail:y,ticketData:{...t,colorTheme:r}})})).json();if(x.success)Zs("tool_executed","free_tools","qr_ticket_generated"),d({title:"QR Ticket Generated!",description:"Check your email for the ticket link to share with your attendee."}),o(!1);else throw new Error(x.message||"Failed to generate QR ticket")}catch(g){console.error("Error generating QR ticket:",g),d({title:"Error",description:"Failed to generate QR ticket. Please try again.",variant:"destructive"})}finally{c(!1)}},v=()=>s.jsxs("div",{className:"w-full max-w-sm mx-auto rounded-2xl shadow-xl overflow-hidden",style:{backgroundColor:r.secondary},children:[s.jsxs("div",{className:"p-6 text-center",style:{backgroundColor:r.primary},children:[s.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-white rounded-full mb-4",children:s.jsx(um,{className:"h-8 w-8",style:{color:r.primary}})}),s.jsx("h2",{className:"text-xl font-bold text-white mb-2",children:t.eventName||"Your Event Name"}),s.jsx("div",{className:"px-3 py-1 rounded-full text-sm font-medium",style:{backgroundColor:r.accent,color:"white"},children:"Event Ticket"})]}),s.jsxs("div",{className:"p-6 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ls,{className:"h-5 w-5 text-slate-600"}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium",style:{color:r.primary},children:t.eventDate?new Date(t.eventDate).toLocaleDateString("en-GB",{weekday:"long",year:"numeric",month:"long",day:"numeric"}):"Select event date"}),t.eventTime&&s.jsx("div",{className:"text-sm text-slate-600",children:t.eventTime})]})]}),t.location&&s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(si,{className:"h-5 w-5 text-slate-600"}),s.jsx("div",{className:"text-sm",style:{color:r.primary},children:t.location})]}),t.price&&s.jsx("div",{className:"text-center py-2",children:s.jsx("div",{className:"text-2xl font-bold",style:{color:r.accent},children:t.price})}),s.jsx("div",{className:"flex justify-center py-4",children:s.jsx("div",{className:"w-32 h-32 border-2 border-dashed rounded-lg flex items-center justify-center",style:{borderColor:r.primary},children:s.jsx(pw,{className:"h-12 w-12 text-slate-400"})})}),t.additionalInfo&&s.jsx("div",{className:"text-xs text-slate-600 text-center leading-relaxed",children:t.additionalInfo}),s.jsxs("div",{className:"text-center pt-4 border-t border-slate-200",children:[s.jsx("div",{className:"text-sm font-medium",style:{color:r.primary},children:t.organizer||"Your Business Name"}),s.jsx("div",{className:"text-xs text-slate-500 mt-1",children:"Powered by Classta"})]})]})]});return s.jsxs("div",{className:"max-w-7xl mx-auto",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h1",{className:"text-3xl font-bold text-slate-900 mb-2",children:"QR Ticket Generator"}),s.jsx("p",{className:"text-slate-600",children:"Create professional QR code tickets for your events and classes. Great for simplifying class check-ins and tracking attendance."})]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-8",children:[s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(um,{className:"h-5 w-5"}),"Event Information"]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"eventName",children:"Event Name *"}),s.jsx(me,{id:"eventName",value:t.eventName,onChange:y=>m("eventName",y.target.value),placeholder:"e.g., HIIT Training Session"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"eventDate",children:"Date *"}),s.jsx(me,{id:"eventDate",type:"date",value:t.eventDate,onChange:y=>m("eventDate",y.target.value)})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"eventTime",children:"Time"}),s.jsx(me,{id:"eventTime",type:"time",value:t.eventTime,onChange:y=>m("eventTime",y.target.value)})]})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"location",children:"Location"}),s.jsx(me,{id:"location",value:t.location,onChange:y=>m("location",y.target.value),placeholder:"e.g., Main Studio, 123 High Street"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"organizer",children:"Organizer *"}),s.jsx(me,{id:"organizer",value:t.organizer,onChange:y=>m("organizer",y.target.value),placeholder:"e.g., Sarah's Fitness Studio"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"attendeeName",children:"Attendee Name (Optional)"}),s.jsx(me,{id:"attendeeName",value:t.attendeeName,onChange:y=>m("attendeeName",y.target.value),placeholder:"e.g., John Smith"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"price",children:"Price"}),s.jsx(me,{id:"price",value:t.price,onChange:y=>m("price",y.target.value),placeholder:"e.g., £15.00 or Free"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"additionalInfo",children:"Additional Information"}),s.jsx(Is,{id:"additionalInfo",value:t.additionalInfo,onChange:y=>m("additionalInfo",y.target.value),placeholder:"e.g., Please bring a water bottle and towel",rows:3})]})]})]}),s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(Q9,{className:"h-5 w-5"}),"Ticket Design"]})}),s.jsx(Ee,{children:s.jsx("div",{className:"grid grid-cols-3 gap-3",children:kL.map(y=>s.jsxs("button",{onClick:()=>a(y),className:`p-3 rounded-lg border-2 transition-all ${r.name===y.name?"border-slate-900 scale-105":"border-slate-200 hover:border-slate-300"}`,children:[s.jsx("div",{className:"w-full h-8 rounded mb-2",style:{backgroundColor:y.primary}}),s.jsx("div",{className:"text-xs font-medium text-slate-700",children:y.name})]},y.name))})})]}),s.jsx(Ce,{children:s.jsx(Ee,{className:"pt-6",children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(B,{onClick:h,disabled:!u||l,className:"w-full",size:"lg",children:l?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent roun
925ded-full"}),"Generating..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Li,{className:"h-4 w-4 mr-2"}),"Generate QR Ticket"]})}),s.jsx("div",{className:"text-center",children:s.jsx(Je,{variant:"secondary",className:"text-xs",children:"Free • Includes QR code and print-ready format"})})]})})})]}),s.jsx("div",{className:"lg:sticky lg:top-6",children:s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(pw,{className:"h-5 w-5"}),"Ticket Preview"]})}),s.jsxs(Ee,{children:[s.jsx("div",{className:"bg-slate-100 p-6 rounded-lg",children:v()}),s.jsxs("div",{className:"mt-4 text-center",children:[s.jsx("p",{className:"text-sm text-slate-600 mb-2",children:"Print-ready format with QR code for easy scanning"}),s.jsxs("div",{className:"flex justify-center gap-2",children:[s.jsx(Je,{variant:"outline",children:"High resolution"}),s.jsx(Je,{variant:"outline",children:"Print ready"}),s.jsx(Je,{variant:"outline",children:"Mobile friendly"})]})]})]})]})})]}),s.jsx(yC,{isOpen:i,onClose:()=>o(!1),onEmailCaptured:p,guestSessionId:e,toolType:"qr-ticket"})]})}function vVe(){cn();const{toast:e}=Yt(),[t,n]=f.useState(null),[r,a]=f.useState(null),[i,o]=f.useState(!1),[l,c]=f.useState(""),[d,m]=f.useState(!1),[u,h]=f.useState(null),[p,v]=f.useState(!1),[y,g]=f.useState(!1),[x,b]=f.useState(!1),[w,j]=f.useState(!1),[N,C]=f.useState({isOpen:!1,formId:null,formName:"",responseCount:0}),P=localStorage.getItem("classta_auth_token"),{data:S,isLoading:E}=Ue({queryKey:["/api/free-tools/forms",r],queryFn:async()=>{if(!r)return[];const U=await fetch(`/api/free-tools/forms/${r}`);if(!U.ok)throw new Error("Failed to fetch forms");return U.json()},enabled:!!r&&(d||!!u),refetchOnWindowFocus:!1}),T=xt({mutationFn:async U=>await(await Pe("POST","/api/free-tools/guest-session",{sessionId:U})).json()}),z=xt({mutationFn:async U=>await(await Pe("POST","/api/free-tools/verify-magic-link",{token:U})).json(),onSuccess:U=>{U.session&&(a(U.session.sessionId),h(U.session.email),m(!0),localStorage.setItem("classta_guest_session",U.session.sessionId),e({title:"Welcome back!",description:"You're now logged in to access your saved tools."}))},onError:()=>{e({title:"Invalid Link",description:"This magic link has expired or is invalid.",variant:"destructive"})}}),O=xt({mutationFn:async U=>{if(!r)throw new Error("Session not available");const J=await Pe("DELETE",`/api/free-tools/forms/${U}?sessionId=${r}`);if(!J.ok){const I=await J.text();throw new Error(`Failed to delete form: ${I}`)}return J.json()},onSuccess:(U,J)=>{e({title:"Form deleted",description:"Form and all responses have been deleted successfully."}),Ms.invalidateQueries({queryKey:["/api/free-tools/forms",r]}),Ms.refetchQueries({queryKey:["/api/free-tools/forms",r]})},onError:U=>{console.error("Delete error:",U),e({title:"Delete failed",description:U.message||"Failed to delete form. Please try again.",variant:"destructive"})}});f.useEffect(()=>{const J=new URLSearchParams(window.location.search).get("token");if(J){z.mutate(J),window.history.replaceState({},"","/free-tools");return}let I=localStorage.getItem("classta_guest_session");I||(I=crypto.randomUUID(),localStorage.setItem("classta_guest_session",I)),T.mutate(I),a(I)},[]),f.useEffect(()=>{const U=document.createElement("script");U.id="helpscout-beacon-bootstrap",U.type="text/javascript",U.async=!0,U.innerHTML='!function(e,t,n){function a(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,a){e.Beacon.readyQueue.push({method:t,options:n,data:a})},n.readyQueue=[],"complete"===t.readyState)return a();e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}(window,document,window.Beacon||function(){});';const J=document.createElement("script");return J.id="helpscout-beacon-init",J.type="text/javascript",J.innerHTML="window.Beacon('init', '4c0a64a0-dadd-4aa9-a084-27ca6e6cb029');",document.body.appendChild(U),document.body.appendChild(J),()=>{document.body.contains(U)&&document.body.removeChild(U),document.body.contains(J)&&document.body.removeChild(J);const I=window.Beacon;if(I)try{I("destroy")}catch{}}},[]);const D=U=>{c(U),o(!0)},k=xt({mutationFn:async U=>await(await Pe("POST","/api/free-tools/request-magic-link",{email:U})).json(),onSuccess:()=>{e({title:"Magic Link Sent!",description:"Check your email for a secure login link."}),v(!1)},onError:()=>{e({title:"Error",description:"Failed to send magic link. Please try again.",variant:"destructive"})}}),F=()=>{o(!1),e({title:"Success!",description:`${l} exported successfully! Check your email for the download link.`}),typeof window<"u"&&window.gtag&&window.gtag("event","conversion",{send_to:"AW-17123389975/Vf97CKTQupMbEJfkiOU_"})},W=U=>{k.mutate(U)},q=U=>{const J=`${window.location.origin}/f/${U}`;navigator.clipboard.writeText(J),e({title:"Link Copied!",description:"Form link copied to clipboard."})},H=async(U,J)=>{if(r)try{const I=await fetch(`/api/free-tools/forms/${U}/responses/csv?sessionId=${r}`);if(!I.ok)throw new Error("Failed to download responses");const re=await I.blob(),R=window.URL.createObjectURL(re),Y=document.createElement("a");Y.style.display="none",Y.href=R,Y.download=`${J.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_responses.csv`,document.body.appendChild(Y),Y.click(),window.URL.revokeObjectURL(R),document.body.removeChild(Y),e({title:"✅ Download Started",description:`${J} responses downloaded successfully`})}catch(I){console.error("Error downloading responses:",I),e({title:"❌ Download Failed",description:"Could not download form responses",variant:"destructive"})}},_=(U,J,I)=>{C({isOpen:!0,formId:U,formName:J,responseCount:I})},L=()=>{N.formId&&O.mutate(N.formId),C({isOpen:!1,formId:null,formName:"",responseCount:0})};return t?s.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100",children:s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsx(B,{variant:"outline",onClick:()=>n(null),className:"flex items-center gap-2",children:"← Back to Tools"}),s.jsx(dt,{href:"/",children:s.jsx(B,{variant:"ghost",children:"Home"})})]}),t==="forms"&&r&&s.jsx(pVe,{guestSessionId:r,isAuthenticated:d||!!u,userEmail:u}),t==="timetable"&&r&&s.jsx(gVe,{guestSessionId:r,onExport:()=>D("Social Timetable")}),t==="tickets"&&r&&s.jsx(yVe,{guestSessionId:r})]})}):s.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100",children:[s.jsxs(zo,{children:[s.jsx("title",{children:"Free Tools for Yoga, Pilates and Class Instru
925ctors | Forms, QR Tickets & Social Media | Classta"}),s.jsx("meta",{name:"description",content:"Free professional tools for class instructors: Forms Builder, QR Ticket Generator, and Social Media Post Maker. Grow your instucting business with these powerful tools - use instantly with just your email."}),s.jsx("meta",{name:"keywords",content:"free forms builder, QR ticket generator, social media posts, fitness instructor tools, class booking tools, professional fitness tools"}),s.jsx("meta",{property:"og:type",content:"website"}),s.jsx("meta",{property:"og:url",content:"https://classta.co/free-tools"}),s.jsx("meta",{property:"og:title",content:"Free Tools for Class/Fitness Instructors | Classta"}),s.jsx("meta",{property:"og:description",content:"Free professional tools for fitness instructors: Forms Builder, QR Ticket Generator, and Social Media Post Maker. Grow your fitness business instantly."}),s.jsx("meta",{property:"og:image",content:"https://classta.co/new-og-image.png"}),s.jsx("meta",{property:"og:image:width",content:"1200"}),s.jsx("meta",{property:"og:image:height",content:"630"}),s.jsx("meta",{property:"og:site_name",content:"Classta"}),s.jsx("meta",{property:"twitter:card",content:"summary_large_image"}),s.jsx("meta",{property:"twitter:url",content:"https://classta.co/free-tools"}),s.jsx("meta",{property:"twitter:title",content:"Free Tools for Class & Fitness Instructors | Classta"}),s.jsx("meta",{property:"twitter:description",content:"Free professional tools for fitness instructors: Forms Builder, QR Ticket Generator, and Social Media Post Maker. Grow your fitness business instantly."}),s.jsx("meta",{property:"twitter:image",content:"https://classta.co/new-og-image.png"}),s.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"WebPage",name:"Free Tools for Class/Fitness Instructors",description:"Free professional tools for class instructors including Forms Builder, QR Ticket Generator, and Social Media Post Maker.",url:"https://classta.co/free-tools",publisher:{"@type":"Organization",name:"Classta",url:"https://classta.co"},mainEntity:{"@type":"SoftwareApplication",name:"Classta Free Tools",applicationCategory:"BusinessApplication",operatingSystem:"Web",offers:{"@type":"Offer",price:"0",priceCurrency:"GBP"}}})})]}),s.jsx("header",{className:"bg-white/80 backdrop-blur-sm border-b border-slate-200 sticky top-0 z-50",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsx("div",{className:"flex items-center space-x-3",children:s.jsx(dt,{href:"/",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(Ia,{className:"text-primary",size:"md"}),s.jsx("span",{className:"text-xl font-bold text-slate-900",children:"Classta"})]})})}),s.jsxs("div",{className:"hidden md:flex items-center space-x-4",children:[s.jsxs("div",{className:"relative",children:[s.jsxs(B,{variant:"ghost",size:"sm",onClick:()=>j(!w),className:"flex items-center space-x-1",children:[s.jsx("span",{children:"Solutions"}),s.jsx(vi,{className:"w-4 h-4"})]}),w&&s.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-slate-200 rounded-lg shadow-lg z-50 min-w-52",children:[s.jsx("a",{href:"/class-booking-system.html",className:"block px-4 py-2 text-sm text-slate-700 hover:bg-slate-50 first:rounded-t-lg",children:"Class Booking System"}),s.jsx("a",{href:"/yoga-booking-system.html",className:"block px-4 py-2 text-sm text-slate-700 hover:bg-slate-50",children:"Yoga Booking System"}),s.jsx("a",{href:"/pilates-booking-software.html",className:"block px-4 py-2 text-sm text-slate-700 hover:bg-slate-50 last:rounded-b-lg",children:"Pilates Booking Software"})]})]}),s.jsx(dt,{href:"/instructor-signup",children:s.jsx(B,{variant:"outline",size:"sm",children:"Start Free Trial"})}),P?s.jsx(dt,{href:"/admin",children:s.jsxs(B,{variant:"ghost",size:"sm",children:[s.jsx(Dd,{className:"w-4 h-4 mr-2"}),"Admin"]})}):s.jsx(dt,{href:"/admin",children:s.jsxs(B,{variant:"ghost",size:"sm",children:[s.jsx(Nd,{className:"w-4 h-4 mr-2"}),"Log In"]})}),s.jsx("a",{href:"https://help.classta.co/",children:s.jsx(B,{variant:"ghost",size:"sm",children:"Help"})})]}),s.jsx("div",{className:"md:hidden",children:s.jsx(B,{variant:"ghost",size:"sm",onClick:()=>b(!x),className:"p-2",children:x?s.jsx(ja,{className:"w-5 h-5"}):s.jsx(MN,{className:"w-5 h-5"})})})]}),x&&s.jsx("div",{className:"md:hidden border-t border-slate-200 bg-white/95 backdrop-blur-sm",children:s.jsxs("div",{className:"px-2 pt-2 pb-3 space-y-1",children:[s.jsxs("div",{className:"px-3 py-2",children:[s.jsx("div",{className:"text-sm font-medium text-slate-900 mb-2",children:"Solutions"}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("a",{href:"/class-booking-system.html",className:"block px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 rounded-md",children:"Class Booking System"}),s.jsx("a",{href:"/yoga-booking-system.html",className:"block px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 rounded-md",children:"Yoga Booking System"}),s.jsx("a",{href:"/pilates-booking-software.html",className:"block px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 rounded-md",children:"Pilates Booking Softw
925are"})]})]}),s.jsxs("div",{className:"border-t border-slate-200 pt-2",children:[s.jsx(dt,{href:"/instructor-signup",children:s.jsx("div",{className:"flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",children:"Start Teaching"})}),P?s.jsx(dt,{href:"/admin",children:s.jsxs("div",{className:"flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",children:[s.jsx(Dd,{className:"w-4 h-4 mr-3"}),"Admin"]})}):s.jsx(dt,{href:"/admin",children:s.jsxs("div",{className:"flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",children:[s.jsx(Nd,{className:"w-4 h-4 mr-3"}),"Log In"]})}),s.jsx("a",{href:"https://help.classta.co/",children:s.jsx("div",{className:"flex items-center px-3 py-3 text-sm font-medium text-slate-900 hover:bg-slate-50 rounded-md",children:"Help"})})]})]})})]})}),s.jsxs("div",{className:"container mx-auto px-4 py-12",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsxs("div",{className:"flex items-center justify-center gap-2 mb-4",children:[s.jsx(jl,{className:"h-6 w-6 text-blue-600"}),s.jsx("span",{className:"bg-blue-100 text-blue-800 text-sm font-medium px-3 py-1 rounded-full",children:"NEW"})]}),s.jsx("h1",{className:"text-4xl font-bold text-slate-900 mb-4",children:"Free Tools for Class Instructors"}),s.jsx("p",{className:"text-xl text-slate-600 max-w-3xl mx-auto",children:"Professional tools to grow your business. Use instantly, get full access with just your email."}),!d&&s.jsx("div",{className:"mt-8 mb-6",children:p?s.jsx(bVe,{onLogin:W,onCancel:()=>v(!1),isLoading:k.isPending}):s.jsxs(B,{variant:"outline",onClick:()=>v(!0),className:"flex items-center gap-2 mx-auto",children:[s.jsx(Nd,{className:"h-4 w-4"}),"Returning User? Access Your Saved Tools"]})}),d&&u&&s.jsx("div",{className:"mt-8 mb-6",children:s.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4 max-w-md mx-auto",children:[s.jsxs("div",{className:"flex items-center gap-2 text-green-800",children:[s.jsx(_n,{className:"h-4 w-4"}),s.jsxs("span",{className:"font-medium",children:["Welcome back, ",u,"!"]})]}),s.jsx("p",{className:"text-green-700 text-sm mt-1",children:"You can now access all your saved tools"}),s.jsx("div",{className:"mt-3 flex gap-2",children:s.jsx(B,{size:"sm",variant:"outline",onClick:()=>g(!y),className:"bg-white hover:bg-green-50",children:y?"Hide Dashboard":"View Dashboard"})})]})}),d&&y&&s.jsx("div",{className:"mb-12",children:s.jsx(wVe,{forms:S||[],isLoading:E,onCopyLink:q,onDownloadResponses:H,onDeleteForm:_})})]}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-8 max-w-6xl mx-auto mb-12",children:[s.jsxs(Ce,{className:"relative overflow-hidden border-0 shadow-lg hover:shadow-xl transition-all duration-300 hover:-translate-y-1",children:[s.jsxs(gt,{className:"bg-gradient-to-br from-green-500 to-emerald-600 text-white",children:[s.jsx(Ng,{className:"h-8 w-8 mb-2"}),s.jsx(Nt,{className:"text-xl",children:"Free Forms Builder"}),s.jsx(Ys,{className:"text-green-100",children:"Create custom intake forms for your clients"})]}),s.jsxs(Ee,{className:"p-6",children:[s.jsxs("ul",{className:"space-y-2 text-sm text-slate-600 mb-6",children:[s.jsx("li",{children:"• Up to 5 active forms"}),s.jsx("li",{children:"• 15 fields per form"}),s.jsx("li",{children:"• 200 total responses"}),s.jsx("li",{children:"• Public form links"}),s.jsx("li",{children:"• Email notifications"})]}),s.jsxs(B,{onClick:()=>{n("forms"),Zs("tool_visited","free_tools","forms_builder")},className:"w-full bg-green-600 hover:bg-green-700",children:["Start Building ",s.jsx(qn,{className:"h-4 w-4 ml-2"})]})]})]}),s.jsxs(Ce,{className:"relative overflow-hidden border-0 shadow-lg hover:shadow-xl transition-all duration-300 hover:-translate-y-1",children:[s.jsxs(gt,{className:"bg-gradient-to-br from-purple-500 to-violet-600 text-white",children:[s.jsx(Ls,{className:"h-8 w-8 mb-2"}),s.jsx(Nt,{className:"text-xl",children:"Social Media Post Maker"}),s.jsx(Ys,{className:"text-purple-100",children:"Create stunning social media posts to promote your classes"})]}),s.jsxs(Ee,{className:"p-6",children:[s.jsxs("ul",{className:"space-y-2 text-sm text-slate-600 mb-6",children:[s.jsx("li",{children:"• AI-generated backgrounds"}),s.jsx("li",{children:"• Smart caption with hashtags"}),s.jsx("li",{children:"• Class info & scheduling"}),s.jsx("li",{children:"• Professional layouts"}),s.jsx("li",{children:"• High-resolution export"})]}),s.jsxs(B,{onClick:()=>{n("timetable"),Zs("tool_visited","free_tools","social_media_maker")},className:"w-full bg-purple-600 hover:bg-purple-700",children:["Create Post ",s.jsx(qn,{
925className:"h-4 w-4 ml-2"})]})]})]}),s.jsxs(Ce,{className:"relative overflow-hidden border-0 shadow-lg hover:shadow-xl transition-all duration-300 hover:-translate-y-1",children:[s.jsxs(gt,{className:"bg-gradient-to-br from-orange-500 to-red-600 text-white",children:[s.jsx(pw,{className:"h-8 w-8 mb-2"}),s.jsx(Nt,{className:"text-xl",children:"QR Ticket Generator"}),s.jsx(Ys,{className:"text-orange-100",children:"Generate professional QR tickets for your classes"})]}),s.jsxs(Ee,{className:"p-6",children:[s.jsxs("ul",{className:"space-y-2 text-sm text-slate-600 mb-6",children:[s.jsx("li",{children:"• Custom class details"}),s.jsx("li",{children:"• Secure QR codes"}),s.jsx("li",{children:"• Professional design"}),s.jsx("li",{children:"• Email delivery"}),s.jsx("li",{children:"• 30-day access"})]}),s.jsxs(B,{onClick:()=>{n("tickets"),Zs("tool_visited","free_tools","qr_ticket_generator")},className:"w-full bg-orange-600 hover:bg-orange-700",children:["Generate Ticket ",s.jsx(qn,{className:"h-4 w-4 ml-2"})]})]})]})]}),s.jsxs("div",{className:"text-center bg-white rounded-2xl p-8 shadow-lg max-w-4xl mx-auto",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-4",children:"Ready to automate your class admin?"}),s.jsx("p",{className:"text-slate-600 mb-6",children:"Get unlimited tools plus automated bookings, payments, and client management. The full system includes automatic QR code generation for bookings with attendance tracking built in on scanning, custom forms built into the booking process for new clients, and class promotions made easy by just selecting your class."}),s.jsx(dt,{href:"/instructor-signup",children:s.jsx(B,{size:"lg",className:"bg-blue-600 hover:bg-blue-700",children:"Create Your Booking Page"})})]}),s.jsx(Zi,{open:N.isOpen,onOpenChange:U=>{U||C({isOpen:!1,formId:null,formName:"",responseCount:0})},children:s.jsxs(bi,{children:[s.jsxs(wi,{children:[s.jsx(Ni,{children:"Delete Form"}),s.jsxs(Ci,{children:['Are you sure you want to delete "',N.formName,'"?',N.responseCount>0&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{}),s.jsx("strong",{children:"Warning:"})," This will also delete"," ",N.responseCount," ",N.responseCount===1?"response":"responses",". This action cannot be undone."]})]})]}),s.jsxs(ji,{children:[s.jsx(to,{children:"Cancel"}),s.jsx(eo,{onClick:L,className:"bg-red-600 hover:bg-red-700",disabled:O.isPending,children:O.isPending?"Deleting...":"Delete"})]})]})}),r&&s.jsx(yC,{isOpen:i,onClose:()=>o(!1),onEmailCaptured:F,guestSessionId:r,toolType:l})]})]})}function bVe({onLogin:e,onCancel:t,isLoading:n}){const[r,a]=f.useState(""),i=o=>{o.preventDefault(),r.trim()&&e(r.trim())};return s.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-6 max-w-md mx-auto border",children:[s.jsxs("div",{className:"text-center mb-4",children:[s.jsx(Nd,{className:"h-6 w-6 text-blue-600 mx-auto mb-2"}),s.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Access Your Saved Tools"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Enter your email and we'll send you a secure login link"})]}),s.jsxs("form",{onSubmit:i,className:"space-y-4",children:[s.jsx("div",{children:s.jsx("input",{type:"email",value:r,onChange:o=>a(o.target.value),placeholder:"[email protected]",className:"w-full px-4 py-2 border border-slate-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",required:!0,disabled:n})}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(B,{type:"submit",disabled:n||!r.trim(),className:"flex-1 bg-blue-600 hover:bg-blue-700",children:n?"Sending...":"Send Login Link"}),s.jsx(B,{type:"button",variant:"outline",onClick:t,disabled:n,children:"Cancel"})]})]})]})}function wVe({forms:e,isLoading:t,onCopyLink:n,onDownloadResponses:r,onDeleteForm:a}){return t?s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"}),s.jsx("p",{className:"text-slate-600 mt-2",children:"Loading your forms..."})]}):!e||e.length===0?s.jsxs("div",{className:"text-center py-8",children:[s.jsx(Ng,{className:"h-12 w-12 text-slate-400 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-medium text-slate-900 mb-2",children:"No forms created yet"}),s.jsx("p",{className:"text-slate-600",children:"Create your first form using the Free Forms Builder below!"})]}):s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Your Forms Dashboard"}),s.jsx("p",{className:"text-slate-600",children:"Manage your forms and view responses"})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map(i=>s.jsxs(Ce,{className:"border-0 shadow-lg hover:shadow-xl transition-all duration-300",children:[s.jsxs(gt,{className:"bg-gradient-to-br from-blue-500 to-indigo-600 text-white",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Ng,{className:"h-6 w-6"}),s.jsxs("span",{className:"bg-blue-400 bg-opacity-30 text-xs px-2 py-1 rounded-full",children:[i.responseCount||0," responses"]})]}),s.jsx(Nt,{className:"text-lg line-clamp-1",children:i.name}),i.description&&s.jsx(Ys,{className:"text-blue-100 text-sm line-clamp-2",children:i.description})]}),s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx("span",{className:"text-slate-600",children:"Status:"}),s.jsx("span",{className:"bg-green-100 text-green-800 px-2 py-1 rounded-full text-xs font-medium",children:"Active"})]}),s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx("span",{className:"text-slate-600",children:"Created:"}),s.jsx("span",{className:"text-slate-900",children:new Date(i.createdAt).toLocaleDateString()})]}),i.responses&&i.responses.length>0&&s.jsxs("div",{className:"bg-slate-50 rounded-md p-3",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(sr,{className:"h-4 w-4 text-slate-600"}),s.jsx("span",{className:"text-sm font-medium text-slate-900",children:"Recent Responses"})]}),s.jsx("div",{className:"space-y-1",children:i.responses.slice(0,3).map((o,l)=>s.jsxs("div",{className:"text-xs text-slate-600",children:["Response #",l+1," -"," ",new Date(o.submittedAt).toLocaleDateString()]},o.id))})]}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsxs(B,{size:"sm",variant:"outline",onClick:()=>n(i.publicId),className:"flex-1",children:[s.jsx(pr,{className:"h-3 w-3 mr-1"}),"Copy Link"]}),i.responseCount>0&&s.jsx(B,{size:"sm",variant:"outline",onClick:()=>r(i.id,i.name),title:"Download responses as CSV",children:"📥"}),s.jsx(B,{size:"sm",variant:"outline",onClick:()=>window.open(`/f/${i.publicId}`,"_blank"),children:s.jsx(Lr,{className:"h-3 w-3"})}),s.jsx(B,{size:"sm",variant:"outline",onClick:()=>a(i.id,i.name,i.responseCount||0),className:"text-red-600 hover:text-red-700 hover:bg-red-50",title:`Delete form${i.responseCount>0?` and ${i.responseCount} responses`:""}`,children:"🗑️"})]})]})})]},i.id))})]})}function jVe(){const t=sa().token;cn();const{toast:n}=Yt(),[r,a]=f.useState(null),[i,o]=f.useState(!0),[l,c]=f.useState(null),[d,m]=f.useState({}),[u,h]=f.useState({});f.useEffect(()=>{t?(async()=>{try{o(!0);const w=await Pe("GET",`/api/form-access/${t}`);if(!w.ok){const N=await w.json();throw new Error(N.message||"Failed to load form")}const j=await w.json();if(a(j),h({name:j.client.name||"",phone:j.client.phone||"",emergencyContactName:j.client.emergencyContactName||"",emergencyContactPhone:j.client.emergencyContactPhone||""}),j.client.onboardingData&&j.form){let N=j.client.onboardingData;if(typeof N=="string")try{N=JSON.parse(N)}catch(P){console.warn("Failed to parse onboarding data JSON:",P),N={}}const C=j.form.id;if(Array.isArray(N.formCompletions)){const P=N.formCompletions.find(S=>S.formId===C);P&&P.formData?m(P.formData||{}):m({})}else if(N.formId===C){const{formId:P,completedAt:S,formCompletions:E,...T}=N;m(T||{})}else m({})}else m({});c(null)}catch(w){console.error("Form access error:",w),c(w.message||"Failed to load form")}finally{o(!1)}})():(c("Invalid access link"),o(!1))},[t]);const p=xt({mutationFn:async()=>{const b=await Pe("POST",`/api/form-access/${t}/submit`,{clientData:{...u,onboardingData:d}});if(!b.ok){const w=await b.json();throw new Error(w.message||"Failed to update information")}return b.json()},onSuccess:()=>{n({title:"Success!",description:"Your information has been updated successfully."})},onError:b=>{n({title:"Error",description:b.message,variant:"destructive"})}}),v=(b,w)=>{m(j=>({...j,[b]:w}))},y=(b,w)=>{h(j=>({...j,[b]:w}))},g=b=>{b.preventDefault(),p.mutate()};if(i)return s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center p-4",children:s.jsx(Ce,{className:"w-full max-w-md",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx(Qr,{className:"h-8 w-8 animate-spin mx-auto mb-4 text-blue-600"}),s.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Loading Form"}),s.jsx("p",{className:"text-slate-600",children:"Please wait while we load your information..."})]})})});if(l)return s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center p-4",children:s.jsx(Ce,{className:"w-full max-w-md",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx(cm,{className:"h-16 w-16 text-red-500 mx-auto mb-4"}),s.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Access Error"}),s.jsx("p",{className:"text-slate-600 mb-4",children:l}),s.jsx("p",{className:"text-sm text-slate-500",children:"This link may have expired or been used already. Please contact the instructor for a new link."})]})})});if(p.isSuccess)return s.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center p-4",children:s.jsx(Ce,{className:"w-full max-w-md",children:s.jsxs(Ee,{className:"p-8 text-center",children:[s.jsx(qt,{className:"h-16 w-16 text-green-500 mx-auto mb-4"}),s.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Information Updated!"}),s.jsxs("p",{className:"text-slate-600 mb-4",children:["Thank you for updating your information with ",r==null?void 0:r.instructor.businessName,"."]}),s.jsx("p",{className:"text-sm text-slate-500",children:"You can now safely close this page."})]})})});if(!r)return null;const x=b=>{var N,C;const w=d[b.id],j=w??"";switch(b.type){case"text":return s.jsx(me,{type:"text",value:j,onChange:P=>v(b.id,P.target.value),placeholder:b.placeholder,className:"w-full"});case"date":return s.jsx(me,{type:"date",value:j,onChange:P=>v(b.id,P.target.value),className:"w-full"});case"textarea":return s.jsx(Is,{value:j,onChange:P=>v(b.id,P.target.value),placeholder:b.placeholder,className:"w-full min-h-[100px]"});case"select":return s.jsxs(Bt,{value:j,onValueChange:P=>v(b.id,P),children:[s.jsx($t,{className:"w-full",children:s.jsx(Lt,{placeholder:b.placeholder||"Select an option"})}),s.jsx(It,{children:(N=b.options)==null?void 0:N.map(P=>s.jsx(ce,{value:P,children:P},P))})]});case"checkbox":if(b.options&&b.options.length>0){const P=Array.isArray(w)?w:[];return s.jsx("div",{className:"space-y-2",children:b.options.map((S,E)=>s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(Xt,{id:`${b.id}-${E}`,checked:P.includes(S),onCheckedChange:T=>{const z=T?[...P,S]:P.filter(O=>O!==S);v(b.id,z)},className:"mt-1"}),s.jsx(V,{htmlFor:`${b.id}-${E}`,className:"text-sm font-normal leading-relaxed",children:S})]},E))})}return s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Xt,{id:b.id,checked:!!w,onCheckedChange:P=>v(b.id,P)}),s.jsx(V,{htmlFor:b.id,className:"text-sm font-normal",children:b.label})]});case"single-checkbox":return s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(Xt,{id:b.id,checked:!!w,onCheckedChange:P=>v(b.id,P),className:"mt-1"}),s.jsxs(V,{htmlFor:b.id,className:"text-sm font-normal leading-relaxed",children:[b.label,b.required&&s.jsx("span",{className:"text-red-500 ml-1",children:"*"})]})]});case"radio":return s.jsx(Sl,{value:j,onValueChange:P=>v(b.id,P),className:"space-y-2",children:(C=b.options)==null?void 0:C.map((P,S)=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx($r,{value:P,id:`${b.id}-${S}`}),s.jsx(V,{htmlFor:`${b.id}-${S}`,className:"text-sm font-normal",children:P})]},S))});case"info":return s.jsxs("div",{className:"mt-2 p-4 bg-blue-50 border-l-4 border-blue-400 rounded-r",children:[s.jsx("h4",{className:"font-semibold text-blue-900 mb-2",children:b.label}),b.content&&s.jsx("div",{className:"text-sm text-blue-800 whitespace-pre-line",children:b.content})]});default:return null}};return s.jsx("div",{className:"min-h-screen bg-slate-50 py-8 px-4",children:s.jsxs("div",{className:"max-w-2xl mx-auto",children:[s.jsx(Ce,{className:"mb-6",children:s.jsxs(gt,{className:"text-center",children:[s.jsx(Nt,{className:"text-2xl text-slate-900",children:"Update Your Information"}),s.jsx("p",{className:"text-slate-600 mt-2",children:r.instructor.businessName}),s.jsxs("div",{className:"flex items-center justify-center space-x-4 mt-4",children:[s.jsxs(Je,{variant:"secondary",className:"bg-green-100 text-green-800",children:[s.jsx(oT,{className:"h-3 w-3 mr-1"}),"Secure"]}),s.jsxs(Je,{variant:"secondary",className:"bg-blue-100 text-blue-800",children:[s.jsx(ei,{className:"h-3 w-3 mr-1"}),"Single Use"]})]})]})}),s.jsxs("form",{onSubmit:g,className:"space-y-6",children:[s.jsxs(Ce,{children:[s.jsx(gt,{children:s.jsx(Nt,{className:"text-lg",children:"Basic Information"})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(V,{htmlFor:"name",className:"text-sm font-medium text-slate-700",children:"Full Name"}),s.jsx(me,{id:"name",type:"text",value:u.name||"",onChange:b=>y("name",b.target.value),placeholder:"Your full name",className:"mt-1"})]}),s.jsxs("div",{children:[s.jsx(V,{className:"text-sm font-medium text-slate-700",children:"Email Address"}),s.jsx(me,{type:"email",value:r.client.email,disabled:!0,className:"mt-1 bg-slate-100"}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Email cannot be changed"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"phone",className:"text-sm font-medium text-slate-700",children:"Phone Number"}),s.jsx(me,{id:"phone",type:"tel",value:u.phone||"",onChange:b=>y("phone",b.target.value),placeholder:"Your phone number",className:"mt-1"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"emergencyContactName",className:"text-sm font-medium text-slate-700",children:"Emergency Contact Name"}),s.jsx(me,{id:"emergencyContactName",type:"text",value:u.emergencyContactName||"",onChange:b=>y("emergencyContactName",b.target.value),placeholder:"Emergency contact full name",className:"mt-1"})]}),s.jsxs("div",{children:[s.jsx(V,{htmlFor:"emergencyContactPhone",className:"text-sm font-medium text-slate-700",children:"Emergency Contact Phone"}),s.jsx(me,{id:"emergencyContactPhone",type:"tel",value:u.emergencyContactPhone||"",onChange:b=>y("emergencyContactPhone",b.target.value),placeholder:"Emergency contact phone number",className:"mt-1"})]})]})]}),r.form&&r.form.questions.length>0&&s.jsxs(Ce,{children:[s.jsxs(gt,{children:[s.jsx(Nt,{className:"text-lg",children:r.form.name}),r.form.description&&s.jsx("p",{className:"text-sm text-slate-600",children:r.form.description})]}),s.jsx(Ee,{className:"space-y-4",children:r.form.questions.map(b=>{const w=b.type!=="single-checkbox"&&b.type!=="info"&&!(b.type==="checkbox"&&(!b.o
925ptions||b.options.length===0));return s.jsxs("div",{children:[w&&s.jsxs(V,{className:"text-sm font-medium text-slate-700",children:[b.label,b.required&&s.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),s.jsx("div",{className:w?"mt-1":void 0,children:x(b)})]},b.id)})})]}),s.jsx(Ce,{children:s.jsxs(Ee,{className:"p-6",children:[s.jsx(B,{type:"submit",disabled:p.isPending,className:"w-full bg-blue-600 hover:bg-blue-700 !text-white font-medium",children:p.isPending?s.jsxs(s.Fragment,{children:[s.jsx(Qr,{className:"h-4 w-4 mr-2 animate-spin"}),"Updating Information..."]}):"Update My Information"}),s.jsx("p",{className:"text-xs text-slate-500 text-center mt-3",children:"This link will be deactivated after submission for security."})]})})]})]})})}function NVe(){const[,e]=cn();return s.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-gradient-to-br from-[#f5f7fa] to-[#f1f5f9] text-gray-900",children:[s.jsx("img",{src:"/classta-logo-1024x1024.png",alt:"Classta Logo",className:"w-32 h-32 mb-6 rounded-xl shadow-lg"}),s.jsx("h1",{className:"text-3xl font-bold mb-2 text-[#a13ac9]",children:"Classta — Instructor Admin"}),s.jsx("p",{className:"max-w-xl text-center mb-6 text-lg",children:"Classta is the all-in-one platform for class-based businesses. Manage bookings, payments, attendance, memberships, and more — all in one place. Built for instructors, by instructors."}),s.jsxs("div",{className:"flex gap-4 mb-8",children:[s.jsx("button",{className:"px-6 py-2 bg-[#a13ac9] text-white rounded-lg font-semibold shadow hover:bg-[#8b2bb0] transition",onClick:()=>e("/admin"),children:"Log In"}),s.jsx("button",{className:"px-6 py-2 bg-white border border-[#a13ac9] text-[#a13ac9] rounded-lg font-semibold shadow hover:bg-[#f5e6fa] transition",onClick:()=>e("/instructor-signup"),children:"Sign Up"})]}),s.jsx("div",{className:"text-sm text-gray-500 max-w-md text-center",children:s.jsx("p",{children:"This app is for instructors and staff. If you’re a member or client, please use the web portal link provided by your instructor."})})]})}function CVe(){return cn(),s.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-gradient-to-br from-[#f5f7fa] to-[#f1f5f9] text-gray-900",children:[s.jsx("img",{src:"/classta-logo-1024x1024.png",alt:"Classta Logo",className:"w-32 h-32 mb-6 rounded-xl shadow-lg"}),s.jsx("h1",{className:"text-3xl font-bold mb-2 text-[#a13ac9]",children:"Classta — Instructor Admin"}),s.jsx("p",{className:"max-w-xl text-center mb-6 text-lg",children:"Classta is the all-in-one platform for class-based businesses. Manage bookings, payments, attendance, memberships, and more — all in one place. Built for instructors, by instructors."}),s.jsx("div",{className:"flex gap-4 mb-8",children:s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-[#a13ac9]"})})]})}function SVe(){f.useEffect(()=>{Zs("404_page_view","navigation",window.location.pathname,0)},[]);const e=()=>{Zs("404_go_to_homepage","engagement","generic_404",0)},t=()=>{Zs("404_start_free_trial","conversion","generic_404",0)};return s.jsxs(s.Fragment,{children:[s.jsx(zo,{children:s.jsx("title",{children:"Page not found | Classta"})}),s.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-slate-50 px-4",children:s.jsx(Ce,{className:"w-full max-w-lg mx-4",children:s.jsxs(Ee,{className:"pt-8 pb-8 px-6",children:[s.jsxs("div",{className:"text-center mb-6",children:[s.jsx("div",{className:"flex justify-center mb-4",children:s.jsx("div",{className:"w-16 h-16 rounded-full bg-slate-100 flex items-center justify-center",children:s.jsx(si,{className:"h-8 w-8 text-slate-400"})})}),s.jsx("h1",{className:"text-3xl font-bold text-slate-900 mb-3",children:"This page doesn't exist"}),s.jsx("p",{className:"text-slate-600 mb-8",children:"The link may be broken, or the page may have moved."})]}),s.jsxs("div",{className:"space-y-3 mb-6",children:[s.jsx(dt,{href:"/",children:s.jsxs(B,{className:"w-full",size:"lg",onClick:e,children:[s.jsx(Sre,{className:"h-4 w-4 mr-2"}),"Go to Classta homepage"]})}
925),s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{variant:"outline",className:"w-full",size:"lg",onClick:t,children:[s.jsx(jl,{className:"h-4 w-4 mr-2"}),"Start free trial (30 days)"]})})]}),s.jsxs("p",{className:"text-xs text-center text-slate-500",children:["If you think this is a mistake,"," ",s.jsx("a",{href:"https://help.classta.co",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"contact support"}),"."]})]})})})]})}function kVe(){const e=[{category:"Booking & Scheduling",items:[{name:"Client self-booking",description:"Clients can book classes directly through your custom booking page"},{name:"Calendar view",description:"Visual calendar interface for managing classes"},{name:"Flexible Scheduling",description:"Support for weekly, daily, and custom schedules"},{name:"Class Packages",description:"Offer multi-class packages at discounted rates"},{name:"Individual Sessions",description:"One-on-one session booking and management"},{name:"Session Bundles",description:"Pre-paid session bundles for clients"},{name:"Private booking links",description:"Create exclusive booking links for VIP clients or events"},{name:"Waitlist management",description:"Automatic waitlist when classes are full with delayed notifications"},{name:"Services (One-on-One)",description:"Book individual appointments like personal training, massage, consultations with flexible availability"},{name:"Client self-reschedule",description:"Allow clients to reschedule their own bookings within specified time windows"},{name:"Booking cutoff times",description:"Set minimum hours before class start time when bookings close (e.g., no bookings within 12 hours)"},{name:"Schedule when bookings open",description:"Control when bookings become available - open bookings N days before each session at a specific time (e.g., bookings open 3 days before at 9am)",new:!0},{name:"Holiday management",description:"Exclude specific dates like holidays, vacations, or closed days from your class schedule"}]},{category:"Memberships",items:[{name:"Membership cards",description:"Digital membership cards with QR codes for easy access"},{name:"Recurring subscriptions",description:"Monthly or yearly membership subscriptions"},{name:"Member portal",description:"Dedicated area for members to manage their account"},{name:"Membership resources",description:"Share exclusive content with members"},{name:"Membership posts",description:"Send updates and announcements to members"},{name:"Member pricing",description:"Special pricing for members on classes"},{name:"Import members from CSV",description:"Bulk import members into memberships from CSV"},{name:"Subscription reminders",description:"Automated email reminders before membership renewal"},{name:"Subscription expiry notifications",description:"Notify members when their subscription is about to expire"}]},{category:"Payments & Pricing",items:[{name:"Online payments",description:"Secure payment processing with Stripe and PayPal"},{name:"Multi-currency support",description:"Support for GBP, USD, EUR, and more"},{name:"Discount coupons",description:"Create and manage discount codes"},{name:"Free trial classes",description:"Offer free trial classes to new customers with automatic badge display and smart detection of returning customers",new:!0},{name:"Membership sales",description:"Sell recurring memberships with automatic billing"},{name:"Cash payment support",description:"Allow clients to pay with cash on arrival"}]},{category:"Client Management",items:[{name:"Client database",description:"Comprehensive client management system"},{name:"Client portal",description:"Self-service portal where clients can view bookings, memberships, bundles, achievements, and manage their profile"},{name:"Client tags",description:"Organize clients with custom tags (e.g., by club, location)"},{name:"Track client achievements",description:"Record and track client accomplishments like belt gradings, certifications"},{name:"Client search & filtering",description:"Advanced search with tag and achievement filters"},{name:"Client export (CSV)",description:"Export client data including achievements to CSV"},{name:"Import clients from CSV",description:"Bulk import clients from CSV files"},{name:"Attendance tracking",description:"Track which clients attended each class"},{name:"QR Check-in",description:"QR code check-in for quick attendance marking"},{name:"Class registers",description:"Print or email class registers with attendee lists, payment details, and attendance checkboxes for each session"},{name:"Client profiles",description:"Detailed client profiles with booking history"},{name:"Client merge",description:"Merge duplicate client records"},{name:"Profile pictures",description:"Upload and manage client profile pictures"}]},{category:"Events",items:[{name:"Event ticket sales",description:"Sell tickets for workshops, retreats, and one-off events with multiple ticket types and capacity"},{name:"Dedicated events page",description:"Custom events page with its own title, description, and logo at classta.co/events/your-subdomain"},{name:"Online or pay on door",description:"Sell tickets with Stripe or collect payment at the door; track owed orders and mark as paid in admin"}
925,{name:"Event coupons",description:"Apply percentage or fixed discount coupons at checkout; 100% discount for free tickets"},{name:"Ticket links & QR codes",description:"Confirmation emails include a unique ticket link and QR code for check-in at the door"},{name:"Event orders export",description:"Export event orders to CSV for check-in lists or records"}]},{category:"Communication",items:[{name:"Email & SMS reminders",description:"Automated reminders before classes"},{name:"Booking confirmations",description:"Automatic confirmation emails with class details"},{name:"Custom email templates",description:"Personalize your communication"},{name:"Waitlist notifications",description:"Automatic notifications when spots become available"},{name:"Request client updates",description:"Send secure links to clients to update their information"}]},{category:"AI-Powered Features",items:[{name:"Create class with AI",description:"Generate complete class descriptions using AI",ai:!0,new:!0},{name:"Auto enrolment forms",description:"AI-generated onboarding forms tailored to your needs",ai:!0},{name:"AI content enhancement",description:"Improve your class descriptions with AI",ai:!0},{name:"AI social media posts",description:"Generate social media content for your classes",ai:!0}]},{category:"Branding & Customization",items:[{name:"Custom branding",description:"Your logo, colors, and subdomain"},{name:"Mobile responsive",description:"Works perfectly on all devices"},{name:"Embeddable booking widget",description:"Embed booking system into your website"},{name:"Custom redirect URLs",description:"Redirect clients to your own page after booking for tracking pixels (Meta, Google Analytics) and conversion tracking"},{name:"Custom Terms and Conditions",description:"Add custom terms and conditions per class via URL or text that clients must agree to before booking"}]},{category:"Analytics & Reporting",items:[{name:"Real-time analytics",description:"Track bookings, revenue, and attendance in real-time"},{name:"Revenue tracking",description:"Monitor your income and payment methods"},{name:"Client statistics",description:"View detailed stats for each client"},{name:"Export capabilities",description:"Export data to CSV for analysis"}]},{category:"Team & Collaboration",items:[{name:"Multi-instructor support",description:"Manage multiple instructors and their classes"},{name:"Team member access",description:"Grant read-only or admin access to team members"},{name:"Team member invitations",description:"Invite team members via email with secure access tokens"}]},{category:"Data Import & Export",items:[{name:"Import bookings from Bookwhen",description:"Import attendance data and bookings from Bookwhen CSV exports"},{name:"Import bookings from CSV",description:"Generic CSV import for bookings from any system"},{name:"Import clients from CSV",description:"Bulk import clients with email, name, phone, and tags"},{name:"Import members from CSV",description:"Import members into memberships from CSV files"},{name:"Export clients to CSV",description:"Export all client data including achievements and onboarding forms"}]},{category:"Forms & Onboarding",items:[{name:"Custom onboarding forms",description:"Create custom health questionnaires and intake forms"},{name:"Form builder",description:"Drag-and-drop form builder with multiple field types"},{name:"Form responses",description:"View and manage responses to onboarding forms"},{name:"Secure form update links",description:"Send clients secure links to update their information"}]},{category:"Free Tools",items:[{name:"Free Forms Builder",description:"Create and share forms without signing up (lead generation tool)",ai:!1},{name:"Social Timetable Maker",description:"Generate beautiful social media timetable graphics",ai:!1},{name:"QR Ticket Generator",description:"Create QR code tickets for classes and events",ai:!1}]},{category:"Integrations",items:[{name:"Zoom integration",description:"Automatically create Zoom meetings for online classes"},{name:"Calendar sync",description:"Sync with Google Calendar and other calendar apps"},{name:"Stripe Connect",description:"Direct payment processing with Stripe"},{name:"PayPal integration",description:"Accept PayPal payments"},{name:"Zapier & webhooks",description:"Send booking, membership, and session-completed events to Zapier (free plan) or any webhook URL—trigger MailerLite sequences, update CRMs, and automate workflows"}]},{category:"Automation & Monitoring",items:[{name:"Overbook prevention",description:"Database-level locking ensures classes can never be overbooked, even with concurrent bookings"},{name:"Payment reconciliation",description:"Automated reconciliation of payments and bookings"},{name:"Trial expiry reminders",description:"Automated reminders for instructors on free trials"}]}];return s.jsxs(s.Fragment,{children:[s.jsxs(zo,{children:[s.jsx("title",{children:"All Features - Classta"}),s.jsx("meta",{name:"description",content:"Complete list of all Classta features for class booking, events and ticket sales, client management, memberships, and more."})]}),s.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white",children:[s.jsx("div",{className:"bg-white border-b",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(dt,{to:"/",children:s.jsxs(B,{variant:"ghost",size:"sm",children:[s.jsx(xr,{className:"h-4 w-4 mr-2"}),"Back to Home"]})}),s.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"All Features"})]})})})}),s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-4",children:"Everything You Need to Run Your Teaching Business"}),s.jsx("p",{className:"text-lg text-slate-600 max-w-3xl mx-auto",children:"Classta provides a comprehensive platform with all the tools you need to manage classes, events, clients, memberships, and more."}),s.jsx("p",{className:"text-sm text-slate-500 mt-4",children:'AI-powered features are marked with an "AI" badge'})]}),s.jsx("div",{className:"space-y-12",children:e.map((t,n)=>s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-6 border-b pb-2",children:t.category}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:t.items.map((r,a)=>s.jsx(Ce,{className:"hover:shadow-md transition-shadow",children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("h4",{className:"font-medium text-slate-900",children:r.name}),"ai"in r&&r.ai&&s.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-800",children:[s.jsx(lr,{className:"w-2.5 h-2.5 mr-1"}),"AI"]}),"new"in r&&r.new&&s.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800",children:"NEW"})]}),s.jsx("p",{className:"text-sm text-slate-600",children:r.description})]})]})})},a))})]},n))}),s.jsx("div",{className:"mt-16 text-center",children:s.jsx(Ce,{className:"bg-gradient-to-r from-blue-50 to-indigo-50 border-blue-200",children:s.jsxs(Ee,{className:"p-8",children:[s.jsx("h3",{className:"text-2xl font-bold text-slate-900 mb-4",children:"Ready to Get Started?"}),s.jsx("p",{className:"text-slate-600 mb-6",children:"Join thousands of instructors using Classta to manage their classes and grow their business."}
925),s.jsx(dt,{to:"/instructor-signup",children:s.jsx(B,{size:"lg",className:"bg-blue-600 hover:bg-blue-700",children:"Start Free Trial"})})]})})})]})]})]})}function PVe(){const{formatPrice:e,currentPrice:t,isLoading:n}=ZN();f.useEffect(()=>{if(document.getElementById("famewall-script"))return;const c=document.createElement("script");c.id="famewall-script",c.src="https://embed.famewall.io/newFrame.js",c.async=!0,document.body.appendChild(c)},[]);const r=["Unlimited classes & bookings","Branded booking page + website embed","Memberships, packages & bundles","Event ticket sales & dedicated events page","Online payments (Stripe & PayPal) — payouts direct to you","SMS & email reminders","QR check-in & attendance registers","AI class setup & onboarding forms","iOS & Android apps","No feature gating — everything's included"],a=[{icon:iT,title:"Booking & scheduling",items:["Client self-booking","Waitlists & auto-notify","Booking cut-offs & scheduled opening","Client self-reschedule"]},{icon:ti,title:"Payments",items:["Stripe & PayPal","Multi-currency (GBP, USD, EUR…)","Discount coupons","Cash & pay-on-door"]},{icon:_re,title:"Memberships & packages",items:["Recurring memberships","Member portal & pricing","Class packages & bundles","Renewal reminders"]},{icon:um,title:"Events & ticketing",items:["Sell tickets for workshops & retreats","Dedicated events page","Online or pay-on-door","QR tickets & check-in"]},{icon:sr,title:"Clients & check-in",items:["Client database & profiles","QR check-in & attendance","Printable class registers","Custom onboarding forms"]},{icon:jl,title:"Growth & automation",items:["AI class creation","Embeddable booking widget","Zapier & webhooks","Real-time analytics"]}],i=[{q:"Do you offer a free trial?",a:"Yes — a 30-day free trial with no credit card required. Create your classes, set up your booking page, and explore every feature before you pay a penny."},{q:"What's included for the price?",a:"Everything. There are no tiers and no feature gating — bookings, memberships, packages, event ticketing, SMS reminders, AI setup, QR check-in and the mobile apps are all included in the one flat monthly price."},{q:"Can I sell tickets for events and workshops?",a:"Yes. Alongside regular classes you can sell tickets for workshops, retreats and one-off events with multiple ticket types, a dedicated events page, online or pay-on-door payment, and QR tickets for check-in."},{q:"Do I need my own payment account?",a:"You connect your own Stripe and/or PayPal, so payouts go directly to you. Classta never adds transaction fees — your payment provider simply charges their standard processing fees."},{q:"Is there a mobile app?",a:"Yes. Classta has iOS and Android apps so you can manage classes, take bookings and check clients in from your phone."},{q:"Can I switch from another system like Bookwhen?",a:"Yes. You can import your bookings, clients and members from CSV, including Bookwhen exports. We're happy to help you move everything across."},{q:"Are SMS reminders included?",a:"Yes. SMS and email reminders are included in the plan — there's no upgrade required to access them."},{q:"Is there a contract? Can I cancel anytime?",a:"There's no contract and no lock-in. Pay monthly and cancel whenever you like — there are no setup or cancellation fees."}],o={"@context":"https://schema.org","@type":"Product",name:"Classta",description:"Class booking software for instructors and small studios. One flat monthly price with all features included — bookings, memberships, event ticketing, payments and more.",image:"https://classta.co/new-og-image.png",brand:{"@type":"Brand",name:"Classta"},offers:{"@type":"Offer",priceCurrency:"GBP",price:15,priceValidUntil:"2026-12-31",availability:"https://schema.org/InStock",url:"https://classta.co/pricing",hasMerchantReturnPolicy:{"@type":"MerchantReturnPolicy",applicableCountry:"GB",returnPolicyCategory:"https://schema.org/MerchantReturnFiniteReturnWindow",merchantReturnDays:30,returnMethod:"https://schema.org/ReturnByMail",returnFees:"https://schema.org/FreeReturn"},shippingDetails:{"@type":"OfferShippingDetails",shippingRate:{"@type":"MonetaryAmount",value:0,currency:"GBP"},deliveryTime:{"@type":"ShippingDeliveryTime",handlingTime:{"@type":"QuantitativeValue",minValue:0,maxValue:0,unitCode:"DAY"},transitTime:{"@type":"QuantitativeValue",minValue:0,maxValue:0,unitCode:"DAY"}}}}},l={"@context":"https://schema.org","@type":"FAQPage",mainEntity:i.map(c=>
925({"@type":"Question",name:c.q,acceptedAnswer:{"@type":"Answer",text:c.a}}))};return s.jsxs(s.Fragment,{children:[s.jsxs(zo,{children:[s.jsx("title",{children:"Pricing – One Plan, Everything Included | Classta"}),s.jsx("meta",{name:"description",content:"Classta pricing: one flat monthly price with every feature included — unlimited classes, memberships, event ticketing, SMS reminders and payments. No tiers, no hidden fees. 30-day free trial, no card required."}),s.jsx("meta",{name:"robots",content:"index, follow"}),s.jsx("link",{rel:"canonical",href:"https://classta.co/pricing"}),s.jsx("script",{type:"application/ld+json",children:JSON.stringify(o)}),s.jsx("script",{type:"application/ld+json",children:JSON.stringify(l)})]}),s.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white",children:[s.jsx("div",{className:"bg-white border-b",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(dt,{to:"/",className:"flex items-center gap-3 text-slate-900 hover:text-primary transition-colors",children:[s.jsx(Ia,{className:"text-primary",size:"md"}),s.jsx("span",{className:"text-xl font-bold",children:"Classta"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(dt,{to:"/features",className:"hidden sm:block",children:s.jsx(B,{variant:"ghost",size:"sm",children:"Features"})}),s.jsx(dt,{to:"/instructor-signup",children:s.jsx(B,{variant:"outline",size:"sm",children:"Start Free Trial"})})]})]})})}),s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 pt-16 pb-8 text-center",children:[s.jsx("h1",{className:"text-4xl sm:text-5xl font-bold text-slate-900 mb-4",children:"One plan. Everything included."}),s.jsx("p",{className:"text-xl text-slate-600 max-w-2xl mx-auto",children:"No tiers, no bolt-ons, no per-booking fees. Every Classta feature for one simple monthly price."}),s.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-6 gap-y-2 mt-6 text-sm text-slate-600",children:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(bn,{className:"w-4 h-4 text-primary"})," 30-day free trial"]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(bn,{className:"w-4 h-4 text-primary"})," No card required"]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(bn,{className:"w-4 h-4 text-primary"})," Cancel anytime"]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(bn,{className:"w-4 h-4 text-primary"})," No transaction fees"]})]})]}),s.jsxs("div",{className:"max-w-lg mx-auto px-4 sm:px-6 lg:px-8 pb-12",children:[s.jsx(Ce,{className:"border-2 border-primary/20 shadow-lg overflow-hidden",children:s.jsxs(Ee,{className:"p-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Classta Plan"}),s.jsxs("div",{className:"flex items-baseline gap-1 mb-2",children:[s.jsx("span",{className:"text-4xl font-bold text-primary",children:n?"…":e(t)}),s.jsx("span",{className:"text-slate-600",children:"per month"})]}),s.jsx("p",{className:"text-slate-600 mb-6",children:"All features included. Nothing locked behind a higher tier."}),s.jsx("ul",{className:"space-y-3 mb-8",children:r.map(c=>s.jsxs("li",{className:"flex items-start gap-3",children:[s.jsx(bn,{className:"w-5 h-5 text-primary flex-shrink-0 mt-0.5"}),s.jsx("span",{className:"text-slate-700",children:c})]},c))}),s.jsx(dt,{to:"/instructor-signup",children:s.jsxs(B,{size:"lg",className:"w-full bg-primary hover:bg-primary/90 text-lg py-6",children:["Start Free Trial",s.jsx(qn,{className:"w-5 h-5 ml-2"})]})}),s.jsx("p",{className:"text-center text-sm text-slate-500 mt-3",children:"No credit card required · Cancel anytime"}),s.jsx("p",{className:"text-sm text-slate-500 mt-6 pt-6 border-t border-slate-200",children:"Classta does not add any transaction fees. If you take online payments, your chosen payment provider (such as Stripe or PayPal) will apply their standard processing fees."})]})}),s.jsx("div",{className:"text-center mt-6",children:s.jsxs("p",{className:"text-slate-600",children:["The features other platforms lock behind premium tiers — SMS reminders, memberships, packages — are all included here."," ",s.jsx("a",{href:"/classta-vs-bookwhen-vs-gymcatch.html",className:"text-primary font-medium underline hover:text-primary/80",children:"See how we compare"})]})})]}),s.jsxs("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 pb-8",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-3 text-center",children:"Everything included in your plan"}),s.jsx("p",{className:"text-lg text-slate-600 max-w-2xl mx-auto text-center mb-10",children:"One price unlocks the whole platform — from classes and memberships to event ticketing and AI-powered setup."}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:a.map(c=>{const d=c.icon;return s.jsx(Ce,{className:"border-slate-200 hover:shadow-md transition-shadow",children:s.jsxs(Ee,{className:"p-6",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:s.jsx(d,{className:"w-5 h-5 text-primary"})}),s.jsx("h3",{className:"font-semibold text-slate-900",children:c.title})]}),s.jsx("ul",{className:"space-y-2",children:c.items.map(m=>s.jsxs("li",{className:"flex items-start gap-2 text-sm text-slate-600",children:[s.jsx(bn,{className:"w-4 h-4 text-primary flex-shrink-0 mt-0.5"}),s.jsx("span",{children:m})]},m))})]})},c.title)})}),s.jsx("div",{className:"text-center mt-10",children:s.jsx(dt,{to:"/features",children:s.jsxs(B,{variant:"outline",size:"lg",children:["See all features",s.jsx(qn,{
925className:"w-4 h-4 ml-2"})]})})})]}),s.jsx("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-10",children:s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-6 text-center",children:[s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx(Mre,{className:"w-7 h-7 text-primary mb-2"}),s.jsx("p",{className:"font-semibold text-slate-900",children:"Your data stays yours"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Export clients and bookings anytime."})]}),s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx($re,{className:"w-7 h-7 text-primary mb-2"}),s.jsx("p",{className:"font-semibold text-slate-900",children:"Run it from anywhere"}),s.jsx("p",{className:"text-sm text-slate-600",children:"iOS & Android apps included."})]}),s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx(ti,{className:"w-7 h-7 text-primary mb-2"}),s.jsx("p",{className:"font-semibold text-slate-900",children:"Direct payouts"}),s.jsx("p",{className:"text-sm text-slate-600",children:"Your Stripe/PayPal, no middleman."})]})]})}),s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12 border-t border-slate-200",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("div",{className:"flex justify-center gap-1 mb-3",children:Array.from({length:5}).map((c,d)=>s.jsx(dl,{className:"w-5 h-5 text-yellow-400 fill-current"},d))}),s.jsx("h2",{className:"text-2xl font-bold text-slate-900",children:"Loved by independent instructors"})]}),s.jsx("div",{className:"famewall-embed","data-src":"classta","data-format":"carousel",style:{width:"100%"}}),s.jsx("div",{className:"text-center mt-6",children:s.jsx("a",{href:"https://wall.famewall.io/classta",target:"_blank",rel:"noopener noreferrer",className:"text-primary font-medium underline hover:text-primary/80",children:"See more testimonials"})})]}),s.jsxs("div",{className:"max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-16 border-t border-slate-200",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-10 text-center",children:"Frequently Asked Questions"}),s.jsx("div",{className:"space-y-8",children:i.map(c=>s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-2",children:c.q}),s.jsx("p",{className:"text-slate-600",children:c.a})]},c.q))}),s.jsxs("p",{className:"text-center text-slate-600 mt-10",children:["Switching from another platform?"," ",s.jsx(dt,{to:"/moving-from-bookwhen",className:"text-primary font-medium underline hover:text-primary/80",children:"See how easy it is to move to Classta"})]})]}),s.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 lg:px-8 pb-20 text-center",children:[s.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-4",children:"Ready to get started?"}),s.jsx("p",{className:"text-slate-600 mb-6",children:"Try everything free for 30 days. No card, no commitment."}),s.jsx(dt,{to:"/instructor-signup",children:s.jsxs(B,{size:"lg",className:"bg-primary hover:bg-primary/90 px-8",children:["Start Free Trial — No Card Required",s.jsx(qn,{className:"w-5 h-5 ml-2"})]})})]})]})]})}const EVe=[{icon:Of,title:"Want more flexible memberships?",description:"Sell recurring memberships with automatic billing, member pricing and a dedicated member portal — without paying for a higher tier."},{icon:Ere,title:"Need packages, bundles or recurring memberships?",description:"Offer multi-class packages, pre-paid session bundles and subscriptions out of the box. No bolt-ons, no add-on fees."},{icon:ti,title:"Looking for simpler pricing?",description:"One flat price with everything included — no tiers, no booking caps and no surprise charges as you grow."},{icon:jl,title:"Want a more modern booking experience?",description:"A fast, mobile-first booking page your clients will love, plus AI-assisted setup, SMS + email reminders and QR check-in built in."}],DVe=["Classes","Bookings","Memberships","Clients (if needed)"];function AVe(){f.useEffect(()=>{if(typeof window>"u"||window.Beacon)return;const n=document.createElement("script");n.type="text/javascript",n.innerHTML='!function(e,t,n){function a(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,a){e.Beacon.readyQueue.push({method:t,options:n,data:a})},n.readyQueue=[],"complete"===t.readyState)return a();e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}(window,document,window.Beacon||function(){});',document.body.appendChild(n);const r=document.createElement("script");r.type="text/javascript",r.innerHTML="window.Beacon('init', '4c0a64a0-dadd-4aa9-a084-27ca6e6cb029');",document.body.appendChild(r)},[]);const e=()=>{Zs("moving_from_bookwhen_start_trial","conversion","cta")},t=()=>{Zs("moving_from_bookwhen_contact","conversion","cta");const n=window.Beacon;if(n)try{n("open"),n("navigate","/ask/message/");return}catch{}window.open("https://help.classta.co/","_blank","noopener,noreferrer")};return s.jsxs(s.Fragment,{children:[s.jsxs(zo,{children:[s.jsx("title",{children:"Bookwhen Alternatives: Switch to Classta — Import in One Click"}),s.jsx("meta",{name:"description",content:"Looking for a Bookwhen alternative? Classta includes memberships, packages, SMS reminders and QR check-in for £15/mo flat — no tiers. Free trial. We help you import from Bookwhen."}),s.jsx("meta",{name:"keywords",content:"moving from bookwhen, bookwhen alternative, switch from bookwhen, bookwhen migration, import from bookwhen, class booking software"}),s.jsx("meta",{name:"robots",content:"index, follow"}),s.jsx("link",{rel:"canonical",href:"https://classta.co/moving-from-bookwhen"}),s.jsx("meta",{property:"og:title",content:"Bookwhen Alternatives: Switch to Classta — Import in One Click"}),s.jsx("meta",{property:"og:description",content:"Looking for a Bookwhen alternative? Classta includes memberships, packages, SMS reminders and QR check-in for £15/mo flat — no tiers. Free trial. We help you import from Bookwhen."}),s.jsx("meta",{property:"og:type",content:"website"}),s.jsx("meta",{property:"og:url",content:"https://classta.co/moving-from-bookwhen"}),s.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),s.jsx("meta",{name:"twitter:title",content:"Bookwhen Alternatives: Switch to Classta — Import in One Click"}),s.jsx("meta",{name:"twitter:description",content:"Looking for a Bookwhen alternative? Classta includes memberships, packages, SMS reminders and QR check-in for £15/mo flat — no tiers. Free trial. We help you import from Bookwhen."})]}),s.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white",children:[s.jsx("header",{className:"bg-white/95 backdrop-blur-sm border-b border-slate-200 sticky top-0 z-50",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex items-center justify-between h-16",children:[s.jsxs(dt,{href:"/",className:"flex items-center",children:[s.jsx(Ia,{className:"text-primary"}),s.jsx("span",{className:"ml-3 text-xl font-bold text-slate-900",children:"Classta"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(dt,{href:"/instru
925ctor-signup",children:s.jsx(B,{size:"sm",onClick:e,children:"Start Free Trial"})})})]})})}),s.jsx("section",{className:"relative overflow-hidden",children:s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 pt-16 pb-12 text-center",children:[s.jsxs("span",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full text-sm font-medium bg-primary/10 text-primary mb-6",children:[s.jsx(Of,{className:"w-4 h-4"}),"Bookwhen alternative"]}),s.jsx("h1",{className:"text-4xl sm:text-5xl font-bold text-slate-900 mb-6",children:"Moving from Bookwhen?"}),s.jsx("p",{className:"text-xl text-slate-600 max-w-2xl mx-auto mb-8",children:"Get flexible memberships, packages and bundles, simpler pricing and a more modern booking experience — without the tiers and add-ons."}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{size:"lg",className:"w-full sm:w-auto",onClick:e,children:["Start free trial",s.jsx(qn,{className:"w-4 h-4 ml-2"})]})}),s.jsxs(B,{size:"lg",variant:"outline",className:"w-full sm:w-auto",onClick:t,children:[s.jsx(hw,{className:"w-4 h-4 mr-2"}),"Contact us about switching"]})]}),s.jsx("p",{className:"text-sm text-slate-500 mt-4",children:"No credit card required · Cancel anytime"})]})}),s.jsxs("section",{className:"max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[s.jsxs("div",{className:"text-center mb-10",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-3",children:"Outgrowing Bookwhen?"}),s.jsx("p",{className:"text-lg text-slate-600 max-w-2xl mx-auto",children:"If any of these sound familiar, Classta was built for you."})]}),s.jsx("div",{className:"grid sm:grid-cols-2 gap-5",children:EVe.map(n=>{const r=n.icon;return s.jsx("div",{className:"bg-white border border-slate-200 rounded-xl p-6 shadow-sm hover:shadow-md transition-shadow",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"flex-shrink-0 w-11 h-11 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(r,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold text-slate-900 mb-1",children:n.title}),s.jsx("p",{className:"text-sm text-slate-600 leading-relaxed",children:n.description})]})]})},n.title)})})]}),s.jsx("section",{className:"bg-white border-y border-slate-200",children:s.jsx("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-14",children:s.jsxs("div",{className:"grid lg:grid-cols-2 gap-10 items-center",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-4",children:"Switching doesn't have to be difficult"}),s.jsx("p",{className:"text-lg text-slate-600 mb-6",children:"We can help you move everything across so you're up and running quickly. We can help import:"}),s.jsx("ul",{className:"space-y-3 mb-6",children:DVe.map(n=>s.jsxs("li",{className:"flex items-center gap-3 text-slate-700",children:[s.jsx(qt,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),s.jsx("span",{children:n})]},n))}),s.jsxs("p",{className:"text-slate-600",children:["Prefer to do it yourself? Classta has a"," ",s.jsx("span",{className:"font-semibold text-slate-900",children:"built-in importer"})," ","that brings your bookings and clients straight in from a Bookwhen export — no spreadsheets to wrangle."]})]}),s.jsxs("div",{className:"bg-gradient-to-br from-primary/5 to-blue-50 border border-primary/10 rounded-2xl p-8",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-white shadow-sm flex items-center justify-center",children:s.jsx(id,{className:"w-6 h-6 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold text-slate-900",children:"Built-in importer"}),s.jsx("p",{className:"text-sm text-slate-500",children:"Bring your data with you"})]})]}),s.jsxs("ul",{className:"space-y-2 text-sm text-slate-700",children:[s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(qt,{className:"w-4 h-4 text-green-600"}),"Import bookings from a Bookwhen CSV export"]}),s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(qt,{className:"w-4 h-4 text-green-600"}),"Bulk import clients with names, emails and phone numbers"]}),s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(qt,{className:"w-4 h-4 text-green-600"}),"Set up classes, memberships and bundles in minutes"]}),s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(qt,{className:"w-4 h-4 text-green-600"}),"Hands-on help from our team whenever you need it"]})]})]})]})})}),s.jsx("section",{className:"max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-14",children:s.jsxs("div",{className:"bg-white border border-slate-200 rounded-2xl p-8 shadow-sm text-center",children:[s.jsx("div",{className:"flex justify-center gap-1 mb-4",children:Array.from({length:5}).map((n,r)=>s.jsx("svg",{className:"w-5 h-5 text-yellow-400 fill-current",viewBox:"0 0 20 20",children:s.jsx("path",{d:"M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"})},r))}),s.jsx("blockquote",{className:"text-xl text-slate-800 leading-relaxed mb-4",children:`"I've just made the switch to Classta and am loving the simplicity of the system. Moreover the support from the Classta team has been second to none. They went over and above with my queries and in record speed time. I highly recommend 😁"`}),s.jsx("p",{className:"text-slate-500 font-medium",children:"— Zarina, Dance fitness instructor"}),s.jsx("div",{className:"mt-6",children:s.jsx(B,{asChild:!0,variant:"outline",size:"sm",children:s.jsx("a",{href:"https://wall.famewall.io/classta",target:"_blank",rel:"noopener noreferrer",children:"See more testimonials"})})})]})}),s.jsx("section",{className:"bg-gradient-to-br from-primary/10 to-blue-50 border-t border-slate-200",children:s.jsxs("div",{className:"max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-16 text-center",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-4",children:"Ready to make the switch?"}),s.jsx("p",{className:"text-lg text-slate-600 mb-8",children:"Start free today, or talk to us about mov
925ing your classes, bookings and members from Bookwhen."}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[s.jsx(dt,{href:"/instructor-signup",children:s.jsxs(B,{size:"lg",className:"w-full sm:w-auto",onClick:e,children:["Start free trial",s.jsx(qn,{className:"w-4 h-4 ml-2"})]})}),s.jsxs(B,{size:"lg",variant:"outline",className:"w-full sm:w-auto",onClick:t,children:[s.jsx(hw,{className:"w-4 h-4 mr-2"}),"Contact us about switching"]})]}),s.jsxs("p",{className:"text-sm text-slate-500 mt-6",children:["Want the full breakdown?"," ",s.jsx("a",{href:"/classta-vs-bookwhen-vs-gymcatch.html",className:"text-primary font-medium underline hover:text-primary/80",children:"See Classta vs Bookwhen vs Gymcatch"})]})]})}),s.jsx("footer",{className:"bg-white border-t border-slate-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:s.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4",children:[s.jsxs(dt,{href:"/",className:"flex items-center",children:[s.jsx(Ia,{size:"sm",className:"text-primary"}),s.jsx("span",{className:"ml-2 text-lg font-bold text-slate-900",children:"Classta"})]}),s.jsxs("p",{className:"text-sm text-slate-500",children:["© ",new Date().getFullYear()," Classta. All rights reserved."]})]})})})]})]})}function PL(){var j;const{subscriptionId:e}=sa(),[t]=cn(),n=t.startsWith("/card/"),[r,a]=f.useState(null),[i,o]=f.useState(!0),[l,c]=f.useState(null),[d,m]=f.useState(!1);if(f.useEffect(()=>{e&&(async()=>{try{const C=n?await fetch(`/api/member-subscriptions/public-card/${encodeURIComponent(e||"")}`):await Pe("GET",`/api/member-subscriptions/${e}/card`);if(C.ok){const P=await C.json();a(P)}else{const P=await C.json().catch(()=>({}));c(P.message||"Failed to load membership card")}}catch(C){c(C.message||"Failed to load membership card")}finally{o(!1)}})()},[e,n]),f.useEffect(()=>{var N;(N=r==null?void 0:r.client)!=null&&N.profilePictureUrl&&m(!1)},[(j=r==null?void 0:r.client)==null?void 0:j.profilePictureUrl]),i)return s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"})});if(l||!r)return s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold text-red-600 mb-4",children:"Error"}),s.jsx("p",{className:"text-gray-600",children:l||"Failed to load membership card"})]})});const{memberSubscription:u,membership:h,client:p,instructor:v,qrCodeDataUrl:y}=r,g=u.name||u.email,x=u.membershipNumber||u.publicId,b=u.currentPeriodEnd?new Date(u.currentPeriodEnd).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}):"N/A",w=p==null?void 0:p.profilePictureUrl;return`${g.replace(/[^a-z0-9]/gi,"_")}${h.name.replace(/[^a-z0-9]/gi,"_")}`,s.jsxs(s.Fragment,{children:[s.jsx(zo,{children:s.jsx("title",{children:`${g} - ${h.name} Membership Card`})}),s.jsx("style",{children:`
926        @media print {
927          @page {
928            size: 85.6mm 53.98mm;
929            margin: 0;
930          }
931          body {
932            margin: 0;
933            padding: 0;
934            background: white;
935          }
936          .no-print {
937            display: none !important;
938          }
939          footer {
940            display: none !important;
941          }
942          /* Hide any footer elements */
943          body > footer,
944          [class*="footer"],
945          [id*="footer"] {
946            display: none !important;
947          }
948        }
949        @media screen {
950          body {
951            background: #f3f4f6;
952            padding: 20px;
953          }
954        }
955      `}),s.jsx("div",{className:"flex items-center justify-center min-h-screen print:min-h-0 print:p-0",children:s.jsx("div",{className:"bg-white rounded-lg shadow-lg print:shadow-none print:rounded-none",style:{width:"85.6mm",height:"53.98mm"},children:s.jsxs("div",{className:"h-full p-3 flex flex-col relative overflow-hidden",children:[s.jsx("div",{className:"absolute inset-0 opacity-5",style:{background:`linear-gradient(135deg, ${v.primaryColor||"#3B82F6"} 0%, ${v.secondaryColor||"#10B981"} 100%)`}}),s.jsxs("div",{className:"relative z-10 flex-1 flex items-start gap-3",children:[s.jsx("div",{className:"flex-shrink-0",children:w&&!d?s.jsx("img",{src:w,alt:g,className:"w-[30mm] h-[40mm] object-cover border border-gray-300 bg-gray-100",style:{aspectRatio:"2/3"},onError:()=>m(!0)}):s.jsx("div",{className:"w-[30mm] h-[40mm] bg-gray-200 border border-gray-300 flex items-center justify-center",children:s.jsx(Dr,{className:"w-7 h-7 text-gray-400"})})}),s.jsxs("div",{className:"flex-1 flex flex-col justify-between h-full min-w-0",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"text-[9px] font-semibold text-gray-500 uppercase tracking-wider mb-1.5",children:h.name}),s.jsx("div",{className:"text-base font-bold text-gray-900 mb-1 leading-tight",children:g}),x&&s.jsxs("div",{className:"text-[7px] text-gray-600 mb-1.5 font-mono",children:["ID: ",x]}),!u.neverExpires&&u.currentPeriodEnd&&s.jsxs("div",{className:"text-[8px] text-gray-700",children:[s.jsx("div",{className:"mb-0.5",children:s.jsx("span",{className:"font-semibold",children:"Expires:"})}),s.jsx("div",{children:b})]})]}),s.jsxs("div",{className:"flex items-start justify-between gap-2 mt-auto pt-1.5 border-t border-gray-200",children:[y&&s.jsx("div",{className:"flex-shrink-0",children:s.jsx("img",{src:y,alt:"Member QR Code",className:"w-12 h-12"})}),s.jsxs("div",{className:"flex flex-col items-end min-h-12 ml-auto",children:[s.jsx("div",{className:"text-right",children:s.jsx("div",{className:"text-[7px] font-semibold text-gray-700 leading-tight",children:v.businessName})}),(h.logoUrl||v.logoUrl)&&s.jsx("img",{src:h.logoUrl||v.logoUrl,alt:v.businessName,className:"h-8 w-auto max-w-[70px] object-contain flex-shrink-0 mt-1"})]})]})]})]})]})})}),s.jsx("div",{className:"no-print fixed bottom-4 right-4",children:s.jsxs("button",{onClick:()=>window.print(),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg shadow-lg flex items-center gap-2",children:[s.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"})}),"Print Card"]})})]})}function TVe(){var j;const{instructorPath:e,subscriptionId:t}=sa(),[n,r]=f.useState(null),[a,i]=f.useState(!0),[o,l]=f.useState(null),[c,d]=f.useState(!1),{data:m}=Ue({queryKey:[`/api/instructor/by-subdomain/${e}`],enabled:!!e});if(f.useEffect(()=>{if(!(m!=null&&m.id)||!t){i(!!e&&!m);return}const N=typeof window<"u"?localStorage.getItem(`client_token_${m.id}`):null;if(!N){l("Please log in to view your membership card."),i(!1);return}let C=!1;return(async()=>{try{const P=await fetch(`/api/client/membership-card/${m.id}/${encodeURIComponent(t)}`,{headers:{Authorization:`Bearer ${N}`}});if(C)return;if(P.ok){const S=await P.json();r(S)}else{const S=await P.json();l(S.message||"Failed to load membership card")}}catch(P){C||l(P.message||"Failed to load membership card")}finally{C||i(!1)}})(),()=>{C=!0}},[m==null?void 0:m.id,t]),f.useEffect(()=>{var N;(N=n==null?void 0:n.client)!=null&&N.profilePictureUrl&&d(!1)},[(j=n==null?void 0:n.client)==null?void 0:j.profilePictureUrl]),!e)return s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("p",{className:"text-gray-600",children:"Invalid link."})});if(a)return s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent roun
955ded-full"})});if(o&&!n)return s.jsx("div",{className:"min-h-screen flex items-center justify-center p-4",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("h1",{className:"text-xl font-bold text-gray-900 mb-2",children:"Membership card"}),s.jsx("p",{className:"text-gray-600 mb-4",children:o}),s.jsx(dt,{href:`/my-account/${e}`,children:s.jsx("a",{className:"text-primary hover:underline",children:"Back to My account"})})]})});if(!n)return null;const{memberSubscription:u,membership:h,client:p,instructor:v,qrCodeDataUrl:y}=n,g=u.name||u.email,x=u.membershipNumber||u.publicId,b=u.currentPeriodEnd?new Date(u.currentPeriodEnd).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}):"N/A",w=p==null?void 0:p.profilePictureUrl;return s.jsxs(s.Fragment,{children:[s.jsx(zo,{children:s.jsx("title",{children:`${g} - ${h.name} Membership Card`})}),s.jsx("style",{children:`
956        @media print {
957          @page { size: 85.6mm 53.98mm; margin: 0; }
958          body { margin: 0; padding: 0; background: white; }
959          .no-print { display: none !important; }
960          footer, body > footer, [class*="footer"], [id*="footer"] { display: none !important; }
961        }
962        @media screen {
963          body { background: #f3f4f6; padding: 20px; }
964        }
965      `}),s.jsx("div",{className:"flex items-center justify-center min-h-screen print:min-h-0 print:p-0",children:s.jsx("div",{className:"bg-white rounded-lg shadow-lg print:shadow-none print:rounded-none",style:{width:"85.6mm",height:"53.98mm"},children:s.jsxs("div",{className:"h-full p-3 flex flex-col relative overflow-hidden",children:[s.jsx("div",{className:"absolute inset-0 opacity-5",style:{background:`linear-gradient(135deg, ${v.primaryColor||"#3B82F6"} 0%, ${v.secondaryColor||"#10B981"} 100%)`}}),s.jsxs("div",{className:"relative z-10 flex-1 flex items-start gap-3",children:[s.jsx("div",{className:"flex-shrink-0",children:w&&!c?s.jsx("img",{src:w,alt:g,className:"w-[30mm] h-[40mm] object-cover border border-gray-300 bg-gray-100",style:{aspectRatio:"2/3"},onError:()=>d(!0)}):s.jsx("div",{className:"w-[30mm] h-[40mm] bg-gray-200 border border-gray-300 flex items-center justify-center",children:s.jsx(Dr,{className:"w-7 h-7 text-gray-400"})})}),s.jsxs("div",{className:"flex-1 flex flex-col justify-between h-full min-w-0",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"text-[9px] font-semibold text-gray-500 uppercase tracking-wider mb-1.5",children:h.name}),s.jsx("div",{className:"text-base font-bold text-gray-900 mb-1 leading-tight",children:g}),x&&s.jsxs("div",{className:"text-[7px] text-gray-600 mb-1.5 font-mono",children:["ID: ",x]}),!u.neverExpires&&u.currentPeriodEnd&&s.jsxs("div",{className:"text-[8px] text-gray-700",children:[s.jsx("div",{className:"mb-0.5",children:s.jsx("span",{className:"font-semibold",children:"Expires:"})}),s.jsx("div",{children:b})]})]}),s.jsxs("div",{className:"flex items-start justify-between gap-2 mt-auto pt-1.5 border-t border-gray-200",children:[y&&s.jsx("div",{className:"flex-shrink-0",children:s.jsx("img",{src:y,alt:"Member QR Code",className:"w-12 h-12"})}),s.jsxs("div",{className:"flex flex-col items-end min-h-12 ml-auto",children:[s.jsx("div",{className:"text-[7px] font-semibold text-gray-700 leading-tight",children:v.businessName}),(h.logoUrl||v.logoUrl)&&s.jsx("img",{src:h.logoUrl||v.logoUrl,alt:v.businessName,className:"h-8 w-auto max-w-[70px] object-contain flex-shrink-0 mt-1"})]})]})]})]})]})})}),s.jsxs("div",{className:"no-print fixed bottom-4 right-4 flex flex-col gap-2 items-end",children:[s.jsx(dt,{href:`/my-account/${e}`,children:s.jsx("a",{className:"text-sm text-primary hover:underline",children:"← Back to My account"})}),s.jsxs("button",{onClick:()=>window.print(),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg shadow-lg flex items-center gap-2",children:[s.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"})}),"Print Card"]})]})]})}function OVe(){const{publicId:e}=sa(),[,t]=cn(),[n,r]=f.useState(!0),[a,i]=f.useState(null);return f.useEffect(()=>{(async()=>
965{if(!e){i("Invalid member ID"),r(!1);return}try{const l=await Pe("GET",`/api/member-subscriptions/by-public-id/${e}`);if(l.ok){const c=await l.json();t(`/admin?clientId=${c.clientId}`)}else if(l.status===401){const c=encodeURIComponent(`/admin/member/${e}`);t(`/admin?returnUrl=${c}&message=Please log in to view member details`)}else l.status===403?(i("You don't have permission to view this member's details."),r(!1)):l.status===404?(i("Member not found. The membership card may be invalid or removed."),r(!1)):(i("Failed to load member details."),r(!1))}catch(l){console.error("Error redirecting:",l),i(l.message||"Failed to load member details."),r(!1)}})()},[e,t]),n?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full mx-auto mb-4"}),s.jsx("p",{className:"text-gray-600",children:"Loading member details..."})]})}):a?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsxs("div",{className:"text-center max-w-md mx-auto p-6",children:[s.jsx("h1",{className:"text-2xl font-bold text-red-600 mb-4",children:"Error"}),s.jsx("p",{className:"text-gray-600 mb-4",children:a}),s.jsx("button",{onClick:()=>t("/admin"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg",children:"Go to Admin"})]})}):null}const FVe=()=>{const[e]=cn(),t=f.useRef(e);f.useEffect(()=>{e!==t.current&&(ghe(e),t.current=e)},[e])};function EL({to:e}){const[,t]=cn();return f.useEffect(()=>{t(e)},[e,t]),null}function DL({url:e}){return f.useEffect(()=>{window.location.replace(e)},[e]),null}function _Ve(){FVe();const[e]=cn();return f.useEffect(()=>{window.scrollTo(0,0)},[e]),s.jsx(s.Fragment,{children:s.jsxs(Tse,{children:[s.jsx(us,{path:"/",component:kye}),s.jsx(us,{path:"/classes",component:T0}),s.jsx(us,{path:"/calendar",component:T0}),s.jsx(us,{path:"/simojo",component:()=>s.jsx(EL,{to:"/classes/simojo"})}),s.jsx(us,{path:"/impact313",component:()=>s.jsx(EL,{to:"/classes/impact313"})}),s.jsx(us,{path:"/admin",component:ek}),s.jsx(us,{path:"/admin/booking/:bookingId",component:JHe}),s.jsx(us,{path:"/admin/print-class-register",component:XHe}),s.jsx(us,{path:"/admin/membership-card/:subscriptionId",component:PL}),s.jsx(us,{path:"/card/:subscriptionId",component:PL}),s.jsx(us,{path:"/admin/member/:publicId",component:OVe}
965),s.jsx(us,{path:"/qr/:bookingId",component:VHe}),s.jsx(us,{path:"/event/:token",component:KHe}),s.jsx(us,{path:"/events/:subdomain/:eventId",component:NL}),s.jsx(us,{path:"/events/:subdomain",component:NL}),s.jsx(us,{path:"/superadmin",component:nWe}),s.jsx(us,{path:"/profile",component:rWe}),s.jsx(us,{path:"/checkout",component:hWe}),s.jsx(us,{path:"/instructor-signup",component:gWe}),s.jsx(us,{path:"/forgot-password",component:yWe}),s.jsx(us,{path:"/reset-password",component:vWe}),s.jsx(us,{path:"/auth/team-invite",component:bWe}),s.jsx(us,{path:"/verify/sent",component:wWe}),s.jsx(us,{path:"/verify/error",component:jWe}),s.jsx(us,{path:"/terms",component:KWe}),s.jsx(us,{path:"/privacy",component:GWe}),s.jsx(us,{path:"/faq",component:()=>s.jsx(DL,{url:"https://help.classta.co"})}),s.jsx(us,{path:"/help",component:()=>s.jsx(DL,{url:"https://help.classta.co"})}),s.jsx(us,{path:"/free-tools",component:vVe}),s.jsx(us,{path:"/features",component:kVe}),s.jsx(us,{path:"/pricing",component:PVe}),s.jsx(us,{path:"/moving-from-bookwhen",component:AVe}),s.jsx(us,{path:"/blog",component:lVe}),s.jsx(us,{path:"/blog/:slug",component:fVe}),s.jsx(us,{path:"/private/:token",component:NWe}),s.jsx(us,{path:"/form-update/:token",component:jVe}),s.jsx(us,{path:"/classes/:subdomain/memberships",component:mL}),s.jsx(us,{path:"/classes/:subdomain/membership-success",component:hL}),s.jsx(us,{path:"/classes/:subdomain/bundles",component:fL}),s.jsx(us,{path:"/classes/:subdomain/member-login",component:pL}),s.jsx(us,{path:"/classes/:subdomain/member-area",component:xL}),s.jsx(us,{path:"/classes/:subdomain/member-password-setup",component:gL}),s.jsx(us,{path:"/classes/:subdomain/admin",component:ek}),s.jsx(us,{path:"/classes/:subdomain",component:T0}),s.jsx(us,{path:"/cal/:subdomain/memberships",component:mL}),s.jsx(us,{path:"/cal/:subdomain/membership-success",component:hL}),s.jsx(us,{path:"/cal/:subdomain/bundles",component:fL}),s.jsx(us,{path:"/cal/:subdomain/member-login",component:pL}),s.jsx(us,{path:"/cal/:subdomain/member-area",component:xL}),s.jsx(us,{path:"/cal/:subdomain/member-password-setup",component:gL}),s.jsx(us,{path:"/cal/:subdomain/admin",component:ek}),s.jsx(us,{path:"/cal/:subdomain",component:T0}),s.jsx(us,{path:"/links/:username",component:rHe}),s.jsx(us,{path:"/my-account/:instructorPath/membership-card/:subscriptionId",component:TVe}),s.jsx(us,{path:"/my-account/:instructorPath",component:VWe}),s.jsx(us,{path:"/embed/:subdomain",component:wye}),s.jsx(us,{path:"/app-entry",component:NVe}),s.jsx(us,{path:"/app-spinner",component:CVe}),s.jsx(us,{component:SVe})]})})}function MVe(){const[e,t]=f.useState(!1),[n,r]=f.useState(!1);return f.useEffect(()=>{const a=()=>{t(window.location.pathname.startsWith("/embed/"))};a();const i=()=>a();window.addEventListener("popstate",i);const o=setInterval(a,250);return()=>{window.removeEventListener("popstate",i),clearInterval(o)}},[]),f.useEffect(()=>{const a=()=>{const l=window.location.pathname;r(l.includes("/print-class-register")||l.includes("/membership-card/")||l.startsWith("/card/"))};a();const i=()=>a();window.addEventListener("popstate",i);const o=setInterval(a,250);return()=>{window.removeEventListener("popstate",i),clearInterval(o)}},[]),f.useEffect(()=>{xhe()},[]),s.jsx(H7,{children:s.jsx(sne,{client:Ms,children:s.jsx(fce,{children:s.jsxs(doe,{children:[s.jsxs("div",{className:"min-h-screen flex flex-col pb-20 md:pb-0",children:[s.jsx("div",{className:"flex-1",children:s.jsx(_Ve,{})}),!e&&!n&&s.jsx(lce,{})]}),s.jsx(jae,{})]})})})})}console.log=()=>{},console.info=()=>{};"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/service-worker.js?v=v3").then(t=>{console.log("SW registered: ",t),t.addEventListener("updatefound",()=>{const n=t.installing;n&&n.addEventListener("statechange",()=>{n.state==="installed"&&navigator.serviceWorker.controller&&(console.log("New service worker available, reloading..."),window.location.reload())})})}).catch(t=>{console.log("SW registration failed: ",t)}),navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(n=>
965{n.scope.includes("/service-worker.js")&&!n.scope.includes("?v=")&&n.unregister()})})});e9(document.getElementById("root")).render(s.jsx(MVe,{}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.