From 76cfbf55815d328b6224f1cb8e86ddf155929cb8 Mon Sep 17 00:00:00 2001 From: Ravi Gulhane <> Date: Wed, 1 Jul 2026 16:44:19 +0530 Subject: [PATCH] 1july --- dist/assets/index-CWH8CnCf.js | 2577 ---------------- dist/assets/index-Cq3hylG7.js | 2600 +++++++++++++++++ ...ex.es-BUUHHqJX.js => index.es-D7LZE7Yc.js} | 2 +- dist/index.html | 2 +- src/app/components/AppShell.tsx | 7 + src/app/components/MainContent.tsx | 471 +-- src/app/components/NavBar.tsx | 15 +- .../components/activities/ActivitiesPage.tsx | 20 +- .../activities/ActivityDetailPage.tsx | 61 +- .../activities/ActivityEventSettings.tsx | 46 +- src/app/components/agenda/AgendaPage.tsx | 89 +- .../components/agenda/AgendaSessionPanel.tsx | 67 +- .../analytics/EventAnalyticsPage.tsx | 155 + .../components/dashboard/ChartsSection.tsx | 196 +- .../components/dashboard/EventBadgesPanel.tsx | 355 +++ src/app/components/dashboard/EventHeader.tsx | 14 +- .../dashboard/EventHomeHeaderActions.tsx | 169 ++ .../components/dashboard/EventHomeModules.tsx | 1071 +++++++ src/app/components/dashboard/FeatureCards.tsx | 379 +-- src/app/components/dashboard/QuickActions.tsx | 241 -- .../dashboard/feedbackFormModule.ts | 15 + .../dashboard/registrationFormModule.ts | 40 + src/app/components/global/GlobalStubPage.tsx | 480 +-- .../panels/BadgeDesignerPreview.tsx | 528 ++++ .../components/panels/BadgeFieldInspector.tsx | 349 +++ .../components/panels/CreateBadgePanel.tsx | 873 ++++-- .../components/panels/CreateEmailerPanel.tsx | 16 +- src/app/components/panels/CreateFormPanel.tsx | 12 +- .../components/panels/badgeBatchFormState.ts | 136 + src/app/components/panels/badgeLayout.ts | 412 +++ .../participants/ParticipantBulkActionBar.tsx | 94 + .../participants/ParticipantBulkDialogs.tsx | 142 + .../ParticipantListHeaderActions.tsx | 56 + .../ParticipantSelectAllMatching.tsx | 42 + .../participants/ParticipantTagFilters.tsx | 43 + .../participants/ParticipantsPage.tsx | 207 +- .../participants/participantTagUtils.ts | 20 + .../participants/useParticipantBulkActions.ts | 181 ++ .../participants/useParticipantSelection.ts | 56 + .../permissions/PermissionsPage.tsx | 8 +- src/app/components/quiz/AddQuestionModal.tsx | 67 +- src/app/components/quiz/AddQuizPollModal.tsx | 101 +- .../quiz/QuizMasterPresenterPanel.tsx | 362 +++ src/app/components/quiz/QuizPollsPage.tsx | 451 ++- .../components/quiz/quizQuestionMappers.ts | 63 + .../components/rewards/RewardPointsPage.tsx | 242 +- .../rewards/rewardRulesSettings.tsx | 316 ++ src/app/components/search/searchIndex.tsx | 14 +- .../whatsapp-chatbot/WhatsAppChatbotsPage.tsx | 2 +- src/app/contexts/AppNavContext.tsx | 6 + src/app/utils/micrositePublicUrl.ts | 24 + src/app/utils/quizPollPresentationUrl.ts | 13 + src/app/utils/sessionFlags.ts | 48 + src/config/constants.ts | 5 +- src/services/api/badgeBatches.ts | 33 + src/services/api/participants.ts | 31 +- src/services/api/quizPolls.ts | 19 + src/services/api/sessions.ts | 9 + src/services/api/types.ts | 42 + src/views/PublicFormView.tsx | 18 + 60 files changed, 9467 insertions(+), 4646 deletions(-) delete mode 100644 dist/assets/index-CWH8CnCf.js create mode 100644 dist/assets/index-Cq3hylG7.js rename dist/assets/{index.es-BUUHHqJX.js => index.es-D7LZE7Yc.js} (99%) create mode 100644 src/app/components/analytics/EventAnalyticsPage.tsx create mode 100644 src/app/components/dashboard/EventBadgesPanel.tsx create mode 100644 src/app/components/dashboard/EventHomeHeaderActions.tsx create mode 100644 src/app/components/dashboard/EventHomeModules.tsx delete mode 100644 src/app/components/dashboard/QuickActions.tsx create mode 100644 src/app/components/dashboard/feedbackFormModule.ts create mode 100644 src/app/components/dashboard/registrationFormModule.ts create mode 100644 src/app/components/panels/BadgeDesignerPreview.tsx create mode 100644 src/app/components/panels/BadgeFieldInspector.tsx create mode 100644 src/app/components/panels/badgeBatchFormState.ts create mode 100644 src/app/components/panels/badgeLayout.ts create mode 100644 src/app/components/participants/ParticipantBulkActionBar.tsx create mode 100644 src/app/components/participants/ParticipantBulkDialogs.tsx create mode 100644 src/app/components/participants/ParticipantListHeaderActions.tsx create mode 100644 src/app/components/participants/ParticipantSelectAllMatching.tsx create mode 100644 src/app/components/participants/ParticipantTagFilters.tsx create mode 100644 src/app/components/participants/participantTagUtils.ts create mode 100644 src/app/components/participants/useParticipantBulkActions.ts create mode 100644 src/app/components/participants/useParticipantSelection.ts create mode 100644 src/app/components/quiz/QuizMasterPresenterPanel.tsx create mode 100644 src/app/components/quiz/quizQuestionMappers.ts create mode 100644 src/app/components/rewards/rewardRulesSettings.tsx create mode 100644 src/app/utils/micrositePublicUrl.ts create mode 100644 src/app/utils/quizPollPresentationUrl.ts create mode 100644 src/app/utils/sessionFlags.ts diff --git a/dist/assets/index-CWH8CnCf.js b/dist/assets/index-CWH8CnCf.js deleted file mode 100644 index 583cc8cf..00000000 --- a/dist/assets/index-CWH8CnCf.js +++ /dev/null @@ -1,2577 +0,0 @@ -var mZ=Object.defineProperty;var vZ=(e,t,r)=>t in e?mZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var yn=(e,t,r)=>vZ(e,typeof t!="symbol"?t+"":t,r);function yZ(e,t){for(var r=0;rn[o]})}}}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 o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(o){if(o.ep)return;o.ep=!0;const a=r(o);fetch(o.href,a)}})();var h1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function un(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kj={exports:{}},oy={},_j={exports:{}},Wr={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var NO;function xZ(){if(NO)return Wr;NO=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;function h(B){return B===null||typeof B!="object"?null:(B=f&&B[f]||B["@@iterator"],typeof B=="function"?B:null)}var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,m={};function x(B,M,$){this.props=B,this.context=M,this.refs=m,this.updater=$||p}x.prototype.isReactComponent={},x.prototype.setState=function(B,M){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,M,"setState")},x.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function b(){}b.prototype=x.prototype;function w(B,M,$){this.props=B,this.context=M,this.refs=m,this.updater=$||p}var k=w.prototype=new b;k.constructor=w,y(k,x.prototype),k.isPureReactComponent=!0;var S=Array.isArray,_=Object.prototype.hasOwnProperty,P={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function T(B,M,$){var q,Y={},K=null,G=null;if(M!=null)for(q in M.ref!==void 0&&(G=M.ref),M.key!==void 0&&(K=""+M.key),M)_.call(M,q)&&!O.hasOwnProperty(q)&&(Y[q]=M[q]);var re=arguments.length-2;if(re===1)Y.children=$;else if(1>>1,M=U[B];if(0>>1;B<$;){var q=2*(B+1)-1,Y=U[q],K=q+1,G=U[K];if(0>o(Y,H))Ko(G,Y)?(U[B]=G,U[K]=H,B=K):(U[B]=Y,U[q]=H,B=q);else if(Ko(G,H))U[B]=G,U[K]=H,B=K;else break e}}return ee}function o(U,ee){var H=U.sortIndex-ee.sortIndex;return H!==0?H:U.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,y=!1,m=!1,x=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(U){for(var ee=r(u);ee!==null;){if(ee.callback===null)n(u);else if(ee.startTime<=U)n(u),ee.sortIndex=ee.expirationTime,t(c,ee);else break;ee=r(u)}}function S(U){if(m=!1,k(U),!y)if(r(c)!==null)y=!0,V(_);else{var ee=r(u);ee!==null&&Q(S,ee.startTime-U)}}function _(U,ee){y=!1,m&&(m=!1,b(T),T=-1),p=!0;var H=h;try{for(k(ee),f=r(c);f!==null&&(!(f.expirationTime>ee)||U&&!E());){var B=f.callback;if(typeof B=="function"){f.callback=null,h=f.priorityLevel;var M=B(f.expirationTime<=ee);ee=e.unstable_now(),typeof M=="function"?f.callback=M:f===r(c)&&n(c),k(ee)}else n(c);f=r(c)}if(f!==null)var $=!0;else{var q=r(u);q!==null&&Q(S,q.startTime-ee),$=!1}return $}finally{f=null,h=H,p=!1}}var P=!1,O=null,T=-1,R=5,I=-1;function E(){return!(e.unstable_now()-IU||125B?(U.sortIndex=H,t(u,U),r(c)===null&&U===r(u)&&(m?(b(T),T=-1):m=!0,Q(S,H-B))):(U.sortIndex=M,t(c,U),y||p||(y=!0,V(_))),U},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(U){var ee=h;return function(){var H=h;h=ee;try{return U.apply(this,arguments)}finally{h=H}}}})(Aj)),Aj}var DO;function jZ(){return DO||(DO=1,Ej.exports=SZ()),Ej.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var zO;function kZ(){if(zO)return ns;zO=1;var e=_w(),t=jZ();function r(g){for(var v="https://reactjs.org/docs/error-decoder.html?invariant="+g,C=1;C"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,u=/^[: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]*$/,d={},f={};function h(g){return c.call(f,g)?!0:c.call(d,g)?!1:u.test(g)?f[g]=!0:(d[g]=!0,!1)}function p(g,v,C,D){if(C!==null&&C.type===0)return!1;switch(typeof v){case"function":case"symbol":return!0;case"boolean":return D?!1:C!==null?!C.acceptsBooleans:(g=g.toLowerCase().slice(0,5),g!=="data-"&&g!=="aria-");default:return!1}}function y(g,v,C,D){if(v===null||typeof v>"u"||p(g,v,C,D))return!0;if(D)return!1;if(C!==null)switch(C.type){case 3:return!v;case 4:return v===!1;case 5:return isNaN(v);case 6:return isNaN(v)||1>v}return!1}function m(g,v,C,D,Z,ne,he){this.acceptsBooleans=v===2||v===3||v===4,this.attributeName=D,this.attributeNamespace=Z,this.mustUseProperty=C,this.propertyName=g,this.type=v,this.sanitizeURL=ne,this.removeEmptyString=he}var x={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(g){x[g]=new m(g,0,!1,g,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(g){var v=g[0];x[v]=new m(v,1,!1,g[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(g){x[g]=new m(g,2,!1,g.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(g){x[g]=new m(g,2,!1,g,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(g){x[g]=new m(g,3,!1,g.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(g){x[g]=new m(g,3,!0,g,null,!1,!1)}),["capture","download"].forEach(function(g){x[g]=new m(g,4,!1,g,null,!1,!1)}),["cols","rows","size","span"].forEach(function(g){x[g]=new m(g,6,!1,g,null,!1,!1)}),["rowSpan","start"].forEach(function(g){x[g]=new m(g,5,!1,g.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function w(g){return g[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(g){var v=g.replace(b,w);x[v]=new m(v,1,!1,g,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(g){var v=g.replace(b,w);x[v]=new m(v,1,!1,g,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(g){var v=g.replace(b,w);x[v]=new m(v,1,!1,g,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(g){x[g]=new m(g,1,!1,g.toLowerCase(),null,!1,!1)}),x.xlinkHref=new m("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(g){x[g]=new m(g,1,!1,g.toLowerCase(),null,!0,!0)});function k(g,v,C,D){var Z=x.hasOwnProperty(v)?x[v]:null;(Z!==null?Z.type!==0:D||!(2Re||Z[he]!==ne[Re]){var Ue=` -`+Z[he].replace(" at new "," at ");return g.displayName&&Ue.includes("")&&(Ue=Ue.replace("",g.displayName)),Ue}while(1<=he&&0<=Re);break}}}finally{$=!1,Error.prepareStackTrace=C}return(g=g?g.displayName||g.name:"")?M(g):""}function Y(g){switch(g.tag){case 5:return M(g.type);case 16:return M("Lazy");case 13:return M("Suspense");case 19:return M("SuspenseList");case 0:case 2:case 15:return g=q(g.type,!1),g;case 11:return g=q(g.type.render,!1),g;case 1:return g=q(g.type,!0),g;default:return""}}function K(g){if(g==null)return null;if(typeof g=="function")return g.displayName||g.name||null;if(typeof g=="string")return g;switch(g){case O:return"Fragment";case P:return"Portal";case R:return"Profiler";case T:return"StrictMode";case F:return"Suspense";case L:return"SuspenseList"}if(typeof g=="object")switch(g.$$typeof){case E:return(g.displayName||"Context")+".Consumer";case I:return(g._context.displayName||"Context")+".Provider";case A:var v=g.render;return g=g.displayName,g||(g=v.displayName||v.name||"",g=g!==""?"ForwardRef("+g+")":"ForwardRef"),g;case z:return v=g.displayName||null,v!==null?v:K(g.type)||"Memo";case V:v=g._payload,g=g._init;try{return K(g(v))}catch{}}return null}function G(g){var v=g.type;switch(g.tag){case 24:return"Cache";case 9:return(v.displayName||"Context")+".Consumer";case 10:return(v._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return g=v.render,g=g.displayName||g.name||"",v.displayName||(g!==""?"ForwardRef("+g+")":"ForwardRef");case 7:return"Fragment";case 5:return v;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K(v);case 8:return v===T?"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 v=="function")return v.displayName||v.name||null;if(typeof v=="string")return v}return null}function re(g){switch(typeof g){case"boolean":case"number":case"string":case"undefined":return g;case"object":return g;default:return""}}function J(g){var v=g.type;return(g=g.nodeName)&&g.toLowerCase()==="input"&&(v==="checkbox"||v==="radio")}function ae(g){var v=J(g)?"checked":"value",C=Object.getOwnPropertyDescriptor(g.constructor.prototype,v),D=""+g[v];if(!g.hasOwnProperty(v)&&typeof C<"u"&&typeof C.get=="function"&&typeof C.set=="function"){var Z=C.get,ne=C.set;return Object.defineProperty(g,v,{configurable:!0,get:function(){return Z.call(this)},set:function(he){D=""+he,ne.call(this,he)}}),Object.defineProperty(g,v,{enumerable:C.enumerable}),{getValue:function(){return D},setValue:function(he){D=""+he},stopTracking:function(){g._valueTracker=null,delete g[v]}}}}function le(g){g._valueTracker||(g._valueTracker=ae(g))}function me(g){if(!g)return!1;var v=g._valueTracker;if(!v)return!0;var C=v.getValue(),D="";return g&&(D=J(g)?g.checked?"true":"false":g.value),g=D,g!==C?(v.setValue(g),!0):!1}function Oe(g){if(g=g||(typeof document<"u"?document:void 0),typeof g>"u")return null;try{return g.activeElement||g.body}catch{return g.body}}function we(g,v){var C=v.checked;return H({},v,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:C??g._wrapperState.initialChecked})}function ie(g,v){var C=v.defaultValue==null?"":v.defaultValue,D=v.checked!=null?v.checked:v.defaultChecked;C=re(v.value!=null?v.value:C),g._wrapperState={initialChecked:D,initialValue:C,controlled:v.type==="checkbox"||v.type==="radio"?v.checked!=null:v.value!=null}}function Me(g,v){v=v.checked,v!=null&&k(g,"checked",v,!1)}function ke(g,v){Me(g,v);var C=re(v.value),D=v.type;if(C!=null)D==="number"?(C===0&&g.value===""||g.value!=C)&&(g.value=""+C):g.value!==""+C&&(g.value=""+C);else if(D==="submit"||D==="reset"){g.removeAttribute("value");return}v.hasOwnProperty("value")?fe(g,v.type,C):v.hasOwnProperty("defaultValue")&&fe(g,v.type,re(v.defaultValue)),v.checked==null&&v.defaultChecked!=null&&(g.defaultChecked=!!v.defaultChecked)}function se(g,v,C){if(v.hasOwnProperty("value")||v.hasOwnProperty("defaultValue")){var D=v.type;if(!(D!=="submit"&&D!=="reset"||v.value!==void 0&&v.value!==null))return;v=""+g._wrapperState.initialValue,C||v===g.value||(g.value=v),g.defaultValue=v}C=g.name,C!==""&&(g.name=""),g.defaultChecked=!!g._wrapperState.initialChecked,C!==""&&(g.name=C)}function fe(g,v,C){(v!=="number"||Oe(g.ownerDocument)!==g)&&(C==null?g.defaultValue=""+g._wrapperState.initialValue:g.defaultValue!==""+C&&(g.defaultValue=""+C))}var Ie=Array.isArray;function ce(g,v,C,D){if(g=g.options,v){v={};for(var Z=0;Z"+v.valueOf().toString()+"",v=Ot.firstChild;g.firstChild;)g.removeChild(g.firstChild);for(;v.firstChild;)g.appendChild(v.firstChild)}});function Ae(g,v){if(v){var C=g.firstChild;if(C&&C===g.lastChild&&C.nodeType===3){C.nodeValue=v;return}}g.textContent=v}var Te={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},wt=["Webkit","ms","Moz","O"];Object.keys(Te).forEach(function(g){wt.forEach(function(v){v=v+g.charAt(0).toUpperCase()+g.substring(1),Te[v]=Te[g]})});function ft(g,v,C){return v==null||typeof v=="boolean"||v===""?"":C||typeof v!="number"||v===0||Te.hasOwnProperty(g)&&Te[g]?(""+v).trim():v+"px"}function Pt(g,v){g=g.style;for(var C in v)if(v.hasOwnProperty(C)){var D=C.indexOf("--")===0,Z=ft(C,v[C],D);C==="float"&&(C="cssFloat"),D?g.setProperty(C,Z):g[C]=Z}}var At=H({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 Ht(g,v){if(v){if(At[g]&&(v.children!=null||v.dangerouslySetInnerHTML!=null))throw Error(r(137,g));if(v.dangerouslySetInnerHTML!=null){if(v.children!=null)throw Error(r(60));if(typeof v.dangerouslySetInnerHTML!="object"||!("__html"in v.dangerouslySetInnerHTML))throw Error(r(61))}if(v.style!=null&&typeof v.style!="object")throw Error(r(62))}}function Se(g,v){if(g.indexOf("-")===-1)return typeof v.is=="string";switch(g){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 ct=null;function gt(g){return g=g.target||g.srcElement||window,g.correspondingUseElement&&(g=g.correspondingUseElement),g.nodeType===3?g.parentNode:g}var We=null,Pe=null,rt=null;function Ze(g){if(g=Vd(g)){if(typeof We!="function")throw Error(r(280));var v=g.stateNode;v&&(v=fp(v),We(g.stateNode,g.type,v))}}function pe(g){Pe?rt?rt.push(g):rt=[g]:Pe=g}function xe(){if(Pe){var g=Pe,v=rt;if(rt=Pe=null,Ze(g),v)for(g=0;g>>=0,g===0?32:31-(Ad(g)/Tv|0)|0}var du=64,wa=4194304;function el(g){switch(g&-g){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 g&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return g&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return g}}function bc(g,v){var C=g.pendingLanes;if(C===0)return 0;var D=0,Z=g.suspendedLanes,ne=g.pingedLanes,he=C&268435455;if(he!==0){var Re=he&~Z;Re!==0?D=el(Re):(ne&=he,ne!==0&&(D=el(ne)))}else he=C&~Z,he!==0?D=el(he):ne!==0&&(D=el(ne));if(D===0)return 0;if(v!==0&&v!==D&&(v&Z)===0&&(Z=D&-D,ne=v&-v,Z>=ne||Z===16&&(ne&4194240)!==0))return v;if((D&4)!==0&&(D|=C&16),v=g.entangledLanes,v!==0)for(g=g.entanglements,v&=D;0C;C++)v.push(g);return v}function fu(g,v,C){g.pendingLanes|=v,v!==536870912&&(g.suspendedLanes=0,g.pingedLanes=0),g=g.eventTimes,v=31-yi(v),g[v]=C}function Pv(g,v){var C=g.pendingLanes&~v;g.pendingLanes=v,g.suspendedLanes=0,g.pingedLanes=0,g.expiredLanes&=v,g.mutableReadLanes&=v,g.entangledLanes&=v,v=g.entanglements;var D=g.eventTimes;for(g=g.expirationTimes;0=Ni),rp=" ",ja=!1;function _c(g,v){switch(g){case"keyup":return tp.indexOf(v.keyCode)!==-1;case"keydown":return v.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Md(g){return g=g.detail,typeof g=="object"&&"data"in g?g.data:null}var Cs=!1;function _u(g,v){switch(g){case"compositionend":return Md(v);case"keypress":return v.which!==32?null:(ja=!0,rp);case"textInput":return g=v.data,g===rp&&ja?null:g;default:return null}}function np(g,v){if(Cs)return g==="compositionend"||!Ya&&_c(g,v)?(g=vu(),kc=jc=Ha=null,Cs=!1,g):null;switch(g){case"paste":return null;case"keypress":if(!(v.ctrlKey||v.altKey||v.metaKey)||v.ctrlKey&&v.altKey){if(v.char&&1=v)return{node:C,offset:v-g};g=D}e:{for(;C;){if(C.nextSibling){C=C.nextSibling;break e}C=C.parentNode}C=void 0}C=no(C)}}function kn(g,v){return g&&v?g===v?!0:g&&g.nodeType===3?!1:v&&v.nodeType===3?kn(g,v.parentNode):"contains"in g?g.contains(v):g.compareDocumentPosition?!!(g.compareDocumentPosition(v)&16):!1:!1}function _n(){for(var g=window,v=Oe();v instanceof g.HTMLIFrameElement;){try{var C=typeof v.contentWindow.location.href=="string"}catch{C=!1}if(C)g=v.contentWindow;else break;v=Oe(g.document)}return v}function ei(g){var v=g&&g.nodeName&&g.nodeName.toLowerCase();return v&&(v==="input"&&(g.type==="text"||g.type==="search"||g.type==="tel"||g.type==="url"||g.type==="password")||v==="textarea"||g.contentEditable==="true")}function Ri(g){var v=_n(),C=g.focusedElem,D=g.selectionRange;if(v!==C&&C&&C.ownerDocument&&kn(C.ownerDocument.documentElement,C)){if(D!==null&&ei(C)){if(v=D.start,g=D.end,g===void 0&&(g=v),"selectionStart"in C)C.selectionStart=v,C.selectionEnd=Math.min(g,C.value.length);else if(g=(v=C.ownerDocument||document)&&v.defaultView||window,g.getSelection){g=g.getSelection();var Z=C.textContent.length,ne=Math.min(D.start,Z);D=D.end===void 0?ne:Math.min(D.end,Z),!g.extend&&ne>D&&(Z=D,D=ne,ne=Z),Z=Es(C,ne);var he=Es(C,D);Z&&he&&(g.rangeCount!==1||g.anchorNode!==Z.node||g.anchorOffset!==Z.offset||g.focusNode!==he.node||g.focusOffset!==he.offset)&&(v=v.createRange(),v.setStart(Z.node,Z.offset),g.removeAllRanges(),ne>D?(g.addRange(v),g.extend(he.node,he.offset)):(v.setEnd(he.node,he.offset),g.addRange(v)))}}for(v=[],g=C;g=g.parentNode;)g.nodeType===1&&v.push({element:g,left:g.scrollLeft,top:g.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C=document.documentMode,ll=null,Ac=null,Tc=null,Xh=!1;function Lv(g,v,C){var D=C.window===C?C.document:C.nodeType===9?C:C.ownerDocument;Xh||ll==null||ll!==Oe(D)||(D=ll,"selectionStart"in D&&ei(D)?D={start:D.selectionStart,end:D.selectionEnd}:(D=(D.ownerDocument&&D.ownerDocument.defaultView||window).getSelection(),D={anchorNode:D.anchorNode,anchorOffset:D.anchorOffset,focusNode:D.focusNode,focusOffset:D.focusOffset}),Tc&&sl(Tc,D)||(Tc=D,D=eg(Ac,"onSelect"),0Bl||(g.current=Vv[Bl],Vv[Bl]=null,Bl--)}function mn(g,v){Bl++,Vv[Bl]=g.current,g.current=v}var Ic={},io=As(Ic),ta=As(!1),Lu=Ic;function Yd(g,v){var C=g.type.contextTypes;if(!C)return Ic;var D=g.stateNode;if(D&&D.__reactInternalMemoizedUnmaskedChildContext===v)return D.__reactInternalMemoizedMaskedChildContext;var Z={},ne;for(ne in C)Z[ne]=v[ne];return D&&(g=g.stateNode,g.__reactInternalMemoizedUnmaskedChildContext=v,g.__reactInternalMemoizedMaskedChildContext=Z),Z}function ra(g){return g=g.childContextTypes,g!=null}function rg(){fn(ta),fn(io)}function zb(g,v,C){if(io.current!==Ic)throw Error(r(168));mn(io,v),mn(ta,C)}function Yv(g,v,C){var D=g.stateNode;if(v=v.childContextTypes,typeof D.getChildContext!="function")return C;D=D.getChildContext();for(var Z in D)if(!(Z in v))throw Error(r(108,G(g)||"Unknown",Z));return H({},C,D)}function Fu(g){return g=(g=g.stateNode)&&g.__reactInternalMemoizedMergedChildContext||Ic,Lu=io.current,mn(io,g),mn(ta,ta.current),!0}function Bb(g,v,C){var D=g.stateNode;if(!D)throw Error(r(169));C?(g=Yv(g,v,Lu),D.__reactInternalMemoizedMergedChildContext=g,fn(ta),fn(io),mn(io,g)):fn(ta),mn(ta,C)}var Wl=null,pp=!1,N=!1;function W(g){Wl===null?Wl=[g]:Wl.push(g)}function te(g){pp=!0,W(g)}function oe(){if(!N&&Wl!==null){N=!0;var g=0,v=Fr;try{var C=Wl;for(Fr=1;g>=he,Z-=he,it=1<<32-yi(v)+Z|C<Cr?(Eo=mr,mr=null):Eo=mr.sibling;var on=Nt(ot,mr,st[Cr],Dt);if(on===null){mr===null&&(mr=Eo);break}g&&mr&&on.alternate===null&&v(ot,mr),Ye=ne(on,Ye,Cr),gr===null?cr=on:gr.sibling=on,gr=on,mr=Eo}if(Cr===st.length)return C(ot,mr),jt&&He(ot,Cr),cr;if(mr===null){for(;CrCr?(Eo=mr,mr=null):Eo=mr.sibling;var of=Nt(ot,mr,on.value,Dt);if(of===null){mr===null&&(mr=Eo);break}g&&mr&&of.alternate===null&&v(ot,mr),Ye=ne(of,Ye,Cr),gr===null?cr=of:gr.sibling=of,gr=of,mr=Eo}if(on.done)return C(ot,mr),jt&&He(ot,Cr),cr;if(mr===null){for(;!on.done;Cr++,on=st.next())on=Ft(ot,on.value,Dt),on!==null&&(Ye=ne(on,Ye,Cr),gr===null?cr=on:gr.sibling=on,gr=on);return jt&&He(ot,Cr),cr}for(mr=D(ot,mr);!on.done;Cr++,on=st.next())on=Vt(mr,ot,Cr,on.value,Dt),on!==null&&(g&&on.alternate!==null&&mr.delete(on.key===null?Cr:on.key),Ye=ne(on,Ye,Cr),gr===null?cr=on:gr.sibling=on,gr=on);return g&&mr.forEach(function(gZ){return v(ot,gZ)}),jt&&He(ot,Cr),cr}function Mi(ot,Ye,st,Dt){if(typeof st=="object"&&st!==null&&st.type===O&&st.key===null&&(st=st.props.children),typeof st=="object"&&st!==null){switch(st.$$typeof){case _:e:{for(var cr=st.key,gr=Ye;gr!==null;){if(gr.key===cr){if(cr=st.type,cr===O){if(gr.tag===7){C(ot,gr.sibling),Ye=Z(gr,st.props.children),Ye.return=ot,ot=Ye;break e}}else if(gr.elementType===cr||typeof cr=="object"&&cr!==null&&cr.$$typeof===V&&In(cr)===gr.type){C(ot,gr.sibling),Ye=Z(gr,st.props),Ye.ref=br(ot,gr,st),Ye.return=ot,ot=Ye;break e}C(ot,gr);break}else v(ot,gr);gr=gr.sibling}st.type===O?(Ye=wp(st.props.children,ot.mode,Dt,st.key),Ye.return=ot,ot=Ye):(Dt=a1(st.type,st.key,st.props,null,ot.mode,Dt),Dt.ref=br(ot,Ye,st),Dt.return=ot,ot=Dt)}return he(ot);case P:e:{for(gr=st.key;Ye!==null;){if(Ye.key===gr)if(Ye.tag===4&&Ye.stateNode.containerInfo===st.containerInfo&&Ye.stateNode.implementation===st.implementation){C(ot,Ye.sibling),Ye=Z(Ye,st.children||[]),Ye.return=ot,ot=Ye;break e}else{C(ot,Ye);break}else v(ot,Ye);Ye=Ye.sibling}Ye=xj(st,ot.mode,Dt),Ye.return=ot,ot=Ye}return he(ot);case V:return gr=st._init,Mi(ot,Ye,gr(st._payload),Dt)}if(Ie(st))return rr(ot,Ye,st,Dt);if(ee(st))return ar(ot,Ye,st,Dt);Mr(ot,st)}return typeof st=="string"&&st!==""||typeof st=="number"?(st=""+st,Ye!==null&&Ye.tag===6?(C(ot,Ye.sibling),Ye=Z(Ye,st),Ye.return=ot,ot=Ye):(C(ot,Ye),Ye=yj(st,ot.mode,Dt),Ye.return=ot,ot=Ye),he(ot)):C(ot,Ye)}return Mi}var Si=Vi(!0),ti=Vi(!1),Li=As(null),Yi=null,qn=null,Hr=null;function en(){Hr=qn=Yi=null}function $n(g){var v=Li.current;fn(Li),g._currentValue=v}function tn(g,v,C){for(;g!==null;){var D=g.alternate;if((g.childLanes&v)!==v?(g.childLanes|=v,D!==null&&(D.childLanes|=v)):D!==null&&(D.childLanes&v)!==v&&(D.childLanes|=v),g===C)break;g=g.return}}function si(g,v){Yi=g,Hr=qn=null,g=g.dependencies,g!==null&&g.firstContext!==null&&((g.lanes&v)!==0&&(es=!0),g.firstContext=null)}function li(g){var v=g._currentValue;if(Hr!==g)if(g={context:g,memoizedValue:v,next:null},qn===null){if(Yi===null)throw Error(r(308));qn=g,Yi.dependencies={lanes:0,firstContext:g}}else qn=qn.next=g;return v}var En=null;function jo(g){En===null?En=[g]:En.push(g)}function vn(g,v,C,D){var Z=v.interleaved;return Z===null?(C.next=C,jo(v)):(C.next=Z.next,Z.next=C),v.interleaved=C,An(g,D)}function An(g,v){g.lanes|=v;var C=g.alternate;for(C!==null&&(C.lanes|=v),C=g,g=g.return;g!==null;)g.childLanes|=v,C=g.alternate,C!==null&&(C.childLanes|=v),C=g,g=g.return;return C.tag===3?C.stateNode:null}var ji=!1;function oo(g){g.updateQueue={baseState:g.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function na(g,v){g=g.updateQueue,v.updateQueue===g&&(v.updateQueue={baseState:g.baseState,firstBaseUpdate:g.firstBaseUpdate,lastBaseUpdate:g.lastBaseUpdate,shared:g.shared,effects:g.effects})}function fi(g,v){return{eventTime:g,lane:v,tag:0,payload:null,callback:null,next:null}}function pi(g,v,C){var D=g.updateQueue;if(D===null)return null;if(D=D.shared,(rn&2)!==0){var Z=D.pending;return Z===null?v.next=v:(v.next=Z.next,Z.next=v),D.pending=v,An(g,C)}return Z=D.interleaved,Z===null?(v.next=v,jo(D)):(v.next=Z.next,Z.next=v),D.interleaved=v,An(g,C)}function ko(g,v,C){if(v=v.updateQueue,v!==null&&(v=v.shared,(C&4194240)!==0)){var D=v.lanes;D&=g.pendingLanes,C|=D,v.lanes=C,Xf(g,C)}}function Tn(g,v){var C=g.updateQueue,D=g.alternate;if(D!==null&&(D=D.updateQueue,C===D)){var Z=null,ne=null;if(C=C.firstBaseUpdate,C!==null){do{var he={eventTime:C.eventTime,lane:C.lane,tag:C.tag,payload:C.payload,callback:C.callback,next:null};ne===null?Z=ne=he:ne=ne.next=he,C=C.next}while(C!==null);ne===null?Z=ne=v:ne=ne.next=v}else Z=ne=v;C={baseState:D.baseState,firstBaseUpdate:Z,lastBaseUpdate:ne,shared:D.shared,effects:D.effects},g.updateQueue=C;return}g=C.lastBaseUpdate,g===null?C.firstBaseUpdate=v:g.next=v,C.lastBaseUpdate=v}function _o(g,v,C,D){var Z=g.updateQueue;ji=!1;var ne=Z.firstBaseUpdate,he=Z.lastBaseUpdate,Re=Z.shared.pending;if(Re!==null){Z.shared.pending=null;var Ue=Re,ut=Ue.next;Ue.next=null,he===null?ne=ut:he.next=ut,he=Ue;var Rt=g.alternate;Rt!==null&&(Rt=Rt.updateQueue,Re=Rt.lastBaseUpdate,Re!==he&&(Re===null?Rt.firstBaseUpdate=ut:Re.next=ut,Rt.lastBaseUpdate=Ue))}if(ne!==null){var Ft=Z.baseState;he=0,Rt=ut=Ue=null,Re=ne;do{var Nt=Re.lane,Vt=Re.eventTime;if((D&Nt)===Nt){Rt!==null&&(Rt=Rt.next={eventTime:Vt,lane:0,tag:Re.tag,payload:Re.payload,callback:Re.callback,next:null});e:{var rr=g,ar=Re;switch(Nt=v,Vt=C,ar.tag){case 1:if(rr=ar.payload,typeof rr=="function"){Ft=rr.call(Vt,Ft,Nt);break e}Ft=rr;break e;case 3:rr.flags=rr.flags&-65537|128;case 0:if(rr=ar.payload,Nt=typeof rr=="function"?rr.call(Vt,Ft,Nt):rr,Nt==null)break e;Ft=H({},Ft,Nt);break e;case 2:ji=!0}}Re.callback!==null&&Re.lane!==0&&(g.flags|=64,Nt=Z.effects,Nt===null?Z.effects=[Re]:Nt.push(Re))}else Vt={eventTime:Vt,lane:Nt,tag:Re.tag,payload:Re.payload,callback:Re.callback,next:null},Rt===null?(ut=Rt=Vt,Ue=Ft):Rt=Rt.next=Vt,he|=Nt;if(Re=Re.next,Re===null){if(Re=Z.shared.pending,Re===null)break;Nt=Re,Re=Nt.next,Nt.next=null,Z.lastBaseUpdate=Nt,Z.shared.pending=null}}while(!0);if(Rt===null&&(Ue=Ft),Z.baseState=Ue,Z.firstBaseUpdate=ut,Z.lastBaseUpdate=Rt,v=Z.shared.interleaved,v!==null){Z=v;do he|=Z.lane,Z=Z.next;while(Z!==v)}else ne===null&&(Z.shared.lanes=0);vp|=he,g.lanes=he,g.memoizedState=Ft}}function Ja(g,v,C){if(g=v.effects,v.effects=null,g!==null)for(v=0;vC?C:4,g(!0);var D=ig.transition;ig.transition={};try{g(!1),v()}finally{Fr=C,ig.transition=D}}function L8(){return _a().memoizedState}function zX(g,v,C){var D=tf(g);if(C={lane:D,action:C,hasEagerState:!1,eagerState:null,next:null},F8(g))M8(v,C);else if(C=vn(g,v,C,D),C!==null){var Z=Aa();Gl(C,g,D,Z),D8(C,v,D)}}function BX(g,v,C){var D=tf(g),Z={lane:D,action:C,hasEagerState:!1,eagerState:null,next:null};if(F8(g))M8(v,Z);else{var ne=g.alternate;if(g.lanes===0&&(ne===null||ne.lanes===0)&&(ne=v.lastRenderedReducer,ne!==null))try{var he=v.lastRenderedState,Re=ne(he,C);if(Z.hasEagerState=!0,Z.eagerState=Re,Hi(Re,he)){var Ue=v.interleaved;Ue===null?(Z.next=Z,jo(v)):(Z.next=Ue.next,Ue.next=Z),v.interleaved=Z;return}}catch{}finally{}C=vn(g,v,Z,D),C!==null&&(Z=Aa(),Gl(C,g,D,Z),D8(C,v,D))}}function F8(g){var v=g.alternate;return g===Un||v!==null&&v===Un}function M8(g,v){$l=Kd=!0;var C=g.pending;C===null?v.next=v:(v.next=C.next,C.next=v),g.pending=v}function D8(g,v,C){if((C&4194240)!==0){var D=v.lanes;D&=g.pendingLanes,C|=D,v.lanes=C,Xf(g,C)}}var Vb={readContext:li,useCallback:Fi,useContext:Fi,useEffect:Fi,useImperativeHandle:Fi,useInsertionEffect:Fi,useLayoutEffect:Fi,useMemo:Fi,useReducer:Fi,useRef:Fi,useState:Fi,useDebugValue:Fi,useDeferredValue:Fi,useTransition:Fi,useMutableSource:Fi,useSyncExternalStore:Fi,useId:Fi,unstable_isNewReconciler:!1},WX={readContext:li,useCallback:function(g,v){return Os().memoizedState=[g,v===void 0?null:v],g},useContext:li,useEffect:lg,useImperativeHandle:function(g,v,C){return C=C!=null?C.concat([g]):null,Is(4194308,4,dg.bind(null,v,g),C)},useLayoutEffect:function(g,v){return Is(4194308,4,g,v)},useInsertionEffect:function(g,v){return Is(4,2,g,v)},useMemo:function(g,v){var C=Os();return v=v===void 0?null:v,g=g(),C.memoizedState=[g,v],g},useReducer:function(g,v,C){var D=Os();return v=C!==void 0?C(v):v,D.memoizedState=D.baseState=v,g={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:v},D.queue=g,g=g.dispatch=zX.bind(null,Un,g),[D.memoizedState,g]},useRef:function(g){var v=Os();return g={current:g},v.memoizedState=g},useState:mp,useDebugValue:HS,useDeferredValue:function(g){return Os().memoizedState=g},useTransition:function(){var g=mp(!1),v=g[0];return g=DX.bind(null,g[1]),Os().memoizedState=g,[v,g]},useMutableSource:function(){},useSyncExternalStore:function(g,v,C){var D=Un,Z=Os();if(jt){if(C===void 0)throw Error(r(407));C=C()}else{if(C=v(),Co===null)throw Error(r(349));(fl&30)!==0||$b(D,v,C)}Z.memoizedState=C;var ne={value:C,getSnapshot:v};return Z.queue=ne,lg(Ub.bind(null,D,ne,g),[g]),D.flags|=2048,Ca(9,Zv.bind(null,D,ne,C,v),void 0,null),C},useId:function(){var g=Os(),v=Co.identifierPrefix;if(jt){var C=Ee,D=it;C=(D&~(1<<32-yi(D)-1)).toString(32)+C,v=":"+v+"R"+C,C=Qd++,0<\/script>",g=g.removeChild(g.firstChild)):typeof D.is=="string"?g=he.createElement(C,{is:D.is}):(g=he.createElement(C),C==="select"&&(he=g,D.multiple?he.multiple=!0:D.size&&(he.size=D.size))):g=he.createElementNS(g,C),g[ul]=v,g[Hd]=D,iO(g,v,!1,!1),v.stateNode=g;e:{switch(he=Se(C,D),C){case"dialog":Cn("cancel",g),Cn("close",g),Z=D;break;case"iframe":case"object":case"embed":Cn("load",g),Z=D;break;case"video":case"audio":for(Z=0;Zgg&&(v.flags|=128,D=!0,Jv(ne,!1),v.lanes=4194304)}else{if(!D)if(g=Ps(he),g!==null){if(v.flags|=128,D=!0,C=g.updateQueue,C!==null&&(v.updateQueue=C,v.flags|=4),Jv(ne,!0),ne.tail===null&&ne.tailMode==="hidden"&&!he.alternate&&!jt)return ia(v),null}else 2*Gr()-ne.renderingStartTime>gg&&C!==1073741824&&(v.flags|=128,D=!0,Jv(ne,!1),v.lanes=4194304);ne.isBackwards?(he.sibling=v.child,v.child=he):(C=ne.last,C!==null?C.sibling=he:v.child=he,ne.last=he)}return ne.tail!==null?(v=ne.tail,ne.rendering=v,ne.tail=v.sibling,ne.renderingStartTime=Gr(),v.sibling=null,C=Mn.current,mn(Mn,D?C&1|2:C&1),v):(ia(v),null);case 22:case 23:return gj(),D=v.memoizedState!==null,g!==null&&g.memoizedState!==null!==D&&(v.flags|=8192),D&&(v.mode&1)!==0?(Ns&1073741824)!==0&&(ia(v),v.subtreeFlags&6&&(v.flags|=8192)):ia(v),null;case 24:return null;case 25:return null}throw Error(r(156,v.tag))}function KX(g,v){switch(at(v),v.tag){case 1:return ra(v.type)&&rg(),g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 3:return dl(),fn(ta),fn(io),Qv(),g=v.flags,(g&65536)!==0&&(g&128)===0?(v.flags=g&-65537|128,v):null;case 5:return Gv(v),null;case 13:if(fn(Mn),g=v.memoizedState,g!==null&&g.dehydrated!==null){if(v.alternate===null)throw Error(r(340));Gt()}return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 19:return fn(Mn),null;case 4:return dl(),null;case 10:return $n(v.type._context),null;case 22:case 23:return gj(),null;case 24:return null;default:return null}}var Qb=!1,oa=!1,QX=typeof WeakSet=="function"?WeakSet:Set,Xt=null;function pg(g,v){var C=g.ref;if(C!==null)if(typeof C=="function")try{C(null)}catch(D){_i(g,v,D)}else C.current=null}function nj(g,v,C){try{C()}catch(D){_i(g,v,D)}}var sO=!1;function XX(g,v){if(dp=Id,g=_n(),ei(g)){if("selectionStart"in g)var C={start:g.selectionStart,end:g.selectionEnd};else e:{C=(C=g.ownerDocument)&&C.defaultView||window;var D=C.getSelection&&C.getSelection();if(D&&D.rangeCount!==0){C=D.anchorNode;var Z=D.anchorOffset,ne=D.focusNode;D=D.focusOffset;try{C.nodeType,ne.nodeType}catch{C=null;break e}var he=0,Re=-1,Ue=-1,ut=0,Rt=0,Ft=g,Nt=null;t:for(;;){for(var Vt;Ft!==C||Z!==0&&Ft.nodeType!==3||(Re=he+Z),Ft!==ne||D!==0&&Ft.nodeType!==3||(Ue=he+D),Ft.nodeType===3&&(he+=Ft.nodeValue.length),(Vt=Ft.firstChild)!==null;)Nt=Ft,Ft=Vt;for(;;){if(Ft===g)break t;if(Nt===C&&++ut===Z&&(Re=he),Nt===ne&&++Rt===D&&(Ue=he),(Vt=Ft.nextSibling)!==null)break;Ft=Nt,Nt=Ft.parentNode}Ft=Vt}C=Re===-1||Ue===-1?null:{start:Re,end:Ue}}else C=null}C=C||{start:0,end:0}}else C=null;for(Nu={focusedElem:g,selectionRange:C},Id=!1,Xt=v;Xt!==null;)if(v=Xt,g=v.child,(v.subtreeFlags&1028)!==0&&g!==null)g.return=v,Xt=g;else for(;Xt!==null;){v=Xt;try{var rr=v.alternate;if((v.flags&1024)!==0)switch(v.tag){case 0:case 11:case 15:break;case 1:if(rr!==null){var ar=rr.memoizedProps,Mi=rr.memoizedState,ot=v.stateNode,Ye=ot.getSnapshotBeforeUpdate(v.elementType===v.type?ar:Hl(v.type,ar),Mi);ot.__reactInternalSnapshotBeforeUpdate=Ye}break;case 3:var st=v.stateNode.containerInfo;st.nodeType===1?st.textContent="":st.nodeType===9&&st.documentElement&&st.removeChild(st.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Dt){_i(v,v.return,Dt)}if(g=v.sibling,g!==null){g.return=v.return,Xt=g;break}Xt=v.return}return rr=sO,sO=!1,rr}function ey(g,v,C){var D=v.updateQueue;if(D=D!==null?D.lastEffect:null,D!==null){var Z=D=D.next;do{if((Z.tag&g)===g){var ne=Z.destroy;Z.destroy=void 0,ne!==void 0&&nj(v,C,ne)}Z=Z.next}while(Z!==D)}}function Xb(g,v){if(v=v.updateQueue,v=v!==null?v.lastEffect:null,v!==null){var C=v=v.next;do{if((C.tag&g)===g){var D=C.create;C.destroy=D()}C=C.next}while(C!==v)}}function ij(g){var v=g.ref;if(v!==null){var C=g.stateNode;switch(g.tag){case 5:g=C;break;default:g=C}typeof v=="function"?v(g):v.current=g}}function lO(g){var v=g.alternate;v!==null&&(g.alternate=null,lO(v)),g.child=null,g.deletions=null,g.sibling=null,g.tag===5&&(v=g.stateNode,v!==null&&(delete v[ul],delete v[Hd],delete v[ea],delete v[qS],delete v[$S])),g.stateNode=null,g.return=null,g.dependencies=null,g.memoizedProps=null,g.memoizedState=null,g.pendingProps=null,g.stateNode=null,g.updateQueue=null}function cO(g){return g.tag===5||g.tag===3||g.tag===4}function uO(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||cO(g.return))return null;g=g.return}for(g.sibling.return=g.return,g=g.sibling;g.tag!==5&&g.tag!==6&&g.tag!==18;){if(g.flags&2||g.child===null||g.tag===4)continue e;g.child.return=g,g=g.child}if(!(g.flags&2))return g.stateNode}}function oj(g,v,C){var D=g.tag;if(D===5||D===6)g=g.stateNode,v?C.nodeType===8?C.parentNode.insertBefore(g,v):C.insertBefore(g,v):(C.nodeType===8?(v=C.parentNode,v.insertBefore(g,C)):(v=C,v.appendChild(g)),C=C._reactRootContainer,C!=null||v.onclick!==null||(v.onclick=Ud));else if(D!==4&&(g=g.child,g!==null))for(oj(g,v,C),g=g.sibling;g!==null;)oj(g,v,C),g=g.sibling}function aj(g,v,C){var D=g.tag;if(D===5||D===6)g=g.stateNode,v?C.insertBefore(g,v):C.appendChild(g);else if(D!==4&&(g=g.child,g!==null))for(aj(g,v,C),g=g.sibling;g!==null;)aj(g,v,C),g=g.sibling}var Vo=null,Vl=!1;function Zd(g,v,C){for(C=C.child;C!==null;)dO(g,v,C),C=C.sibling}function dO(g,v,C){if(ba&&typeof ba.onCommitFiberUnmount=="function")try{ba.onCommitFiberUnmount(uu,C)}catch{}switch(C.tag){case 5:oa||pg(C,v);case 6:var D=Vo,Z=Vl;Vo=null,Zd(g,v,C),Vo=D,Vl=Z,Vo!==null&&(Vl?(g=Vo,C=C.stateNode,g.nodeType===8?g.parentNode.removeChild(C):g.removeChild(C)):Vo.removeChild(C.stateNode));break;case 18:Vo!==null&&(Vl?(g=Vo,C=C.stateNode,g.nodeType===8?Hv(g.parentNode,C):g.nodeType===1&&Hv(g,C),Ll(g)):Hv(Vo,C.stateNode));break;case 4:D=Vo,Z=Vl,Vo=C.stateNode.containerInfo,Vl=!0,Zd(g,v,C),Vo=D,Vl=Z;break;case 0:case 11:case 14:case 15:if(!oa&&(D=C.updateQueue,D!==null&&(D=D.lastEffect,D!==null))){Z=D=D.next;do{var ne=Z,he=ne.destroy;ne=ne.tag,he!==void 0&&((ne&2)!==0||(ne&4)!==0)&&nj(C,v,he),Z=Z.next}while(Z!==D)}Zd(g,v,C);break;case 1:if(!oa&&(pg(C,v),D=C.stateNode,typeof D.componentWillUnmount=="function"))try{D.props=C.memoizedProps,D.state=C.memoizedState,D.componentWillUnmount()}catch(Re){_i(C,v,Re)}Zd(g,v,C);break;case 21:Zd(g,v,C);break;case 22:C.mode&1?(oa=(D=oa)||C.memoizedState!==null,Zd(g,v,C),oa=D):Zd(g,v,C);break;default:Zd(g,v,C)}}function fO(g){var v=g.updateQueue;if(v!==null){g.updateQueue=null;var C=g.stateNode;C===null&&(C=g.stateNode=new QX),v.forEach(function(D){var Z=aZ.bind(null,g,D);C.has(D)||(C.add(D),D.then(Z,Z))})}}function Yl(g,v){var C=v.deletions;if(C!==null)for(var D=0;DZ&&(Z=he),D&=~ne}if(D=Z,D=Gr()-D,D=(120>D?120:480>D?480:1080>D?1080:1920>D?1920:3e3>D?3e3:4320>D?4320:1960*JX(D/1960))-D,10g?16:g,ef===null)var D=!1;else{if(g=ef,ef=null,r1=0,(rn&6)!==0)throw Error(r(331));var Z=rn;for(rn|=4,Xt=g.current;Xt!==null;){var ne=Xt,he=ne.child;if((Xt.flags&16)!==0){var Re=ne.deletions;if(Re!==null){for(var Ue=0;UeGr()-cj?xp(g,0):lj|=C),rs(g,v)}function _O(g,v){v===0&&((g.mode&1)===0?v=1:(v=wa,wa<<=1,(wa&130023424)===0&&(wa=4194304)));var C=Aa();g=An(g,v),g!==null&&(fu(g,v,C),rs(g,C))}function oZ(g){var v=g.memoizedState,C=0;v!==null&&(C=v.retryLane),_O(g,C)}function aZ(g,v){var C=0;switch(g.tag){case 13:var D=g.stateNode,Z=g.memoizedState;Z!==null&&(C=Z.retryLane);break;case 19:D=g.stateNode;break;default:throw Error(r(314))}D!==null&&D.delete(v),_O(g,C)}var CO;CO=function(g,v,C){if(g!==null)if(g.memoizedProps!==v.pendingProps||ta.current)es=!0;else{if((g.lanes&C)===0&&(v.flags&128)===0)return es=!1,YX(g,v,C);es=(g.flags&131072)!==0}else es=!1,jt&&(v.flags&1048576)!==0&&et(v,ye,v.index);switch(v.lanes=0,v.tag){case 2:var D=v.type;Kb(g,v),g=v.pendingProps;var Z=Yd(v,io.current);si(v,C),Z=hp(null,v,D,g,Z,C);var ne=pl();return v.flags|=1,typeof Z=="object"&&Z!==null&&typeof Z.render=="function"&&Z.$$typeof===void 0?(v.tag=1,v.memoizedState=null,v.updateQueue=null,ra(D)?(ne=!0,Fu(v)):ne=!1,v.memoizedState=Z.state!==null&&Z.state!==void 0?Z.state:null,oo(v),Z.updater=Yb,v.stateNode=Z,Z._reactInternals=v,YS(v,D,g,C),v=XS(null,v,D,!0,ne,C)):(v.tag=0,jt&&ne&&yt(v),Ea(null,v,Z,C),v=v.child),v;case 16:D=v.elementType;e:{switch(Kb(g,v),g=v.pendingProps,Z=D._init,D=Z(D._payload),v.type=D,Z=v.tag=lZ(D),g=Hl(D,g),Z){case 0:v=QS(null,v,D,g,C);break e;case 1:v=Z8(null,v,D,g,C);break e;case 11:v=Y8(null,v,D,g,C);break e;case 14:v=G8(null,v,D,Hl(D.type,g),C);break e}throw Error(r(306,D,""))}return v;case 0:return D=v.type,Z=v.pendingProps,Z=v.elementType===D?Z:Hl(D,Z),QS(g,v,D,Z,C);case 1:return D=v.type,Z=v.pendingProps,Z=v.elementType===D?Z:Hl(D,Z),Z8(g,v,D,Z,C);case 3:e:{if(J8(v),g===null)throw Error(r(387));D=v.pendingProps,ne=v.memoizedState,Z=ne.element,na(g,v),_o(v,D,null,C);var he=v.memoizedState;if(D=he.element,ne.isDehydrated)if(ne={element:D,isDehydrated:!1,cache:he.cache,pendingSuspenseBoundaries:he.pendingSuspenseBoundaries,transitions:he.transitions},v.updateQueue.baseState=ne,v.memoizedState=ne,v.flags&256){Z=fg(Error(r(423)),v),v=eO(g,v,D,C,Z);break e}else if(D!==Z){Z=fg(Error(r(424)),v),v=eO(g,v,D,C,Z);break e}else for(mt=Ho(v.stateNode.containerInfo.firstChild),ht=v,jt=!0,Et=null,C=ti(v,null,D,C),v.child=C;C;)C.flags=C.flags&-3|4096,C=C.sibling;else{if(Gt(),D===Z){v=Du(g,v,C);break e}Ea(g,v,D,C)}v=v.child}return v;case 5:return Wb(v),g===null&&Jt(v),D=v.type,Z=v.pendingProps,ne=g!==null?g.memoizedProps:null,he=Z.children,$v(D,Z)?he=null:ne!==null&&$v(D,ne)&&(v.flags|=32),X8(g,v),Ea(g,v,he,C),v.child;case 6:return g===null&&Jt(v),null;case 13:return tO(g,v,C);case 4:return Gd(v,v.stateNode.containerInfo),D=v.pendingProps,g===null?v.child=Si(v,null,D,C):Ea(g,v,D,C),v.child;case 11:return D=v.type,Z=v.pendingProps,Z=v.elementType===D?Z:Hl(D,Z),Y8(g,v,D,Z,C);case 7:return Ea(g,v,v.pendingProps,C),v.child;case 8:return Ea(g,v,v.pendingProps.children,C),v.child;case 12:return Ea(g,v,v.pendingProps.children,C),v.child;case 10:e:{if(D=v.type._context,Z=v.pendingProps,ne=v.memoizedProps,he=Z.value,mn(Li,D._currentValue),D._currentValue=he,ne!==null)if(Hi(ne.value,he)){if(ne.children===Z.children&&!ta.current){v=Du(g,v,C);break e}}else for(ne=v.child,ne!==null&&(ne.return=v);ne!==null;){var Re=ne.dependencies;if(Re!==null){he=ne.child;for(var Ue=Re.firstContext;Ue!==null;){if(Ue.context===D){if(ne.tag===1){Ue=fi(-1,C&-C),Ue.tag=2;var ut=ne.updateQueue;if(ut!==null){ut=ut.shared;var Rt=ut.pending;Rt===null?Ue.next=Ue:(Ue.next=Rt.next,Rt.next=Ue),ut.pending=Ue}}ne.lanes|=C,Ue=ne.alternate,Ue!==null&&(Ue.lanes|=C),tn(ne.return,C,v),Re.lanes|=C;break}Ue=Ue.next}}else if(ne.tag===10)he=ne.type===v.type?null:ne.child;else if(ne.tag===18){if(he=ne.return,he===null)throw Error(r(341));he.lanes|=C,Re=he.alternate,Re!==null&&(Re.lanes|=C),tn(he,C,v),he=ne.sibling}else he=ne.child;if(he!==null)he.return=ne;else for(he=ne;he!==null;){if(he===v){he=null;break}if(ne=he.sibling,ne!==null){ne.return=he.return,he=ne;break}he=he.return}ne=he}Ea(g,v,Z.children,C),v=v.child}return v;case 9:return Z=v.type,D=v.pendingProps.children,si(v,C),Z=li(Z),D=D(Z),v.flags|=1,Ea(g,v,D,C),v.child;case 14:return D=v.type,Z=Hl(D,v.pendingProps),Z=Hl(D.type,Z),G8(g,v,D,Z,C);case 15:return K8(g,v,v.type,v.pendingProps,C);case 17:return D=v.type,Z=v.pendingProps,Z=v.elementType===D?Z:Hl(D,Z),Kb(g,v),v.tag=1,ra(D)?(g=!0,Fu(v)):g=!1,si(v,C),B8(v,D,Z),YS(v,D,Z,C),XS(null,v,D,!0,g,C);case 19:return nO(g,v,C);case 22:return Q8(g,v,C)}throw Error(r(156,v.tag))};function EO(g,v){return xa(g,v)}function sZ(g,v,C,D){this.tag=g,this.key=C,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=v,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=D,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gl(g,v,C,D){return new sZ(g,v,C,D)}function vj(g){return g=g.prototype,!(!g||!g.isReactComponent)}function lZ(g){if(typeof g=="function")return vj(g)?1:0;if(g!=null){if(g=g.$$typeof,g===A)return 11;if(g===z)return 14}return 2}function nf(g,v){var C=g.alternate;return C===null?(C=gl(g.tag,v,g.key,g.mode),C.elementType=g.elementType,C.type=g.type,C.stateNode=g.stateNode,C.alternate=g,g.alternate=C):(C.pendingProps=v,C.type=g.type,C.flags=0,C.subtreeFlags=0,C.deletions=null),C.flags=g.flags&14680064,C.childLanes=g.childLanes,C.lanes=g.lanes,C.child=g.child,C.memoizedProps=g.memoizedProps,C.memoizedState=g.memoizedState,C.updateQueue=g.updateQueue,v=g.dependencies,C.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext},C.sibling=g.sibling,C.index=g.index,C.ref=g.ref,C}function a1(g,v,C,D,Z,ne){var he=2;if(D=g,typeof g=="function")vj(g)&&(he=1);else if(typeof g=="string")he=5;else e:switch(g){case O:return wp(C.children,Z,ne,v);case T:he=8,Z|=8;break;case R:return g=gl(12,C,v,Z|2),g.elementType=R,g.lanes=ne,g;case F:return g=gl(13,C,v,Z),g.elementType=F,g.lanes=ne,g;case L:return g=gl(19,C,v,Z),g.elementType=L,g.lanes=ne,g;case Q:return s1(C,Z,ne,v);default:if(typeof g=="object"&&g!==null)switch(g.$$typeof){case I:he=10;break e;case E:he=9;break e;case A:he=11;break e;case z:he=14;break e;case V:he=16,D=null;break e}throw Error(r(130,g==null?g:typeof g,""))}return v=gl(he,C,v,Z),v.elementType=g,v.type=D,v.lanes=ne,v}function wp(g,v,C,D){return g=gl(7,g,D,v),g.lanes=C,g}function s1(g,v,C,D){return g=gl(22,g,D,v),g.elementType=Q,g.lanes=C,g.stateNode={isHidden:!1},g}function yj(g,v,C){return g=gl(6,g,null,v),g.lanes=C,g}function xj(g,v,C){return v=gl(4,g.children!==null?g.children:[],g.key,v),v.lanes=C,v.stateNode={containerInfo:g.containerInfo,pendingChildren:null,implementation:g.implementation},v}function cZ(g,v,C,D,Z){this.tag=v,this.containerInfo=g,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Pd(0),this.expirationTimes=Pd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pd(0),this.identifierPrefix=D,this.onRecoverableError=Z,this.mutableSourceEagerHydrationData=null}function bj(g,v,C,D,Z,ne,he,Re,Ue){return g=new cZ(g,v,C,Re,Ue),v===1?(v=1,ne===!0&&(v|=8)):v=0,ne=gl(3,null,null,v),g.current=ne,ne.stateNode=g,ne.memoizedState={element:D,isDehydrated:C,cache:null,transitions:null,pendingSuspenseBoundaries:null},oo(ne),g}function uZ(g,v,C){var D=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Cj.exports=kZ(),Cj.exports}var WO;function _Z(){if(WO)return g1;WO=1;var e=j6();return g1.createRoot=e.createRoot,g1.hydrateRoot=e.hydrateRoot,g1}var YW=_Z(),j=_w();const ze=un(j),GW=yZ({__proto__:null,default:ze},[j]);var k6=j6();const CZ=un(k6);/** - * @remix-run/router v1.23.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function tx(){return tx=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function _6(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function AZ(){return Math.random().toString(36).substr(2,8)}function $O(e,t){return{usr:e.state,key:e.key,idx:t}}function $3(e,t,r,n){return r===void 0&&(r=null),tx({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?tv(t):t,{state:r,key:t&&t.key||n||AZ()})}function T0(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function tv(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function TZ(e,t,r,n){n===void 0&&(n={});let{window:o=document.defaultView,v5Compat:a=!1}=n,s=o.history,l=bf.Pop,c=null,u=d();u==null&&(u=0,s.replaceState(tx({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){l=bf.Pop;let x=d(),b=x==null?null:x-u;u=x,c&&c({action:l,location:m.location,delta:b})}function h(x,b){l=bf.Push;let w=$3(m.location,x,b);u=d()+1;let k=$O(w,u),S=m.createHref(w);try{s.pushState(k,"",S)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;o.location.assign(S)}a&&c&&c({action:l,location:m.location,delta:1})}function p(x,b){l=bf.Replace;let w=$3(m.location,x,b);u=d();let k=$O(w,u),S=m.createHref(w);s.replaceState(k,"",S),a&&c&&c({action:l,location:m.location,delta:0})}function y(x){let b=o.location.origin!=="null"?o.location.origin:o.location.href,w=typeof x=="string"?x:T0(x);return w=w.replace(/ $/,"%20"),mi(b,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,b)}let m={get action(){return l},get location(){return e(o,s)},listen(x){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(qO,f),c=x,()=>{o.removeEventListener(qO,f),c=null}},createHref(x){return t(o,x)},createURL:y,encodeLocation(x){let b=y(x);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:h,replace:p,go(x){return s.go(x)}};return m}var UO;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(UO||(UO={}));function PZ(e,t,r){return r===void 0&&(r="/"),OZ(e,t,r)}function OZ(e,t,r,n){let o=typeof t=="string"?tv(t):t,a=gm(o.pathname||"/",r);if(a==null)return null;let s=KW(e);IZ(s);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:s,route:a};c.relativePath.startsWith("/")&&(mi(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let u=Cf([n,c.relativePath]),d=r.concat(c);a.children&&a.children.length>0&&(mi(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),KW(a.children,t,d,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:zZ(u,a.index),routesMeta:d})};return e.forEach((a,s)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))o(a,s);else for(let c of QW(a.path))o(a,s,c)}),t}function QW(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,o=r.endsWith("?"),a=r.replace(/\?$/,"");if(n.length===0)return o?[a,""]:[a];let s=QW(n.join("/")),l=[];return l.push(...s.map(c=>c===""?a:[a,c].join("/"))),o&&l.push(...s),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function IZ(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:BZ(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const NZ=/^:[\w-]+$/,RZ=3,LZ=2,FZ=1,MZ=10,DZ=-2,HO=e=>e==="*";function zZ(e,t){let r=e.split("/"),n=r.length;return r.some(HO)&&(n+=DZ),t&&(n+=LZ),r.filter(o=>!HO(o)).reduce((o,a)=>o+(NZ.test(a)?RZ:a===""?FZ:MZ),n)}function BZ(e,t){return e.length===t.length&&e.slice(0,-1).every((n,o)=>n===t[o])?e[e.length-1]-t[t.length-1]:0}function WZ(e,t,r){let{routesMeta:n}=e,o={},a="/",s=[];for(let l=0;l{let{paramName:h,isOptional:p}=d;if(h==="*"){let m=l[f]||"";s=a.slice(0,a.length-m.length).replace(/(.)\/+$/,"$1")}const y=l[f];return p&&!y?u[h]=void 0:u[h]=(y||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:s,pattern:e}}function qZ(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),_6(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}function $Z(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return _6(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function gm(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const UZ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,HZ=e=>UZ.test(e);function VZ(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:o=""}=typeof e=="string"?tv(e):e,a;if(r)if(HZ(r))a=r;else{if(r.includes("//")){let s=r;r=r.replace(/\/\/+/g,"/"),_6(!1,"Pathnames cannot have embedded double slashes - normalizing "+(s+" -> "+r))}r.startsWith("/")?a=VO(r.substring(1),"/"):a=VO(r,t)}else a=t;return{pathname:a,search:KZ(n),hash:QZ(o)}}function VO(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function Tj(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function YZ(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function C6(e,t){let r=YZ(e);return t?r.map((n,o)=>o===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function E6(e,t,r,n){n===void 0&&(n=!1);let o;typeof e=="string"?o=tv(e):(o=tx({},e),mi(!o.pathname||!o.pathname.includes("?"),Tj("?","pathname","search",o)),mi(!o.pathname||!o.pathname.includes("#"),Tj("#","pathname","hash",o)),mi(!o.search||!o.search.includes("#"),Tj("#","search","hash",o)));let a=e===""||o.pathname==="",s=a?"/":o.pathname,l;if(s==null)l=r;else{let f=t.length-1;if(!n&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),f-=1;o.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=VZ(o,l),u=s&&s!=="/"&&s.endsWith("/"),d=(a||s===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Cf=e=>e.join("/").replace(/\/\/+/g,"/"),GZ=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),KZ=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,QZ=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function XZ(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const XW=["post","put","patch","delete"];new Set(XW);const ZZ=["get",...XW];new Set(ZZ);/** - * React Router v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function rx(){return rx=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),j.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let f=E6(u,JSON.parse(s),a,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Cf([t,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[t,n,s,a,e])}const tJ=j.createContext(null);function rJ(e){let t=j.useContext(ru).outlet;return t&&j.createElement(tJ.Provider,{value:e},t)}function A6(){let{matches:e}=j.useContext(ru),t=e[e.length-1];return t?t.params:{}}function Aw(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=j.useContext(yd),{matches:o}=j.useContext(ru),{pathname:a}=xd(),s=JSON.stringify(C6(o,n.v7_relativeSplatPath));return j.useMemo(()=>E6(e,JSON.parse(s),a,r==="path"),[e,s,a,r])}function nJ(e,t){return iJ(e,t)}function iJ(e,t,r,n){rv()||mi(!1);let{navigator:o}=j.useContext(yd),{matches:a}=j.useContext(ru),s=a[a.length-1],l=s?s.params:{};s&&s.pathname;let c=s?s.pathnameBase:"/";s&&s.route;let u=xd(),d;if(t){var f;let x=typeof t=="string"?tv(t):t;c==="/"||(f=x.pathname)!=null&&f.startsWith(c)||mi(!1),d=x}else d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let x=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(x.length).join("/")}let y=PZ(e,{pathname:p}),m=cJ(y&&y.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:Cf([c,o.encodeLocation?o.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?c:Cf([c,o.encodeLocation?o.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),a,r,n);return t&&m?j.createElement(Ew.Provider,{value:{location:rx({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:bf.Pop}},m):m}function oJ(){let e=pJ(),t=XZ(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},t),r?j.createElement("pre",{style:o},r):null,null)}const aJ=j.createElement(oJ,null);class sJ extends j.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?j.createElement(ru.Provider,{value:this.props.routeContext},j.createElement(JW.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function lJ(e){let{routeContext:t,match:r,children:n}=e,o=j.useContext(Cw);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),j.createElement(ru.Provider,{value:t},n)}function cJ(e,t,r,n){var o;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var a;if(!r)return null;if(r.errors)e=r.matches;else if((a=n)!=null&&a.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,l=(o=r)==null?void 0:o.errors;if(l!=null){let d=s.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||mi(!1),s=s.slice(0,Math.min(s.length,d+1))}let c=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,f,h)=>{let p,y=!1,m=null,x=null;r&&(p=l&&f.route.id?l[f.route.id]:void 0,m=f.route.errorElement||aJ,c&&(u<0&&h===0?(gJ("route-fallback"),y=!0,x=null):u===h&&(y=!0,x=f.route.hydrateFallbackElement||null)));let b=t.concat(s.slice(0,h+1)),w=()=>{let k;return p?k=m:y?k=x:f.route.Component?k=j.createElement(f.route.Component,null):f.route.element?k=f.route.element:k=d,j.createElement(lJ,{match:f,routeContext:{outlet:d,matches:b,isDataRoute:r!=null},children:k})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?j.createElement(sJ,{location:r.location,revalidation:r.revalidation,component:m,error:p,children:w(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):w()},null)}var tq=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(tq||{}),rq=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(rq||{});function uJ(e){let t=j.useContext(Cw);return t||mi(!1),t}function dJ(e){let t=j.useContext(ZW);return t||mi(!1),t}function fJ(e){let t=j.useContext(ru);return t||mi(!1),t}function nq(e){let t=fJ(),r=t.matches[t.matches.length-1];return r.route.id||mi(!1),r.route.id}function pJ(){var e;let t=j.useContext(JW),r=dJ(),n=nq();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function hJ(){let{router:e}=uJ(tq.UseNavigateStable),t=nq(rq.UseNavigateStable),r=j.useRef(!1);return eq(()=>{r.current=!0}),j.useCallback(function(o,a){a===void 0&&(a={}),r.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,rx({fromRouteId:t},a)))},[e,t])}const YO={};function gJ(e,t,r){YO[e]||(YO[e]=!0)}function mJ(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function th(e){let{to:t,replace:r,state:n,relative:o}=e;rv()||mi(!1);let{future:a,static:s}=j.useContext(yd),{matches:l}=j.useContext(ru),{pathname:c}=xd(),u=bd(),d=E6(t,C6(l,a.v7_relativeSplatPath),c,o==="path"),f=JSON.stringify(d);return j.useEffect(()=>u(JSON.parse(f),{replace:r,state:n,relative:o}),[u,f,o,r,n]),null}function iq(e){return rJ(e.context)}function as(e){mi(!1)}function vJ(e){let{basename:t="/",children:r=null,location:n,navigationType:o=bf.Pop,navigator:a,static:s=!1,future:l}=e;rv()&&mi(!1);let c=t.replace(/^\/*/,"/"),u=j.useMemo(()=>({basename:c,navigator:a,static:s,future:rx({v7_relativeSplatPath:!1},l)}),[c,l,a,s]);typeof n=="string"&&(n=tv(n));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:y="default"}=n,m=j.useMemo(()=>{let x=gm(d,c);return x==null?null:{location:{pathname:x,search:f,hash:h,state:p,key:y},navigationType:o}},[c,d,f,h,p,y,o]);return m==null?null:j.createElement(yd.Provider,{value:u},j.createElement(Ew.Provider,{children:r,value:m}))}function yJ(e){let{children:t,location:r}=e;return nJ(H3(t),r)}new Promise(()=>{});function H3(e,t){t===void 0&&(t=[]);let r=[];return j.Children.forEach(e,(n,o)=>{if(!j.isValidElement(n))return;let a=[...t,o];if(n.type===j.Fragment){r.push.apply(r,H3(n.props.children,a));return}n.type!==as&&mi(!1),!n.props.index||!n.props.children||mi(!1);let s={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=H3(n.props.children,a)),r.push(s)}),r}/** - * React Router DOM v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function P0(){return P0=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(r[o]=e[o]);return r}function xJ(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function bJ(e,t){return e.button===0&&(!t||t==="_self")&&!xJ(e)}function V3(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(o=>[r,o]):[[r,n]])},[]))}function wJ(e,t){let r=V3(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(a=>{r.append(o,a)})}),r}const SJ=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],jJ=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],kJ="6";try{window.__reactRouterVersion=kJ}catch{}const _J=j.createContext({isTransitioning:!1}),CJ="startTransition",GO=GW[CJ];function EJ(e){let{basename:t,children:r,future:n,window:o}=e,a=j.useRef();a.current==null&&(a.current=EZ({window:o,v5Compat:!0}));let s=a.current,[l,c]=j.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},d=j.useCallback(f=>{u&&GO?GO(()=>c(f)):c(f)},[c,u]);return j.useLayoutEffect(()=>s.listen(d),[s,d]),j.useEffect(()=>mJ(n),[n]),j.createElement(vJ,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}const AJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",TJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,PJ=j.forwardRef(function(t,r){let{onClick:n,relative:o,reloadDocument:a,replace:s,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,h=oq(t,SJ),{basename:p}=j.useContext(yd),y,m=!1;if(typeof u=="string"&&TJ.test(u)&&(y=u,AJ))try{let k=new URL(window.location.href),S=u.startsWith("//")?new URL(k.protocol+u):new URL(u),_=gm(S.pathname,p);S.origin===k.origin&&_!=null?u=_+S.search+S.hash:m=!0}catch{}let x=JZ(u,{relative:o}),b=IJ(u,{replace:s,state:l,target:c,preventScrollReset:d,relative:o,viewTransition:f});function w(k){n&&n(k),k.defaultPrevented||b(k)}return j.createElement("a",P0({},h,{href:y||x,onClick:m||a?n:w,ref:r,target:c}))}),KO=j.forwardRef(function(t,r){let{"aria-current":n="page",caseSensitive:o=!1,className:a="",end:s=!1,style:l,to:c,viewTransition:u,children:d}=t,f=oq(t,jJ),h=Aw(c,{relative:f.relative}),p=xd(),y=j.useContext(ZW),{navigator:m,basename:x}=j.useContext(yd),b=y!=null&&NJ(h)&&u===!0,w=m.encodeLocation?m.encodeLocation(h).pathname:h.pathname,k=p.pathname,S=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;o||(k=k.toLowerCase(),S=S?S.toLowerCase():null,w=w.toLowerCase()),S&&x&&(S=gm(S,x)||S);const _=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let P=k===w||!s&&k.startsWith(w)&&k.charAt(_)==="/",O=S!=null&&(S===w||!s&&S.startsWith(w)&&S.charAt(w.length)==="/"),T={isActive:P,isPending:O,isTransitioning:b},R=P?n:void 0,I;typeof a=="function"?I=a(T):I=[a,P?"active":null,O?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let E=typeof l=="function"?l(T):l;return j.createElement(PJ,P0({},f,{"aria-current":R,className:I,ref:r,style:E,to:c,viewTransition:u}),typeof d=="function"?d(T):d)});var Y3;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Y3||(Y3={}));var QO;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(QO||(QO={}));function OJ(e){let t=j.useContext(Cw);return t||mi(!1),t}function IJ(e,t){let{target:r,replace:n,state:o,preventScrollReset:a,relative:s,viewTransition:l}=t===void 0?{}:t,c=bd(),u=xd(),d=Aw(e,{relative:s});return j.useCallback(f=>{if(bJ(f,r)){f.preventDefault();let h=n!==void 0?n:T0(u)===T0(d);c(e,{replace:h,state:o,preventScrollReset:a,relative:s,viewTransition:l})}},[u,c,d,n,o,r,e,a,s,l])}function aq(e){let t=j.useRef(V3(e)),r=j.useRef(!1),n=xd(),o=j.useMemo(()=>wJ(n.search,r.current?null:t.current),[n.search]),a=bd(),s=j.useCallback((l,c)=>{const u=V3(typeof l=="function"?l(o):l);r.current=!0,a("?"+u,c)},[a,o]);return[o,s]}function NJ(e,t){t===void 0&&(t={});let r=j.useContext(_J);r==null&&mi(!1);let{basename:n}=OJ(Y3.useViewTransitionState),o=Aw(e,{relative:t.relative});if(!r.isTransitioning)return!1;let a=gm(r.currentLocation.pathname,n)||r.currentLocation.pathname,s=gm(r.nextLocation.pathname,n)||r.nextLocation.pathname;return U3(o.pathname,s)!=null||U3(o.pathname,a)!=null}const sq=j.createContext({theme:"light",setTheme:()=>{}});function RJ({children:e}){const[t,r]=j.useState(()=>{try{const o=localStorage.getItem("eb-theme");if(o==="dark"||o==="light")return o}catch{}return"light"}),n=o=>{r(o);try{localStorage.setItem("eb-theme",o)}catch{}};return j.useEffect(()=>{const o=document.documentElement;t==="dark"?o.classList.add("dark"):o.classList.remove("dark")},[t]),i.jsx(sq.Provider,{value:{theme:t,setTheme:n},children:e})}function lq(){return j.useContext(sq)}let O0=0;const G3=new Set;function cq(){G3.forEach(e=>e())}function LJ(e){return G3.add(e),()=>{G3.delete(e)}}function XO(){return O0>0}function uq(){O0+=1,cq()}function dq(){O0=Math.max(0,O0-1),cq()}const FJ=new Set(["POST","PUT","PATCH","DELETE"]);function fq(e){const t=(e||"GET").toUpperCase();return FJ.has(t)}const Dy="https://api.eventbuzz.live/api",T6=Dy,mm={access:"eventbuzz_access_token",refresh:"eventbuzz_refresh_token"};let El=null,nd=null;function pq(){try{const e=localStorage.getItem(mm.access),t=localStorage.getItem(mm.refresh);e&&t&&(El=e,nd=t)}catch{}}pq();function vf(e,t){El=e,nd=t;try{localStorage.setItem(mm.access,e),localStorage.setItem(mm.refresh,t)}catch{}}function hq(){El=null,nd=null;try{localStorage.removeItem(mm.access),localStorage.removeItem(mm.refresh)}catch{}}function MJ(){return El||(pq(),El)}function DJ(){return nd}async function gq(){var t;if(!nd)return!1;const e=T6.replace(/\/api\/?$/,"");try{const n=await(await fetch(`${e}/api/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:nd})})).json();if(n.success&&((t=n.data)!=null&&t.token))return vf(n.data.token,nd),!0}catch{}return hq(),!1}async function Fg(e,t={}){var a;const{skipGlobalLoading:r,...n}=t,o=fq(n.method)&&!r;o&&uq();try{const s=e.startsWith("http")?e:`${T6}${e.startsWith("/")?e:`/${e}`}`,l={"Content-Type":"application/json",...typeof n.headers=="object"&&!(n.headers instanceof Headers)?n.headers:{}};El&&(l.Authorization=`Bearer ${El}`);let c=await fetch(s,{...n,headers:l});c.status===401&&nd&&await gq()&&(l.Authorization=`Bearer ${El}`,c=await fetch(s,{...n,headers:l}));let u;try{u=await c.json()}catch{return{error:c.statusText||"Network error",status:c.status}}const d=u;return d.success===!0&&"data"in d?{data:d.data,status:c.status}:{error:((a=d.error)==null?void 0:a.message)||(typeof d.error=="string"?d.error:c.statusText),status:c.status}}finally{o&&dq()}}const Xe={get:e=>Fg(e,{method:"GET"}),post:(e,t)=>Fg(e,{method:"POST",body:JSON.stringify(t)}),put:(e,t)=>Fg(e,{method:"PUT",body:JSON.stringify(t)}),patch:(e,t)=>Fg(e,{method:"PATCH",body:JSON.stringify(t)}),delete:e=>Fg(e,{method:"DELETE"})};async function vm(e,t={}){const{skipGlobalLoading:r,...n}=t,o=fq(n.method)&&!r;o&&uq();try{const a=e.startsWith("http")?e:`${T6}${e.startsWith("/")?e:`/${e}`}`,s={...typeof n.headers=="object"&&n.headers&&!(n.headers instanceof Headers)?n.headers:{}};El&&(s.Authorization=`Bearer ${El}`),typeof FormData<"u"&&n.body instanceof FormData&&(delete s["Content-Type"],delete s["content-type"]);let l=await fetch(a,{...n,headers:s});return l.status===401&&nd&&await gq()&&(s.Authorization=`Bearer ${El}`,l=await fetch(a,{...n,headers:s})),l}finally{o&&dq()}}const Ia={async register(e){const t=await Xe.post("/auth/register",e);return t.data&&vf(t.data.token,t.data.refreshToken),t},async login(e,t){const r=await Xe.post("/auth/login",{email:e,password:t}),n=r.data;return n&&"requiresTwoFactor"in n&&n.requiresTwoFactor||n&&"token"in n&&n.token&&"refreshToken"in n&&vf(n.token,n.refreshToken),r},async googleLogin(e){const t=await Xe.post("/auth/google",{idToken:e}),r=t.data;return r&&"requiresTwoFactor"in r&&r.requiresTwoFactor||r&&"token"in r&&r.token&&"refreshToken"in r&&vf(r.token,r.refreshToken),t},async googleRegister(e){var r;const t=await Xe.post("/auth/google/register",e);return(r=t.data)!=null&&r.token&&t.data.refreshToken&&vf(t.data.token,t.data.refreshToken),t},async completeLogin2fa(e,t){var n;const r=await Xe.post("/auth/login/2fa",{twoFactorToken:e,token:t});return(n=r.data)!=null&&n.token&&r.data.refreshToken&&vf(r.data.token,r.data.refreshToken),r},async refresh(){var r;const e=DJ();if(!e)return{error:"No refresh token",status:401};const t=await Xe.post("/auth/refresh",{refreshToken:e});return(r=t.data)!=null&&r.token&&vf(t.data.token,e),t},async me(){return Xe.get("/auth/me")},async updateMe(e){return Xe.put("/auth/me",e)},async changePassword(e,t){return Xe.post("/auth/change-password",{currentPassword:e,newPassword:t})},async setup2fa(){return Xe.post("/auth/2fa/setup",{})},async verify2faSetup(e){return Xe.post("/auth/2fa/verify-setup",{token:e})},async disable2fa(e,t){return Xe.post("/auth/2fa/disable",{currentPassword:e,token:t??""})},logout(){hq()}},zr={list(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.type&&t.set("type",e.type),(e==null?void 0:e.page)!=null&&t.set("page",String(e.page)),(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit)),e!=null&&e.recordKind&&t.set("recordKind",e.recordKind),e!=null&&e.activitySubtype&&t.set("activitySubtype",e.activitySubtype),e!=null&&e.enrich&&t.set("enrich","1");const r=t.toString();return Xe.get(`/events${r?`?${r}`:""}`)},get(e){return Xe.get(`/events/${e}`)},create(e){return Xe.post("/events",e)},update(e,t){return Xe.put(`/events/${e}`,t)},remove(e){return Xe.delete(`/events/${e}`)},analytics(e){return Xe.get(`/events/${e}/analytics`)},duplicate(e){return Xe.post(`/events/${e}/duplicate`,{})},generateFromAi(e){return Xe.post("/events/generate-from-ai",e)},aiExtractPreview(e){return Xe.post("/events/ai-extract-preview",e)},emailerLinkTargets(e){return Xe.get(`/events/${e}/emailer-link-targets`)}},ZO={leaderboard(e,t){const r=t!=null&&t>0?`?limit=${encodeURIComponent(String(t))}`:"";return Xe.get(`/events/${e}/leaderboard${r}`)},create(e,t){return Xe.post(`/events/${e}/reward-points`,{source:"manual",...t})}},Ei={listAll(e){var n,o;const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization),t.set("page",String((e==null?void 0:e.page)??1)),t.set("limit",String((e==null?void 0:e.limit)??20)),(n=e==null?void 0:e.q)!=null&&n.trim()&&t.set("q",e.q.trim()),(o=e==null?void 0:e.tag)!=null&&o.trim()&&t.set("tag",e.tag.trim());const r=t.toString();return Xe.get(`/participants${r?`?${r}`:""}`)},listDistinctTags(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization);const r=t.toString();return Xe.get(`/participants/tags${r?`?${r}`:""}`)},matchingIds(e){var n,o;const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization),(n=e==null?void 0:e.q)!=null&&n.trim()&&t.set("q",e.q.trim()),(o=e==null?void 0:e.tag)!=null&&o.trim()&&t.set("tag",e.tag.trim());const r=t.toString();return Xe.get(`/participants/matching-ids${r?`?${r}`:""}`)},bulk(e){return Xe.post("/participants/bulk",e)},list(e,t){var o;const r=new URLSearchParams;r.set("page",String((t==null?void 0:t.page)??1)),r.set("limit",String((t==null?void 0:t.limit)??20)),t!=null&&t.status&&r.set("status",t.status),(o=t==null?void 0:t.q)!=null&&o.trim()&&r.set("q",t.q.trim()),t!=null&&t.designation&&r.set("designation",t.designation);const n=r.toString();return Xe.get(`/events/${e}/participants${n?`?${n}`:""}`)},get(e){return Xe.get(`/participants/${e}`)},create(e,t){return Xe.post(`/events/${e}/participants`,t)},update(e,t){return Xe.put(`/participants/${e}`,t)},remove(e,t){const r=new URLSearchParams({event_id:t});return Xe.delete(`/participants/${e}?${r.toString()}`)},deleteOne(e){return Xe.delete(`/participants/${e}`)},checkIn(e,t){const r=new URLSearchParams({event_id:t});return Xe.post(`/participants/${e}/check-in?${r.toString()}`,{})},async downloadExport(e,t="participants-export.csv"){var s;const r=await vm(`/events/${e}/participants/export`,{method:"GET"});if(!r.ok){let l=r.statusText;try{const c=await r.json();l=((s=c==null?void 0:c.error)==null?void 0:s.message)||l}catch{}return{ok:!1,error:l}}const n=await r.blob(),o=URL.createObjectURL(n),a=document.createElement("a");return a.href=o,a.download=t,a.click(),URL.revokeObjectURL(o),{ok:!0}},importCsv(e,t){return Xe.post(`/events/${e}/participants/import`,{csv:t})},async downloadExportAll(e,t="all-participants-export.csv"){var c,u,d;const r=new URLSearchParams;e!=null&&e.organization&&r.set("organization",e.organization),(c=e==null?void 0:e.q)!=null&&c.trim()&&r.set("q",e.q.trim()),(u=e==null?void 0:e.tag)!=null&&u.trim()&&r.set("tag",e.tag.trim());const n=r.toString(),o=await vm(`/participants/export${n?`?${n}`:""}`,{method:"GET"});if(!o.ok){let f=o.statusText;try{const h=await o.json();f=((d=h==null?void 0:h.error)==null?void 0:d.message)||f}catch{}return{ok:!1,error:f}}const a=await o.blob(),s=URL.createObjectURL(a),l=document.createElement("a");return l.href=s,l.download=t,l.click(),URL.revokeObjectURL(s),{ok:!0}},importGlobal(e){return Xe.post("/participants/import",e)}},Fa={list(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization);const r=t.toString();return Xe.get(`/participant-lists${r?`?${r}`:""}`)},create(e){return Xe.post("/participant-lists",e)},get(e){return Xe.get(`/participant-lists/${e}`)},update(e,t){return Xe.put(`/participant-lists/${e}`,t)},members(e,t){const r=new URLSearchParams;return t!=null&&t.organization&&r.set("organization",t.organization),r.set("page",String((t==null?void 0:t.page)??1)),r.set("limit",String((t==null?void 0:t.limit)??50)),Xe.get(`/participant-lists/${e}/members?${r}`)},remove(e){return Xe.delete(`/participant-lists/${e}`)}},Hs={list(e){const t=new URLSearchParams;e!=null&&e.type&&t.set("type",e.type),e!=null&&e.organization&&t.set("organization",e.organization),(e==null?void 0:e.page)!=null&&t.set("page",String(e.page)),(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit));const r=t.toString();return Xe.get(`/design-templates${r?`?${r}`:""}`)},get(e){return Xe.get(`/design-templates/${e}`)},create(e){return Xe.post("/design-templates",e)},update(e,t){return Xe.put(`/design-templates/${e}`,t)},remove(e){return Xe.delete(`/design-templates/${e}`)},duplicate(e){return Xe.post(`/design-templates/${e}/duplicate`,{})},useForEvent(e,t){return Xe.post(`/design-templates/${e}/use/${t}`,{})}},mq={list(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization),e!=null&&e.event&&t.set("event",e.event),(e==null?void 0:e.page)!=null&&t.set("page",String(e.page)),(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit));const r=t.toString();return Xe.get(`/badge-batches${r?`?${r}`:""}`)},get(e,t){const r=new URLSearchParams;t&&r.set("organization",t);const n=r.toString();return Xe.get(`/badge-batches/${e}${n?`?${n}`:""}`)},create(e){return Xe.post("/badge-batches",e)}},m1={async list(e){var r;const t=await Xe.get(`/events/${e}/tickets`);if(t.error)throw new Error(t.error);return((r=t.data)==null?void 0:r.tickets)??[]},async create(e,t){const r=await Xe.post(`/events/${e}/tickets`,t);if(r.error||!r.data)throw new Error(r.error??"Failed to create ticket");return r.data},async update(e,t,r){const n=await Xe.patch(`/events/${e}/tickets/${t}`,r);if(n.error||!n.data)throw new Error(n.error??"Failed to update ticket");return n.data},async remove(e,t){const r=await Xe.delete(`/events/${e}/tickets/${t}`);if(r.error)throw new Error(r.error)}};async function af(e){var n;let t;try{t=await e.json()}catch{return{error:e.statusText||"Network error"}}const r=t;return r.success===!0&&r.data!==void 0?{data:r.data}:{error:((n=r.error)==null?void 0:n.message)||"Request failed"}}function sf(e){const t=Dy.endsWith("/")?Dy.slice(0,-1):Dy,r=e.startsWith("/")?e:`/${e}`;return`${t}${r}`}const lf={async getEventSummary(e){const t=await fetch(sf(`/public/events/${e}/summary`),{method:"GET"}),r=await af(t);if(r.error)throw new Error(r.error);return r.data},async listTickets(e){var n;const t=await fetch(sf(`/public/events/${e}/tickets`),{method:"GET"}),r=await af(t);if(r.error)throw new Error(r.error);return((n=r.data)==null?void 0:n.tickets)??[]},async checkoutOptions(e){const t=await fetch(sf(`/public/events/${e}/tickets/checkout-options`),{method:"GET"}),r=await af(t);if(r.error)throw new Error(r.error);return r.data},async quote(e,t){const r=await fetch(sf(`/public/events/${e}/tickets/quote`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await af(r);if(n.error)throw new Error(n.error);return n.data},async manualQuote(e,t){const r=await fetch(sf(`/public/events/${e}/tickets/manual-quote`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await af(r);if(n.error)throw new Error(n.error);return n.data},async checkout(e,t){const r=await fetch(sf(`/public/events/${e}/tickets/checkout`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await af(r);if(n.error)throw new Error(n.error);return n.data},async verifyPayment(e,t){const r=await fetch(sf(`/public/events/${e}/payment/verify`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await af(r);if(n.error)throw new Error(n.error)},async manualSubmit(e,t){const r=await fetch(sf(`/public/events/${e}/tickets/manual-submit`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await af(r);if(n.error)throw new Error(n.error);return n.data}},Pj={async get(e){var r;const t=await Xe.get(`/events/${e}/ticketing-manual-payment`);if(t.error||!((r=t.data)!=null&&r.ticketingManualPayment))throw new Error(t.error??"Failed to load manual payment settings");return t.data.ticketingManualPayment},async patch(e,t){var n;const r=await Xe.patch(`/events/${e}/ticketing-manual-payment`,t);if(r.error||!((n=r.data)!=null&&n.ticketingManualPayment))throw new Error(r.error??"Failed to save");return r.data.ticketingManualPayment},async checkoutEnablementOrder(e){const t=await Xe.post(`/events/${e}/ticketing-manual-enablement/checkout-order`,{});if(t.error||!t.data)throw new Error(t.error??"Failed to create payment order");return t.data}},v1={async list(e,t="pending_review"){var o;const r=t==="pending_review"?"":`?status=${encodeURIComponent(t)}`,n=await Xe.get(`/events/${e}/ticket-manual-orders${r}`);if(n.error)throw new Error(n.error);return((o=n.data)==null?void 0:o.orders)??[]},async approve(e,t){const r=await Xe.post(`/events/${e}/ticket-manual-orders/${t}/approve`,{});if(r.error)throw new Error(r.error)},async reject(e,t,r){const n=await Xe.post(`/events/${e}/ticket-manual-orders/${t}/reject`,{reason:r});if(n.error)throw new Error(n.error)}},Ef={list(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization),(e==null?void 0:e.page)!=null&&t.set("page",String(e.page)),(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit));const r=t.toString();return Xe.get(`/speakers${r?`?${r}`:""}`)},get(e){return Xe.get(`/speakers/${e}`)},create(e){return Xe.post("/speakers",e)},update(e,t){return Xe.put(`/speakers/${e}`,t)},remove(e){return Xe.delete(`/speakers/${e}`)},byEvent(e){return Xe.get(`/events/${e}/speakers`)}};async function y1(e){if(e.error||!e.data)throw new Error(e.error??"Request failed");return e.data}const Ma={async list(e){var o;const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization);const r=t.toString(),n=await Xe.get(`/forms${r?`?${r}`:""}`);if(n.error)throw new Error(n.error);return((o=n.data)==null?void 0:o.forms)??[]},async listForEvent(e){var r;const t=await Xe.get(`/events/${e}/forms`);if(t.error)throw new Error(t.error);return((r=t.data)==null?void 0:r.forms)??[]},async get(e){return y1(await Xe.get(`/forms/${e}`))},async create(e){return y1(await Xe.post("/forms",e))},async createForEvent(e,t){return y1(await Xe.post(`/events/${e}/forms`,t))},async update(e,t){return y1(await Xe.put(`/forms/${e}`,t))},async remove(e){const t=await Xe.delete(`/forms/${e}`);if(t.error)throw new Error(t.error)},async getPublic(e){var o;const t=`${Dy}/public/forms/${e}`,r=await fetch(t);let n;try{n=await r.json()}catch{throw new Error("Network error")}if(!n.success||!n.data)throw new Error(((o=n.error)==null?void 0:o.message)||"Form not available");return n.data},async submit(e,t){const r=await Xe.post(`/forms/${e}/submit`,t);if(r.error)throw new Error(r.error);return r.data},async listSubmissions(e,t){var a,s,l,c;const r=new URLSearchParams;t!=null&&t.q&&r.set("q",t.q),t!=null&&t.dateFrom&&r.set("dateFrom",t.dateFrom),t!=null&&t.dateTo&&r.set("dateTo",t.dateTo),(t==null?void 0:t.page)!=null&&r.set("page",String(t.page)),(t==null?void 0:t.limit)!=null&&r.set("limit",String(t.limit));const n=r.toString(),o=await Xe.get(`/forms/${e}/submissions${n?`?${n}`:""}`);if(o.error)throw new Error(o.error);return{submissions:((a=o.data)==null?void 0:a.submissions)??[],total:((s=o.data)==null?void 0:s.total)??0,page:((l=o.data)==null?void 0:l.page)??1,limit:((c=o.data)==null?void 0:c.limit)??20}},async exportSubmissionsCsv(e,t){var o;const r=new URLSearchParams;r.set("export","csv"),t!=null&&t.q&&r.set("q",t.q),t!=null&&t.dateFrom&&r.set("dateFrom",t.dateFrom),t!=null&&t.dateTo&&r.set("dateTo",t.dateTo);const n=await vm(`/forms/${e}/submissions?${r.toString()}`,{method:"GET"});if(!n.ok){let a=n.statusText;try{a=((o=(await n.json()).error)==null?void 0:o.message)||a}catch{}throw new Error(a)}return n.blob()}},nx={list(){return Xe.get("/users")},create(e){return Xe.post("/users",e)},update(e,t){return Xe.put(`/users/${e}`,t)},remove(e){return Xe.delete(`/users/${e}`)}},rh={list(e){return Xe.get(`/events/${e}/tracks`)},create(e,t){return Xe.post(`/events/${e}/tracks`,t)},update(e,t){return Xe.put(`/tracks/${e}`,t)},remove(e){return Xe.delete(`/tracks/${e}`)}},Da={list(e){return Xe.get(`/events/${e}/sessions`)},create(e,t){return Xe.post(`/events/${e}/sessions`,t)},update(e,t){return Xe.put(`/sessions/${e}`,t)},remove(e){return Xe.delete(`/sessions/${e}`)}},za={listStaff(e){return Xe.get(`/events/${e}/staff`)},listAvailableUsers(e){return Xe.get(`/events/${e}/staff/available-users`)},agendaTree(e){return Xe.get(`/events/${e}/agenda-tree`)},addStaff(e,t){return Xe.post(`/events/${e}/staff`,t)},updateStaff(e,t,r){return Xe.put(`/events/${e}/staff/${t}`,r)},removeStaff(e,t){return Xe.delete(`/events/${e}/staff/${t}`)},sendInvites(e,t){return Xe.post(`/events/${e}/staff/invites`,t)},cancelInvite(e,t){return Xe.delete(`/events/${e}/staff/invites/${t}`)},resendInvite(e,t){return Xe.post(`/events/${e}/staff/invites/${t}/resend`,{})},invitePreview(e){return Xe.get(`/event-invites/${e}`)},inviteAccept(e){return Xe.post("/event-invites/accept",e)}},Oa={listByEvent(e){return Xe.get(`/events/${e}/quiz-polls`)},listBySession(e){return Xe.get(`/sessions/${e}/quiz-polls`)},get(e){return Xe.get(`/quiz-polls/${e}`)},create(e,t){return Xe.post(`/events/${e}/quiz-polls`,t)},update(e,t){return Xe.put(`/quiz-polls/${e}`,t)},remove(e){return Xe.delete(`/quiz-polls/${e}`)},publish(e){return Xe.post(`/quiz-polls/${e}/publish`,{})},close(e){return Xe.post(`/quiz-polls/${e}/close`,{})}},zJ=["home","agenda","speakers","registration","sponsors","custom"],BJ=["header","banner","contact_form","agenda","register_links","speakers","footer","sponsors","cta","custom_html","countdown","gallery","about","venue","faq","tickets"],Wc={list(e){return Xe.get(`/events/${e}/pages`)},get(e){return Xe.get(`/pages/${e}`)},create(e,t){return Xe.post(`/events/${e}/pages`,t)},update(e,t){return Xe.put(`/pages/${e}`,t)},remove(e){return Xe.delete(`/pages/${e}`)},publish(e){return Xe.post(`/pages/${e}/publish`,{})},exportHtml(e,t){const r=t?`?registrationUrl=${encodeURIComponent(t)}`:"";return Xe.get(`/pages/${e}/export-html${r}`)}},Uc={get(e){return Xe.get(`/events/${e}/website-settings`)},update(e,t){return Xe.put(`/events/${e}/website-settings`,t)},checkFolder(e,t,r){const n=new URLSearchParams({folder:t});return r&&n.set("micrositeId",r),Xe.get(`/events/${e}/website-settings/check-folder?${n.toString()}`)},publishMicrosite(e,t){return Xe.post(`/events/${e}/website/publish-microsite`,t??{})},micrositePreviewHtml(e,t){const r=t?`?micrositeId=${encodeURIComponent(t)}`:"";return Xe.get(`/events/${e}/website-settings/microsite-preview-html${r}`)}},ua={listForOrganization(e){return Xe.get(`/event-microsites?organization=${encodeURIComponent(e)}`)},list(e){return Xe.get(`/events/${e}/microsites`)},get(e,t){return Xe.get(`/events/${e}/microsites/${t}`)},create(e,t){return Xe.post(`/events/${e}/microsites`,t)},update(e,t,r){return Xe.put(`/events/${e}/microsites/${t}`,r)},delete(e,t){return Xe.delete(`/events/${e}/microsites/${t}`)},publish(e,t,r){return Xe.post(`/events/${e}/microsites/${t}/publish`,r??{})},previewHtml(e,t){return Xe.get(`/events/${e}/microsites/${t}/preview-html`)},checkFolder(e,t,r){const n=new URLSearchParams({folder:t});return r&&n.set("micrositeId",r),Xe.get(`/events/${e}/microsites/check-folder?${n.toString()}`)}};async function vq(e={}){var n,o;const t=new URLSearchParams;e.organization&&t.set("organization",e.organization),t.set("page",String(e.page??1)),t.set("limit",String(e.limit??200)),e.type&&t.set("type",e.type);const r=await Xe.get(`/library/media?${t.toString()}`);if(r.error)throw new Error(r.error);return{media:((n=r.data)==null?void 0:n.media)??[],total:((o=r.data)==null?void 0:o.total)??0}}async function Ys(e,t={}){var a;const r=new FormData;r.append("file",e),r.append("name",e.name),t.eventId&&r.append("eventId",t.eventId),t.module&&r.append("module",t.module),t.description!=null&&r.append("description",t.description),t.visibility&&r.append("visibility",t.visibility),t.tags&&r.append("tags",t.tags),t.contentCollectionId&&r.append("contentCollectionId",t.contentCollectionId);const o=await(await vm("/media/upload",{method:"POST",body:r,skipGlobalLoading:!0})).json();if(o.success&&o.data)return o.data;throw new Error(((a=o.error)==null?void 0:a.message)||"Upload failed")}const I0={async list(e){var n;const t=new URLSearchParams;t.set("limit","200"),e!=null&&e.organization&&t.set("organization",e.organization);const r=await Xe.get(`/content-collections?${t}`);if(r.error)throw new Error(r.error);return((n=r.data)==null?void 0:n.collections)??[]},async create(e){const t=await Xe.post("/content-collections",e);if(t.error||!t.data)throw new Error(t.error??"Failed to create collection");return t.data},async get(e){const t=await Xe.get(`/content-collections/${e}`);if(t.error||!t.data)throw new Error(t.error??"Not found");return t.data},async update(e,t){const r=await Xe.put(`/content-collections/${e}`,t);if(r.error||!r.data)throw new Error(r.error??"Failed to update collection");return r.data},async remove(e){const t=await Xe.delete(`/content-collections/${e}`);if(t.error)throw new Error(t.error)}},ls={async get(e){const t=e!=null&&e.cacheBust?`?_=${encodeURIComponent(String(Date.now()))}`:"",r=await Xe.get(`/organization${t}`);if(r.error)throw new Error(r.error);return r.data??null},async update(e){const t=await Xe.put("/organization",e);if(t.error||t.data==null)throw new Error(t.error??"Update failed");return t.data},getEmailSettings(){return Xe.get("/organization/email-settings")},updateEmailSettings(e){return Xe.put("/organization/email-settings",e)},testEmailSettings(e){return Xe.post("/organization/email-settings/test",{to:e})},getWhatsAppSettings(){return Xe.get("/organization/whatsapp-settings")},updateWhatsAppSettings(e){return Xe.put("/organization/whatsapp-settings",e)}},Bg={list(e){const t=new URLSearchParams;e!=null&&e.sync&&t.set("sync","1"),e!=null&&e.status&&t.set("status",e.status);const r=t.toString();return Xe.get(`/whatsapp-templates${r?`?${r}`:""}`)},get(e,t){const r=new URLSearchParams;t!=null&&t.sync&&r.set("sync","1");const n=r.toString();return Xe.get(`/whatsapp-templates/${e}${n?`?${n}`:""}`)},create(e){return Xe.post("/whatsapp-templates",e)},sync(e){return Xe.post(`/whatsapp-templates/${e}/sync`,{})},remove(e){return Xe.delete(`/whatsapp-templates/${e}`)}},co={listByOrg(e){const t=new URLSearchParams;e!=null&&e.channel&&t.set("channel",e.channel);const r=t.toString();return Xe.get(`/campaigns${r?`?${r}`:""}`)},listForEvent(e){return Xe.get(`/events/${e}/campaigns`)},create(e,t){return Xe.post(`/events/${e}/campaigns`,t)},get(e){return Xe.get(`/campaigns/${e}`)},update(e,t){return Xe.put(`/campaigns/${e}`,t)},remove(e){return Xe.delete(`/campaigns/${e}`)},send(e,t={}){return Xe.post(`/campaigns/${e}/send`,t)},schedule(e,t){return Xe.post(`/campaigns/${e}/schedule`,{scheduledFor:t})},cancel(e){return Xe.post(`/campaigns/${e}/cancel`,{})},stop(e){return Xe.post(`/campaigns/${e}/stop`,{})},analytics(e){return Xe.get(`/campaigns/${e}/analytics`)},preview(e,t){return Xe.post(`/campaigns/${e}/preview`,t||{})}};function P6(){return typeof window>"u"?Promise.reject(new Error("No window")):window.Razorpay?Promise.resolve():new Promise((t,r)=>{const n=document.createElement("script");n.src="https://checkout.razorpay.com/v1/checkout.js",n.async=!0,n.onload=()=>t(),n.onerror=()=>r(new Error("Failed to load Razorpay")),document.body.appendChild(n)})}const Ku={async catalog(){const e=await Xe.get("/subscription/catalog");if(e.error||!e.data)throw new Error(e.error??"Failed to load catalog");return e.data},async checkoutOrder(e){const t=await Xe.post("/subscription/checkout/order",{targetPlanId:e});if(t.error||!t.data)throw new Error(t.error??"Failed to create payment order");return t.data},async checkoutVerify(e){const t=await Xe.post("/subscription/checkout/verify",e);if(t.error||!t.data)throw new Error(t.error??"Payment verification failed");return t.data},async contactSalesRequest(e){const t=await Xe.post("/subscription/contact-sales",e);if(t.error||t.data==null)throw new Error(t.error??"Failed to send request");return t.data},async listInvoices(){const e=await Xe.get("/subscription/invoices");if(e.error||!e.data)throw new Error(e.error??"Failed to load invoices");return e.data},async downloadInvoice(e){const t=await vm(`/subscription/invoices/${encodeURIComponent(e)}/invoice`,{method:"GET",skipGlobalLoading:!0});if(!t.ok)throw new Error("Download failed");const r=await t.blob(),n=URL.createObjectURL(r),o=document.createElement("a");o.href=n,o.download=`eventbuzz-invoice-${e}.html`,o.click(),URL.revokeObjectURL(n)}},Zu={async listOrganizations(e={}){const t=new URLSearchParams;e.page!=null&&t.set("page",String(e.page)),e.limit!=null&&t.set("limit",String(e.limit)),e.search&&t.set("search",e.search);const r=t.toString(),n=`/platform-admin/organizations${r?`?${r}`:""}`,o=await Xe.get(n);if(o.error||!o.data)throw new Error(o.error??"Failed to load organizations");const a=o.data;return{organizations:a.organizations??[],total:a.total??0,page:a.page??1,limit:a.limit??20}},async createOrganization(e){const t=await Xe.post("/platform-admin/organizations",e);if(t.error||!t.data)throw new Error(t.error??"Failed to create organization");return t.data},async getOrganization(e){const t=await Xe.get(`/platform-admin/organizations/${e}`);if(t.error||!t.data)throw new Error(t.error??"Failed to load organization");return t.data},async patchOrganizationSubscription(e,t){const r=await Xe.patch(`/platform-admin/organizations/${e}/subscription`,t);if(r.error||!r.data)throw new Error(r.error??"Failed to update subscription");return r.data},async listPermissions(){const e=await Xe.get("/platform-admin/permissions");if(e.error||!e.data)throw new Error(e.error??"Failed to load permissions");return e.data},async listPlans(){const e=await Xe.get("/platform-admin/plans");if(e.error||!e.data)throw new Error(e.error??"Failed to load plans");return e.data},async createPlan(e){const t=await Xe.post("/platform-admin/plans",e);if(t.error||!t.data)throw new Error(t.error??"Failed to create plan");return t.data},async updatePlan(e,t){const r=encodeURIComponent(e),n=await Xe.put(`/platform-admin/plans/${r}`,t);if(n.error||!n.data)throw new Error(n.error??"Failed to update plan");return n.data},async deletePlan(e){const t=encodeURIComponent(e),r=await Xe.delete(`/platform-admin/plans/${t}`);if(r.error||!r.data)throw new Error(r.error??"Failed to delete plan");return r.data}},JO={async create(e){const t=await Xe.post("/admin-requests",e);if(t.error||!t.data)throw new Error(t.error??"Request failed");return t.data}},Bu={getPlatformConfig(){return Xe.get("/platform/payment-config")},updatePlatformConfig(e){return Xe.put("/platform/payment-config",e)},getOrgProfile(){return Xe.get("/organization/payment-profile")},updateOrgProfile(e){return Xe.put("/organization/payment-profile",e)},addGateway(e){return Xe.post("/organization/payment-profile/gateways",e)},patchGateway(e,t){return Xe.patch(`/organization/payment-profile/gateways/${e}`,t)},deleteGateway(e){return Xe.delete(`/organization/payment-profile/gateways/${e}`)},listTransactions(e){const t=new URLSearchParams;Object.entries(e).forEach(([n,o])=>{o!=null&&String(o)!==""&&t.set(n,String(o))});const r=t.toString();return Xe.get(`/payment/transactions${r?`?${r}`:""}`)},async downloadTransactionsCsv(e){const t=new URLSearchParams;Object.entries(e).forEach(([s,l])=>{l&&t.set(s,l)});const r=await vm(`/payment/transactions/export?${t.toString()}`,{method:"GET",skipGlobalLoading:!0});if(!r.ok)throw new Error("Export failed");const n=await r.blob(),o=URL.createObjectURL(n),a=document.createElement("a");a.href=o,a.download="payment-transactions.csv",a.click(),URL.revokeObjectURL(o)}};function yq(e){if(e===null||typeof e!="object")return!1;const t=e;return t.version===1&&typeof t.layoutId=="string"&&Array.isArray(t.sections)}function zn(e){if(!(!(e!=null&&e.organization)||typeof e.organization!="object"))return e.organization._id}const K3="eventbuzz_user";function WJ(){try{const e=localStorage.getItem(K3);return e?JSON.parse(e):null}catch{return null}}function ml(e){try{e?localStorage.setItem(K3,JSON.stringify(e)):localStorage.removeItem(K3)}catch{}}const xq=j.createContext(null);function qJ({children:e}){const[t,r]=j.useState(()=>({user:WJ(),loading:!0,checked:!1})),n=j.useCallback(async()=>{try{const f=await Ia.me();f.data?(ml(f.data),r(h=>({...h,user:f.data,checked:!0}))):(ml(null),r(h=>({...h,user:null,checked:!0})))}catch{ml(null),r(f=>({...f,user:null,checked:!0}))}},[]);j.useEffect(()=>{let f=!1;return(async()=>{try{const h=await Ia.me();if(f)return;h.data?(ml(h.data),r({user:h.data,loading:!1,checked:!0})):(ml(null),r({user:null,loading:!1,checked:!0}))}catch{f||(ml(null),r({user:null,loading:!1,checked:!0}))}})(),()=>{f=!0}},[]);const o=j.useCallback(async(f,h)=>{const p=await Ia.login(f,h);if(p.error)return{error:p.error};const y=p.data;return y&&"requiresTwoFactor"in y&&y.requiresTwoFactor&&y.twoFactorToken?{requiresTwoFactor:!0,twoFactorToken:y.twoFactorToken,email:"email"in y?y.email:void 0}:y&&"user"in y&&y.user?(ml(y.user),r(m=>({...m,user:y.user})),{success:!0}):{error:"Login failed"}},[]),a=j.useCallback(async f=>{let h=await Ia.googleLogin(f);if(h.error&&/register first|not registered/i.test(h.error)&&(h=await Ia.googleRegister({idToken:f})),h.error)return{error:h.error};const p=h.data;return p&&"requiresTwoFactor"in p&&p.requiresTwoFactor&&p.twoFactorToken?{requiresTwoFactor:!0,twoFactorToken:p.twoFactorToken,email:"email"in p?p.email:void 0}:p&&"user"in p&&p.user?(ml(p.user),r(y=>({...y,user:p.user})),{success:!0}):{error:"Google sign-in failed"}},[]),s=j.useCallback(async(f,h)=>{var y;const p=await Ia.completeLogin2fa(f,h.replace(/\s/g,""));return p.error?{error:p.error}:(y=p.data)!=null&&y.user?(ml(p.data.user),r(m=>({...m,user:p.data.user})),{}):{error:"Verification failed"}},[]),l=j.useCallback(async f=>{const h=await Ia.register(f);if(h.data){const p=h.data.user;return ml(p),r(y=>({...y,user:p})),{}}return{error:h.error||"Registration failed"}},[]),c=j.useCallback(async f=>{const h=await Ia.googleRegister(f);if(h.data){const p=h.data.user;return ml(p),r(y=>({...y,user:p})),{}}return{error:h.error||"Registration failed"}},[]),u=j.useCallback(()=>{Ia.logout(),ml(null),r({user:null,loading:!1,checked:!0})},[]),d={...t,login:o,loginWithGoogleCredential:a,completeTwoFactorLogin:s,register:l,registerWithGoogle:c,logout:u,refreshUser:n};return i.jsx(xq.Provider,{value:d,children:e})}function Ur(){const e=j.useContext(xq);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $J=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),UJ=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),eI=e=>{const t=UJ(e);return t.charAt(0).toUpperCase()+t.slice(1)},bq=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var HJ={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VJ=j.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:a,iconNode:s,...l},c)=>j.createElement("svg",{ref:c,...HJ,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:bq("lucide",o),...l},[...s.map(([u,d])=>j.createElement(u,d)),...Array.isArray(a)?a:[a]]));/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Lt=(e,t)=>{const r=j.forwardRef(({className:n,...o},a)=>j.createElement(VJ,{ref:a,iconNode:t,className:bq(`lucide-${$J(eI(e))}`,`lucide-${e}`,n),...o}));return r.displayName=eI(e),r};/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YJ=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],GJ=Lt("align-left",YJ);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KJ=[["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"}]],QJ=Lt("archive",KJ);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XJ=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],wq=Lt("arrow-left",XJ);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZJ=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],O6=Lt("arrow-right",ZJ);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const JJ=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],eee=Lt("arrow-up-narrow-wide",JJ);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tee=[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]],ree=Lt("award",tee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nee=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],iee=Lt("bell-off",nee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oee=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],I6=Lt("bell",oee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aee=[["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"}]],N0=Lt("book-open",aee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const see=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],tI=Lt("bookmark",see);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lee=[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]],nb=Lt("building-2",lee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cee=[["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"}]],Sq=Lt("calendar-days",cee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uee=[["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"}]],Wi=Lt("calendar",uee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dee=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],N6=Lt("chart-column",dee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fee=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],jq=Lt("chart-line",fee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pee=[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]],hee=Lt("chart-no-axes-column-increasing",pee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gee=[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]],nu=Lt("chart-no-axes-column",gee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mee=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Oi=Lt("check",mee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vee=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],po=Lt("chevron-down",vee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yee=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Nf=Lt("chevron-left",yee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xee=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],va=Lt("chevron-right",xee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bee=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],$f=Lt("chevron-up",bee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wee=[["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"}]],nv=Lt("circle-alert",wee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const See=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],iv=Lt("circle-check",See);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jee=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ib=Lt("circle-help",jee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kee=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],ob=Lt("clock",kee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _ee=[["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"}]],iu=Lt("copy",_ee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Cee=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],ov=Lt("credit-card",Cee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Eee=[["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"}]],Al=Lt("download",Eee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Aee=[["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"}]],Tee=Lt("ellipsis",Aee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pee=[["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"}]],av=Lt("external-link",Pee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Oee=[["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"}]],R6=Lt("eye-off",Oee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Iee=[["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"}]],Ah=Lt("eye",Iee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Nee=[["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"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],Ree=Lt("file-image",Nee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Lee=[["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"}]],lh=Lt("file-text",Lee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Fee=[["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"}]],L6=Lt("file",Fee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mee=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]],Dee=Lt("film",Mee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zee=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],rI=Lt("folder-open",zee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Bee=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Wee=Lt("funnel",Bee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qee=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],ud=Lt("globe",qee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $ee=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],sv=Lt("grip-vertical",$ee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Uee=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Hee=Lt("hash",Uee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vee=[["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"}]],F6=Lt("house",Vee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Yee=[["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"}]],R0=Lt("image",Yee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gee=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Tw=Lt("layers",Gee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Kee=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Qee=Lt("layout-dashboard",Kee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xee=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],ab=Lt("layout-grid",Xee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Zee=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]],Jee=Lt("layout-list",Zee);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ete=[["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"}]],Q3=Lt("link-2",ete);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tte=[["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"}]],rte=Lt("linkedin",tte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nte=[["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"}]],sb=Lt("list",nte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ite=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ix=Lt("loader-circle",ite);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ote=[["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"}]],ate=Lt("lock",ote);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ste=[["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"}]],lte=Lt("log-out",ste);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cte=[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]],kq=Lt("mail-check",cte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ute=[["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"}]],Uf=Lt("mail",ute);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dte=[["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"}]],lb=Lt("map-pin",dte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fte=[["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"}]],pte=Lt("menu",fte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hte=[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],Zs=Lt("message-circle",hte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gte=[["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"}]],ch=Lt("message-square",gte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mte=[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]],Pw=Lt("mic-vocal",mte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vte=[["path",{d:"M5 12h14",key:"1ays0h"}]],Ow=Lt("minus",vte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yte=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],nI=Lt("moon",yte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xte=[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]],bte=Lt("mouse-pointer",xte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wte=[["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"}]],Wg=Lt("palette",wte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ste=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],_q=Lt("panels-top-left",Ste);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jte=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Ii=Lt("pencil",jte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kte=[["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"}]],Iw=Lt("phone",kte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _te=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],Cq=Lt("plug",_te);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Cte=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],wr=Lt("plus",Cte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ete=[["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"}]],lv=Lt("qr-code",Ete);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ate=[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]],Eq=Lt("radio",Ate);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Tte=[["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"}]],X3=Lt("refresh-cw",Tte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pte=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],Aq=Lt("rocket",Pte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ote=[["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"}]],Ite=Lt("rotate-ccw",Ote);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Nte=[["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"}]],Nw=Lt("save",Nte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Rte=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Pi=Lt("search",Rte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Lte=[["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"}]],Tq=Lt("send",Lte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Fte=[["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"}]],Pl=Lt("settings",Fte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mte=[["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"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Dte=Lt("shield-check",Mte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zte=[["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"}]],id=Lt("shield",zte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Bte=[["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"}]],Wte=Lt("sparkles",Bte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qte=[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],M6=Lt("square-check-big",qte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $te=[["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"}]],Z3=Lt("square-pen",$te);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ute=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Pq=Lt("square",Ute);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hte=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Rf=Lt("star",Hte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vte=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],iI=Lt("sun",Vte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Yte=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Oq=Lt("tag",Yte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gte=[["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"}]],Kte=Lt("ticket",Gte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Qte=[["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"}]],gn=Lt("trash-2",Qte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xte=[["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"}]],D6=Lt("trending-up",Xte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Zte=[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]],od=Lt("trophy",Zte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Jte=[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]],ere=Lt("twitter",Jte);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tre=[["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"}]],ou=Lt("upload",tre);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rre=[["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"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]],Iq=Lt("user-check",rre);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nre=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],z6=Lt("user-plus",nre);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ire=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],ore=Lt("user-x",ire);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const are=[["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"}]],ym=Lt("user",are);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sre=[["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"}]],vi=Lt("users",sre);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lre=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],er=Lt("x",lre);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cre=[["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"}]],B6=Lt("zap",cre);function cb({title:e="Confirm",message:t,confirmLabel:r="Confirm",cancelLabel:n="Cancel",variant:o="danger",onConfirm:a,onCancel:s}){const l=o==="danger",c=o==="warning";return i.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-modal-title",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:110,display:"flex",alignItems:"center",justifyContent:"center"},onClick:s,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"360px",padding:"20px",boxShadow:"var(--shadow-xl)"},onClick:u=>u.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",gap:"12px",alignItems:"flex-start",marginBottom:"20px"},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:l?"#fee2e2":c?"#fef3c7":"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx(nv,{size:16,style:{color:l?"var(--destructive)":c?"#b45309":"var(--muted)"}})}),i.jsxs("div",{children:[i.jsx("p",{id:"confirm-modal-title",style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"5px"},children:e}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:t})]})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:s,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:n}),i.jsx("button",{type:"button",onClick:a,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"none",background:l?"var(--destructive)":c?"#b45309":"var(--primary)",color:"#fff",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:r})]})]})})}function ps(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e==null||e(o),r===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function oI(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Nq(...e){return t=>{let r=!1;const n=e.map(o=>{const a=oI(o,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let o=0;o{const{children:s,...l}=a,c=j.useMemo(()=>l,Object.values(l));return i.jsx(r.Provider,{value:c,children:s})};n.displayName=e+"Provider";function o(a){const s=j.useContext(r);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,o]}function Rw(e,t=[]){let r=[];function n(a,s){const l=j.createContext(s),c=r.length;r=[...r,s];const u=f=>{var b;const{scope:h,children:p,...y}=f,m=((b=h==null?void 0:h[e])==null?void 0:b[c])||l,x=j.useMemo(()=>y,Object.values(y));return i.jsx(m.Provider,{value:x,children:p})};u.displayName=a+"Provider";function d(f,h){var m;const p=((m=h==null?void 0:h[e])==null?void 0:m[c])||l,y=j.useContext(p);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,d]}const o=()=>{const a=r.map(s=>j.createContext(s));return function(l){const c=(l==null?void 0:l[e])||a;return j.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[n,dre(o,...t)]}function dre(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const s=n.reduce((l,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...l,...f}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var uh=globalThis!=null&&globalThis.document?j.useLayoutEffect:()=>{},fre=GW.useId||(()=>{}),pre=0;function h0(e){const[t,r]=j.useState(fre());return uh(()=>{r(n=>n??String(pre++))},[e]),e||(t?`radix-${t}`:"")}function Lf(e){const t=j.useRef(e);return j.useEffect(()=>{t.current=e}),j.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function W6({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,o]=hre({defaultProp:t,onChange:r}),a=e!==void 0,s=a?e:n,l=Lf(r),c=j.useCallback(u=>{if(a){const f=typeof u=="function"?u(e):u;f!==e&&l(f)}else o(u)},[a,e,o,l]);return[s,c]}function hre({defaultProp:e,onChange:t}){const r=j.useState(e),[n]=r,o=j.useRef(n),a=Lf(t);return j.useEffect(()=>{o.current!==n&&(a(n),o.current=n)},[n,o,a]),r}var Lw=j.forwardRef((e,t)=>{const{children:r,...n}=e,o=j.Children.toArray(r),a=o.find(mre);if(a){const s=a.props.children,l=o.map(c=>c===a?j.Children.count(s)>1?j.Children.only(null):j.isValidElement(s)?s.props.children:null:c);return i.jsx(J3,{...n,ref:t,children:j.isValidElement(s)?j.cloneElement(s,void 0,l):null})}return i.jsx(J3,{...n,ref:t,children:r})});Lw.displayName="Slot";var J3=j.forwardRef((e,t)=>{const{children:r,...n}=e;if(j.isValidElement(r)){const o=yre(r),a=vre(n,r.props);return r.type!==j.Fragment&&(a.ref=t?Nq(t,o):o),j.cloneElement(r,a)}return j.Children.count(r)>1?j.Children.only(null):null});J3.displayName="SlotClone";var gre=({children:e})=>i.jsx(i.Fragment,{children:e});function mre(e){return j.isValidElement(e)&&e.type===gre}function vre(e,t){const r={...t};for(const n in t){const o=e[n],a=t[n];/^on[A-Z]/.test(n)?o&&a?r[n]=(...l)=>{a(...l),o(...l)}:o&&(r[n]=o):n==="style"?r[n]={...o,...a}:n==="className"&&(r[n]=[o,a].filter(Boolean).join(" "))}return{...e,...r}}function yre(e){var n,o;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var xre=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ya=xre.reduce((e,t)=>{const r=j.forwardRef((n,o)=>{const{asChild:a,...s}=n,l=a?Lw:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(l,{...s,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function bre(e,t){e&&k6.flushSync(()=>e.dispatchEvent(t))}function wre(e,t=globalThis==null?void 0:globalThis.document){const r=Lf(e);j.useEffect(()=>{const n=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Sre="DismissableLayer",eE="dismissableLayer.update",jre="dismissableLayer.pointerDownOutside",kre="dismissableLayer.focusOutside",aI,Rq=j.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),q6=j.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:s,onDismiss:l,...c}=e,u=j.useContext(Rq),[d,f]=j.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=j.useState({}),y=Nl(t,O=>f(O)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(x),w=d?m.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=b,_=Ere(O=>{const T=O.target,R=[...u.branches].some(I=>I.contains(T));!S||R||(o==null||o(O),s==null||s(O),O.defaultPrevented||l==null||l())},h),P=Are(O=>{const T=O.target;[...u.branches].some(I=>I.contains(T))||(a==null||a(O),s==null||s(O),O.defaultPrevented||l==null||l())},h);return wre(O=>{w===u.layers.size-1&&(n==null||n(O),!O.defaultPrevented&&l&&(O.preventDefault(),l()))},h),j.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(aI=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),sI(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=aI)}},[d,h,r,u]),j.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),sI())},[d,u]),j.useEffect(()=>{const O=()=>p({});return document.addEventListener(eE,O),()=>document.removeEventListener(eE,O)},[]),i.jsx(ya.div,{...c,ref:y,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:ps(e.onFocusCapture,P.onFocusCapture),onBlurCapture:ps(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:ps(e.onPointerDownCapture,_.onPointerDownCapture)})});q6.displayName=Sre;var _re="DismissableLayerBranch",Cre=j.forwardRef((e,t)=>{const r=j.useContext(Rq),n=j.useRef(null),o=Nl(t,n);return j.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),i.jsx(ya.div,{...e,ref:o})});Cre.displayName=_re;function Ere(e,t=globalThis==null?void 0:globalThis.document){const r=Lf(e),n=j.useRef(!1),o=j.useRef(()=>{});return j.useEffect(()=>{const a=l=>{if(l.target&&!n.current){let c=function(){Lq(jre,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Are(e,t=globalThis==null?void 0:globalThis.document){const r=Lf(e),n=j.useRef(!1);return j.useEffect(()=>{const o=a=>{a.target&&!n.current&&Lq(kre,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function sI(){const e=new CustomEvent(eE);document.dispatchEvent(e)}function Lq(e,t,r,{discrete:n}){const o=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?bre(o,a):o.dispatchEvent(a)}var Oj="focusScope.autoFocusOnMount",Ij="focusScope.autoFocusOnUnmount",lI={bubbles:!1,cancelable:!0},Tre="FocusScope",$6=j.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...s}=e,[l,c]=j.useState(null),u=Lf(o),d=Lf(a),f=j.useRef(null),h=Nl(t,m=>c(m)),p=j.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;j.useEffect(()=>{if(n){let m=function(k){if(p.paused||!l)return;const S=k.target;l.contains(S)?f.current=S:mf(f.current,{select:!0})},x=function(k){if(p.paused||!l)return;const S=k.relatedTarget;S!==null&&(l.contains(S)||mf(f.current,{select:!0}))},b=function(k){if(document.activeElement===document.body)for(const _ of k)_.removedNodes.length>0&&mf(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),w.disconnect()}}},[n,l,p.paused]),j.useEffect(()=>{if(l){uI.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(Oj,lI);l.addEventListener(Oj,u),l.dispatchEvent(b),b.defaultPrevented||(Pre(Lre(Fq(l)),{select:!0}),document.activeElement===m&&mf(l))}return()=>{l.removeEventListener(Oj,u),setTimeout(()=>{const b=new CustomEvent(Ij,lI);l.addEventListener(Ij,d),l.dispatchEvent(b),b.defaultPrevented||mf(m??document.body,{select:!0}),l.removeEventListener(Ij,d),uI.remove(p)},0)}}},[l,u,d,p]);const y=j.useCallback(m=>{if(!r&&!n||p.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(x&&b){const w=m.currentTarget,[k,S]=Ore(w);k&&S?!m.shiftKey&&b===S?(m.preventDefault(),r&&mf(k,{select:!0})):m.shiftKey&&b===k&&(m.preventDefault(),r&&mf(S,{select:!0})):b===w&&m.preventDefault()}},[r,n,p.paused]);return i.jsx(ya.div,{tabIndex:-1,...s,ref:h,onKeyDown:y})});$6.displayName=Tre;function Pre(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(mf(n,{select:t}),document.activeElement!==r)return}function Ore(e){const t=Fq(e),r=cI(t,e),n=cI(t.reverse(),e);return[r,n]}function Fq(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function cI(e,t){for(const r of e)if(!Ire(r,{upTo:t}))return r}function Ire(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 Nre(e){return e instanceof HTMLInputElement&&"select"in e}function mf(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Nre(e)&&t&&e.select()}}var uI=Rre();function Rre(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=dI(e,t),e.unshift(t)},remove(t){var r;e=dI(e,t),(r=e[0])==null||r.resume()}}}function dI(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Lre(e){return e.filter(t=>t.tagName!=="A")}var Fre="Portal",U6=j.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[o,a]=j.useState(!1);uh(()=>a(!0),[]);const s=r||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?CZ.createPortal(i.jsx(ya.div,{...n,ref:t}),s):null});U6.displayName=Fre;function Mre(e,t){return j.useReducer((r,n)=>t[r][n]??r,e)}var cv=e=>{const{present:t,children:r}=e,n=Dre(t),o=typeof r=="function"?r({present:n.isPresent}):j.Children.only(r),a=Nl(n.ref,zre(o));return typeof r=="function"||n.isPresent?j.cloneElement(o,{ref:a}):null};cv.displayName="Presence";function Dre(e){const[t,r]=j.useState(),n=j.useRef({}),o=j.useRef(e),a=j.useRef("none"),s=e?"mounted":"unmounted",[l,c]=Mre(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return j.useEffect(()=>{const u=x1(n.current);a.current=l==="mounted"?u:"none"},[l]),uh(()=>{const u=n.current,d=o.current;if(d!==e){const h=a.current,p=x1(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),uh(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=x1(n.current).includes(p.animationName);if(p.target===t&&m&&(c("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(a.current=x1(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:j.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function x1(e){return(e==null?void 0:e.animationName)||"none"}function zre(e){var n,o;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Nj=0;function Mq(){j.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??fI()),document.body.insertAdjacentElement("beforeend",e[1]??fI()),Nj++,()=>{Nj===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Nj--}},[])}function fI(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Hc=function(){return Hc=Object.assign||function(t){for(var r,n=1,o=arguments.length;n"u")return rne;var t=nne(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},one=Wq(),Xg="data-scroll-locked",ane=function(e,t,r,n){var o=e.left,a=e.top,s=e.right,l=e.gap;return r===void 0&&(r="margin"),` - .`.concat(Wre,` { - overflow: hidden `).concat(n,`; - padding-right: `).concat(l,"px ").concat(n,`; - } - body[`).concat(Xg,`] { - overflow: hidden `).concat(n,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&` - padding-left: `.concat(o,`px; - padding-top: `).concat(a,`px; - padding-right: `).concat(s,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(l,"px ").concat(n,`; - `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),` - } - - .`).concat(g0,` { - right: `).concat(l,"px ").concat(n,`; - } - - .`).concat(m0,` { - margin-right: `).concat(l,"px ").concat(n,`; - } - - .`).concat(g0," .").concat(g0,` { - right: 0 `).concat(n,`; - } - - .`).concat(m0," .").concat(m0,` { - margin-right: 0 `).concat(n,`; - } - - body[`).concat(Xg,`] { - `).concat(qre,": ").concat(l,`px; - } -`)},hI=function(){var e=parseInt(document.body.getAttribute(Xg)||"0",10);return isFinite(e)?e:0},sne=function(){j.useEffect(function(){return document.body.setAttribute(Xg,(hI()+1).toString()),function(){var e=hI()-1;e<=0?document.body.removeAttribute(Xg):document.body.setAttribute(Xg,e.toString())}},[])},lne=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,o=n===void 0?"margin":n;sne();var a=j.useMemo(function(){return ine(o)},[o]);return j.createElement(one,{styles:ane(a,!t,o,r?"":"!important")})},tE=!1;if(typeof window<"u")try{var b1=Object.defineProperty({},"passive",{get:function(){return tE=!0,!0}});window.addEventListener("test",b1,b1),window.removeEventListener("test",b1,b1)}catch{tE=!1}var vg=tE?{passive:!1}:!1,cne=function(e){return e.tagName==="TEXTAREA"},qq=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!cne(e)&&r[t]==="visible")},une=function(e){return qq(e,"overflowY")},dne=function(e){return qq(e,"overflowX")},gI=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=$q(e,n);if(o){var a=Uq(e,n),s=a[1],l=a[2];if(s>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},fne=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},pne=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},$q=function(e,t){return e==="v"?une(t):dne(t)},Uq=function(e,t){return e==="v"?fne(t):pne(t)},hne=function(e,t){return e==="h"&&t==="rtl"?-1:1},gne=function(e,t,r,n,o){var a=hne(e,window.getComputedStyle(t).direction),s=a*n,l=r.target,c=t.contains(l),u=!1,d=s>0,f=0,h=0;do{if(!l)break;var p=Uq(e,l),y=p[0],m=p[1],x=p[2],b=m-x-a*y;(y||b)&&$q(e,l)&&(f+=b,h+=y);var w=l.parentNode;l=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(u=!0),u},w1=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},mI=function(e){return[e.deltaX,e.deltaY]},vI=function(e){return e&&"current"in e?e.current:e},mne=function(e,t){return e[0]===t[0]&&e[1]===t[1]},vne=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},yne=0,yg=[];function xne(e){var t=j.useRef([]),r=j.useRef([0,0]),n=j.useRef(),o=j.useState(yne++)[0],a=j.useState(Wq)[0],s=j.useRef(e);j.useEffect(function(){s.current=e},[e]),j.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=Bre([e.lockRef.current],(e.shards||[]).map(vI),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=j.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=w1(m),w=r.current,k="deltaX"in m?m.deltaX:w[0]-b[0],S="deltaY"in m?m.deltaY:w[1]-b[1],_,P=m.target,O=Math.abs(k)>Math.abs(S)?"h":"v";if("touches"in m&&O==="h"&&P.type==="range")return!1;var T=window.getSelection(),R=T&&T.anchorNode,I=R?R===P||R.contains(P):!1;if(I)return!1;var E=gI(O,P);if(!E)return!0;if(E?_=O:(_=O==="v"?"h":"v",E=gI(O,P)),!E)return!1;if(!n.current&&"changedTouches"in m&&(k||S)&&(n.current=_),!_)return!0;var A=n.current||_;return gne(A,x,m,A==="h"?k:S)},[]),c=j.useCallback(function(m){var x=m;if(!(!yg.length||yg[yg.length-1]!==a)){var b="deltaY"in x?mI(x):w1(x),w=t.current.filter(function(_){return _.name===x.type&&(_.target===x.target||x.target===_.shadowParent)&&mne(_.delta,b)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var k=(s.current.shards||[]).map(vI).filter(Boolean).filter(function(_){return _.contains(x.target)}),S=k.length>0?l(x,k[0]):!s.current.noIsolation;S&&x.cancelable&&x.preventDefault()}}},[]),u=j.useCallback(function(m,x,b,w){var k={name:m,delta:x,target:b,should:w,shadowParent:bne(b)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(S){return S!==k})},1)},[]),d=j.useCallback(function(m){r.current=w1(m),n.current=void 0},[]),f=j.useCallback(function(m){u(m.type,mI(m),m.target,l(m,e.lockRef.current))},[]),h=j.useCallback(function(m){u(m.type,w1(m),m.target,l(m,e.lockRef.current))},[]);j.useEffect(function(){return yg.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,vg),document.addEventListener("touchmove",c,vg),document.addEventListener("touchstart",d,vg),function(){yg=yg.filter(function(m){return m!==a}),document.removeEventListener("wheel",c,vg),document.removeEventListener("touchmove",c,vg),document.removeEventListener("touchstart",d,vg)}},[]);var p=e.removeScrollBar,y=e.inert;return j.createElement(j.Fragment,null,y?j.createElement(a,{styles:vne(o)}):null,p?j.createElement(lne,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function bne(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const wne=Kre(Bq,xne);var H6=j.forwardRef(function(e,t){return j.createElement(Fw,Hc({},e,{ref:t,sideCar:wne}))});H6.classNames=Fw.classNames;var Sne=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},xg=new WeakMap,S1=new WeakMap,j1={},Mj=0,Hq=function(e){return e&&(e.host||Hq(e.parentNode))},jne=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Hq(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},kne=function(e,t,r,n){var o=jne(t,Array.isArray(e)?e:[e]);j1[r]||(j1[r]=new WeakMap);var a=j1[r],s=[],l=new Set,c=new Set(o),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};o.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var p=h.getAttribute(n),y=p!==null&&p!=="false",m=(xg.get(h)||0)+1,x=(a.get(h)||0)+1;xg.set(h,m),a.set(h,x),s.push(h),m===1&&y&&S1.set(h,!0),x===1&&h.setAttribute(r,"true"),y||h.setAttribute(n,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(t),l.clear(),Mj++,function(){s.forEach(function(f){var h=xg.get(f)-1,p=a.get(f)-1;xg.set(f,h),a.set(f,p),h||(S1.has(f)||f.removeAttribute(n),S1.delete(f)),p||f.removeAttribute(r)}),Mj--,Mj||(xg=new WeakMap,xg=new WeakMap,S1=new WeakMap,j1={})}},Vq=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),o=Sne(e);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live], script"))),kne(n,o,r,"aria-hidden")):function(){return null}},V6="Dialog",[Yq]=Rw(V6),[_ne,hc]=Yq(V6),Gq=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:o,onOpenChange:a,modal:s=!0}=e,l=j.useRef(null),c=j.useRef(null),[u=!1,d]=W6({prop:n,defaultProp:o,onChange:a});return i.jsx(_ne,{scope:t,triggerRef:l,contentRef:c,contentId:h0(),titleId:h0(),descriptionId:h0(),open:u,onOpenChange:d,onOpenToggle:j.useCallback(()=>d(f=>!f),[d]),modal:s,children:r})};Gq.displayName=V6;var Kq="DialogTrigger",Cne=j.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=hc(Kq,r),a=Nl(t,o.triggerRef);return i.jsx(ya.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":K6(o.open),...n,ref:a,onClick:ps(e.onClick,o.onOpenToggle)})});Cne.displayName=Kq;var Y6="DialogPortal",[Ene,Qq]=Yq(Y6,{forceMount:void 0}),Xq=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:o}=e,a=hc(Y6,t);return i.jsx(Ene,{scope:t,forceMount:r,children:j.Children.map(n,s=>i.jsx(cv,{present:r||a.open,children:i.jsx(U6,{asChild:!0,container:o,children:s})}))})};Xq.displayName=Y6;var L0="DialogOverlay",Zq=j.forwardRef((e,t)=>{const r=Qq(L0,e.__scopeDialog),{forceMount:n=r.forceMount,...o}=e,a=hc(L0,e.__scopeDialog);return a.modal?i.jsx(cv,{present:n||a.open,children:i.jsx(Ane,{...o,ref:t})}):null});Zq.displayName=L0;var Ane=j.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=hc(L0,r);return i.jsx(H6,{as:Lw,allowPinchZoom:!0,shards:[o.contentRef],children:i.jsx(ya.div,{"data-state":K6(o.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),dh="DialogContent",Jq=j.forwardRef((e,t)=>{const r=Qq(dh,e.__scopeDialog),{forceMount:n=r.forceMount,...o}=e,a=hc(dh,e.__scopeDialog);return i.jsx(cv,{present:n||a.open,children:a.modal?i.jsx(Tne,{...o,ref:t}):i.jsx(Pne,{...o,ref:t})})});Jq.displayName=dh;var Tne=j.forwardRef((e,t)=>{const r=hc(dh,e.__scopeDialog),n=j.useRef(null),o=Nl(t,r.contentRef,n);return j.useEffect(()=>{const a=n.current;if(a)return Vq(a)},[]),i.jsx(e$,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ps(e.onCloseAutoFocus,a=>{var s;a.preventDefault(),(s=r.triggerRef.current)==null||s.focus()}),onPointerDownOutside:ps(e.onPointerDownOutside,a=>{const s=a.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&a.preventDefault()}),onFocusOutside:ps(e.onFocusOutside,a=>a.preventDefault())})}),Pne=j.forwardRef((e,t)=>{const r=hc(dh,e.__scopeDialog),n=j.useRef(!1),o=j.useRef(!1);return i.jsx(e$,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var s,l;(s=e.onCloseAutoFocus)==null||s.call(e,a),a.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),a.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:a=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=a.target;((u=r.triggerRef.current)==null?void 0:u.contains(s))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),e$=j.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:a,...s}=e,l=hc(dh,r),c=j.useRef(null),u=Nl(t,c);return Mq(),i.jsxs(i.Fragment,{children:[i.jsx($6,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:a,children:i.jsx(q6,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":K6(l.open),...s,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(Ine,{titleId:l.titleId}),i.jsx(Rne,{contentRef:c,descriptionId:l.descriptionId})]})]})}),G6="DialogTitle",t$=j.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=hc(G6,r);return i.jsx(ya.h2,{id:o.titleId,...n,ref:t})});t$.displayName=G6;var r$="DialogDescription",One=j.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=hc(r$,r);return i.jsx(ya.p,{id:o.descriptionId,...n,ref:t})});One.displayName=r$;var n$="DialogClose",i$=j.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=hc(n$,r);return i.jsx(ya.button,{type:"button",...n,ref:t,onClick:ps(e.onClick,()=>o.onOpenChange(!1))})});i$.displayName=n$;function K6(e){return e?"open":"closed"}var o$="DialogTitleWarning",[UNe,a$]=ure(o$,{contentName:dh,titleName:G6,docsSlug:"dialog"}),Ine=({titleId:e})=>{const t=a$(o$),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Nne="DialogDescriptionWarning",Rne=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${a$(Nne).contentName}}.`;return j.useEffect(()=>{var a;const o=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},s$=Gq,l$=Xq,c$=Zq,u$=Jq,d$=t$,f$=i$;function p$(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t{const t=Mne(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{const l=s.split(Q6);return l[0]===""&&l.length!==1&&l.shift(),h$(l,t)||Fne(s)},getConflictingClassGroupIds:(s,l)=>{const c=r[s]||[];return l&&n[s]?[...c,...n[s]]:c}}},h$=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),o=n?h$(e.slice(1),n):void 0;if(o)return o;if(t.validators.length===0)return;const a=e.join(Q6);return(s=t.validators.find(({validator:l})=>l(a)))==null?void 0:s.classGroupId},yI=/^\[(.+)\]$/,Fne=e=>{if(yI.test(e)){const t=yI.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},Mne=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const o in r)rE(r[o],n,o,t);return n},rE=(e,t,r,n)=>{e.forEach(o=>{if(typeof o=="string"){const a=o===""?t:xI(t,o);a.classGroupId=r;return}if(typeof o=="function"){if(Dne(o)){rE(o(n),t,r,n);return}t.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([a,s])=>{rE(s,xI(t,a),r,n)})})},xI=(e,t)=>{let r=e;return t.split(Q6).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Dne=e=>e.isThemeGetter,zne=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const o=(a,s)=>{r.set(a,s),t++,t>e&&(t=0,n=r,r=new Map)};return{get(a){let s=r.get(a);if(s!==void 0)return s;if((s=n.get(a))!==void 0)return o(a,s),s},set(a,s){r.has(a)?r.set(a,s):o(a,s)}}},nE="!",iE=":",Bne=iE.length,Wne=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=o=>{const a=[];let s=0,l=0,c=0,u;for(let y=0;yc?u-c:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}};if(t){const o=t+iE,a=n;n=s=>s.startsWith(o)?a(s.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:s,maybePostfixModifierPosition:void 0}}if(r){const o=n;n=a=>r({className:a,parseClassName:o})}return n},qne=e=>e.endsWith(nE)?e.substring(0,e.length-1):e.startsWith(nE)?e.substring(1):e,$ne=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const o=[];let a=[];return n.forEach(s=>{s[0]==="["||t[s]?(o.push(...a.sort(),s),a=[]):a.push(s)}),o.push(...a.sort()),o}},Une=e=>({cache:zne(e.cacheSize),parseClassName:Wne(e),sortModifiers:$ne(e),...Lne(e)}),Hne=/\s+/,Vne=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:a}=t,s=[],l=e.trim().split(Hne);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:m}=r(d);if(f){c=d+(c.length>0?" "+c:c);continue}let x=!!m,b=n(x?y.substring(0,m):y);if(!b){if(!x){c=d+(c.length>0?" "+c:c);continue}if(b=n(y),!b){c=d+(c.length>0?" "+c:c);continue}x=!1}const w=a(h).join(":"),k=p?w+nE:w,S=k+b;if(s.includes(S))continue;s.push(S);const _=o(b,x);for(let P=0;P<_.length;++P){const O=_[P];s.push(k+O)}c=d+(c.length>0?" "+c:c)}return c};function Yne(){let e=0,t,r,n="";for(;e{if(typeof e=="string")return e;let t,r="";for(let n=0;nf(d),e());return r=Une(u),n=r.cache.get,o=r.cache.set,a=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=Vne(c,r);return o(c,d),d}return function(){return a(Yne.apply(null,arguments))}}const so=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},m$=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,v$=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Kne=/^\d+\/\d+$/,Qne=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Xne=/\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$/,Zne=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Jne=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,eie=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bg=e=>Kne.test(e),Dr=e=>!!e&&!Number.isNaN(Number(e)),cf=e=>!!e&&Number.isInteger(Number(e)),Dj=e=>e.endsWith("%")&&Dr(e.slice(0,-1)),Wu=e=>Qne.test(e),tie=()=>!0,rie=e=>Xne.test(e)&&!Zne.test(e),y$=()=>!1,nie=e=>Jne.test(e),iie=e=>eie.test(e),oie=e=>!nr(e)&&!ir(e),aie=e=>uv(e,w$,y$),nr=e=>m$.test(e),Sp=e=>uv(e,S$,rie),zj=e=>uv(e,die,Dr),bI=e=>uv(e,x$,y$),sie=e=>uv(e,b$,iie),k1=e=>uv(e,j$,nie),ir=e=>v$.test(e),ay=e=>dv(e,S$),lie=e=>dv(e,fie),wI=e=>dv(e,x$),cie=e=>dv(e,w$),uie=e=>dv(e,b$),_1=e=>dv(e,j$,!0),uv=(e,t,r)=>{const n=m$.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},dv=(e,t,r=!1)=>{const n=v$.exec(e);return n?n[1]?t(n[1]):r:!1},x$=e=>e==="position"||e==="percentage",b$=e=>e==="image"||e==="url",w$=e=>e==="length"||e==="size"||e==="bg-size",S$=e=>e==="length",die=e=>e==="number",fie=e=>e==="family-name",j$=e=>e==="shadow",pie=()=>{const e=so("color"),t=so("font"),r=so("text"),n=so("font-weight"),o=so("tracking"),a=so("leading"),s=so("breakpoint"),l=so("container"),c=so("spacing"),u=so("radius"),d=so("shadow"),f=so("inset-shadow"),h=so("text-shadow"),p=so("drop-shadow"),y=so("blur"),m=so("perspective"),x=so("aspect"),b=so("ease"),w=so("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...S(),ir,nr],P=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],T=()=>[ir,nr,c],R=()=>[bg,"full","auto",...T()],I=()=>[cf,"none","subgrid",ir,nr],E=()=>["auto",{span:["full",cf,ir,nr]},cf,ir,nr],A=()=>[cf,"auto",ir,nr],F=()=>["auto","min","max","fr",ir,nr],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...T()],Q=()=>[bg,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],U=()=>[e,ir,nr],ee=()=>[...S(),wI,bI,{position:[ir,nr]}],H=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",cie,aie,{size:[ir,nr]}],M=()=>[Dj,ay,Sp],$=()=>["","none","full",u,ir,nr],q=()=>["",Dr,ay,Sp],Y=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>[Dr,Dj,wI,bI],re=()=>["","none",y,ir,nr],J=()=>["none",Dr,ir,nr],ae=()=>["none",Dr,ir,nr],le=()=>[Dr,ir,nr],me=()=>[bg,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Wu],breakpoint:[Wu],color:[tie],container:[Wu],"drop-shadow":[Wu],ease:["in","out","in-out"],font:[oie],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Wu],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Wu],shadow:[Wu],spacing:["px",Dr],text:[Wu],"text-shadow":[Wu],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",bg,nr,ir,x]}],container:["container"],columns:[{columns:[Dr,nr,ir,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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"],sr:["sr-only","not-sr-only"],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:_()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{start:R()}],end:[{end:R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[cf,"auto",ir,nr]}],basis:[{basis:[bg,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Dr,bg,"auto","initial","none",nr]}],grow:[{grow:["",Dr,ir,nr]}],shrink:[{shrink:["",Dr,ir,nr]}],order:[{order:[cf,"first","last","none",ir,nr]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:E()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:E()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],w:[{w:[l,"screen",...Q()]}],"min-w":[{"min-w":[l,"screen","none",...Q()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[s]},...Q()]}],h:[{h:["screen",...Q()]}],"min-h":[{"min-h":["screen","none",...Q()]}],"max-h":[{"max-h":["screen",...Q()]}],"font-size":[{text:["base",r,ay,Sp]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,ir,zj]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Dj,nr]}],"font-family":[{font:[lie,nr,t]}],"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:[o,ir,nr]}],"line-clamp":[{"line-clamp":[Dr,"none",ir,zj]}],leading:[{leading:[a,...T()]}],"list-image":[{"list-image":["none",ir,nr]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ir,nr]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[Dr,"from-font","auto",ir,Sp]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[Dr,"auto",ir,nr]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ir,nr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ir,nr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:H()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},cf,ir,nr],radial:["",ir,nr],conic:[cf,ir,nr]},uie,sie]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:M()}],"gradient-via-pos":[{via:M()}],"gradient-to-pos":[{to:M()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:q()}],"border-w-x":[{"border-x":q()}],"border-w-y":[{"border-y":q()}],"border-w-s":[{"border-s":q()}],"border-w-e":[{"border-e":q()}],"border-w-t":[{"border-t":q()}],"border-w-r":[{"border-r":q()}],"border-w-b":[{"border-b":q()}],"border-w-l":[{"border-l":q()}],"divide-x":[{"divide-x":q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Dr,ir,nr]}],"outline-w":[{outline:["",Dr,ay,Sp]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",d,_1,k1]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",f,_1,k1]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[Dr,Sp]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":q()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",h,_1,k1]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[Dr,ir,nr]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Dr]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[ir,nr]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[Dr]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:H()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ir,nr]}],filter:[{filter:["","none",ir,nr]}],blur:[{blur:re()}],brightness:[{brightness:[Dr,ir,nr]}],contrast:[{contrast:[Dr,ir,nr]}],"drop-shadow":[{"drop-shadow":["","none",p,_1,k1]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",Dr,ir,nr]}],"hue-rotate":[{"hue-rotate":[Dr,ir,nr]}],invert:[{invert:["",Dr,ir,nr]}],saturate:[{saturate:[Dr,ir,nr]}],sepia:[{sepia:["",Dr,ir,nr]}],"backdrop-filter":[{"backdrop-filter":["","none",ir,nr]}],"backdrop-blur":[{"backdrop-blur":re()}],"backdrop-brightness":[{"backdrop-brightness":[Dr,ir,nr]}],"backdrop-contrast":[{"backdrop-contrast":[Dr,ir,nr]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Dr,ir,nr]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Dr,ir,nr]}],"backdrop-invert":[{"backdrop-invert":["",Dr,ir,nr]}],"backdrop-opacity":[{"backdrop-opacity":[Dr,ir,nr]}],"backdrop-saturate":[{"backdrop-saturate":[Dr,ir,nr]}],"backdrop-sepia":[{"backdrop-sepia":["",Dr,ir,nr]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ir,nr]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Dr,"initial",ir,nr]}],ease:[{ease:["linear","initial",b,ir,nr]}],delay:[{delay:[Dr,ir,nr]}],animate:[{animate:["none",w,ir,nr]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ir,nr]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:J()}],"rotate-x":[{"rotate-x":J()}],"rotate-y":[{"rotate-y":J()}],"rotate-z":[{"rotate-z":J()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":["scale-3d"],skew:[{skew:le()}],"skew-x":[{"skew-x":le()}],"skew-y":[{"skew-y":le()}],transform:[{transform:[ir,nr,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",ir,nr]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",ir,nr]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[Dr,ay,Sp,zj]}],stroke:[{stroke:["none",...U()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},hie=Gne(pie);function Xo(...e){return hie(Lr(e))}function gie({...e}){return i.jsx(s$,{"data-slot":"dialog",...e})}function mie({...e}){return i.jsx(l$,{"data-slot":"dialog-portal",...e})}const k$=j.forwardRef(({className:e,...t},r)=>i.jsx(c$,{ref:r,"data-slot":"dialog-overlay",className:Xo("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t}));k$.displayName="DialogOverlay";function vie({className:e,children:t,...r}){return i.jsxs(mie,{"data-slot":"dialog-portal",children:[i.jsx(k$,{}),i.jsxs(u$,{"data-slot":"dialog-content",className:Xo("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,i.jsxs(f$,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[i.jsx(er,{}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function yie({className:e,...t}){return i.jsx("div",{"data-slot":"dialog-header",className:Xo("flex flex-col gap-2 text-center sm:text-left",e),...t})}function xie({className:e,...t}){return i.jsx(d$,{"data-slot":"dialog-title",className:Xo("text-lg leading-none font-semibold",e),...t})}function bie({open:e,onOpenChange:t,title:r,children:n,contentClassName:o}){return i.jsx(gie,{open:e,onOpenChange:t,children:i.jsxs(vie,{className:o,children:[r&&i.jsx(yie,{children:i.jsx(xie,{children:r})}),n]})})}function SI({icon:e,title:t,description:r,action:n,style:o}){return i.jsxs("div",{style:{textAlign:"center",padding:"48px 24px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)",background:"var(--card)",...o},children:[e&&i.jsx("div",{style:{width:"48px",height:"48px",borderRadius:"var(--radius-card)",background:"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 16px",color:"var(--muted)"},children:e}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"8px"},children:t}),r&&i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"20px",maxWidth:"360px",margin:"0 auto 20px"},children:r}),n]})}function fh({message:e="Loading…",style:t}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px",padding:"48px 24px",...t},children:[i.jsx("div",{style:{width:"32px",height:"32px",border:"3px solid var(--border)",borderTopColor:"var(--primary)",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:e}),i.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]})}class wie extends j.Component{constructor(){super(...arguments);yn(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,n){var o,a;(a=(o=this.props).onError)==null||a.call(o,r,n)}render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:i.jsxs("div",{style:{padding:"24px",margin:"24px",border:"1px solid var(--destructive)",borderRadius:"var(--radius-card)",background:"#fef2f2",color:"var(--destructive)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[i.jsx(nv,{size:20}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-base)"},children:"Something went wrong"})]}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",margin:0},children:this.state.error.message})]}):this.props.children}}function Sie(){return j.useSyncExternalStore(LJ,XO,XO)?i.jsxs("div",{role:"status","aria-live":"polite","aria-busy":"true","aria-label":"Please wait",style:{position:"fixed",inset:0,zIndex:1e5,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(15, 23, 42, 0.45)",backdropFilter:"blur(2px)",pointerEvents:"all"},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",padding:"28px 36px",borderRadius:"var(--radius-card)",background:"var(--card)",border:"1px solid var(--border)",boxShadow:"var(--elevation-sm)",minWidth:"200px"},children:[i.jsx("div",{style:{width:"36px",height:"36px",border:"3px solid var(--border)",borderTopColor:"var(--primary)",borderRadius:"50%",animation:"eb-global-spin 0.8s linear infinite"}}),i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Please wait"})]}),i.jsx("style",{children:"@keyframes eb-global-spin { to { transform: rotate(360deg); } }"})]}):null}const Ao={p10df6080:"M37.7893 38.8274C36.0748 38.8274 34.6629 38.4744 33.5536 37.7684C32.4778 37.0289 31.6879 36.054 31.1836 34.8438C30.6794 33.6336 30.4272 32.3225 30.4272 30.9106C30.4272 29.9694 30.4777 29.0113 30.5785 28.0364C30.713 27.0615 30.8642 26.1371 31.0323 25.263L34.1587 10.4381H43.689L40.5122 25.616C40.4114 26.053 40.3105 26.6077 40.2097 27.28C40.1088 27.9188 40.0584 28.5239 40.0584 29.0953C40.0584 29.8013 40.2433 30.3392 40.6131 30.7089C40.9829 31.0451 41.4199 31.2132 41.9241 31.2132C42.4956 31.2132 43.0503 30.9611 43.5882 30.4568C44.1596 29.9526 44.6975 29.1626 45.2018 28.0868C45.706 27.0111 46.1262 25.6496 46.4624 24.0024L49.3366 10.4381H58.8669L52.9672 38.3231H45.353L45.6556 34.4404H45.4539C44.8488 35.4825 44.1765 36.3229 43.4369 36.9616C42.6973 37.6004 41.8569 38.071 40.9156 38.3735C40.008 38.6761 38.9659 38.8274 37.7893 38.8274Z",p142b6380:"M31.0583 13.3131C31.4698 13.0263 32.0388 13.1259 32.2977 13.5556C33.4072 15.3973 34.0662 17.4753 34.2208 19.6197C34.2569 20.1201 33.8493 20.5294 33.3477 20.5322V20.5322C32.846 20.5349 32.4408 20.1299 32.3996 19.6299C32.2533 17.8536 31.7076 16.1329 30.8035 14.5969C30.549 14.1646 30.6467 13.6 31.0583 13.3131V13.3131Z",p1674a600:"M53.2547 29.9849C53.3365 27.5678 52.774 25.1726 51.6264 23.0438C50.4786 20.9149 48.7858 19.1285 46.7213 17.8684C44.6571 16.6085 42.2954 15.9192 39.8775 15.8715C37.4595 15.8238 35.0718 16.4192 32.9594 17.5968C30.8471 18.7745 29.0848 20.4922 27.854 22.5741C26.6232 24.6561 25.9672 27.0281 25.9537 29.4466C25.9407 31.7765 26.5261 34.0685 27.6484 36.107L27.6474 36.1073L27.6618 36.1307C27.7003 36.2002 27.7376 36.2704 27.7774 36.3394L27.7828 36.3369L35.9118 50.1145C37.7038 49.0572 38.2991 46.7469 37.2418 44.9548L31.0476 34.4551L31.0598 34.4478C30.1875 32.9338 29.7328 31.2149 29.7426 29.4677C29.7524 27.7203 30.2264 26.0069 31.1156 24.5027C32.0048 22.9986 33.2778 21.7579 34.8038 20.907C36.3301 20.0561 38.0556 19.6251 39.8027 19.6596C41.5497 19.6941 43.2565 20.1923 44.748 21.1027C46.2394 22.013 47.4622 23.3033 48.2914 24.8413C49.1207 26.3794 49.5268 28.1107 49.4676 29.8572C49.4084 31.6035 48.8866 33.3032 47.9553 34.7816L47.9627 34.7867L37.0389 53.7059C35.9959 55.5125 36.6149 57.8227 38.4215 58.8657L51.1614 36.8009C52.4505 34.7545 53.1729 32.402 53.2547 29.9849Z",p1945f480:"M63.6456 33.23L69.3941 6.35351H71.8649L70.9068 12.3541H70.9573C71.5624 11.3792 72.3355 10.4043 73.2768 9.42944C74.2181 8.42094 75.3442 7.58052 76.6553 6.90819C77.9663 6.20224 79.4287 5.84926 81.0423 5.84926C82.4878 5.84926 83.7148 6.11819 84.7233 6.65606C85.7654 7.16031 86.5554 7.89988 87.0933 8.87476C87.6311 9.84965 87.9001 11.0598 87.9001 12.5054C87.9001 13.1105 87.8496 13.766 87.7488 14.4719C87.6816 15.1779 87.5807 15.8166 87.4462 16.3881L83.8156 33.23H80.8406L84.4712 16.0351C84.6392 15.3628 84.7569 14.7745 84.8241 14.2702C84.8914 13.766 84.925 13.2954 84.925 12.8583C84.925 11.3456 84.5216 10.2362 83.7148 9.53029C82.9416 8.82434 81.8154 8.47136 80.3363 8.47136C78.8572 8.47136 77.378 8.9588 75.8989 9.93369C74.4198 10.875 73.0919 12.2364 71.9153 14.0181C70.7724 15.7998 69.932 17.9513 69.3941 20.4725L66.6711 33.23H63.6456Z",p1e5a9f00:"M21.5276 21.5276C21.5276 18.7006 20.9708 15.9012 19.8889 13.2893C18.8071 10.6775 17.2213 8.30431 15.2223 6.30529C13.2233 4.30626 10.8501 2.72055 8.23826 1.63869C5.62641 0.556826 2.82705 -8.70599e-07 0 0L1.3922e-06 4.5208C2.23337 4.5208 4.44486 4.96069 6.50822 5.81536C8.57159 6.67003 10.4464 7.92274 12.0256 9.50197C13.6049 11.0812 14.8576 12.956 15.7122 15.0194C16.5669 17.0827 17.0068 19.2942 17.0068 21.5276H21.5276Z",p24dd2380:"M15.6318 38.8273C14.6905 38.8273 13.8333 38.7096 13.0601 38.4743C12.3206 38.239 11.6146 37.8524 10.9423 37.3145C10.3036 36.7766 9.64805 36.0875 8.97571 35.2471H8.77401L7.56381 38.323H6.10352e-05L8.11849 0H17.6488L16.4386 5.69803C16.2369 6.70653 16.0016 7.69822 15.7327 8.67311C15.4637 9.61437 15.1948 10.4716 14.9259 11.2448C14.6569 12.018 14.4216 12.6399 14.2199 13.1105H14.4216C14.8586 12.5726 15.3125 12.0684 15.7831 11.5978C16.2537 11.0935 16.8252 10.6901 17.4975 10.3876C18.1699 10.085 19.0271 9.93373 20.0692 9.93373C21.5147 9.93373 22.8258 10.2699 24.0024 10.9422C25.2126 11.6146 26.1706 12.7239 26.8766 14.2703C27.6162 15.8166 27.9859 17.9177 27.9859 20.5734C27.9859 21.9181 27.8179 23.414 27.4817 25.0612C27.1791 26.7084 26.7085 28.3389 26.0698 29.9525C25.4311 31.5661 24.6243 33.0452 23.6494 34.3899C22.6745 35.7345 21.5147 36.8103 20.1701 37.6171C18.8254 38.4239 17.3126 38.8273 15.6318 38.8273ZM13.3123 31.1627C13.8501 31.1627 14.3544 30.9778 14.825 30.608C15.3293 30.2046 15.7831 29.6835 16.1865 29.0448C16.5899 28.3725 16.9429 27.6161 17.2454 26.7757C17.5816 25.9016 17.8337 24.9772 18.0018 24.0023C18.1699 23.0274 18.2539 22.0693 18.2539 21.1281C18.2539 19.9851 18.069 19.1111 17.6992 18.506C17.3631 17.9009 16.842 17.5983 16.1361 17.5983C15.6318 17.5983 15.1612 17.7496 14.7242 18.0522C14.3208 18.3547 13.9342 18.7749 13.5644 19.3128C13.2282 19.817 12.9257 20.4053 12.6567 21.0777C12.3878 21.75 12.1525 22.4559 11.9508 23.1955C11.7827 23.9351 11.6482 24.6915 11.5474 25.4646C11.4465 26.2042 11.3961 26.927 11.3961 27.6329C11.3961 28.675 11.5474 29.5323 11.8499 30.2046C12.1861 30.8433 12.6735 31.1627 13.3123 31.1627Z",p2c694f80:"M48.5463 14.0889C48.1347 13.8021 47.5657 13.9017 47.3069 14.3314C46.3407 15.9351 45.7146 17.7206 45.4677 19.5764C45.4015 20.0737 45.7836 20.5069 46.2842 20.5398V20.5398C46.7848 20.5728 47.2137 20.1929 47.2849 19.6963C47.5039 18.1702 48.019 16.7014 48.8011 15.3727C49.0555 14.9404 48.9578 14.3758 48.5463 14.0889V14.0889Z",p2fc98c00:"M56.3998 38.3231L57.4588 32.8772L69.8129 17.8001H61.2407L62.9047 10.4381H82.873L81.5619 16.3882L69.3591 30.9611H78.7886L77.175 38.3231H56.3998Z",p30ec5580:"M78.8566 38.3231L79.9155 32.8772L92.2697 17.8001H83.6974L85.3614 10.4381H105.33L104.019 16.3882L91.8158 30.9611H101.245L99.6317 38.3231H78.8566Z",p33b7c800:"M53.7052 24.2408C55.6176 22.6016 57.9466 21.5226 60.4336 21.1246C62.9206 20.7266 65.4696 21.0249 67.7979 21.9852C70.1261 22.9455 72.1434 24.5309 73.6266 26.5663C75.1098 28.602 76.0016 31.0087 76.2024 33.5194C76.4031 36.03 75.9053 38.5473 74.7644 40.7927C73.6234 43.0382 71.8832 44.9243 69.737 46.2425C67.6663 47.5142 65.2953 48.2073 62.869 48.2567L62.8692 48.2576L62.8458 48.2568C62.7651 48.2583 62.6843 48.262 62.6035 48.2621L62.6027 48.2552L49.4801 48.1318C49.4996 46.0511 51.2025 44.3796 53.2832 44.3992L62.6 44.4869L62.6002 44.4727C64.4199 44.471 66.2041 43.966 67.7547 43.0137C69.3051 42.0613 70.5624 40.6984 71.3867 39.0762C72.2108 37.4541 72.5703 35.6354 72.4254 33.8217C72.2803 32.0078 71.6363 30.2688 70.5647 28.7981C69.493 27.3274 68.0347 26.1813 66.3524 25.4875C64.6702 24.7937 62.8287 24.5792 61.0319 24.8668C59.2352 25.1544 57.5531 25.9333 56.1715 27.1175C54.7898 28.3017 53.7621 29.845 53.203 31.5768L49.5972 30.4127C50.371 28.0159 51.793 25.8799 53.7052 24.2408Z",p3763d600:"M25.2927 33.23L21.6621 6.40394H24.5364L26.7551 23.7501C26.8895 24.5569 26.9904 25.3974 27.0576 26.2714C27.1249 27.1454 27.1921 27.969 27.2593 28.7422C27.3266 29.4818 27.3602 30.1205 27.3602 30.6584H27.5114C27.8476 29.9524 28.2006 29.2129 28.5704 28.4397C28.9738 27.6329 29.3772 26.8261 29.7806 26.0193C30.184 25.1789 30.5874 24.4057 30.9908 23.6997L40.6724 6.40394H43.7483L28.7216 33.23H25.2927Z",p37f9b00:"M28.0432 34.0512C29.248 36.0968 30.9683 37.7905 33.0324 38.9632C35.0965 40.136 37.4322 40.7467 39.8061 40.7343C42.1801 40.722 44.5093 40.0871 46.5611 38.893C48.613 37.699 50.3156 35.9875 51.4991 33.9295L49.6351 32.8576C48.6392 34.5895 47.2063 36.0297 45.4796 37.0346C43.7529 38.0395 41.7928 38.5738 39.795 38.5841C37.7972 38.5945 35.8317 38.0806 34.0946 37.0937C32.3576 36.1068 30.9099 34.6814 29.896 32.96L28.0432 34.0512Z",p48e8300:"M51.5881 33.7343C49.7728 33.7343 48.1424 33.3645 46.6969 32.625C45.2514 31.8518 44.1084 30.7088 43.268 29.1961C42.4612 27.6833 42.0578 25.784 42.0578 23.498C42.0578 21.2121 42.3772 19.027 43.0159 16.9428C43.6882 14.8249 44.6295 12.9424 45.8397 11.2952C47.0835 9.61436 48.529 8.30331 50.1762 7.36204C51.8235 6.38715 53.6556 5.89971 55.6726 5.89971C57.8577 5.89971 59.5553 6.45439 60.7655 7.56374C62.0093 8.63947 62.6312 10.085 62.6312 11.9003C62.6312 13.413 62.2614 14.7409 61.5219 15.8839C60.7823 16.9932 59.7066 17.9177 58.2947 18.6572C56.9164 19.3968 55.2187 19.9683 53.2017 20.3717C51.2184 20.7415 48.9492 20.9264 46.3944 20.9264H45.1337C45.1001 21.2625 45.0665 21.6659 45.0329 22.1366C44.9993 22.5736 44.9825 23.0106 44.9825 23.4476C44.9825 25.9353 45.6044 27.8682 46.8482 29.2465C48.092 30.5912 49.8401 31.2635 52.0924 31.2635C53.4707 31.2635 54.7313 31.0786 55.8743 30.7088C57.0172 30.339 58.1266 29.902 59.2023 29.3978V31.9694C58.1938 32.4401 57.0509 32.8603 55.7734 33.2301C54.5296 33.5662 53.1345 33.7343 51.5881 33.7343ZM46.949 18.506C49.3694 18.506 51.5545 18.3043 53.5043 17.9009C55.4541 17.4639 56.9836 16.7747 58.093 15.8334C59.2359 14.8586 59.8074 13.6147 59.8074 12.102C59.8074 11.0263 59.4376 10.1354 58.6981 9.42947C57.9921 8.72352 56.8996 8.37054 55.4204 8.37054C54.0758 8.37054 52.7311 8.77394 51.3864 9.58074C50.0754 10.3539 48.8988 11.4969 47.8567 13.0096C46.8146 14.5224 46.0414 16.3545 45.5371 18.506H46.949Z",p5358df0:"M13.382 21.5276C13.382 19.7702 13.0359 18.0301 12.3634 16.4065C11.6909 14.7829 10.7052 13.3077 9.46252 12.0651C8.21989 10.8224 6.74466 9.83673 5.12108 9.16422C3.4975 8.49172 1.75735 8.14558 2.50846e-06 8.14558L3.90565e-06 12.6826C1.16155 12.6826 2.31172 12.9114 3.38485 13.3559C4.45797 13.8004 5.43304 14.4519 6.25438 15.2732C7.07571 16.0946 7.72723 17.0696 8.17173 18.1428C8.61624 19.2159 8.84502 20.3661 8.84502 21.5276H13.382Z",p6535700:"M9.5304 33.7343C7.7151 33.7343 6.08469 33.3645 4.63917 32.625C3.19366 31.8518 2.05069 30.7088 1.21027 29.1961C0.403473 27.6833 7.30464e-05 25.784 7.30464e-05 23.498C7.30464e-05 21.2121 0.319431 19.027 0.958148 16.9428C1.63048 14.8249 2.57175 12.9424 3.78195 11.2952C5.02577 9.61436 6.47128 8.30331 8.1185 7.36204C9.76572 6.38715 11.5978 5.89971 13.6148 5.89971C15.7999 5.89971 17.4976 6.45439 18.7078 7.56374C19.9516 8.63947 20.5735 10.085 20.5735 11.9003C20.5735 13.413 20.2037 14.7409 19.4641 15.8839C18.7246 16.9932 17.6488 17.9177 16.2369 18.6572C14.8586 19.3968 13.161 19.9683 11.144 20.3717C9.16062 20.7415 6.89149 20.9264 4.33662 20.9264H3.076C3.04238 21.2625 3.00877 21.6659 2.97515 22.1366C2.94153 22.5736 2.92472 23.0106 2.92472 23.4476C2.92472 25.9353 3.54663 27.8682 4.79045 29.2465C6.03427 30.5912 7.78233 31.2635 10.0347 31.2635C11.4129 31.2635 12.6736 31.0786 13.8165 30.7088C14.9595 30.339 16.0688 29.902 17.1446 29.3978V31.9694C16.1361 32.4401 14.9931 32.8603 13.7157 33.2301C12.4719 33.5662 11.0768 33.7343 9.5304 33.7343ZM4.8913 18.506C7.3117 18.506 9.49678 18.3043 11.4466 17.9009C13.3963 17.4639 14.9259 16.7747 16.0352 15.8334C17.1782 14.8586 17.7497 13.6147 17.7497 12.102C17.7497 11.0263 17.3799 10.1354 16.6403 9.42947C15.9344 8.72352 14.8418 8.37054 13.3627 8.37054C12.018 8.37054 10.6734 8.77394 9.3287 9.58074C8.01765 10.3539 6.84107 11.4969 5.79895 13.0096C4.75683 14.5224 3.98365 16.3545 3.4794 18.506H4.8913Z",p6970200:"M31.8056 40.9033C32.6086 42.2668 33.7553 43.3958 35.1312 44.1775C36.507 44.9592 38.0639 45.3662 39.6463 45.358C41.2287 45.3498 42.7812 44.9266 44.1489 44.1307C45.5165 43.3348 46.6514 42.1939 47.4403 40.8222L45.2644 39.5709C44.6945 40.562 43.8745 41.3862 42.8864 41.9613C41.8982 42.5364 40.7765 42.8421 39.6332 42.8481C38.49 42.854 37.3651 42.5599 36.3711 41.9951C35.377 41.4303 34.5486 40.6147 33.9684 39.6295L31.8056 40.9033Z",pd494300:"M25.6088 24.241C23.6964 22.6019 21.3675 21.5229 18.8804 21.1248C16.3935 20.7269 13.8445 21.0251 11.5161 21.9855C9.18797 22.9458 7.17066 24.5312 5.6875 26.5666C4.20423 28.6022 3.31243 31.0089 3.11167 33.5196C2.91094 36.0303 3.40878 38.5476 4.54967 40.793C5.69062 43.0385 7.43083 44.9246 9.57707 46.2428C11.6477 47.5145 14.0188 48.2076 16.4451 48.2569L16.4448 48.2579L16.4683 48.2571C16.549 48.2586 16.6297 48.2623 16.7105 48.2623L16.7113 48.2555L29.834 48.132C29.8144 46.0513 28.1115 44.3798 26.0308 44.3994L16.7141 44.4872L16.7139 44.473C14.8942 44.4713 13.11 43.9663 11.5594 43.014C10.0089 42.0616 8.75165 40.6987 7.92739 39.0765C7.10323 37.4543 6.74374 35.6357 6.88868 33.822C7.03372 32.0081 7.67779 30.2691 8.74935 28.7984C9.82102 27.3276 11.2794 26.1816 12.9617 25.4877C14.6438 24.794 16.4854 24.5795 18.2821 24.867C20.0789 25.1547 21.7609 25.9335 23.1426 27.1177C24.5242 28.302 25.5519 29.8453 26.111 31.577L29.7168 30.413C28.943 28.0162 27.5211 25.8801 25.6088 24.241Z",pdd63b00:"M97.0978 33.7343C95.3833 33.7343 94.0218 33.3141 93.0133 32.4737C92.0048 31.6333 91.5006 30.3054 91.5006 28.4901C91.5006 28.0195 91.5342 27.5153 91.6014 26.9774C91.6687 26.4059 91.7695 25.8176 91.904 25.2125L95.3833 8.72354H91.3493L91.7023 7.16037L95.8876 6.15187L98.308 1.2012e-05H100.123L98.7618 6.40399H106.275L105.771 8.72354H98.2575L94.7782 25.1621C94.6774 25.6663 94.5765 26.1874 94.4757 26.7253C94.4084 27.2295 94.3748 27.717 94.3748 28.1876C94.3748 29.1289 94.6101 29.8852 95.0808 30.4567C95.585 31.0282 96.375 31.3139 97.4507 31.3139C98.1567 31.3139 98.8122 31.2635 99.4173 31.1627C100.022 31.0282 100.611 30.8601 101.182 30.6584V32.978C100.712 33.1461 100.106 33.3141 99.3669 33.4822C98.6609 33.6503 97.9046 33.7343 97.0978 33.7343Z"},_$="linear-gradient(135deg, rgb(11,77,209) 0%, rgb(29,102,239) 45%, rgb(107,53,210) 100%)",Fc="#EF8D1D";function C$({variant:e="color",scale:t=1}){const r=e==="light"?"white":"#0F3072",n=Math.round(320*t),o=Math.round(60*t);return i.jsxs("div",{style:{position:"relative",width:n,height:o,flexShrink:0},children:[i.jsxs("svg",{style:{position:"absolute",left:0,top:0},fill:"none",preserveAspectRatio:"none",viewBox:"0 0 79.3139 60.1372",width:Math.round(79*t),height:Math.round(60*t),children:[i.jsx("path",{d:Ao.pd494300,fill:Fc}),i.jsx("path",{d:Ao.p33b7c800,fill:Fc}),i.jsx("path",{d:Ao.p142b6380,fill:r}),i.jsx("path",{d:Ao.p2c694f80,fill:r}),i.jsx("circle",{cx:"39.8711",cy:"7.36343",r:"6.01221",fill:r,transform:"rotate(75 39.8711 7.36343)"}),i.jsx("circle",{cx:"17.7246",cy:"12.6819",r:"5.28744",fill:Fc,transform:"rotate(75 17.7246 12.6819)"}),i.jsx("circle",{cx:"5.28744",cy:"5.28744",r:"5.28744",fill:Fc,transform:"matrix(-0.258819 0.965926 0.965926 0.258819 58.2047 6.20616)"}),i.jsx("path",{d:Ao.p1674a600,fill:r}),i.jsx("path",{d:Ao.p6970200,fill:r}),i.jsx("path",{d:Ao.p37f9b00,fill:r})]}),i.jsxs("svg",{style:{position:"absolute",left:Math.round(91*t),top:Math.round(13*t)},fill:"none",preserveAspectRatio:"none",viewBox:"0 0 106.275 33.7343",width:Math.round(106*t),height:Math.round(34*t),children:[i.jsx("path",{d:Ao.pdd63b00,fill:r}),i.jsx("path",{d:Ao.p1945f480,fill:r}),i.jsx("path",{d:Ao.p48e8300,fill:r}),i.jsx("path",{d:Ao.p3763d600,fill:r}),i.jsx("path",{d:Ao.p6535700,fill:r})]}),i.jsxs("svg",{style:{position:"absolute",left:Math.round(197*t),top:Math.round(8*t)},fill:"none",preserveAspectRatio:"none",viewBox:"0 0 105.33 38.8275",width:Math.round(106*t),height:Math.round(39*t),children:[i.jsx("path",{d:Ao.p30ec5580,fill:Fc}),i.jsx("path",{d:Ao.p2fc98c00,fill:Fc}),i.jsx("path",{d:Ao.p10df6080,fill:Fc}),i.jsx("path",{d:Ao.p24dd2380,fill:Fc})]}),i.jsxs("svg",{style:{position:"absolute",left:Math.round(298*t),top:Math.round(9*t)},fill:"none",preserveAspectRatio:"none",viewBox:"0 0 21.5276 21.5276",width:Math.round(22*t),height:Math.round(22*t),children:[i.jsx("path",{d:Ao.p1e5a9f00,fill:Fc}),i.jsx("path",{d:Ao.p5358df0,fill:Fc})]})]})}function E$(){return i.jsxs("div",{"aria-hidden":"true",style:{position:"fixed",inset:0,zIndex:0,backgroundImage:_$,overflow:"hidden"},children:[i.jsx("div",{style:{position:"absolute",top:"-160px",right:"-160px",width:480,height:480,borderRadius:"50%",background:"rgba(255,255,255,0.07)"}}),i.jsx("div",{style:{position:"absolute",top:"-60px",right:"-60px",width:280,height:280,borderRadius:"50%",border:"1px solid rgba(255,255,255,0.12)",background:"transparent"}}),i.jsx("div",{style:{position:"absolute",bottom:"-200px",left:"-200px",width:560,height:560,borderRadius:"50%",background:"rgba(255,255,255,0.06)"}}),i.jsx("div",{style:{position:"absolute",bottom:"-80px",left:"-80px",width:300,height:300,borderRadius:"50%",border:"1px solid rgba(255,255,255,0.10)",background:"transparent"}}),i.jsx("div",{style:{position:"absolute",top:"20%",left:"12%",width:80,height:80,borderRadius:"50%",background:"rgba(255,255,255,0.05)"}}),i.jsx("div",{style:{position:"absolute",bottom:"18%",right:"8%",width:120,height:120,borderRadius:"50%",background:"rgba(255,255,255,0.05)"}})]})}function Qu({label:e,placeholder:t,value:r,onChange:n,type:o="text",required:a,showToggle:s,inputMode:l,autoComplete:c,name:u}){const[d,f]=j.useState(!1),[h,p]=j.useState(!1),y=s?h?"text":"password":o;return i.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",marginBottom:5},children:[a&&i.jsx("span",{style:{color:"var(--destructive)",marginRight:3},children:"*"}),e]}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("input",{type:y,value:r,onChange:m=>n(m.target.value),placeholder:t,required:a,name:u,inputMode:l,autoComplete:c,onFocus:()=>f(!0),onBlur:()=>f(!1),style:{width:"100%",padding:"8px 12px",paddingRight:s?38:12,border:d?"1px solid var(--primary)":"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box",boxShadow:d?"0 0 0 2px rgba(11,77,209,0.10)":"none",transition:"border-color 0.15s, box-shadow 0.15s"}}),s&&i.jsx("button",{type:"button",tabIndex:-1,onClick:()=>p(m=>!m),style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0,lineHeight:0},children:h?i.jsx(R6,{size:15}):i.jsx(Ah,{size:15})})]})]})}function A$({label:e,disabled:t}){const[r,n]=j.useState(!1),o=!!t;return i.jsx("button",{type:"submit",disabled:o,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:"10px 24px",borderRadius:"var(--radius-button)",background:"var(--primary)",border:"none",cursor:o?"not-allowed":"pointer",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-sm)",color:"var(--primary-foreground)",letterSpacing:"0.02em",opacity:o?.55:r?.88:1,transition:"opacity 0.15s ease"},children:e})}function T$({prompt:e,linkLabel:t,onClick:r}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:[i.jsx("span",{style:{fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",fontSize:"var(--text-sm)",color:"var(--muted)"},children:e}),i.jsx("button",{type:"button",onClick:r,style:{fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-sm)",color:"var(--primary)",textDecoration:"underline",textDecorationSkipInk:"none",background:"none",border:"none",cursor:"pointer",padding:0,opacity:1,transition:"opacity 0.15s ease"},onMouseEnter:n=>{n.currentTarget.style.opacity="0.7"},onMouseLeave:n=>{n.currentTarget.style.opacity="1"},children:t})]})}function F0({label:e}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}}),i.jsx("span",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:"var(--muted)",whiteSpace:"nowrap"},children:e}),i.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}})]})}const X6="951022141012-uqd3e8da53gj8vhbhg9ibha5f9k8jsqj.apps.googleusercontent.com";function jie(e){try{const t=e.split(".")[1];if(!t)return null;const r=t.replace(/-/g,"+").replace(/_/g,"/"),n=r+"=".repeat((4-r.length%4)%4),o=atob(n);return JSON.parse(o)}catch{return null}}function P$({text:e,onCredential:t}){const r=j.useRef(null),n=j.useRef(t);return n.current=t,j.useEffect(()=>{var l,c;if(!r.current)return;const o=r.current;let a=!0;const s=()=>{var f,h;if(!a||!o.isConnected)return;const u=(h=(f=window.google)==null?void 0:f.accounts)==null?void 0:h.id;if(!u)return;o.innerHTML="",u.initialize({client_id:X6,callback:p=>{p.credential&&n.current(p.credential)}});const d=Math.max(Math.floor(o.getBoundingClientRect().width),280);u.renderButton(o,{type:"standard",theme:"outline",size:"large",text:e,width:Math.min(400,d)})};if((c=(l=window.google)==null?void 0:l.accounts)!=null&&c.id)s();else{const u=window.setInterval(()=>{var f,h;(h=(f=window.google)==null?void 0:f.accounts)!=null&&h.id&&(window.clearInterval(u),s())},100),d=window.setTimeout(()=>window.clearInterval(u),2e4);return()=>{a=!1,window.clearInterval(u),window.clearTimeout(d)}}return()=>{a=!1}},[e]),i.jsx("div",{style:{width:"100%"},children:i.jsx("div",{ref:r,style:{width:"100%",minHeight:44}})})}function kie({onNavigateToLogin:e,onSuccess:t,onRegister:r,onRegisterWithGoogle:n}){const[o,a]=j.useState(""),[s,l]=j.useState(""),[c,u]=j.useState(""),[d,f]=j.useState(""),[h,p]=j.useState(""),[y,m]=j.useState(""),[x,b]=j.useState(null),[w,k]=j.useState(!1),S=async O=>{if(!n)return;b(null);const T=jie(O);if(!(T!=null&&T.email)){b("Could not read your Google account details. Try again.");return}k(!0);try{const R=await n({idToken:O,teamName:o.trim()||void 0,firstName:T.given_name||void 0,lastName:T.family_name||void 0});if(R.error){b(R.error);return}t==null||t()}finally{k(!1)}},_=async O=>{if(O.preventDefault(),b(null),r){const T=await r({email:s,password:c,teamName:o.trim(),firstName:d||void 0,lastName:h||void 0});if(T.error){b(T.error);return}}t==null||t()},P=[{icon:i.jsx(Wi,{size:16}),label:"Manage all your events in one place"},{icon:i.jsx(vi,{size:16}),label:"Track participants and attendance"},{icon:i.jsx(nu,{size:16}),label:"Real-time analytics and insights"}];return i.jsxs("div",{style:{minHeight:"100vh",width:"100%",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 16px"},children:[i.jsx(E$,{}),i.jsxs("div",{style:{position:"relative",zIndex:1,display:"flex",flexDirection:"row",borderRadius:"var(--radius-card)",overflow:"hidden",boxShadow:"0px 20px 48px 0px rgba(0,0,0,0.28), 0px 4px 12px 0px rgba(0,0,0,0.18)",width:"min(960px, 100%)",minHeight:640},children:[i.jsxs("div",{style:{flex:"0 0 42%",position:"relative",overflow:"hidden",display:"flex",flexDirection:"column",justifyContent:"space-between",padding:"40px 36px",minHeight:580},children:[i.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"none",background:"linear-gradient(160deg, rgba(11,77,209,0.92) 0%, rgba(29,102,239,0.88) 50%, rgba(107,53,210,0.92) 100%)"}}),i.jsxs("div",{style:{position:"relative",zIndex:1,display:"flex",flexDirection:"column",height:"100%",gap:0},children:[i.jsx("div",{children:i.jsx(C$,{variant:"light",scale:.72})}),i.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",gap:20,paddingTop:32,paddingBottom:16},children:[i.jsxs("div",{children:[i.jsxs("p",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-2xl)",color:"white",lineHeight:1.25,margin:"0 0 10px"},children:["Your event",i.jsx("br",{}),"management portal"]}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",fontSize:"var(--text-sm)",color:"rgba(255,255,255,0.80)",lineHeight:1.55,margin:0},children:"Everything you need to run exceptional events — in one place."})]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:P.map((O,T)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx("div",{style:{width:28,height:28,borderRadius:"var(--radius-button)",background:"rgba(255,255,255,0.15)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:O.icon}),i.jsx("span",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-normal)",color:"rgba(255,255,255,0.88)",lineHeight:1.4},children:O.label})]},T))})]}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:"rgba(255,255,255,0.55)",margin:0},children:"© 2026 Stratawiz Technologies · EventBuzz"})]})]}),i.jsxs("div",{style:{flex:"1 1 0",background:"var(--card)",display:"flex",flexDirection:"column",overflowY:"auto",padding:"40px 40px 36px"},children:[i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{marginBottom:28},children:[i.jsx("h2",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-2xl)",color:"var(--foreground)",lineHeight:1.25,margin:"0 0 6px"},children:"Create your account"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",fontSize:"var(--text-sm)",color:"var(--muted)",margin:0,lineHeight:1.5},children:"Complete your registration to access the portal"})]}),i.jsxs("form",{onSubmit:_,style:{display:"flex",flexDirection:"column",gap:14,flex:1},children:[x&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0},children:x}),n&&X6&&i.jsxs(i.Fragment,{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 4px"},children:"Sign up with Google — your account is created instantly, no extra steps."}),w&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Creating your account with Google…"}),i.jsx(P$,{text:"signup_with",onCredential:O=>{S(O)}}),i.jsx(F0,{label:"or register with email"})]}),i.jsx(Qu,{label:"Team Name",placeholder:"Enter your team or organization name",value:o,onChange:a,type:"text",required:!0}),i.jsx(Qu,{label:"Email Address",placeholder:"Enter your email address",value:s,onChange:l,type:"email",required:!0}),r&&i.jsx(Qu,{label:"Password",placeholder:"Choose a password (min 6 characters)",value:c,onChange:u,type:"password",required:!0}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[i.jsx(Qu,{label:"First Name",placeholder:"First name",value:d,onChange:f,required:!0}),i.jsx(Qu,{label:"Last Name",placeholder:"Last name",value:h,onChange:p,required:!0})]}),i.jsx(Qu,{label:"Phone Number",placeholder:"Enter your phone number",value:y,onChange:m,type:"tel"}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[i.jsx(A$,{label:"Create Account"}),i.jsx(F0,{label:"Already registered?"}),i.jsx(T$,{prompt:"Have an account?",linkLabel:"Sign in here",onClick:e})]})]})]}),i.jsxs("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:24,lineHeight:1.5,textAlign:"center"},children:["By registering you agree to our"," ",i.jsx("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"Terms of Service"})," ","and"," ",i.jsx("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"Privacy Policy"}),"."]})]})]})]})}function _ie({onNavigateToRegister:e,onSuccess:t,onLogin:r,onLoginWithGoogle:n,onCompleteTwoFactorLogin:o}){const[a,s]=j.useState(""),[l,c]=j.useState(""),[u,d]=j.useState(""),[f,h]=j.useState("password"),[p,y]=j.useState(null),[m,x]=j.useState(null),[b,w]=j.useState(!1),k=async P=>{if(n){x(null),w(!0);try{const O=await n(P);if("error"in O&&O.error){x(O.error);return}if("requiresTwoFactor"in O&&O.requiresTwoFactor){y(O.twoFactorToken),O.email&&s(O.email),h("2fa"),d("");return}t==null||t()}finally{w(!1)}}},S=()=>{h("password"),y(null),d(""),x(null)},_=async P=>{if(P.preventDefault(),x(null),f==="2fa"){if(!o||!p)return;const O=await o(p,u.trim());if(O.error){x(O.error);return}t==null||t();return}if(r){const O=await r(a,l);if("error"in O){x(O.error);return}if("requiresTwoFactor"in O&&O.requiresTwoFactor){y(O.twoFactorToken),h("2fa"),d("");return}}else{t==null||t();return}t==null||t()};return i.jsxs("div",{style:{minHeight:"100vh",width:"100%",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 16px"},children:[i.jsx(E$,{}),i.jsxs("div",{style:{position:"relative",zIndex:1,background:"var(--card)",borderRadius:"var(--radius-card)",overflow:"hidden",boxShadow:"0px 20px 48px 0px rgba(0,0,0,0.28), 0px 4px 12px 0px rgba(0,0,0,0.18)",width:"min(440px, 100%)"},children:[i.jsxs("div",{style:{padding:"32px 40px 28px",backgroundImage:_$,display:"flex",flexDirection:"column",alignItems:"center",gap:16,position:"relative",overflow:"hidden"},children:[i.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:-40,right:-40,width:160,height:160,borderRadius:"50%",border:"1px solid rgba(255,255,255,0.15)",background:"transparent"}}),i.jsx("div",{"aria-hidden":"true",style:{position:"absolute",bottom:-50,left:-30,width:120,height:120,borderRadius:"50%",background:"rgba(255,255,255,0.06)"}}),i.jsx("div",{style:{position:"relative",zIndex:1},children:i.jsx(C$,{variant:"light",scale:.72})}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",fontSize:"var(--text-xs)",color:"rgba(255,255,255,0.72)",margin:0,letterSpacing:"0.04em",textTransform:"uppercase",position:"relative",zIndex:1},children:"Event Management Portal"})]}),i.jsxs("div",{style:{padding:"32px 40px 36px"},children:[i.jsxs("div",{style:{marginBottom:24,textAlign:"center"},children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-xl)",color:"var(--foreground)",margin:"0 0 6px",lineHeight:1.3},children:f==="2fa"?"Authenticator code":"Welcome back"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",fontSize:"var(--text-sm)",color:"var(--muted)",margin:0,lineHeight:1.5},children:f==="2fa"?"Open Google Authenticator and enter the 6-digit code for your EventBuzz account.":"Enter your email to access your portal"})]}),i.jsxs("form",{onSubmit:_,style:{display:"flex",flexDirection:"column",gap:14},children:[m&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0},children:m}),f==="password"?i.jsxs(i.Fragment,{children:[i.jsx(Qu,{label:"Email Address",placeholder:"Enter your email address",value:a,onChange:s,type:"email",required:!0}),r&&i.jsx(Qu,{label:"Password",placeholder:"Enter your password",value:l,onChange:c,type:"password",required:!0})]}):i.jsxs(i.Fragment,{children:[i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:["Signed in as ",i.jsx("strong",{style:{color:"var(--foreground)"},children:a})]}),i.jsx(Qu,{label:"Authentication code",placeholder:"000000",value:u,onChange:d,type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[i.jsx(A$,{label:f==="2fa"?"Verify and sign in":"Sign In"}),f==="2fa"&&i.jsx("button",{type:"button",onClick:S,style:{background:"none",border:"none",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--primary)",padding:"4px 0"},children:"← Use a different account"}),f==="password"&&n&&X6&&i.jsxs(i.Fragment,{children:[i.jsx(F0,{label:"or"}),b&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Signing in with Google…"}),i.jsx(P$,{text:"signin_with",onCredential:P=>{k(P)}})]}),i.jsx(F0,{label:"New to EventBuzz?"}),i.jsx(T$,{prompt:"Don't have an account?",linkLabel:"Register here",onClick:e})]})]}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:24,lineHeight:1.5,textAlign:"center"},children:"© 2026 Stratawiz Technologies · EventBuzz"})]})]})]})}function Cie(){var c,u;const e=bd(),t=xd(),{user:r,checked:n,login:o,loginWithGoogleCredential:a,completeTwoFactorLogin:s}=Ur(),l=((u=(c=t.state)==null?void 0:c.from)==null?void 0:u.pathname)??"/home";return n&&r?i.jsx(th,{to:l,replace:!0}):i.jsx(_ie,{onNavigateToRegister:()=>e("/register"),onSuccess:()=>e(l,{replace:!0}),onLogin:o,onLoginWithGoogle:a,onCompleteTwoFactorLogin:s})}function Eie(){const e=bd(),{user:t,checked:r,register:n,registerWithGoogle:o}=Ur();return r&&t?i.jsx(th,{to:"/home",replace:!0}):i.jsx(kie,{onNavigateToLogin:()=>e("/login"),onSuccess:()=>e("/home",{replace:!0}),onRegister:n,onRegisterWithGoogle:o})}function Aie(){const[e]=aq(),t=bd(),r=e.get("token")||"",[n,o]=j.useState(!0),[a,s]=j.useState(null),[l,c]=j.useState(null),[u,d]=j.useState(""),[f,h]=j.useState(""),[p,y]=j.useState(""),[m,x]=j.useState(!1);j.useEffect(()=>{if(!r){s("Missing invitation link."),o(!1);return}za.invitePreview(r).then(w=>{if(o(!1),w.error||!w.data){s(w.error||"Invalid or expired invitation.");return}const k=w.data;c(k),k.accountExists&&!k.sameOrganization&&s("This email is already registered with another organization.")})},[r]);const b=async w=>{if(w.preventDefault(),!r||!u)return;x(!0),s(null);const k=await za.inviteAccept({token:r,password:u,firstName:l!=null&&l.accountExists?void 0:f,lastName:l!=null&&l.accountExists?void 0:p});if(x(!1),k.error||!k.data){s(k.error||"Could not accept invitation.");return}const S=k.data;vf(S.token,S.refreshToken),t("/events",{replace:!0})};return n?i.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Loading invitation…"}):i.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"var(--secondary)"},children:i.jsxs("div",{style:{width:"100%",maxWidth:420,background:"var(--card)",borderRadius:12,padding:28,border:"1px solid var(--border)",boxShadow:"var(--shadow-md)"},children:[i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"1.25rem",margin:"0 0 8px",color:"var(--foreground)"},children:"Event invitation"}),l&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:20,lineHeight:1.5},children:["Join ",i.jsx("strong",{children:l.eventName}),l.organizationName?` · ${l.organizationName}`:""," as ",i.jsx("strong",{children:l.eventRole||"team member"}),".",i.jsx("br",{}),i.jsx("span",{style:{fontSize:"var(--text-xs)"},children:l.email})]}),a&&i.jsx("div",{style:{padding:12,background:"#fef2f2",color:"#b91c1c",borderRadius:8,marginBottom:16,fontSize:"var(--text-sm)"},children:a}),l&&(!l.accountExists||l.sameOrganization)&&!(a!=null&&a.includes("another organization"))&&i.jsxs("form",{onSubmit:b,children:[!l.accountExists&&i.jsxs(i.Fragment,{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",marginBottom:6},children:"First name"}),i.jsx("input",{value:f,onChange:w=>h(w.target.value),style:{width:"100%",marginBottom:12,padding:10,borderRadius:8,border:"1px solid var(--border)"}}),i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",marginBottom:6},children:"Last name"}),i.jsx("input",{value:p,onChange:w=>y(w.target.value),style:{width:"100%",marginBottom:12,padding:10,borderRadius:8,border:"1px solid var(--border)"}})]}),i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",marginBottom:6},children:[l.accountExists?"Password":"Create password"," ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx("input",{type:"password",value:u,onChange:w=>d(w.target.value),placeholder:l.accountExists?"Your account password":"At least 6 characters",style:{width:"100%",marginBottom:16,padding:10,borderRadius:8,border:"1px solid var(--border)"},autoComplete:l.accountExists?"current-password":"new-password"}),i.jsx("button",{type:"submit",disabled:m||!u,style:{width:"100%",padding:12,borderRadius:8,border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontWeight:600,cursor:m?"wait":"pointer"},children:m?"Please wait…":l.accountExists?"Accept & sign in":"Create account & join"})]})]})})}const O$=j.createContext(null),Tie="home";function Pie({children:e,activeNavFromUrl:t,setActiveNavToUrl:r}){const[n,o]=j.useState(Tie),[a,s]=j.useState(null),[l,c]=j.useState(""),[u,d]=j.useState(!1),[f,h]=j.useState(!1),[p,y]=j.useState(null),[m,x]=j.useState(!1),[b,w]=j.useState(null),_={activeNav:t??n,setActiveNav:r??o,selectedEventId:a,setSelectedEventId:s,searchQuery:l,setSearchQuery:c,sidebarCollapsed:u,setSidebarCollapsed:d,drawerOpen:f,setDrawerOpen:h,settingsInitialSection:p,setSettingsInitialSection:y,openAgendaSessionPanelOnce:m,setOpenAgendaSessionPanelOnce:x,pendingMicrositeBuilder:b,setPendingMicrositeBuilder:w};return i.jsx(O$.Provider,{value:_,children:e})}function eo(){const e=j.useContext(O$);if(!e)throw new Error("useAppNav must be used within AppNavProvider");return e}function jI(e){return e<640?"mobile":e<1024?"tablet":"desktop"}function qi(){const[e,t]=j.useState(()=>jI(window.innerWidth));return j.useEffect(()=>{const r=()=>t(jI(window.innerWidth));return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),e}const kI=[{id:"home",label:"Home",icon:i.jsx(F6,{size:16})},{id:"events",label:"All Events",icon:i.jsx(Tw,{size:16})},{id:"activities",label:"Activities",icon:i.jsx(B6,{size:16})},{id:"design",label:"Design",icon:i.jsx(Wg,{size:16}),children:[{id:"design-brochure",label:"Brochure"},{id:"design-microsite",label:"Microsite Templates"},{id:"design-badges",label:"Badges"},{id:"design-emailers",label:"Emailers"},{id:"design-whatsapp-templates",label:"WhatsApp Templates"}]},{id:"faculty",label:"Faculty & Speakers",icon:i.jsx(Pw,{size:16})},{id:"all-participants",label:"Participants",icon:i.jsx(vi,{size:16})},{id:"forms",label:"Forms & Workflow",icon:i.jsx(lh,{size:16}),children:[{id:"forms-feedback",label:"Feedback"},{id:"forms-registration",label:"Registration"},{id:"forms-other",label:"Other Forms"},{id:"forms-add",label:"Add New Form",isAction:!0}]},{id:"content",label:"Content",icon:i.jsx(N0,{size:16}),children:[{id:"content-library",label:"Library"},{id:"content-collections",label:"Collections"}]},{id:"messaging",label:"Messaging",icon:i.jsx(ch,{size:16}),children:[{id:"messaging-email",label:"Email"},{id:"messaging-whatsapp",label:"WhatsApp"}]},{id:"payment",label:"Payment Settings",icon:i.jsx(ov,{size:16})},{id:"user-management",label:"User Management",icon:i.jsx(id,{size:16})},{id:"settings",label:"Settings",icon:i.jsx(Pl,{size:16})}];function I$(e,t){var r;return!!((r=e.children)!=null&&r.some(n=>n.id===t))}function Oie(e,t){return t===e.id||I$(e,t)}function Gp({label:e,children:t}){const[r,n]=j.useState(!1);return i.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[t,r&&i.jsxs("div",{style:{position:"absolute",left:"calc(100% + 8px)",top:"50%",transform:"translateY(-50%)",background:"var(--foreground)",color:"#fff",padding:"4px 10px",borderRadius:"var(--radius-button)",fontSize:"12px",fontFamily:"var(--font-noto-sans)",whiteSpace:"nowrap",zIndex:300,pointerEvents:"none",boxShadow:"var(--elevation-sm)"},children:[e,i.jsx("span",{style:{position:"absolute",right:"100%",top:"50%",transform:"translateY(-50%)",borderWidth:"4px",borderStyle:"solid",borderColor:"transparent var(--foreground) transparent transparent"}})]})]})}function _I({activeItem:e,onNavigate:t,showCollapsed:r,selectedEventId:n,onEventSelect:o}){const a=kI.filter(f=>f.children).reduce((f,h)=>(f[h.id]=I$(h,e),f),{}),[s,l]=j.useState({events:!0,...a}),c=f=>l(h=>({...h,[f]:!h[f]})),u=f=>({width:"100%",display:"flex",alignItems:"center",gap:r?0:"9px",padding:r?"8px 0":"7px 10px",justifyContent:r?"center":"flex-start",borderRadius:"var(--radius-button)",background:f?"var(--sidebar-accent)":"transparent",border:"none",cursor:"pointer",textAlign:"left",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:f?"var(--font-weight-medium)":"var(--font-weight-normal)",color:f?"var(--sidebar-accent-foreground)":"var(--sidebar-foreground)",transition:"background 0.12s",marginBottom:"1px",whiteSpace:"nowrap",overflow:"hidden"}),d=f=>({color:f?"var(--sidebar-primary)":"var(--muted)",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"});return i.jsx(i.Fragment,{children:kI.map(f=>{if(f.id==="events"){const m=e==="events",x=!!s.events&&!r;return r?i.jsx(Gp,{label:"All Events",children:i.jsxs("button",{onClick:()=>t("events"),style:{...u(m||!!n),position:"relative"},onMouseEnter:b=>{m||(b.currentTarget.style.background="var(--accent)")},onMouseLeave:b=>{m||(b.currentTarget.style.background=m||n?"var(--sidebar-accent)":"transparent")},children:[i.jsx("span",{style:d(m||!!n),children:f.icon}),n&&i.jsx("span",{style:{position:"absolute",top:"6px",right:"6px",width:"6px",height:"6px",borderRadius:"50%",background:"#16a34a",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--sidebar)"}})]})},"events"):i.jsx("div",{style:{marginBottom:"1px"},children:i.jsx("div",{style:{display:"flex",alignItems:"center"},children:i.jsxs("button",{onClick:()=>{t("events"),x||l(b=>({...b,events:!0}))},style:{...u(m),flex:1,borderRadius:"var(--radius-button) 0 0 var(--radius-button)",marginBottom:0,overflow:"hidden"},onMouseEnter:b=>{m||(b.currentTarget.style.background="var(--accent)")},onMouseLeave:b=>{m||(b.currentTarget.style.background="transparent")},children:[i.jsx("span",{style:d(m),children:f.icon}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",overflow:"hidden",textOverflow:"ellipsis"},children:f.label}),n&&!x&&i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"var(--primary)",flexShrink:0,marginRight:"2px"}})]})})},"events")}const h=Oie(f,e),p=!!s[f.id]&&!r;if(f.children){const m=i.jsxs("button",{onClick:()=>c(f.id),style:u(h),onMouseEnter:x=>{h||(x.currentTarget.style.background="var(--accent)")},onMouseLeave:x=>{h||(x.currentTarget.style.background="transparent")},children:[i.jsx("span",{style:d(h),children:f.icon}),!r&&i.jsxs(i.Fragment,{children:[i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:f.label}),i.jsx(va,{size:13,style:{color:"var(--muted)",flexShrink:0,transform:p?"rotate(90deg)":"none",transition:"transform 0.18s"}})]})]});return i.jsxs("div",{children:[r?i.jsx(Gp,{label:f.label,children:m}):m,p&&i.jsx("div",{style:{paddingLeft:"14px",marginBottom:"2px"},children:i.jsx("div",{style:{borderLeft:"1px solid var(--sidebar-border)",paddingLeft:"8px"},children:f.children.map(x=>{const b=e===x.id;return i.jsxs("button",{onClick:()=>t(x.id),style:{...u(b),padding:"5px 8px",fontSize:"var(--text-xs)",gap:"6px"},onMouseEnter:w=>{b||(w.currentTarget.style.background="var(--accent)")},onMouseLeave:w=>{b||(w.currentTarget.style.background="transparent")},children:[x.isAction&&i.jsx(wr,{size:11,style:{color:"var(--primary)",flexShrink:0}}),i.jsx("span",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:b?"var(--sidebar-accent-foreground)":x.isAction?"var(--primary)":"var(--card-foreground)"},children:x.label})]},x.id)})})})]},f.id)}const y=i.jsxs("button",{onClick:()=>t(f.id),style:u(h),onMouseEnter:m=>{h||(m.currentTarget.style.background="var(--accent)")},onMouseLeave:m=>{h||(m.currentTarget.style.background="transparent")},children:[i.jsx("span",{style:d(h),children:f.icon}),!r&&i.jsxs(i.Fragment,{children:[i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:f.label}),h&&i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"var(--primary)",flexShrink:0}})]})]},f.id);return r?i.jsx(Gp,{label:f.label,children:y},f.id):y})})}function N$(e){var t;return e?e.firstName||e.lastName?[e.firstName,e.lastName].filter(Boolean).join(" ").trim():((t=e.email)==null?void 0:t.split("@")[0])??"User":"User"}function Iie(e){return N$(e).slice(0,2).toUpperCase()||"?"}function CI({collapsed:e,onNavigate:t}){const{theme:r,setTheme:n}=lq(),{user:o,logout:a}=Ur(),s=bd(),l=(o==null?void 0:o.platform_admin)==="yes",c=N$(o??null),u=Iie(o??null),d=(o==null?void 0:o.email)??"",f=()=>{a(),s("/login",{replace:!0})},h={width:"100%",display:"flex",alignItems:"center",gap:e?0:"9px",padding:e?"8px 0":"7px 10px",justifyContent:e?"center":"flex-start",borderRadius:"var(--radius-button)",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.12s",marginBottom:"1px",whiteSpace:"nowrap",overflow:"hidden"};return i.jsxs("div",{style:{borderTopWidth:"1px",borderTopStyle:"solid",borderTopColor:"var(--sidebar-border)",padding:e?"8px 4px 12px":"8px 8px 12px",display:"flex",flexDirection:"column",alignItems:e?"center":"stretch",gap:"2px",flexShrink:0},children:[e?i.jsx(Gp,{label:r==="dark"?"Switch to Light":"Switch to Dark",children:i.jsx("button",{onClick:()=>n(r==="dark"?"light":"dark"),style:{...h,marginBottom:"4px"},onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:i.jsx("span",{style:{color:"var(--muted)",flexShrink:0,display:"flex"},children:r==="dark"?i.jsx(iI,{size:16}):i.jsx(nI,{size:16})})})}):i.jsxs("div",{style:{marginBottom:"4px"},children:[i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"700",letterSpacing:"0.07em",textTransform:"uppercase",margin:"0 0 6px 2px"},children:"Appearance"}),i.jsx("div",{style:{display:"flex",alignItems:"center",background:"var(--sidebar-accent)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopColor:"var(--sidebar-border)",borderRightColor:"var(--sidebar-border)",borderBottomColor:"var(--sidebar-border)",borderLeftColor:"var(--sidebar-border)",borderRadius:"var(--radius-button)",padding:"2px",gap:"2px"},children:["light","dark"].map(p=>{const y=r===p;return i.jsx("button",{onClick:()=>n(p),style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"5px",borderRadius:"var(--radius-button)",border:"none",cursor:"pointer",background:y?"var(--sidebar)":"transparent",boxShadow:y?"var(--elevation-sm)":"none",color:y?"var(--sidebar-foreground)":"var(--muted)",transition:"background 0.15s, color 0.15s, box-shadow 0.15s"},onMouseEnter:m=>{y||(m.currentTarget.style.color="var(--sidebar-foreground)")},onMouseLeave:m=>{y||(m.currentTarget.style.color="var(--muted)")},title:p==="light"?"Light mode":"Dark mode",children:p==="light"?i.jsx(iI,{size:13}):i.jsx(nI,{size:13})},p)})})]}),l&&(e?i.jsx(Gp,{label:"Go to Super Admin Panel",children:i.jsx("button",{type:"button",style:h,onClick:()=>s("/super-admin"),onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:i.jsx("span",{style:{color:"var(--muted)",flexShrink:0,display:"flex"},children:i.jsx(id,{size:16})})})}):i.jsxs("button",{type:"button",style:h,onClick:()=>s("/super-admin"),onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[i.jsx("span",{style:{color:"var(--muted)",flexShrink:0,display:"flex"},children:i.jsx(id,{size:16})}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--sidebar-foreground)"},children:"Go to Super Admin Panel"})]})),e?i.jsx(Gp,{label:"Settings",children:i.jsx("button",{style:h,onClick:()=>t("settings"),onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:i.jsx("span",{style:{color:"var(--muted)",flexShrink:0,display:"flex"},children:i.jsx(Pl,{size:16})})})}):i.jsxs("button",{style:h,onClick:()=>t("settings"),onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[i.jsx("span",{style:{color:"var(--muted)",flexShrink:0,display:"flex"},children:i.jsx(Pl,{size:16})}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--sidebar-foreground)"},children:"Settings"})]}),e?i.jsx(Gp,{label:`${c} · Log out`,children:i.jsx("button",{type:"button",onClick:f,style:{...h,padding:"6px 0"},onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("span",{style:{color:"#fff",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"600"},children:u})})})}):i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 10px",borderRadius:"var(--radius-button)"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx("span",{style:{color:"#fff",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"600"},children:u})}),i.jsxs("div",{style:{flex:1,overflow:"hidden"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--sidebar-foreground)",lineHeight:"1.3",margin:0},children:c}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",margin:0},children:d||"—"})]}),i.jsx("button",{type:"button",onClick:f,title:"Log out",style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:"2px",flexShrink:0},onMouseEnter:p=>{p.currentTarget.style.color="var(--foreground)"},onMouseLeave:p=>{p.currentTarget.style.color="var(--muted)"},children:i.jsx(lte,{size:13})})]})]})}function EI(){return i.jsx("div",{style:{padding:"10px 14px 4px",flexShrink:0},children:i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"700",letterSpacing:"0.07em",textTransform:"uppercase",margin:0},children:"Portfolio"})})}function AI({activeItem:e,onItemClick:t,collapsed:r,onToggleCollapse:n,drawerOpen:o,onDrawerClose:a,selectedEventId:s,onEventSelect:l}){const c=qi(),u=c==="mobile"||c==="tablet",d=p=>{t(p),u&&a&&a()},f=p=>{l==null||l(p),u&&a&&a()};if(u)return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:a,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:40,opacity:o?1:0,pointerEvents:o?"auto":"none",transition:"opacity 0.22s"}}),i.jsxs("aside",{style:{position:"fixed",top:0,left:0,bottom:0,width:"272px",background:"var(--sidebar)",borderRight:"1px solid var(--sidebar-border)",zIndex:50,display:"flex",flexDirection:"column",transform:o?"translateX(0)":"translateX(-100%)",transition:"transform 0.22s cubic-bezier(0.4,0,0.2,1)",boxShadow:o?"var(--elevation-sm)":"none",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 14px 14px 16px",borderBottom:"1px solid var(--sidebar-border)",flexShrink:0,minHeight:"52px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"9px"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"6px",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("span",{style:{color:"#fff",fontSize:"11px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)"},children:"EB"})}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-base)",color:"var(--sidebar-foreground)"},children:"EventBuzz"})]}),i.jsx("button",{onClick:a,style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",borderRadius:"var(--radius-button)",color:"var(--muted)"},onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="none"},children:i.jsx(er,{size:15})})]}),i.jsx(EI,{}),i.jsx("nav",{style:{flex:1,overflowY:"auto",overflowX:"hidden",padding:"4px 8px"},children:i.jsx(_I,{activeItem:e,onNavigate:d,showCollapsed:!1,selectedEventId:s,onEventSelect:f})}),i.jsx(CI,{collapsed:!1,onNavigate:d})]})]});const h=r?60:240;return i.jsxs("aside",{style:{width:`${h}px`,flexShrink:0,height:"100%",display:"flex",flexDirection:"column",background:"var(--sidebar)",borderRight:"1px solid var(--sidebar-border)",transition:"width 0.2s cubic-bezier(0.4,0,0.2,1)",overflow:"hidden",zIndex:30,position:"relative"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:r?"center":"space-between",padding:r?"14px 0":"14px 12px 14px 14px",borderBottom:"1px solid var(--sidebar-border)",flexShrink:0,minHeight:"52px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"9px",overflow:"hidden"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"6px",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx("span",{style:{color:"#fff",fontSize:"11px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)"},children:"EB"})}),!r&&i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-base)",color:"var(--sidebar-foreground)",whiteSpace:"nowrap",overflow:"hidden"},children:"EventBuzz"})]}),i.jsx("button",{onClick:n,title:r?"Expand sidebar":"Collapse sidebar",style:{width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",borderRadius:"var(--radius-button)",color:"var(--muted)",flexShrink:0},onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)",p.currentTarget.style.color="var(--primary)"},onMouseLeave:p=>{p.currentTarget.style.background="none",p.currentTarget.style.color="var(--muted)"},children:r?i.jsx(va,{size:14}):i.jsx(Nf,{size:14})})]}),!r&&i.jsx(EI,{}),i.jsx("nav",{style:{flex:1,overflowY:"auto",overflowX:"hidden",padding:r?"8px 4px":"4px 8px"},children:i.jsx(_I,{activeItem:e,onNavigate:d,showCollapsed:r,selectedEventId:s,onEventSelect:f})}),r&&i.jsx("div",{style:{borderTop:"1px solid var(--sidebar-border)",padding:"8px 4px 4px",display:"flex",justifyContent:"center"},children:i.jsx("button",{onClick:n,title:"Expand",style:{width:"36px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",borderRadius:"var(--radius-button)",color:"var(--muted)"},onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)",p.currentTarget.style.color="var(--primary)"},onMouseLeave:p=>{p.currentTarget.style.background="none",p.currentTarget.style.color="var(--muted)"},children:i.jsx(va,{size:14})})}),i.jsx(CI,{collapsed:r,onNavigate:d})]})}const oE="eb:organization-subscription-updated",aE={Live:{bg:"#dcfce7",color:"#15803d",dot:"#16a34a"},Upcoming:{bg:"#dbeafe",color:"#1d4ed8"},Completed:{bg:"#f1f5f9",color:"#475569"},Draft:{bg:"#ffedd5",color:"#c2410c"}},Nie={Physical:i.jsx(nb,{size:10}),Virtual:i.jsx(ud,{size:10}),Hybrid:i.jsx(B6,{size:10})},Z6=[{id:"e1",title:"Napcon Jaipur 2026",subtitle:"27th National Conference on Pulmonary Diseases",status:"Live",type:"Conference",location:"Birla Auditorium, Jaipur",locationType:"Physical",startDate:"Nov 23, 2025",endDate:"Nov 26, 2025",participants:26,sessions:12},{id:"e2",title:"Napcon Mumbai 2025",subtitle:"26th National Conference on Pulmonary Diseases",status:"Completed",type:"Conference",location:"NSCI Dome, Mumbai",locationType:"Physical",startDate:"Oct 12, 2025",endDate:"Oct 15, 2025",participants:342,sessions:28},{id:"e3",title:"CHEST India 2026",subtitle:"Annual Indian CHEST Conference",status:"Upcoming",type:"Conference",location:"Taj Palace, New Delhi",locationType:"Physical",startDate:"Mar 15, 2026",endDate:"Mar 18, 2026",participants:0,sessions:0},{id:"e4",title:"ICS Annual Conference 2026",subtitle:"Indian Chest Society Annual Scientific Conference",status:"Upcoming",type:"Conference",location:"Hotel Lalit, Bengaluru",locationType:"Hybrid",startDate:"Jun 10, 2026",endDate:"Jun 12, 2026",participants:0,sessions:0},{id:"e5",title:"COPD Management Workshop",subtitle:"Evidence-based COPD Treatment Protocols",status:"Completed",type:"Workshop",location:"AIIMS, New Delhi",locationType:"Physical",startDate:"Sep 05, 2025",endDate:"Sep 05, 2025",participants:48,sessions:6},{id:"e6",title:"Interventional Pulmonology",subtitle:"Advanced Bronchoscopy & Intervention Training",status:"Completed",type:"Workshop",location:"PGI Chandigarh",locationType:"Physical",startDate:"Nov 28, 2025",endDate:"Nov 29, 2025",participants:22,sessions:8},{id:"e7",title:"Respiratory Physiology Lab",subtitle:"Masterclass: PFT & Interpretation",status:"Upcoming",type:"Workshop",location:"Online",locationType:"Virtual",startDate:"Apr 10, 2026",endDate:"Apr 10, 2026",participants:0,sessions:0},{id:"e8",title:"IMA Annual Summit 2025",subtitle:"Indian Medical Association National Congress",status:"Completed",type:"Summit",location:"Vigyan Bhavan, New Delhi",locationType:"Physical",startDate:"Aug 20, 2025",endDate:"Aug 22, 2025",participants:520,sessions:18},{id:"e9",title:"AIIMS Research Conclave 2026",subtitle:"National Medical Research & Innovation Summit",status:"Upcoming",type:"Summit",location:"AIIMS Auditorium, New Delhi",locationType:"Physical",startDate:"Jul 15, 2026",endDate:"Jul 17, 2026",participants:0,sessions:0},{id:"e10",title:"Monthly CME – December 2025",subtitle:"Asthma & Allergy Management Update",status:"Upcoming",type:"CME",location:"Online",locationType:"Virtual",startDate:"Dec 20, 2025",endDate:"Dec 20, 2025",participants:0,sessions:0},{id:"e11",title:"Monthly CME – November 2025",subtitle:"COPD Exacerbations: Case Studies",status:"Completed",type:"CME",location:"Online",locationType:"Virtual",startDate:"Nov 20, 2025",endDate:"Nov 20, 2025",participants:65,sessions:4},{id:"e12",title:"Monthly CME – October 2025",subtitle:"Sleep Apnoea: Diagnosis & Management",status:"Completed",type:"CME",location:"Online",locationType:"Virtual",startDate:"Oct 18, 2025",endDate:"Oct 18, 2025",participants:72,sessions:4}],R$=[{id:"p0",navId:"home",title:"Home",section:"Portfolio",description:"Dashboard home — AI event ideas and quick actions",icon:i.jsx(F6,{size:14})},{id:"p1",navId:"events",title:"All Events",section:"Portfolio",description:"Browse and manage all your events",icon:i.jsx(Tw,{size:14})},{id:"p2",navId:"design-brochure",title:"Design · Brochure",section:"Design",description:"Create and manage event brochures",icon:i.jsx(Wg,{size:14})},{id:"p3",navId:"design-microsite",title:"Design · Microsite Templates",section:"Design",description:"Manage microsite templates for events",icon:i.jsx(Wg,{size:14})},{id:"p4",navId:"design-badges",title:"Design · Badges",section:"Design",description:"Create attendee and speaker badges",icon:i.jsx(Wg,{size:14})},{id:"p5",navId:"design-emailers",title:"Design · Emailers",section:"Design",description:"Design email templates and newsletters",icon:i.jsx(Wg,{size:14})},{id:"p5w",navId:"design-whatsapp-templates",title:"Design · WhatsApp Templates",section:"Design",description:"Create Meta message templates and sync approval status",icon:i.jsx(Zs,{size:14})},{id:"p6",navId:"faculty",title:"Faculty & Speakers",section:"Portfolio",description:"Manage faculty profiles and speaker details",icon:i.jsx(Pw,{size:14})},{id:"p7",navId:"all-participants",title:"Participants",section:"Portfolio",description:"View and manage all participants across events",icon:i.jsx(vi,{size:14})},{id:"p8",navId:"forms-feedback",title:"Forms · Feedback",section:"Forms & Workflow",description:"Feedback forms and response analytics",icon:i.jsx(lh,{size:14})},{id:"p9",navId:"forms-registration",title:"Forms · Registration",section:"Forms & Workflow",description:"Registration forms and submissions",icon:i.jsx(lh,{size:14})},{id:"p10",navId:"content-library",title:"Content · Library",section:"Content",description:"Manage your content library and assets",icon:i.jsx(N0,{size:14})},{id:"p11",navId:"content-collections",title:"Content · Collections",section:"Content",description:"Organise content into curated collections",icon:i.jsx(N0,{size:14})},{id:"p12",navId:"messaging-email",title:"Messaging · Email",section:"Messaging",description:"Email campaigns, templates, and analytics",icon:i.jsx(ch,{size:14})},{id:"p13",navId:"messaging-whatsapp",title:"Messaging · WhatsApp",section:"Messaging",description:"WhatsApp messaging campaigns",icon:i.jsx(ch,{size:14})},{id:"p14",navId:"payment",title:"Payment Settings",section:"Portfolio",description:"Configure payment gateways and billing",icon:i.jsx(ov,{size:14})},{id:"p15",navId:"user-management",title:"User Management",section:"Portfolio",description:"Manage team members, roles, and permissions",icon:i.jsx(id,{size:14})},{id:"p16",navId:"settings",title:"Settings",section:"General",description:"Organisation, profile, and platform preferences",icon:i.jsx(Pl,{size:14})},{id:"p17",navId:"dashboard",title:"Dashboard",section:"Event",description:"Tracks, sessions, and schedule for the event",icon:i.jsx(ab,{size:14})},{id:"p18",navId:"analytics",title:"Event Analytics",section:"Event",description:"Stats, charts, quick actions, and feature overview",icon:i.jsx(jq,{size:14})},{id:"p19",navId:"participants",title:"Event Participants",section:"Event",description:"Registrations, check-ins, and attendance",icon:i.jsx(vi,{size:14})},{id:"p20",navId:"permissions",title:"Permissions",section:"Event",description:"Control team access and event-level roles",icon:i.jsx(id,{size:14})},{id:"p21",navId:"questions",title:"Q&A Questions",section:"Event",description:"Manage audience questions and Q&A sessions",icon:i.jsx(ib,{size:14})},{id:"p22",navId:"quiz",title:"Quiz & Polls",section:"Event",description:"Create quizzes, polls, and live surveys",icon:i.jsx(nu,{size:14})},{id:"p23",navId:"rewards",title:"Reward Points",section:"Event",description:"Configure and manage attendee rewards",icon:i.jsx(ree,{size:14})}],Rie=[{id:"a1",title:"Create New Event",description:"Set up a new conference, workshop, or CME",icon:i.jsx(wr,{size:14}),navTarget:"events"},{id:"a2",title:"Add Speaker / Faculty",description:"Add a new faculty or speaker profile",icon:i.jsx(Pw,{size:14}),navTarget:"faculty"},{id:"a3",title:"New Email Campaign",description:"Draft and send an email campaign",icon:i.jsx(ch,{size:14}),navTarget:"messaging-email"},{id:"a4",title:"Invite Team Member",description:"Send an invitation to a team member",icon:i.jsx(vi,{size:14}),navTarget:"user-management"},{id:"a5",title:"Upload Content",description:"Upload files, videos, or documents",icon:i.jsx(ou,{size:14}),navTarget:"content-library"},{id:"a6",title:"Connect Payment Gateway",description:"Link Razorpay, Stripe, or other gateways",icon:i.jsx(ov,{size:14}),navTarget:"payment"}],Lie=[{label:"Home",navId:"home",icon:i.jsx(F6,{size:12})},{label:"All Events",navId:"events",icon:i.jsx(Tw,{size:12})},{label:"Faculty & Speakers",navId:"faculty",icon:i.jsx(Pw,{size:12})},{label:"Design",navId:"design-brochure",icon:i.jsx(Wg,{size:12})},{label:"Participants",navId:"all-participants",icon:i.jsx(vi,{size:12})},{label:"Messaging",navId:"messaging-email",icon:i.jsx(ch,{size:12})},{label:"Settings",navId:"settings",icon:i.jsx(Pl,{size:12})}];function L$(e){const t=e.trim().toLowerCase();if(!t)return{events:[],pages:[],actions:[],total:0};const r=(...s)=>s.some(l=>l.toLowerCase().includes(t)),n=Z6.filter(s=>r(s.title,s.subtitle,s.location,s.type,s.status)),o=R$.filter(s=>r(s.title,s.section,s.description)),a=Rie.filter(s=>r(s.title,s.description));return{events:n,pages:o,actions:a,total:n.length+o.length+a.length}}function C1({text:e,q:t}){if(!t.trim())return i.jsx(i.Fragment,{children:e});const r=e.toLowerCase().indexOf(t.toLowerCase());return r===-1?i.jsx(i.Fragment,{children:e}):i.jsxs(i.Fragment,{children:[e.slice(0,r),i.jsx("mark",{style:{background:"var(--accent)",color:"var(--accent-foreground)",borderRadius:"2px",padding:"0 1px"},children:e.slice(r,r+t.length)}),e.slice(r+t.length)]})}function TI({query:e,results:t,activeIndex:r,onEventClick:n,onPageClick:o,onActionClick:a,onViewAll:s}){const l=e.trim(),c=t?Math.min(t.events.length,4):0,u=t?Math.min(t.pages.length,5):0;t&&Math.min(t.actions.length,3);const d=c,f=c+u,h=({label:p,count:y})=>i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px 4px"},children:[i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"700",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.07em"},children:p}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",background:"var(--secondary)",padding:"1px 6px",borderRadius:"999px"},children:y})]});return l?!t||t.total===0?i.jsxs("div",{style:{padding:"28px 14px",textAlign:"center"},children:[i.jsx(Pi,{size:20,style:{color:"var(--border)",margin:"0 auto 10px"}}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:['No results for "',l,'"']}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Try a different search term"})]}):i.jsxs("div",{children:[t.events.length>0&&i.jsxs("div",{children:[i.jsx(h,{label:"Events",count:t.events.length}),t.events.slice(0,4).map((p,y)=>{const m=aE[p.status],x=r===y;return i.jsxs("button",{onClick:()=>n(p),style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 14px",textAlign:"left",background:x?"var(--accent)":"none",border:"none",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:b=>{b.currentTarget.style.background="var(--secondary)"},onMouseLeave:b=>{b.currentTarget.style.background=x?"var(--accent)":"none"},children:[i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:m.dot??m.color,flexShrink:0}}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 1px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i.jsx(C1,{text:p.title,q:l})}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"3px"},children:[i.jsx(lb,{size:9}),p.location]}),i.jsx("span",{style:{margin:"0 6px",color:"var(--border)"},children:"·"}),i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"3px"},children:[i.jsx(Wi,{size:9}),p.startDate]})]})]}),i.jsx("span",{style:{padding:"1px 7px",borderRadius:"999px",background:m.bg,color:m.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0},children:p.status})]},p.id)}),t.events.length>4&&i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",padding:"4px 14px 6px",margin:0},children:["+",t.events.length-4," more event",t.events.length-4>1?"s":""]})]}),t.events.length>0&&t.pages.length>0&&i.jsx("div",{style:{borderTop:"1px solid var(--border)",margin:"4px 0"}}),t.pages.length>0&&i.jsxs("div",{children:[i.jsx(h,{label:"Pages",count:t.pages.length}),t.pages.slice(0,5).map((p,y)=>{const m=r===d+y;return i.jsxs("button",{onClick:()=>o(p),style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"7px 14px",textAlign:"left",background:m?"var(--accent)":"none",border:"none",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:x=>{x.currentTarget.style.background="var(--secondary)"},onMouseLeave:x=>{x.currentTarget.style.background=m?"var(--accent)":"none"},children:[i.jsx("div",{style:{width:"26px",height:"26px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"var(--primary)"},children:p.icon}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 1px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i.jsx(C1,{text:p.title,q:l})}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:p.section})]}),i.jsx(va,{size:12,style:{color:"var(--muted)",flexShrink:0}})]},p.id)})]}),(t.events.length>0||t.pages.length>0)&&t.actions.length>0&&i.jsx("div",{style:{borderTop:"1px solid var(--border)",margin:"4px 0"}}),t.actions.length>0&&i.jsxs("div",{children:[i.jsx(h,{label:"Quick Actions",count:t.actions.length}),t.actions.slice(0,3).map((p,y)=>{const m=r===f+y;return i.jsxs("button",{onClick:()=>a(p),style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"7px 14px",textAlign:"left",background:m?"var(--accent)":"none",border:"none",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:x=>{x.currentTarget.style.background="var(--secondary)"},onMouseLeave:x=>{x.currentTarget.style.background=m?"var(--accent)":"none"},children:[i.jsx("div",{style:{width:"26px",height:"26px",borderRadius:"var(--radius-button)",background:"var(--accent)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"var(--accent-foreground)"},children:p.icon}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 1px"},children:i.jsx(C1,{text:p.title,q:l})}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i.jsx(C1,{text:p.description,q:l})})]}),i.jsx("span",{style:{padding:"2px 8px",borderRadius:"var(--radius-button)",background:"var(--accent)",color:"var(--accent-foreground)",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0},children:"Go"})]},p.id)})]}),i.jsx("div",{style:{borderTop:"1px solid var(--border)",margin:"4px 0 0"},children:i.jsxs("button",{onClick:s,style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"10px 14px",background:"none",border:"none",cursor:"pointer",borderRadius:"0 0 var(--radius-card) var(--radius-card)",transition:"background 0.1s"},onMouseEnter:p=>{p.currentTarget.style.background="var(--secondary)"},onMouseLeave:p=>{p.currentTarget.style.background="none"},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--primary)"},children:["View all ",t.total," result",t.total!==1?"s":"",' for "',l,'"']}),i.jsx(O6,{size:13,style:{color:"var(--primary)",flexShrink:0}})]})})]}):i.jsxs("div",{children:[i.jsxs("div",{style:{padding:"12px 14px 8px"},children:[i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"700",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.07em",marginBottom:"8px"},children:"Suggested"}),i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:Lie.map(p=>i.jsxs("button",{onClick:()=>o({id:p.navId,navId:p.navId,title:p.label,section:"",description:"",icon:p.icon}),style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",cursor:"pointer",transition:"background 0.1s, border-color 0.1s"},onMouseEnter:y=>{y.currentTarget.style.borderColor="var(--primary)",y.currentTarget.style.color="var(--primary)"},onMouseLeave:y=>{y.currentTarget.style.borderColor="var(--border)",y.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx("span",{style:{color:"var(--primary)"},children:p.icon}),p.label]},p.navId))})]}),i.jsx("div",{style:{borderTop:"1px solid var(--border)",margin:"4px 0"}}),i.jsxs("div",{style:{padding:"4px 14px 10px"},children:[i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"700",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.07em",marginBottom:"4px",paddingTop:"8px"},children:"Recent Events"}),Z6.slice(0,3).map(p=>{const y=aE[p.status];return i.jsxs("button",{onClick:()=>n(p),style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 0",textAlign:"left",background:"none",border:"none",borderBottom:"1px solid var(--border)",cursor:"pointer"},onMouseEnter:m=>{m.currentTarget.style.background="var(--secondary)",m.currentTarget.style.borderRadius="var(--radius-button)",m.currentTarget.style.paddingLeft="6px"},onMouseLeave:m=>{m.currentTarget.style.background="none",m.currentTarget.style.paddingLeft="0"},children:[i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:y.dot??y.color,flexShrink:0}}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.title}),i.jsx("span",{style:{padding:"1px 6px",borderRadius:"999px",background:y.bg,color:y.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0},children:p.status})]},p.id)})]})]})}function F$(e){var t;return e?e.firstName||e.lastName?[e.firstName,e.lastName].filter(Boolean).join(" ").trim():((t=e.email)==null?void 0:t.split("@")[0])??"User":"User"}function Fie(e){return F$(e).slice(0,2).toUpperCase()||"?"}function Mie(e,t){if(!e)return"Free";const r=t.find(n=>n.id===e);return r!=null&&r.name?r.name:e.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function Die(e,t){var s,l,c;const r=(s=e.subscription)==null?void 0:s.maxParticipants;if(r!=null&&Number.isFinite(Number(r)))return Number(r);const n=((l=e.subscription)==null?void 0:l.plan)??"free",o=t.find(u=>u.id===n),a=(c=o==null?void 0:o.defaultLimits)==null?void 0:c.maxParticipants;return a!=null&&Number.isFinite(Number(a))?Number(a):null}function zie(e){if(!e)return{desktop:"",mobile:"",title:""};const t=new Date(e);if(Number.isNaN(t.getTime()))return{desktop:"",mobile:"",title:""};const r=t.toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"}),n=t.toLocaleDateString("en-IN",{day:"numeric",month:"short"});return{desktop:` · Renews ${r}`,mobile:` · ${n}`,title:` Renews on ${r}.`}}function Bie({isMobile:e}){const{user:t}=Ur(),r=F$(t??null),n=Fie(t??null);return i.jsxs("button",{style:{display:"flex",alignItems:"center",gap:e?"0":"8px",padding:e?"4px":"4px 8px 4px 4px",borderRadius:"var(--radius-button)",background:"none",border:"none",cursor:"pointer"},onMouseEnter:o=>{o.currentTarget.style.background="var(--secondary)"},onMouseLeave:o=>{o.currentTarget.style.background="none"},children:[i.jsx("div",{style:{width:"26px",height:"26px",borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("span",{style:{color:"#fff",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)"},children:n})}),!e&&i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:r})]})}function Wie({onMenuClick:e,onNavigate:t,onEventSelect:r,onOpenSearchPage:n}){var $,q;const{user:o}=Ur(),{setActiveNav:a,setSettingsInitialSection:s}=eo(),[l,c]=j.useState(""),[u,d]=j.useState(!1),[f,h]=j.useState(-1),[p,y]=j.useState(!1),[m,x]=j.useState(!1),[b,w]=j.useState(null),[k,S]=j.useState([]),[_,P]=j.useState(0),O=qi(),T=O==="mobile",R=O==="tablet",I=j.useRef(null),E=j.useRef(null),A=j.useRef(null),F=j.useMemo(()=>l.trim()?L$(l):null,[l]),L=j.useMemo(()=>F?[...F.events.slice(0,4).map(Y=>({type:"event",data:Y})),...F.pages.slice(0,5).map(Y=>({type:"page",data:Y})),...F.actions.slice(0,3).map(Y=>({type:"action",data:Y}))]:[],[F]);j.useEffect(()=>{const Y=K=>{I.current&&!I.current.contains(K.target)&&(d(!1),h(-1))};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[]),j.useEffect(()=>{const Y=()=>P(K=>K+1);return window.addEventListener(oE,Y),()=>window.removeEventListener(oE,Y)},[]),j.useEffect(()=>{var K;if(!((K=o==null?void 0:o.organization)!=null&&K._id)){w(null),S([]);return}let Y=!1;return(async()=>{try{const[G,re]=await Promise.all([ls.get({cacheBust:_>0}),Ku.catalog().then(J=>J.plans).catch(()=>[])]);Y||(w(G),S(re))}catch{Y||(w(null),S([]))}})(),()=>{Y=!0}},[($=o==null?void 0:o.organization)==null?void 0:$._id,_]);const z=j.useMemo(()=>{var me,Oe,we;if(!((me=o==null?void 0:o.organization)!=null&&me._id)||!b)return null;const Y=(Oe=b.subscription)==null?void 0:Oe.plan,K=Mie(Y,k),G=Die(b,k),re=G==null?"Unlimited participants":`${G.toLocaleString("en-IN")} participants max`,J=zie((we=b.subscription)==null?void 0:we.expiresAt),ae=T?`${K} · ${G==null?"∞":G.toLocaleString("en-IN")}${J.mobile}`:`${K} · ${re}${J.desktop}`,le=`${K} — ${re}.${J.title} Open Billing in Settings.`;return{label:ae,title:le}},[(q=o==null?void 0:o.organization)==null?void 0:q._id,b,k,T]);j.useEffect(()=>{const Y=K=>{var G;(K.metaKey||K.ctrlKey)&&K.key==="k"&&(K.preventDefault(),T?(y(!0),setTimeout(()=>{var re;return(re=A.current)==null?void 0:re.focus()},50)):((G=E.current)==null||G.focus(),d(!0)))};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[T]);const V=Y=>{if(Y.key==="ArrowDown")Y.preventDefault(),h(K=>Math.min(K+1,L.length-1));else if(Y.key==="ArrowUp")Y.preventDefault(),h(K=>Math.max(K-1,-1));else if(Y.key==="Enter")if(f>=0&&L[f]){const K=L[f];Q(K)}else l.trim()&&B();else Y.key==="Escape"&&(d(!1),h(-1),y(!1))},Q=Y=>{Y.type==="event"?r==null||r(Y.data.id):Y.type==="page"?t==null||t(Y.data.navId):t==null||t(Y.data.navTarget),M()},U=Y=>{r==null||r(Y.id),M()},ee=Y=>{t==null||t(Y.navId),M()},H=Y=>{t==null||t(Y.navTarget),M()},B=()=>{n==null||n(l),M()},M=()=>{d(!1),h(-1),y(!1),c("")};return i.jsxs(i.Fragment,{children:[i.jsxs("header",{style:{height:"52px",display:"flex",alignItems:"center",justifyContent:"space-between",padding:T?"0 12px":"0 24px",background:"var(--card)",borderBottom:"1px solid var(--border)",flexShrink:0,zIndex:20,gap:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[(T||R)&&i.jsx("button",{onClick:e,style:{width:"34px",height:"34px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",color:"var(--muted)",borderRadius:"var(--radius-button)",flexShrink:0},onMouseEnter:Y=>{Y.currentTarget.style.background="var(--secondary)",Y.currentTarget.style.color="var(--foreground)"},onMouseLeave:Y=>{Y.currentTarget.style.background="none",Y.currentTarget.style.color="var(--muted)"},"aria-label":"Open menu",children:i.jsx(pte,{size:18})}),T&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px"},children:[i.jsx("div",{style:{width:"26px",height:"26px",borderRadius:"6px",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("span",{style:{color:"#fff",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)"},children:"EB"})}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-sm)",color:"var(--foreground)"},children:"EventBuzz"})]}),!T&&i.jsxs("div",{ref:I,style:{position:"relative"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"0 10px",height:"32px",width:R?"220px":"300px",background:"var(--secondary)",borderRadius:u?"var(--radius-button) var(--radius-button) 0 0":"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:m||u?"var(--ring)":"transparent",borderBottomColor:u?"transparent":m?"var(--ring)":"transparent",transition:"border-color 0.15s",boxShadow:u?"0 -1px 0 0 var(--ring)":"none"},children:[i.jsx(Pi,{size:13,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{ref:E,type:"text",value:l,placeholder:"Search events, pages, actions…",onChange:Y=>{c(Y.target.value),h(-1),d(!0)},onFocus:()=>{x(!0),d(!0)},onBlur:()=>x(!1),onKeyDown:V,style:{background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",width:"100%"}}),l?i.jsx("button",{onClick:()=>{c(""),h(-1)},style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:"0",flexShrink:0},children:i.jsx(er,{size:12})}):!R&&i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",flexShrink:0,background:"var(--border)",padding:"1px 5px",borderRadius:"3px"},children:"⌘K"})]}),u&&i.jsx("div",{style:{position:"absolute",top:"32px",left:0,width:R?"340px":"420px",background:"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--ring)",borderTop:"none",borderRadius:"0 var(--radius-card) var(--radius-card) var(--radius-card)",boxShadow:"var(--elevation-sm)",zIndex:200,maxHeight:"440px",overflowY:"auto"},children:i.jsx(TI,{query:l,results:F,activeIndex:f,onEventClick:U,onPageClick:ee,onActionClick:H,onViewAll:B})})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:[T&&i.jsx("button",{"aria-label":"Search",onClick:()=>{y(!0),setTimeout(()=>{var Y;return(Y=A.current)==null?void 0:Y.focus()},60)},style:{width:"34px",height:"34px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",color:"var(--muted)",borderRadius:"var(--radius-button)"},onMouseEnter:Y=>{Y.currentTarget.style.background="var(--secondary)",Y.currentTarget.style.color="var(--foreground)"},onMouseLeave:Y=>{Y.currentTarget.style.background="none",Y.currentTarget.style.color="var(--muted)"},children:i.jsx(Pi,{size:16})}),z&&i.jsxs("button",{type:"button","aria-label":z.title,title:z.title,onClick:()=>{s("billing"),a("settings")},style:{display:"inline-flex",alignItems:"center",gap:"6px",maxWidth:T?"min(46vw, 200px)":"none",padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer",flexShrink:1,minWidth:0},onMouseEnter:Y=>{Y.currentTarget.style.background="var(--accent)",Y.currentTarget.style.borderColor="var(--primary)"},onMouseLeave:Y=>{Y.currentTarget.style.background="var(--secondary)",Y.currentTarget.style.borderColor="var(--border)"},children:[i.jsx(ov,{size:14,style:{color:"var(--primary)",flexShrink:0},"aria-hidden":!0}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:"left",color:"var(--primary)"},children:z.label})]}),i.jsxs("button",{style:{position:"relative",width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",color:"var(--muted)",borderRadius:"var(--radius-button)"},"aria-label":"Notifications (3 unread)",onMouseEnter:Y=>{Y.currentTarget.style.background="var(--secondary)",Y.currentTarget.style.color="var(--foreground)"},onMouseLeave:Y=>{Y.currentTarget.style.background="none",Y.currentTarget.style.color="var(--muted)"},children:[i.jsx(I6,{size:16}),i.jsx("span",{style:{position:"absolute",top:"4px",right:"4px",minWidth:"14px",height:"14px",borderRadius:"999px",background:"var(--destructive)",border:"2px solid var(--card)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"8px",fontFamily:"var(--font-inter)",fontWeight:"700",color:"var(--destructive-foreground)",padding:"0 2px",lineHeight:1},children:"3"})]}),i.jsx("div",{style:{width:"1px",height:"20px",background:"var(--border)",margin:"0 2px"}}),i.jsx(Bie,{isMobile:T})]})]}),p&&i.jsxs("div",{style:{position:"fixed",inset:0,zIndex:300,display:"flex",flexDirection:"column"},children:[i.jsx("div",{onClick:()=>y(!1),style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.5)"}}),i.jsxs("div",{style:{position:"relative",background:"var(--card)",boxShadow:"var(--elevation-sm)",display:"flex",flexDirection:"column",maxHeight:"90vh"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 14px",borderBottom:"1px solid var(--border)"},children:[i.jsx(Pi,{size:16,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{ref:A,type:"text",value:l,placeholder:"Search events, pages, actions…",onChange:Y=>{c(Y.target.value),h(-1)},onKeyDown:V,style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:"var(--text-base)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"}}),l&&i.jsx("button",{onClick:()=>c(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:"2px"},children:i.jsx(er,{size:14})}),i.jsx("button",{onClick:()=>{y(!1),c("")},style:{background:"none",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--primary)",padding:"4px 0 4px 4px",flexShrink:0},children:"Cancel"})]}),i.jsx("div",{style:{overflowY:"auto",flex:1},children:i.jsx(TI,{query:l,results:F,activeIndex:f,onEventClick:U,onPageClick:ee,onActionClick:H,onViewAll:B})})]})]})]})}const M$=[{id:"dashboard",label:"Dashboard",shortLabel:"Dash",icon:i.jsx(Qee,{size:13})},{id:"participants",label:"Participants",shortLabel:"People",icon:i.jsx(vi,{size:13})},{id:"permissions",label:"Users & Permissions",shortLabel:"Permissions",icon:i.jsx(Dte,{size:13})},{id:"questions",label:"Questions",shortLabel:"Q&A",icon:i.jsx(ch,{size:13})},{id:"quiz",label:"Quiz & Polls",shortLabel:"Quiz",icon:i.jsx(nu,{size:13})},{id:"rewards",label:"Reward Points",shortLabel:"Rewards",icon:i.jsx(od,{size:13})},{id:"ticketing",label:"Ticketing",shortLabel:"Tickets",icon:i.jsx(Kte,{size:13})},{id:"analytics",label:"Analytics",shortLabel:"Analytics",icon:i.jsx(jq,{size:13})}],qie=new Set([...M$.map(e=>e.id),"website"]);function $ie({activeItem:e,onNavigate:t}){const r=j.useRef(null),o=qi()==="mobile",[a,s]=j.useState(!1),[l,c]=j.useState(!1);return j.useEffect(()=>{const u=r.current;if(!u)return;const d=()=>{c(u.scrollLeft>4),s(u.scrollLeft+u.clientWidth{u.removeEventListener("scroll",d),window.removeEventListener("resize",d)}},[]),i.jsxs("div",{style:{flexShrink:0,background:"var(--card)",borderBottom:"1px solid var(--border)",zIndex:20,display:"flex",alignItems:"stretch",height:o?"40px":"44px",position:"relative"},children:[l&&i.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"32px",zIndex:2,background:"linear-gradient(to right, var(--card) 0%, transparent 100%)",pointerEvents:"none"}}),i.jsx("div",{ref:r,style:{display:"flex",alignItems:"stretch",flex:1,overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none"},children:M$.map(u=>{const d=e===u.id;return i.jsxs("button",{onClick:()=>t(u.id),style:{display:"flex",alignItems:"center",gap:o?"4px":"6px",padding:o?"0 10px":"0 16px",height:"100%",background:"transparent",borderTopWidth:0,borderTopStyle:"solid",borderTopColor:"transparent",borderLeftWidth:0,borderLeftStyle:"solid",borderLeftColor:"transparent",borderRightWidth:0,borderRightStyle:"solid",borderRightColor:"transparent",borderBottomWidth:"2px",borderBottomStyle:"solid",borderBottomColor:d?"var(--primary)":"transparent",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:d?"var(--font-weight-medium)":"var(--font-weight-normal)",color:d?"var(--primary)":"var(--card-foreground)",whiteSpace:"nowrap",flexShrink:0,transition:"color 0.12s, border-color 0.12s, background 0.12s"},onMouseEnter:f=>{d||(f.currentTarget.style.background="var(--secondary)",f.currentTarget.style.color="var(--foreground)")},onMouseLeave:f=>{d||(f.currentTarget.style.background="transparent",f.currentTarget.style.color="var(--card-foreground)")},children:[i.jsx("span",{style:{color:d?"var(--primary)":"var(--muted)",display:"flex",flexShrink:0},children:u.icon}),o?u.shortLabel:u.label]},u.id)})}),a&&i.jsx("div",{style:{position:"absolute",right:0,top:0,bottom:0,width:"32px",zIndex:2,background:"linear-gradient(to left, var(--card) 0%, transparent 100%)",pointerEvents:"none"}})]})}function nc(e){return e==="dropdown"||e==="checkboxes"||e==="radio"}function ph(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")||"field"}function Uie(e){return{Conference:"conference",Workshop:"workshop",Summit:"summit",CME:"cme",Webinar:"webinar"}[e]||e.toLowerCase()}function Hie(e){return{Draft:"draft",Upcoming:"upcoming",Live:"live",Completed:"completed"}[e]||e.toLowerCase()}function J6(e){return{Physical:"physical",Virtual:"virtual",Hybrid:"hybrid"}[e]||e.toLowerCase()}function Bj(e){return new Date(e+"T12:00:00.000Z").toISOString()}function M0(e){const t=e==null?void 0:e.trim();if(!t)return null;const r=new Date(t);return Number.isNaN(r.getTime())?null:r.toISOString()}function Vie(e){var l;const t=M0(e.startLocal),r=M0(e.endLocal);if(!t||!r)throw new RangeError("Invalid start or end date/time.");if(new Date(r).getTime()<=new Date(t).getTime())throw new RangeError("End must be after start.");const n=e.locationTypeLabel.trim(),o=e.virtualLink.trim(),a=o&&!o.startsWith("http")?`https://${o}`:o,s={name:e.eventName.trim(),description:e.description.trim()||void 0,type:"conference",status:"draft",startDate:t,endDate:r,location:e.venue.trim()||void 0,locationType:J6(n),virtualLink:n==="Virtual"||n==="Hybrid"?a:void 0,bootstrapAgenda:!0,settings:{registrationOpen:!1,requiresApproval:!1,verifyEmail:!0,enableFeedback:!0,enableRatings:!1,authenticationType:"otp_email",registrationBaseFields:"name_email"},tags:[],metadata:{registrationCustomFields:[]}};return(l=e.organizationId)!=null&&l.trim()&&(s.organization=e.organizationId.trim()),s}function Yie(e){const t=(e||"physical").toLowerCase();return t==="virtual"?"Virtual":t==="hybrid"?"Hybrid":"Physical"}function D$(e,t,r){var p,y,m,x;const n=(t.eventName??e.name??"").trim();if(n.length<3)throw new RangeError("Event name must be at least 3 characters.");let o,a;if((p=t.startLocal)!=null&&p.trim()&&((y=t.endLocal)!=null&&y.trim())){const b=M0(t.startLocal),w=M0(t.endLocal);if(!b||!w)throw new RangeError("Invalid start or end date/time.");if(new Date(w).getTime()<=new Date(b).getTime())throw new RangeError("End must be after start.");o=b,a=w}else{const b=e.startDate,w=e.endDate;o=typeof b=="string"?b:new Date(b).toISOString(),a=typeof w=="string"?w:new Date(w).toISOString()}const s=((m=t.locationType)==null?void 0:m.trim())||Yie(e.locationType),l=(t.venue??e.location??"").trim(),c=(t.virtualLink??e.virtualLink??"").trim(),u=c&&!c.startsWith("http")?`https://${c}`:c,d=typeof e.type=="string"&&e.type.trim()?e.type.trim().toLowerCase():"conference",f=typeof e.status=="string"&&e.status.trim()?e.status.trim().toLowerCase():"draft",h={name:n,description:((x=e.description)==null?void 0:x.trim())||void 0,type:d,status:f,startDate:o,endDate:a,location:l||void 0,locationType:J6(s),virtualLink:(s==="Virtual"||s==="Hybrid")&&u||void 0,bootstrapAgenda:!0,settings:{registrationOpen:!1,requiresApproval:!1,verifyEmail:!0,enableFeedback:!0,enableRatings:!1,authenticationType:"otp_email",registrationBaseFields:"name_email"},tags:Array.isArray(e.tags)?e.tags.filter(b=>typeof b=="string"&&b.trim()):[],metadata:{registrationCustomFields:[]}};return r!=null&&r.trim()&&(h.organization=r.trim()),h}function z$(e){return{name:String(e.name??""),subtitle:e.subtitle!=null?String(e.subtitle):void 0,description:e.description!=null?String(e.description):void 0,type:e.type!=null?String(e.type):void 0,status:e.status!=null?String(e.status):void 0,startDate:String(e.startDate??""),endDate:String(e.endDate??""),location:e.location!=null?String(e.location):void 0,locationType:String(e.locationType??"physical"),virtualLink:e.virtualLink!=null?String(e.virtualLink):void 0,tags:Array.isArray(e.tags)?e.tags.map(String):void 0}}function B$(e,t){const r=e.registrationRequired==="Yes",n=e.registrationMode;let o=!0,a=!1;r?(n==="Invite Only"&&(o=!1),n==="Approval Required"&&(a=!0)):o=!1;const s=e.virtualLink.trim(),l=s&&!s.startsWith("http")?`https://${s}`:s,c=e.eventType.trim()||"Conference",u=e.status.trim()||"Draft",d=e.locationType.trim()||"Physical",f=(t==null?void 0:t.tags)!=null?t.tags.map(h=>String(h).trim()).filter(Boolean):e.keyPeople.split(/[,;]/).map(h=>h.trim()).filter(Boolean);return{name:e.eventName.trim(),description:e.description.trim()||void 0,type:Uie(c),status:Hie(u),startDate:Bj(e.startDate.trim()),endDate:Bj(e.endDate.trim()),location:e.venue.trim()||void 0,locationType:J6(d),virtualLink:(d==="Virtual"||d==="Hybrid")&&l||void 0,image:e.eventLogo||void 0,bannerImage:e.eventBanner||void 0,tags:f,settings:{registrationOpen:o,requiresApproval:a,registrationMode:n||void 0,verifyEmail:e.verifyEmail==="Yes",registrationDeadline:e.registrationDeadline?Bj(e.registrationDeadline.trim()):void 0,authenticationType:e.authenticationType||void 0,registrationBaseFields:e.registrationBaseFields||void 0,enableFeedback:e.enableFeedback==="Yes",enableRatings:e.enableRatings==="Yes"},metadata:{registrationCustomFields:e.customFields.filter(h=>h.label.trim()).map(h=>({label:h.label.trim(),code:(h.code.trim()||ph(h.label)).replace(/[^a-z0-9_]/gi,"_"),fieldType:h.fieldType,options:nc(h.fieldType)?h.options.filter(p=>p.label.trim()&&p.value.trim()).map(p=>({value:p.value.trim(),label:p.label.trim()})):[]}))}}}const Xr={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"},Ra={...Xr,cursor:"pointer",appearance:"none",paddingRight:"32px"};function ur({text:e,required:t}){return i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",marginBottom:"5px"},children:[t&&i.jsx("span",{style:{color:"var(--destructive)",marginRight:"2px"},children:"*"}),e]})}function lr({children:e,error:t}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e,t?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:"5px 0 0",lineHeight:1.35},children:t}):null]})}function No({children:e}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:e})}function La({children:e}){return i.jsxs("div",{style:{position:"relative"},children:[e,i.jsx(po,{size:14,style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}})]})}function wf({name:e,value:t,onChange:r,options:n}){return i.jsx("div",{style:{display:"flex",gap:"20px",alignItems:"center",flexWrap:"wrap"},children:n.map(o=>i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[i.jsx("input",{type:"radio",name:e,value:o.value,checked:t===o.value,onChange:()=>r(o.value),style:{accentColor:"var(--primary)",width:"16px",height:"16px",cursor:"pointer"}}),o.label]},o.value))})}function D0({label:e,preview:t,error:r,inputRef:n,onFile:o}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[i.jsxs("div",{onClick:()=>{var a;return(a=n.current)==null?void 0:a.click()},onDragOver:a=>a.preventDefault(),onDrop:a=>{a.preventDefault();const s=a.dataTransfer.files[0];if(s!=null&&s.type.startsWith("image/")){const l=new FileReader;l.onload=()=>{typeof l.result=="string"&&o(l.result)},l.readAsDataURL(s)}},style:{border:`1.5px dashed ${r?"var(--destructive)":"var(--primary)"}`,borderRadius:"var(--radius-button)",background:"var(--secondary)",padding:"16px 12px",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",cursor:"pointer"},children:[i.jsx("input",{ref:n,type:"file",accept:"image/*",style:{display:"none"},onChange:a=>{var l;const s=(l=a.target.files)==null?void 0:l[0];if(s){const c=new FileReader;c.onload=()=>{typeof c.result=="string"&&o(c.result)},c.readAsDataURL(s)}}}),t?i.jsx("img",{src:t,alt:"",style:{maxHeight:72,maxWidth:"100%",objectFit:"contain",borderRadius:4}}):i.jsx(ou,{size:22,style:{color:"var(--primary)"}}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",textAlign:"center",margin:0},children:["Drag and drop or ",i.jsxs("span",{style:{color:"var(--primary)",textDecoration:"underline"},children:["select ",e]})]})]}),r?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:0},children:r}):null]})}function Gie({n:e,state:t}){const r=t==="todo"?"var(--muted)":"var(--primary)";return i.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:r,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t==="done"?i.jsx(Oi,{size:13,style:{color:"#fff"}}):i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",color:"#fff",fontWeight:"var(--font-weight-medium)"},children:e})})}function Sf({n:e,title:t,subtitle:r,open:n,completed:o,onToggle:a,children:s,onNext:l,nextLabel:c,nextDisabled:u}){const d=n?"active":o?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{type:"button",onClick:a,style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(Gie,{n:e,state:d}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:n?"var(--primary)":"var(--card-foreground)",margin:0},children:t}),!n&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:r})]}),n?i.jsx($f,{size:18,style:{color:"var(--muted)"}}):i.jsx(po,{size:18,style:{color:"var(--muted)"}})]}),n&&i.jsxs("div",{style:{padding:"0 20px 16px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 14px 40px"},children:r}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:s}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"12px",marginTop:"18px",paddingTop:"12px",borderTop:"1px solid var(--border)"},children:[o&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",fontSize:"var(--text-xs)",color:"var(--primary)"},children:[i.jsx(Oi,{size:12})," Complete"]}),i.jsx("button",{type:"button",disabled:u,onClick:l,style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 16px",borderRadius:"var(--radius-button)",background:u?"var(--secondary)":"var(--primary)",color:u?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:u?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:c})]})]})]})}const eT=[{label:"Text",value:"text"},{label:"Textarea",value:"textarea"},{label:"Dropdown",value:"dropdown"},{label:"Checkboxes",value:"checkboxes"},{label:"Radio",value:"radio"},{label:"Yes / No",value:"yes_no"},{label:"Stars (rating)",value:"stars"},{label:"Image upload",value:"image_upload"},{label:"File upload",value:"file_upload"}],tT=[{label:"OTP on Email",value:"otp_email"},{label:"Link on Email",value:"link_email"},{label:"None",value:"none"}],rT=[{label:"Name & Email",value:"name_email"},{label:"Email Only",value:"email_only"},{label:"Name, Email & Phone",value:"name_email_phone"},{label:"Anonymous with Name",value:"anonymous_name"},{label:"Anonymous",value:"anonymous"}],W$=new Set(tT.map(e=>e.value)),q$=new Set(rT.map(e=>e.value));function $$(){return{id:Math.random().toString(36).slice(2),label:"",code:"",codeAuto:!0,fieldType:"text",options:[]}}const PI={eventName:"",eventType:"",description:"",status:"",locationType:"",venue:"",virtualLink:"",startDate:"",endDate:"",registrationRequired:"No",registrationMode:"",verifyEmail:"Yes",registrationDeadline:"",authenticationType:"otp_email",registrationBaseFields:"name_email",enableFeedback:"Yes",enableRatings:"No",keyPeople:"",eventLogo:null,eventBanner:null,customFields:[]};function Wj(e){if(!e)return"";const t=typeof e=="string"?new Date(e):e;return Number.isNaN(t.getTime())?"":t.toISOString().slice(0,10)}function Kie(e){const t=(e||"conference").toLowerCase();return{conference:"Conference",workshop:"Workshop",summit:"Summit",cme:"CME",webinar:"Webinar"}[t]||"Conference"}function Qie(e){const t=(e||"draft").toLowerCase();return{draft:"Draft",upcoming:"Upcoming",live:"Live",completed:"Completed"}[t]||"Draft"}function Xie(e){const t=(e||"physical").toLowerCase();return t==="virtual"?"Virtual":t==="hybrid"?"Hybrid":"Physical"}function Zie(e){const t=typeof e=="string"?e:"";return W$.has(t)?t:"otp_email"}function Jie(e){const t=typeof e=="string"?e:"";return q$.has(t)?t:"name_email"}function z0(e){const t=e.settings||{};let r="No",n="";const o=t.registrationMode;o==="Invite Only"?(r="Yes",n="Invite Only"):o==="Approval Required"||t.requiresApproval===!0?(r="Yes",n="Approval Required"):o==="Open"||t.registrationOpen===!0?(r="Yes",n="Open"):t.registrationOpen===!1&&t.requiresApproval===!1&&!o?r="No":(t.registrationOpen||t.requiresApproval)&&(r="Yes",n=t.requiresApproval?"Approval Required":"Open");const l=((e.metadata||{}).registrationCustomFields||[]).map(d=>{const f=d.options||[],h=d.fieldType||"text";return{id:Math.random().toString(36).slice(2),label:String(d.label||""),code:String(d.code||ph(String(d.label||""))),codeAuto:!d.code,fieldType:nc(h)||eT.some(p=>p.value===h)?h:"text",options:nc(h)?(f.length?f:[{value:"",label:""}]).map(p=>({id:Math.random().toString(36).slice(2),value:String(p.value??""),label:String(p.label??"")})):[]}}),c=String(e.virtualLink||""),u=Xie(e.locationType);return{eventName:String(e.name||""),eventType:Kie(e.type),description:String(e.description||e.subtitle||""),status:Qie(e.status),locationType:u,venue:u==="Virtual"?"":String(e.location||""),virtualLink:u==="Physical"?"":c,startDate:Wj(e.startDate),endDate:Wj(e.endDate),registrationRequired:r,registrationMode:n,verifyEmail:t.verifyEmail===!1?"No":"Yes",registrationDeadline:t.registrationDeadline?Wj(t.registrationDeadline):"",authenticationType:Zie(t.authenticationType),registrationBaseFields:Jie(t.registrationBaseFields),enableFeedback:t.enableFeedback===!1?"No":"Yes",enableRatings:t.enableRatings===!0?"Yes":"No",keyPeople:Array.isArray(e.tags)?e.tags.join(", "):"",eventLogo:e.image||null,eventBanner:e.bannerImage||null,customFields:l}}function eoe(e,t){const r=z0(t),n=o=>o.trim();return{eventName:n(e.eventName)||r.eventName,description:e.description,eventType:e.eventType||r.eventType,status:e.status||r.status,locationType:e.locationType||r.locationType,venue:e.venue,virtualLink:e.virtualLink,startDate:n(e.startDate)||r.startDate,endDate:n(e.endDate)||r.endDate,registrationRequired:e.registrationRequired,registrationMode:e.registrationMode||r.registrationMode,verifyEmail:e.verifyEmail,registrationDeadline:e.registrationDeadline,authenticationType:e.authenticationType||r.authenticationType,registrationBaseFields:e.registrationBaseFields||r.registrationBaseFields,enableFeedback:e.enableFeedback,enableRatings:e.enableRatings,keyPeople:e.keyPeople,eventLogo:e.eventLogo,eventBanner:e.eventBanner,customFields:e.customFields}}function toe(e){const t={};if(e.locationType==="Virtual"||e.locationType==="Hybrid"){const r=e.virtualLink.trim();if(r)try{new URL(r.startsWith("http")?r:`https://${r}`)}catch{t.virtualLink="Enter a valid URL (e.g. https://…)."}}if(e.startDate&&e.endDate){const r=new Date(e.startDate);new Date(e.endDate)o.label.trim()&&o.value.trim()).length===0&&(t[`cf_${e.id}_options`]="Add at least one option with both Value and Label."),e.options.forEach(o=>{const a=o.label.trim(),s=o.value.trim();a&&!s&&(t[`cf_${e.id}_opt_${o.id}`]="Value is required when Label is set."),s&&!a&&(t[`cf_${e.id}_opt_${o.id}`]="Label is required when Value is set.")})),t}function RI(e,t){const r={};return e.registrationRequired==="Yes"&&!e.registrationMode&&(r.registrationMode="Select a registration mode when registration is required."),!(t!=null&&t.editMode)&&e.registrationRequired==="Yes"&&((!e.authenticationType||!W$.has(e.authenticationType))&&(r.authenticationType="Select an authentication type."),(!e.registrationBaseFields||!q$.has(e.registrationBaseFields))&&(r.registrationBaseFields="Select registration base fields.")),t!=null&&t.editMode||e.customFields.forEach(n=>Object.assign(r,roe(n))),r}function noe(...e){return e.reduce((t,r)=>({...t,...r}),{})}function uf(e,t){const r={...e};return t.forEach(n=>{delete r[n]}),r}function qj(e){const t=["registrationMode","authenticationType","registrationBaseFields"];return e.customFields.forEach(r=>{t.push(`cf_${r.id}_label`,`cf_${r.id}_type`,`cf_${r.id}_code`,`cf_${r.id}_options`),r.options.forEach(n=>t.push(`cf_${r.id}_opt_${n.id}`))}),t}const $j=["eventName","eventType","description"],Uj=["status","locationType","startDate","endDate","venue","virtualLink"],Hj=["eventLogo","eventBanner"],Zg=4;function ioe({onClose:e,onSuccess:t,eventId:r}){const n=!!r,[o,a]=j.useState(1),[s,l]=j.useState(new Set),[c,u]=j.useState(PI),[d,f]=j.useState({}),[h,p]=j.useState(!1),[y,m]=j.useState(null),[x,b]=j.useState(null),[w,k]=j.useState(!!r),[S,_]=j.useState([]),P=j.useRef(null),O=j.useRef(null),T={editMode:n};j.useEffect(()=>{if(!r){k(!1),u(PI),_([]),l(new Set),a(1),b(null);return}k(!0),b(null),zr.get(r).then(q=>{if(k(!1),q.error||!q.data){b(q.error||"Could not load event.");return}const Y=q.data;u(z0(Y));const K=Y.tags;_(Array.isArray(K)?K.map(String):[]),l(new Set([1,2,3,4])),a(1)})},[r]);const R=j.useCallback((q,Y)=>{u(K=>({...K,[q]:Y}))},[]),I=Math.round(s.size/Zg*100),E=()=>u(q=>({...q,customFields:[...q.customFields,$$()]})),A=q=>{u(Y=>({...Y,customFields:Y.customFields.filter(K=>K.id!==q)})),f(Y=>{const K={...Y};return Object.keys(K).forEach(G=>{(G.startsWith(`cf_${q}_`)||G===`cf_${q}_label`)&&delete K[G]}),K})},F=(q,Y)=>{u(K=>({...K,customFields:K.customFields.map(G=>{if(G.id!==q)return G;const re={...G,label:Y};return G.codeAuto&&(re.code=ph(Y)),re})}))},L=(q,Y)=>{u(K=>({...K,customFields:K.customFields.map(G=>G.id===q?{...G,code:Y,codeAuto:!1}:G)}))},z=(q,Y)=>{u(K=>({...K,customFields:K.customFields.map(G=>{if(G.id!==q)return G;const re={...G,fieldType:Y};return nc(Y)&&G.options.length===0&&(re.options=[{id:Math.random().toString(36).slice(2),value:"",label:""}]),nc(Y)||(re.options=[]),re})}))},V=q=>{u(Y=>({...Y,customFields:Y.customFields.map(K=>K.id===q?{...K,options:[...K.options,{id:Math.random().toString(36).slice(2),value:"",label:""}]}:K)}))},Q=(q,Y)=>{u(K=>({...K,customFields:K.customFields.map(G=>G.id===q?{...G,options:G.options.filter(re=>re.id!==Y)}:G)})),f(K=>{const G={...K};return delete G[`cf_${q}_opt_${Y}`],G})},U=(q,Y,K,G)=>{u(re=>({...re,customFields:re.customFields.map(J=>J.id===q?{...J,options:J.options.map(ae=>ae.id===Y?{...ae,[K]:G}:ae)}:J)}))},ee=q=>{m(null);let Y={};if(q===1?Y=OI(c,T):q===2?Y=II(c,T):q===3?Y=NI(c,T):q===4&&(Y=RI(c,T)),Object.keys(Y).length>0){f(K=>{let G={...K};return q===1&&(G=uf(G,$j)),q===2&&(G=uf(G,Uj)),q===3&&(G=uf(G,Hj)),q===4&&(G=uf(G,qj(c))),{...G,...Y}}),a(q);return}q===1&&f(K=>uf(K,$j)),q===2&&f(K=>uf(K,Uj)),q===3&&f(K=>uf(K,Hj)),q===4&&f(K=>uf(K,qj(c))),l(K=>new Set([...K,q])),qB$(c,n?{tags:S}:void 0),B=async()=>{m(null);const q=noe(OI(c,T),II(c,T),NI(c,T),RI(c,T));if(Object.keys(q).length>0){f(q);for(const G of[1,2,3,4]){let re=[];if(G===1&&(re=$j),G===2&&(re=Uj),G===3&&(re=Hj),G===4&&(re=qj(c)),re.some(J=>q[J])){a(G);break}}return}f({}),p(!0);const Y=H(),K=n&&r?await zr.update(r,Y):await zr.create(Y);p(!1),K.data!=null&&!K.error?(t==null||t(),e()):m(K.error||"Could not save event. Please try again.")},M=q=>d[q],$=q=>a(Y=>Y===q?0:q);return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:e,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(580px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)",animation:"slideInRight 0.25s ease"},children:[i.jsx("style",{children:"@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }"}),i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:"12px"},children:[i.jsxs("div",{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:n?"Edit Event":"Create New Event"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0"},children:n?"Update details and save.":"4 steps: Basic → Schedule → Media → Registration & form fields. Save submits when all are valid."})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:e,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(er,{size:14})}),i.jsx("button",{type:"button",disabled:h||w||!!x,onClick:()=>B(),style:{padding:"6px 14px",borderRadius:"var(--radius-button)",background:h||w||x?"var(--secondary)":"var(--primary)",color:h||w||x?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:h||w||x?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:h?"Saving…":n?"Save changes":"Save event"})]})]}),x&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"0 0 8px"},children:x}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:[s.size," of ",Zg," sections complete"]}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:[I,"%"]})]}),i.jsx("div",{style:{height:"6px",borderRadius:"99px",background:"var(--border)",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${I}%`,background:"#22c55e",borderRadius:"99px",transition:"width 0.3s ease"}})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto",position:"relative"},children:[w&&i.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(255,255,255,0.85)",zIndex:5,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Loading event…"}),i.jsxs(Sf,{n:1,title:"Basic Information",subtitle:"Core details about your event",open:o===1,completed:s.has(1),onToggle:()=>$(1),onNext:()=>ee(1),nextLabel:"Continue to Schedule & Location",nextDisabled:h,children:[i.jsxs(lr,{error:M("eventName"),children:[i.jsx(ur,{text:"Event Name",required:!0}),i.jsx("input",{style:{...Xr,...M("eventName")?{borderColor:"var(--destructive)"}:{}},value:c.eventName,onChange:q=>R("eventName",q.target.value)})]}),i.jsxs(lr,{error:M("eventType"),children:[i.jsx(ur,{text:"Event type",required:!n}),i.jsx(La,{children:i.jsxs("select",{style:{...Ra,...M("eventType")?{borderColor:"var(--destructive)"}:{}},value:c.eventType,onChange:q=>R("eventType",q.target.value),children:[i.jsx("option",{value:"",children:"Select Type"}),i.jsx("option",{children:"Conference"}),i.jsx("option",{children:"Workshop"}),i.jsx("option",{children:"Summit"}),i.jsx("option",{children:"CME"}),i.jsx("option",{children:"Webinar"})]})})]}),i.jsxs(lr,{error:M("description"),children:[i.jsx(ur,{text:"Description",required:!n}),i.jsx("textarea",{style:{...Xr,resize:"vertical",minHeight:"80px",...M("description")?{borderColor:"var(--destructive)"}:{}},value:c.description,onChange:q=>R("description",q.target.value)})]})]}),i.jsxs(Sf,{n:2,title:"Schedule & Location",subtitle:"When and where",open:o===2,completed:s.has(2),onToggle:()=>$(2),onNext:()=>ee(2),nextLabel:"Continue to Media & Tags",nextDisabled:h,children:[i.jsxs(No,{children:[i.jsxs(lr,{error:M("status"),children:[i.jsx(ur,{text:"Status",required:!n}),i.jsx(La,{children:i.jsxs("select",{style:{...Ra,...M("status")?{borderColor:"var(--destructive)"}:{}},value:c.status,onChange:q=>R("status",q.target.value),children:[i.jsx("option",{value:"",children:"Select Status"}),i.jsx("option",{children:"Draft"}),i.jsx("option",{children:"Upcoming"}),i.jsx("option",{children:"Live"}),i.jsx("option",{children:"Completed"})]})})]}),i.jsxs(lr,{error:M("locationType"),children:[i.jsx(ur,{text:"Location Type",required:!0}),i.jsx(La,{children:i.jsxs("select",{style:{...Ra,...M("locationType")?{borderColor:"var(--destructive)"}:{}},value:c.locationType,onChange:q=>R("locationType",q.target.value),children:[i.jsx("option",{value:"",children:"Select"}),i.jsx("option",{children:"Physical"}),i.jsx("option",{children:"Virtual"}),i.jsx("option",{children:"Hybrid"})]})})]})]}),(c.locationType==="Physical"||c.locationType==="Hybrid")&&i.jsxs(lr,{error:M("venue"),children:[i.jsx(ur,{text:"Venue / Address",required:!0}),i.jsx("input",{style:{...Xr,...M("venue")?{borderColor:"var(--destructive)"}:{}},value:c.venue,onChange:q=>R("venue",q.target.value)})]}),(c.locationType==="Virtual"||c.locationType==="Hybrid")&&i.jsxs(lr,{error:M("virtualLink"),children:[i.jsx(ur,{text:"Virtual link",required:!0}),i.jsx("input",{style:{...Xr,...M("virtualLink")?{borderColor:"var(--destructive)"}:{}},placeholder:"https://…",value:c.virtualLink,onChange:q=>R("virtualLink",q.target.value)})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:M("startDate"),children:[i.jsx(ur,{text:"Start Date",required:!0}),i.jsx("input",{type:"date",style:{...Xr,...M("startDate")?{borderColor:"var(--destructive)"}:{}},value:c.startDate,onChange:q=>R("startDate",q.target.value)})]}),i.jsxs(lr,{error:M("endDate"),children:[i.jsx(ur,{text:"End Date",required:!0}),i.jsx("input",{type:"date",style:{...Xr,...M("endDate")?{borderColor:"var(--destructive)"}:{}},value:c.endDate,onChange:q=>R("endDate",q.target.value)})]})]})]}),i.jsxs(Sf,{n:3,title:"Media",subtitle:"Logo and banner (optional)",open:o===3,completed:s.has(3),onToggle:()=>$(3),onNext:()=>ee(3),nextLabel:"Continue to Registration",nextDisabled:h,children:[i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Event logo"}),i.jsx(D0,{label:"logo",preview:c.eventLogo,error:M("eventLogo"),inputRef:P,onFile:q=>{R("eventLogo",q),f(Y=>{const K={...Y};return delete K.eventLogo,K})}})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Banner image"}),i.jsx(D0,{label:"banner",preview:c.eventBanner,error:M("eventBanner"),inputRef:O,onFile:q=>{R("eventBanner",q),f(Y=>{const K={...Y};return delete K.eventBanner,K})}})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Enable Feedback",required:!n}),i.jsx(wf,{name:"enableFeedback",value:c.enableFeedback,onChange:q=>R("enableFeedback",q),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Enable Ratings",required:!n}),i.jsx(wf,{name:"enableRatings",value:c.enableRatings,onChange:q=>R("enableRatings",q),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]})]})]}),i.jsxs(Sf,{n:4,title:"Registration & Form Fields",subtitle:"Registration rules and custom registration fields",open:o===4,completed:s.has(4),onToggle:()=>$(4),onNext:()=>B(),nextLabel:"Save event",nextDisabled:h,children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:"Registration settings"}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Registration Required",required:!0}),i.jsx(wf,{name:"regRequired",value:c.registrationRequired,onChange:q=>R("registrationRequired",q),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{error:M("registrationMode"),children:[i.jsx(ur,{text:"Registration Mode",required:c.registrationRequired==="Yes"}),i.jsx(La,{children:i.jsxs("select",{style:{...Ra,...M("registrationMode")?{borderColor:"var(--destructive)"}:{}},value:c.registrationMode,onChange:q=>R("registrationMode",q.target.value),disabled:c.registrationRequired!=="Yes",children:[i.jsx("option",{value:"",children:c.registrationRequired==="Yes"?"Select mode":"N/A"}),i.jsx("option",{children:"Open"}),i.jsx("option",{children:"Invite Only"}),i.jsx("option",{children:"Approval Required"})]})})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Verify Email",required:!0}),i.jsx(wf,{name:"verifyEmail",value:c.verifyEmail,onChange:q=>R("verifyEmail",q),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Registration Deadline"}),i.jsx("input",{type:"date",style:Xr,value:c.registrationDeadline,onChange:q=>R("registrationDeadline",q.target.value)})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:M("authenticationType"),children:[i.jsx(ur,{text:"Authentication Type",required:c.registrationRequired==="Yes"&&!n}),i.jsx(La,{children:i.jsx("select",{style:{...Ra,...M("authenticationType")?{borderColor:"var(--destructive)"}:{}},value:c.authenticationType,onChange:q=>R("authenticationType",q.target.value),disabled:c.registrationRequired!=="Yes",children:tT.map(q=>i.jsx("option",{value:q.value,children:q.label},q.value))})})]}),i.jsxs(lr,{error:M("registrationBaseFields"),children:[i.jsx(ur,{text:"Registration Base Fields",required:c.registrationRequired==="Yes"&&!n}),i.jsx(La,{children:i.jsx("select",{style:{...Ra,...M("registrationBaseFields")?{borderColor:"var(--destructive)"}:{}},value:c.registrationBaseFields,onChange:q=>R("registrationBaseFields",q.target.value),disabled:c.registrationRequired!=="Yes",children:rT.map(q=>i.jsx("option",{value:q.value,children:q.label},q.value))})})]})]}),i.jsxs("div",{style:{borderTop:"1px solid var(--border)",paddingTop:"12px",marginTop:"4px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 10px",fontFamily:"var(--font-noto-sans)"},children:"Custom registration fields (optional)"}),c.customFields.map((q,Y)=>i.jsxs("div",{style:{background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"12px",marginBottom:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",fontFamily:"var(--font-noto-sans)"},children:["Field ",Y+1]}),i.jsx("button",{type:"button",onClick:()=>A(q.id),style:{background:"none",border:"none",cursor:"pointer",color:"var(--destructive)"},children:i.jsx(gn,{size:14})})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:M(`cf_${q.id}_label`),children:[i.jsx(ur,{text:"Field Label",required:!0}),i.jsx("input",{style:{...Xr,...M(`cf_${q.id}_label`)?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. Dietary preference",value:q.label,onChange:K=>F(q.id,K.target.value)})]}),i.jsxs(lr,{error:M(`cf_${q.id}_code`),children:[i.jsx(ur,{text:"Field Code",required:!0}),i.jsx("input",{style:{...Xr,...M(`cf_${q.id}_code`)?{borderColor:"var(--destructive)"}:{},opacity:q.codeAuto?.92:1},placeholder:"auto from label",value:q.code||(q.codeAuto?ph(q.label):""),onChange:K=>L(q.id,K.target.value)}),i.jsx("p",{style:{fontSize:"10px",color:"var(--muted)",margin:"4px 0 0"},children:"Auto-updates from label until you edit it."})]})]}),i.jsxs(lr,{error:M(`cf_${q.id}_type`),children:[i.jsx(ur,{text:"Field Type",required:!0}),i.jsx(La,{children:i.jsx("select",{style:{...Ra,...M(`cf_${q.id}_type`)?{borderColor:"var(--destructive)"}:{}},value:q.fieldType,onChange:K=>z(q.id,K.target.value),children:eT.map(K=>i.jsx("option",{value:K.value,children:K.label},K.value))})})]}),nc(q.fieldType)&&i.jsxs("div",{style:{marginTop:"10px"},children:[i.jsx(ur,{text:"Options (Value & Label)",required:!0}),M(`cf_${q.id}_options`)&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"0 0 6px"},children:M(`cf_${q.id}_options`)}),q.options.map(K=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr auto",gap:"8px",alignItems:"start",marginBottom:"8px"},children:[i.jsx(lr,{error:M(`cf_${q.id}_opt_${K.id}`),children:i.jsx("input",{style:{...Xr,...M(`cf_${q.id}_opt_${K.id}`)?{borderColor:"var(--destructive)"}:{}},placeholder:"Value",value:K.value,onChange:G=>U(q.id,K.id,"value",G.target.value)})}),i.jsx(lr,{error:M(`cf_${q.id}_opt_${K.id}`),children:i.jsx("input",{style:{...Xr,...M(`cf_${q.id}_opt_${K.id}`)?{borderColor:"var(--destructive)"}:{}},placeholder:"Label",value:K.label,onChange:G=>U(q.id,K.id,"label",G.target.value)})}),i.jsx("button",{type:"button",onClick:()=>Q(q.id,K.id),style:{padding:"8px",border:"none",background:"transparent",cursor:"pointer",color:"var(--destructive)",marginTop:"4px"},"aria-label":"Remove option",children:i.jsx(gn,{size:14})})]},K.id)),i.jsxs("button",{type:"button",onClick:()=>V(q.id),style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px dashed var(--primary)",background:"var(--card)",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(wr,{size:12})," Add option"]})]})]},q.id)),i.jsxs("button",{type:"button",onClick:E,style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"var(--secondary)",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:13})," Add custom field"]})]})]})]}),i.jsxs("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"12px",background:"var(--card)"},children:[y&&i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",flex:1},children:y}),i.jsx("button",{type:"button",disabled:h,onClick:()=>B(),style:{padding:"8px 20px",borderRadius:"var(--radius-button)",background:h?"var(--secondary)":"var(--primary)",color:h?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:h?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:h?"Saving…":"Save event"})]})]})]})}var Vj=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],Jg={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(e){return typeof console<"u"&&console.warn(e)},getWeek:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var r=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-r.getTime())/864e5-3+(r.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},ox={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var t=e%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},ss=function(e,t){return t===void 0&&(t=2),("000"+e).slice(t*-1)},jl=function(e){return e===!0?1:0};function LI(e,t){var r;return function(){var n=this,o=arguments;clearTimeout(r),r=setTimeout(function(){return e.apply(n,o)},t)}}var Yj=function(e){return e instanceof Array?e:[e]};function Ta(e,t,r){if(r===!0)return e.classList.add(t);e.classList.remove(t)}function pn(e,t,r){var n=window.document.createElement(e);return t=t||"",r=r||"",n.className=t,r!==void 0&&(n.textContent=r),n}function E1(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function U$(e,t){if(t(e))return e;if(e.parentNode)return U$(e.parentNode,t)}function A1(e,t){var r=pn("div","numInputWrapper"),n=pn("input","numInput "+e),o=pn("span","arrowUp"),a=pn("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?n.type="number":(n.type="text",n.pattern="\\d*"),t!==void 0)for(var s in t)n.setAttribute(s,t[s]);return r.appendChild(n),r.appendChild(o),r.appendChild(a),r}function Rs(e){try{if(typeof e.composedPath=="function"){var t=e.composedPath();return t[0]}return e.target}catch{return e.target}}var Gj=function(){},B0=function(e,t,r){return r.months[t?"shorthand":"longhand"][e]},ooe={D:Gj,F:function(e,t,r){e.setMonth(r.months.longhand.indexOf(t))},G:function(e,t){e.setHours((e.getHours()>=12?12:0)+parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t,r){e.setHours(e.getHours()%12+12*jl(new RegExp(r.amPM[1],"i").test(t)))},M:function(e,t,r){e.setMonth(r.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(parseFloat(t))},U:function(e,t){return new Date(parseFloat(t)*1e3)},W:function(e,t,r){var n=parseInt(t),o=new Date(e.getFullYear(),0,2+(n-1)*7,0,0,0,0);return o.setDate(o.getDate()-o.getDay()+r.firstDayOfWeek),o},Y:function(e,t){e.setFullYear(parseFloat(t))},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours((e.getHours()>=12?12:0)+parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:Gj,m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},u:function(e,t){return new Date(parseFloat(t))},w:Gj,y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},Hp={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},zy={Z:function(e){return e.toISOString()},D:function(e,t,r){return t.weekdays.shorthand[zy.w(e,t,r)]},F:function(e,t,r){return B0(zy.n(e,t,r)-1,!1,t)},G:function(e,t,r){return ss(zy.h(e,t,r))},H:function(e){return ss(e.getHours())},J:function(e,t){return t.ordinal!==void 0?e.getDate()+t.ordinal(e.getDate()):e.getDate()},K:function(e,t){return t.amPM[jl(e.getHours()>11)]},M:function(e,t){return B0(e.getMonth(),!0,t)},S:function(e){return ss(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,t,r){return r.getWeek(e)},Y:function(e){return ss(e.getFullYear(),4)},d:function(e){return ss(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return ss(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,t){return t.weekdays.longhand[e.getDay()]},m:function(e){return ss(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},H$=function(e){var t=e.config,r=t===void 0?Jg:t,n=e.l10n,o=n===void 0?ox:n,a=e.isMobile,s=a===void 0?!1:a;return function(l,c,u){var d=u||o;return r.formatDate!==void 0&&!s?r.formatDate(l,c,d):c.split("").map(function(f,h,p){return zy[f]&&p[h-1]!=="\\"?zy[f](l,d,r):f!=="\\"?f:""}).join("")}},sE=function(e){var t=e.config,r=t===void 0?Jg:t,n=e.l10n,o=n===void 0?ox:n;return function(a,s,l,c){if(!(a!==0&&!a)){var u=c||o,d,f=a;if(a instanceof Date)d=new Date(a.getTime());else if(typeof a!="string"&&a.toFixed!==void 0)d=new Date(a);else if(typeof a=="string"){var h=s||(r||Jg).dateFormat,p=String(a).trim();if(p==="today")d=new Date,l=!0;else if(r&&r.parseDate)d=r.parseDate(a,h);else if(/Z$/.test(p)||/GMT$/.test(p))d=new Date(a);else{for(var y=void 0,m=[],x=0,b=0,w="";xMath.min(t,r)&&e=0?new Date:new Date(r.config.minDate.getTime()),De=Qj(r.config);xe.setHours(De.hours,De.minutes,De.seconds,xe.getMilliseconds()),r.selectedDates=[xe],r.latestSelectedDateObj=xe}pe!==void 0&&pe.type!=="blur"&&Ze(pe);var tt=r._input.value;f(),Pe(),r._input.value!==tt&&r._debouncedChange()}function u(pe,xe){return pe%12+12*jl(xe===r.l10n.amPM[1])}function d(pe){switch(pe%24){case 0:case 12:return 12;default:return pe%12}}function f(){if(!(r.hourElement===void 0||r.minuteElement===void 0)){var pe=(parseInt(r.hourElement.value.slice(-2),10)||0)%24,xe=(parseInt(r.minuteElement.value,10)||0)%60,De=r.secondElement!==void 0?(parseInt(r.secondElement.value,10)||0)%60:0;r.amPM!==void 0&&(pe=u(pe,r.amPM.textContent));var tt=r.config.minTime!==void 0||r.config.minDate&&r.minDateHasTime&&r.latestSelectedDateObj&&Ms(r.latestSelectedDateObj,r.config.minDate,!0)===0,Le=r.config.maxTime!==void 0||r.config.maxDate&&r.maxDateHasTime&&r.latestSelectedDateObj&&Ms(r.latestSelectedDateObj,r.config.maxDate,!0)===0;if(r.config.maxTime!==void 0&&r.config.minTime!==void 0&&r.config.minTime>r.config.maxTime){var Ke=Kj(r.config.minTime.getHours(),r.config.minTime.getMinutes(),r.config.minTime.getSeconds()),Fe=Kj(r.config.maxTime.getHours(),r.config.maxTime.getMinutes(),r.config.maxTime.getSeconds()),Ve=Kj(pe,xe,De);if(Ve>Fe&&Ve=12)]),r.secondElement!==void 0&&(r.secondElement.value=ss(De)))}function y(pe){var xe=Rs(pe),De=parseInt(xe.value)+(pe.delta||0);(De/1e3>1||pe.key==="Enter"&&!/[^\d]/.test(De.toString()))&&G(De)}function m(pe,xe,De,tt){if(xe instanceof Array)return xe.forEach(function(Le){return m(pe,Le,De,tt)});if(pe instanceof Array)return pe.forEach(function(Le){return m(Le,xe,De,tt)});pe.addEventListener(xe,De,tt),r._handlers.push({remove:function(){return pe.removeEventListener(xe,De,tt)}})}function x(){At("onChange")}function b(){if(r.config.wrap&&["open","close","toggle","clear"].forEach(function(De){Array.prototype.forEach.call(r.element.querySelectorAll("[data-"+De+"]"),function(tt){return m(tt,"click",r[De])})}),r.isMobile){ft();return}var pe=LI(Oe,50);if(r._debouncedChange=LI(x,coe),r.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&m(r.daysContainer,"mouseover",function(De){r.config.mode==="range"&&me(Rs(De))}),m(r._input,"keydown",le),r.calendarContainer!==void 0&&m(r.calendarContainer,"keydown",le),!r.config.inline&&!r.config.static&&m(window,"resize",pe),window.ontouchstart!==void 0?m(window.document,"touchstart",K):m(window.document,"mousedown",K),m(window.document,"focus",K,{capture:!0}),r.config.clickOpens===!0&&(m(r._input,"focus",r.open),m(r._input,"click",r.open)),r.daysContainer!==void 0&&(m(r.monthNav,"click",rt),m(r.monthNav,["keyup","increment"],y),m(r.daysContainer,"click",Ne)),r.timeContainer!==void 0&&r.minuteElement!==void 0&&r.hourElement!==void 0){var xe=function(De){return Rs(De).select()};m(r.timeContainer,["increment"],c),m(r.timeContainer,"blur",c,{capture:!0}),m(r.timeContainer,"click",k),m([r.hourElement,r.minuteElement],["focus","click"],xe),r.secondElement!==void 0&&m(r.secondElement,"focus",function(){return r.secondElement&&r.secondElement.select()}),r.amPM!==void 0&&m(r.amPM,"click",function(De){c(De)})}r.config.allowInput&&m(r._input,"blur",ae)}function w(pe,xe){var De=pe!==void 0?r.parseDate(pe):r.latestSelectedDateObj||(r.config.minDate&&r.config.minDate>r.now?r.config.minDate:r.config.maxDate&&r.config.maxDate1),r.calendarContainer.appendChild(pe);var Le=r.config.appendTo!==void 0&&r.config.appendTo.nodeType!==void 0;if((r.config.inline||r.config.static)&&(r.calendarContainer.classList.add(r.config.inline?"inline":"static"),r.config.inline&&(!Le&&r.element.parentNode?r.element.parentNode.insertBefore(r.calendarContainer,r._input.nextSibling):r.config.appendTo!==void 0&&r.config.appendTo.appendChild(r.calendarContainer)),r.config.static)){var Ke=pn("div","flatpickr-wrapper");r.element.parentNode&&r.element.parentNode.insertBefore(Ke,r.element),Ke.appendChild(r.element),r.altInput&&Ke.appendChild(r.altInput),Ke.appendChild(r.calendarContainer)}!r.config.static&&!r.config.inline&&(r.config.appendTo!==void 0?r.config.appendTo:window.document.body).appendChild(r.calendarContainer)}function P(pe,xe,De,tt){var Le=re(xe,!0),Ke=pn("span",pe,xe.getDate().toString());return Ke.dateObj=xe,Ke.$i=tt,Ke.setAttribute("aria-label",r.formatDate(xe,r.config.ariaDateFormat)),pe.indexOf("hidden")===-1&&Ms(xe,r.now)===0&&(r.todayDateElem=Ke,Ke.classList.add("today"),Ke.setAttribute("aria-current","date")),Le?(Ke.tabIndex=-1,Se(xe)&&(Ke.classList.add("selected"),r.selectedDateElem=Ke,r.config.mode==="range"&&(Ta(Ke,"startRange",r.selectedDates[0]&&Ms(xe,r.selectedDates[0],!0)===0),Ta(Ke,"endRange",r.selectedDates[1]&&Ms(xe,r.selectedDates[1],!0)===0),pe==="nextMonthDay"&&Ke.classList.add("inRange")))):Ke.classList.add("flatpickr-disabled"),r.config.mode==="range"&&ct(xe)&&!Se(xe)&&Ke.classList.add("inRange"),r.weekNumbers&&r.config.showMonths===1&&pe!=="prevMonthDay"&&tt%7===6&&r.weekNumbers.insertAdjacentHTML("beforeend",""+r.config.getWeek(xe)+""),At("onDayCreate",Ke),Ke}function O(pe){pe.focus(),r.config.mode==="range"&&me(pe)}function T(pe){for(var xe=pe>0?0:r.config.showMonths-1,De=pe>0?r.config.showMonths:-1,tt=xe;tt!=De;tt+=pe)for(var Le=r.daysContainer.children[tt],Ke=pe>0?0:Le.children.length-1,Fe=pe>0?Le.children.length:-1,Ve=Ke;Ve!=Fe;Ve+=pe){var xt=Le.children[Ve];if(xt.className.indexOf("hidden")===-1&&re(xt.dateObj))return xt}}function R(pe,xe){for(var De=pe.className.indexOf("Month")===-1?pe.dateObj.getMonth():r.currentMonth,tt=xe>0?r.config.showMonths:-1,Le=xe>0?1:-1,Ke=De-r.currentMonth;Ke!=tt;Ke+=Le)for(var Fe=r.daysContainer.children[Ke],Ve=De-r.currentMonth===Ke?pe.$i+xe:xe<0?Fe.children.length-1:0,xt=Fe.children.length,dt=Ve;dt>=0&&dt0?xt:-1);dt+=Le){var Tt=Fe.children[dt];if(Tt.className.indexOf("hidden")===-1&&re(Tt.dateObj)&&Math.abs(pe.$i-dt)>=Math.abs(xe))return O(Tt)}r.changeMonth(Le),I(T(Le),0)}function I(pe,xe){var De=a(),tt=J(De||document.body),Le=pe!==void 0?pe:tt?De:r.selectedDateElem!==void 0&&J(r.selectedDateElem)?r.selectedDateElem:r.todayDateElem!==void 0&&J(r.todayDateElem)?r.todayDateElem:T(xe>0?1:-1);Le===void 0?r._input.focus():tt?R(Le,xe):O(Le)}function E(pe,xe){for(var De=(new Date(pe,xe,1).getDay()-r.l10n.firstDayOfWeek+7)%7,tt=r.utils.getDaysInMonth((xe-1+12)%12,pe),Le=r.utils.getDaysInMonth(xe,pe),Ke=window.document.createDocumentFragment(),Fe=r.config.showMonths>1,Ve=Fe?"prevMonthDay hidden":"prevMonthDay",xt=Fe?"nextMonthDay hidden":"nextMonthDay",dt=tt+1-De,Tt=0;dt<=tt;dt++,Tt++)Ke.appendChild(P("flatpickr-day "+Ve,new Date(pe,xe-1,dt),dt,Tt));for(dt=1;dt<=Le;dt++,Tt++)Ke.appendChild(P("flatpickr-day",new Date(pe,xe,dt),dt,Tt));for(var Mt=Le+1;Mt<=42-De&&(r.config.showMonths===1||Tt%7!==0);Mt++,Tt++)Ke.appendChild(P("flatpickr-day "+xt,new Date(pe,xe+1,Mt%Le),Mt,Tt));var fr=pn("div","dayContainer");return fr.appendChild(Ke),fr}function A(){if(r.daysContainer!==void 0){E1(r.daysContainer),r.weekNumbers&&E1(r.weekNumbers);for(var pe=document.createDocumentFragment(),xe=0;xe1||r.config.monthSelectorType!=="dropdown")){var pe=function(tt){return r.config.minDate!==void 0&&r.currentYear===r.config.minDate.getFullYear()&&ttr.config.maxDate.getMonth())};r.monthsDropdownContainer.tabIndex=-1,r.monthsDropdownContainer.innerHTML="";for(var xe=0;xe<12;xe++)if(pe(xe)){var De=pn("option","flatpickr-monthDropdown-month");De.value=new Date(r.currentYear,xe).getMonth().toString(),De.textContent=B0(xe,r.config.shorthandCurrentMonth,r.l10n),De.tabIndex=-1,r.currentMonth===xe&&(De.selected=!0),r.monthsDropdownContainer.appendChild(De)}}}function L(){var pe=pn("div","flatpickr-month"),xe=window.document.createDocumentFragment(),De;r.config.showMonths>1||r.config.monthSelectorType==="static"?De=pn("span","cur-month"):(r.monthsDropdownContainer=pn("select","flatpickr-monthDropdown-months"),r.monthsDropdownContainer.setAttribute("aria-label",r.l10n.monthAriaLabel),m(r.monthsDropdownContainer,"change",function(Fe){var Ve=Rs(Fe),xt=parseInt(Ve.value,10);r.changeMonth(xt-r.currentMonth),At("onMonthChange")}),F(),De=r.monthsDropdownContainer);var tt=A1("cur-year",{tabindex:"-1"}),Le=tt.getElementsByTagName("input")[0];Le.setAttribute("aria-label",r.l10n.yearAriaLabel),r.config.minDate&&Le.setAttribute("min",r.config.minDate.getFullYear().toString()),r.config.maxDate&&(Le.setAttribute("max",r.config.maxDate.getFullYear().toString()),Le.disabled=!!r.config.minDate&&r.config.minDate.getFullYear()===r.config.maxDate.getFullYear());var Ke=pn("div","flatpickr-current-month");return Ke.appendChild(De),Ke.appendChild(tt),xe.appendChild(Ke),pe.appendChild(xe),{container:pe,yearElement:Le,monthElement:De}}function z(){E1(r.monthNav),r.monthNav.appendChild(r.prevMonthNav),r.config.showMonths&&(r.yearElements=[],r.monthElements=[]);for(var pe=r.config.showMonths;pe--;){var xe=L();r.yearElements.push(xe.yearElement),r.monthElements.push(xe.monthElement),r.monthNav.appendChild(xe.container)}r.monthNav.appendChild(r.nextMonthNav)}function V(){return r.monthNav=pn("div","flatpickr-months"),r.yearElements=[],r.monthElements=[],r.prevMonthNav=pn("span","flatpickr-prev-month"),r.prevMonthNav.innerHTML=r.config.prevArrow,r.nextMonthNav=pn("span","flatpickr-next-month"),r.nextMonthNav.innerHTML=r.config.nextArrow,z(),Object.defineProperty(r,"_hidePrevMonthArrow",{get:function(){return r.__hidePrevMonthArrow},set:function(pe){r.__hidePrevMonthArrow!==pe&&(Ta(r.prevMonthNav,"flatpickr-disabled",pe),r.__hidePrevMonthArrow=pe)}}),Object.defineProperty(r,"_hideNextMonthArrow",{get:function(){return r.__hideNextMonthArrow},set:function(pe){r.__hideNextMonthArrow!==pe&&(Ta(r.nextMonthNav,"flatpickr-disabled",pe),r.__hideNextMonthArrow=pe)}}),r.currentYearElement=r.yearElements[0],gt(),r.monthNav}function Q(){r.calendarContainer.classList.add("hasTime"),r.config.noCalendar&&r.calendarContainer.classList.add("noCalendar");var pe=Qj(r.config);r.timeContainer=pn("div","flatpickr-time"),r.timeContainer.tabIndex=-1;var xe=pn("span","flatpickr-time-separator",":"),De=A1("flatpickr-hour",{"aria-label":r.l10n.hourAriaLabel});r.hourElement=De.getElementsByTagName("input")[0];var tt=A1("flatpickr-minute",{"aria-label":r.l10n.minuteAriaLabel});if(r.minuteElement=tt.getElementsByTagName("input")[0],r.hourElement.tabIndex=r.minuteElement.tabIndex=-1,r.hourElement.value=ss(r.latestSelectedDateObj?r.latestSelectedDateObj.getHours():r.config.time_24hr?pe.hours:d(pe.hours)),r.minuteElement.value=ss(r.latestSelectedDateObj?r.latestSelectedDateObj.getMinutes():pe.minutes),r.hourElement.setAttribute("step",r.config.hourIncrement.toString()),r.minuteElement.setAttribute("step",r.config.minuteIncrement.toString()),r.hourElement.setAttribute("min",r.config.time_24hr?"0":"1"),r.hourElement.setAttribute("max",r.config.time_24hr?"23":"12"),r.hourElement.setAttribute("maxlength","2"),r.minuteElement.setAttribute("min","0"),r.minuteElement.setAttribute("max","59"),r.minuteElement.setAttribute("maxlength","2"),r.timeContainer.appendChild(De),r.timeContainer.appendChild(xe),r.timeContainer.appendChild(tt),r.config.time_24hr&&r.timeContainer.classList.add("time24hr"),r.config.enableSeconds){r.timeContainer.classList.add("hasSeconds");var Le=A1("flatpickr-second");r.secondElement=Le.getElementsByTagName("input")[0],r.secondElement.value=ss(r.latestSelectedDateObj?r.latestSelectedDateObj.getSeconds():pe.seconds),r.secondElement.setAttribute("step",r.minuteElement.getAttribute("step")),r.secondElement.setAttribute("min","0"),r.secondElement.setAttribute("max","59"),r.secondElement.setAttribute("maxlength","2"),r.timeContainer.appendChild(pn("span","flatpickr-time-separator",":")),r.timeContainer.appendChild(Le)}return r.config.time_24hr||(r.amPM=pn("span","flatpickr-am-pm",r.l10n.amPM[jl((r.latestSelectedDateObj?r.hourElement.value:r.config.defaultHour)>11)]),r.amPM.title=r.l10n.toggleTitle,r.amPM.tabIndex=-1,r.timeContainer.appendChild(r.amPM)),r.timeContainer}function U(){r.weekdayContainer?E1(r.weekdayContainer):r.weekdayContainer=pn("div","flatpickr-weekdays");for(var pe=r.config.showMonths;pe--;){var xe=pn("div","flatpickr-weekdaycontainer");r.weekdayContainer.appendChild(xe)}return ee(),r.weekdayContainer}function ee(){if(r.weekdayContainer){var pe=r.l10n.firstDayOfWeek,xe=FI(r.l10n.weekdays.shorthand);pe>0&&pe - `+xe.join("")+` - - `}}function H(){r.calendarContainer.classList.add("hasWeeks");var pe=pn("div","flatpickr-weekwrapper");pe.appendChild(pn("span","flatpickr-weekday",r.l10n.weekAbbreviation));var xe=pn("div","flatpickr-weeks");return pe.appendChild(xe),{weekWrapper:pe,weekNumbers:xe}}function B(pe,xe){xe===void 0&&(xe=!0);var De=xe?pe:pe-r.currentMonth;De<0&&r._hidePrevMonthArrow===!0||De>0&&r._hideNextMonthArrow===!0||(r.currentMonth+=De,(r.currentMonth<0||r.currentMonth>11)&&(r.currentYear+=r.currentMonth>11?1:-1,r.currentMonth=(r.currentMonth+12)%12,At("onYearChange"),F()),A(),At("onMonthChange"),gt())}function M(pe,xe){if(pe===void 0&&(pe=!0),xe===void 0&&(xe=!0),r.input.value="",r.altInput!==void 0&&(r.altInput.value=""),r.mobileInput!==void 0&&(r.mobileInput.value=""),r.selectedDates=[],r.latestSelectedDateObj=void 0,xe===!0&&(r.currentYear=r._initialDate.getFullYear(),r.currentMonth=r._initialDate.getMonth()),r.config.enableTime===!0){var De=Qj(r.config),tt=De.hours,Le=De.minutes,Ke=De.seconds;p(tt,Le,Ke)}r.redraw(),pe&&At("onChange")}function $(){r.isOpen=!1,r.isMobile||(r.calendarContainer!==void 0&&r.calendarContainer.classList.remove("open"),r._input!==void 0&&r._input.classList.remove("active")),At("onClose")}function q(){r.config!==void 0&&At("onDestroy");for(var pe=r._handlers.length;pe--;)r._handlers[pe].remove();if(r._handlers=[],r.mobileInput)r.mobileInput.parentNode&&r.mobileInput.parentNode.removeChild(r.mobileInput),r.mobileInput=void 0;else if(r.calendarContainer&&r.calendarContainer.parentNode)if(r.config.static&&r.calendarContainer.parentNode){var xe=r.calendarContainer.parentNode;if(xe.lastChild&&xe.removeChild(xe.lastChild),xe.parentNode){for(;xe.firstChild;)xe.parentNode.insertBefore(xe.firstChild,xe);xe.parentNode.removeChild(xe)}}else r.calendarContainer.parentNode.removeChild(r.calendarContainer);r.altInput&&(r.input.type="text",r.altInput.parentNode&&r.altInput.parentNode.removeChild(r.altInput),delete r.altInput),r.input&&(r.input.type=r.input._type,r.input.classList.remove("flatpickr-input"),r.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(De){try{delete r[De]}catch{}})}function Y(pe){return r.calendarContainer.contains(pe)}function K(pe){if(r.isOpen&&!r.config.inline){var xe=Rs(pe),De=Y(xe),tt=xe===r.input||xe===r.altInput||r.element.contains(xe)||pe.path&&pe.path.indexOf&&(~pe.path.indexOf(r.input)||~pe.path.indexOf(r.altInput)),Le=!tt&&!De&&!Y(pe.relatedTarget),Ke=!r.config.ignoredFocusElements.some(function(Fe){return Fe.contains(xe)});Le&&Ke&&(r.config.allowInput&&r.setDate(r._input.value,!1,r.config.altInput?r.config.altFormat:r.config.dateFormat),r.timeContainer!==void 0&&r.minuteElement!==void 0&&r.hourElement!==void 0&&r.input.value!==""&&r.input.value!==void 0&&c(),r.close(),r.config&&r.config.mode==="range"&&r.selectedDates.length===1&&r.clear(!1))}}function G(pe){if(!(!pe||r.config.minDate&&per.config.maxDate.getFullYear())){var xe=pe,De=r.currentYear!==xe;r.currentYear=xe||r.currentYear,r.config.maxDate&&r.currentYear===r.config.maxDate.getFullYear()?r.currentMonth=Math.min(r.config.maxDate.getMonth(),r.currentMonth):r.config.minDate&&r.currentYear===r.config.minDate.getFullYear()&&(r.currentMonth=Math.max(r.config.minDate.getMonth(),r.currentMonth)),De&&(r.redraw(),At("onYearChange"),F())}}function re(pe,xe){var De;xe===void 0&&(xe=!0);var tt=r.parseDate(pe,void 0,xe);if(r.config.minDate&&tt&&Ms(tt,r.config.minDate,xe!==void 0?xe:!r.minDateHasTime)<0||r.config.maxDate&&tt&&Ms(tt,r.config.maxDate,xe!==void 0?xe:!r.maxDateHasTime)>0)return!1;if(!r.config.enable&&r.config.disable.length===0)return!0;if(tt===void 0)return!1;for(var Le=!!r.config.enable,Ke=(De=r.config.enable)!==null&&De!==void 0?De:r.config.disable,Fe=0,Ve=void 0;Fe=Ve.from.getTime()&&tt.getTime()<=Ve.to.getTime())return Le}return!Le}function J(pe){return r.daysContainer!==void 0?pe.className.indexOf("hidden")===-1&&pe.className.indexOf("flatpickr-disabled")===-1&&r.daysContainer.contains(pe):!1}function ae(pe){var xe=pe.target===r._input,De=r._input.value.trimEnd()!==We();xe&&De&&!(pe.relatedTarget&&Y(pe.relatedTarget))&&r.setDate(r._input.value,!0,pe.target===r.altInput?r.config.altFormat:r.config.dateFormat)}function le(pe){var xe=Rs(pe),De=r.config.wrap?e.contains(xe):xe===r._input,tt=r.config.allowInput,Le=r.isOpen&&(!tt||!De),Ke=r.config.inline&&De&&!tt;if(pe.keyCode===13&&De){if(tt)return r.setDate(r._input.value,!0,xe===r.altInput?r.config.altFormat:r.config.dateFormat),r.close(),xe.blur();r.open()}else if(Y(xe)||Le||Ke){var Fe=!!r.timeContainer&&r.timeContainer.contains(xe);switch(pe.keyCode){case 13:Fe?(pe.preventDefault(),c(),qe()):Ne(pe);break;case 27:pe.preventDefault(),qe();break;case 8:case 46:De&&!r.config.allowInput&&(pe.preventDefault(),r.clear());break;case 37:case 39:if(!Fe&&!De){pe.preventDefault();var Ve=a();if(r.daysContainer!==void 0&&(tt===!1||Ve&&J(Ve))){var xt=pe.keyCode===39?1:-1;pe.ctrlKey?(pe.stopPropagation(),B(xt),I(T(1),0)):I(void 0,xt)}}else r.hourElement&&r.hourElement.focus();break;case 38:case 40:pe.preventDefault();var dt=pe.keyCode===40?1:-1;r.daysContainer&&xe.$i!==void 0||xe===r.input||xe===r.altInput?pe.ctrlKey?(pe.stopPropagation(),G(r.currentYear-dt),I(T(1),0)):Fe||I(void 0,dt*7):xe===r.currentYearElement?G(r.currentYear-dt):r.config.enableTime&&(!Fe&&r.hourElement&&r.hourElement.focus(),c(pe),r._debouncedChange());break;case 9:if(Fe){var Tt=[r.hourElement,r.minuteElement,r.secondElement,r.amPM].concat(r.pluginElements).filter(function(hr){return hr}),Mt=Tt.indexOf(xe);if(Mt!==-1){var fr=Tt[Mt+(pe.shiftKey?-1:1)];pe.preventDefault(),(fr||r._input).focus()}}else!r.config.noCalendar&&r.daysContainer&&r.daysContainer.contains(xe)&&pe.shiftKey&&(pe.preventDefault(),r._input.focus());break}}if(r.amPM!==void 0&&xe===r.amPM)switch(pe.key){case r.l10n.amPM[0].charAt(0):case r.l10n.amPM[0].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[0],f(),Pe();break;case r.l10n.amPM[1].charAt(0):case r.l10n.amPM[1].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[1],f(),Pe();break}(De||Y(xe))&&At("onKeyDown",pe)}function me(pe,xe){if(xe===void 0&&(xe="flatpickr-day"),!(r.selectedDates.length!==1||pe&&(!pe.classList.contains(xe)||pe.classList.contains("flatpickr-disabled")))){for(var De=pe?pe.dateObj.getTime():r.days.firstElementChild.dateObj.getTime(),tt=r.parseDate(r.selectedDates[0],void 0,!0).getTime(),Le=Math.min(De,r.selectedDates[0].getTime()),Ke=Math.max(De,r.selectedDates[0].getTime()),Fe=!1,Ve=0,xt=0,dt=Le;dtLe&&dtVe)?Ve=dt:dt>tt&&(!xt||dt ."+xe));Tt.forEach(function(Mt){var fr=Mt.dateObj,hr=fr.getTime(),Qr=Ve>0&&hr0&&hr>xt;if(Qr){Mt.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(Rn){Mt.classList.remove(Rn)});return}else if(Fe&&!Qr)return;["startRange","inRange","endRange","notAllowed"].forEach(function(Rn){Mt.classList.remove(Rn)}),pe!==void 0&&(pe.classList.add(De<=r.selectedDates[0].getTime()?"startRange":"endRange"),ttDe&&hr===tt&&Mt.classList.add("endRange"),hr>=Ve&&(xt===0||hr<=xt)&&aoe(hr,tt,De)&&Mt.classList.add("inRange"))})}}function Oe(){r.isOpen&&!r.config.static&&!r.config.inline&&fe()}function we(pe,xe){if(xe===void 0&&(xe=r._positionElement),r.isMobile===!0){if(pe){pe.preventDefault();var De=Rs(pe);De&&De.blur()}r.mobileInput!==void 0&&(r.mobileInput.focus(),r.mobileInput.click()),At("onOpen");return}else if(r._input.disabled||r.config.inline)return;var tt=r.isOpen;r.isOpen=!0,tt||(r.calendarContainer.classList.add("open"),r._input.classList.add("active"),At("onOpen"),fe(xe)),r.config.enableTime===!0&&r.config.noCalendar===!0&&r.config.allowInput===!1&&(pe===void 0||!r.timeContainer.contains(pe.relatedTarget))&&setTimeout(function(){return r.hourElement.select()},50)}function ie(pe){return function(xe){var De=r.config["_"+pe+"Date"]=r.parseDate(xe,r.config.dateFormat),tt=r.config["_"+(pe==="min"?"max":"min")+"Date"];De!==void 0&&(r[pe==="min"?"minDateHasTime":"maxDateHasTime"]=De.getHours()>0||De.getMinutes()>0||De.getSeconds()>0),r.selectedDates&&(r.selectedDates=r.selectedDates.filter(function(Le){return re(Le)}),!r.selectedDates.length&&pe==="min"&&h(De),Pe()),r.daysContainer&&(je(),De!==void 0?r.currentYearElement[pe]=De.getFullYear().toString():r.currentYearElement.removeAttribute(pe),r.currentYearElement.disabled=!!tt&&De!==void 0&&tt.getFullYear()===De.getFullYear())}}function Me(){var pe=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],xe=pa(pa({},JSON.parse(JSON.stringify(e.dataset||{}))),t),De={};r.config.parseDate=xe.parseDate,r.config.formatDate=xe.formatDate,Object.defineProperty(r.config,"enable",{get:function(){return r.config._enable},set:function(Tt){r.config._enable=nt(Tt)}}),Object.defineProperty(r.config,"disable",{get:function(){return r.config._disable},set:function(Tt){r.config._disable=nt(Tt)}});var tt=xe.mode==="time";if(!xe.dateFormat&&(xe.enableTime||tt)){var Le=Xi.defaultConfig.dateFormat||Jg.dateFormat;De.dateFormat=xe.noCalendar||tt?"H:i"+(xe.enableSeconds?":S":""):Le+" H:i"+(xe.enableSeconds?":S":"")}if(xe.altInput&&(xe.enableTime||tt)&&!xe.altFormat){var Ke=Xi.defaultConfig.altFormat||Jg.altFormat;De.altFormat=xe.noCalendar||tt?"h:i"+(xe.enableSeconds?":S K":" K"):Ke+(" h:i"+(xe.enableSeconds?":S":"")+" K")}Object.defineProperty(r.config,"minDate",{get:function(){return r.config._minDate},set:ie("min")}),Object.defineProperty(r.config,"maxDate",{get:function(){return r.config._maxDate},set:ie("max")});var Fe=function(Tt){return function(Mt){r.config[Tt==="min"?"_minTime":"_maxTime"]=r.parseDate(Mt,"H:i:S")}};Object.defineProperty(r.config,"minTime",{get:function(){return r.config._minTime},set:Fe("min")}),Object.defineProperty(r.config,"maxTime",{get:function(){return r.config._maxTime},set:Fe("max")}),xe.mode==="time"&&(r.config.noCalendar=!0,r.config.enableTime=!0),Object.assign(r.config,De,xe);for(var Ve=0;Ve-1?r.config[dt]=Yj(xt[dt]).map(s).concat(r.config[dt]):typeof xe[dt]>"u"&&(r.config[dt]=xt[dt])}xe.altInputClass||(r.config.altInputClass=ke().className+" "+r.config.altInputClass),At("onParseConfig")}function ke(){return r.config.wrap?e.querySelector("[data-input]"):e}function se(){typeof r.config.locale!="object"&&typeof Xi.l10ns[r.config.locale]>"u"&&r.config.errorHandler(new Error("flatpickr: invalid locale "+r.config.locale)),r.l10n=pa(pa({},Xi.l10ns.default),typeof r.config.locale=="object"?r.config.locale:r.config.locale!=="default"?Xi.l10ns[r.config.locale]:void 0),Hp.D="("+r.l10n.weekdays.shorthand.join("|")+")",Hp.l="("+r.l10n.weekdays.longhand.join("|")+")",Hp.M="("+r.l10n.months.shorthand.join("|")+")",Hp.F="("+r.l10n.months.longhand.join("|")+")",Hp.K="("+r.l10n.amPM[0]+"|"+r.l10n.amPM[1]+"|"+r.l10n.amPM[0].toLowerCase()+"|"+r.l10n.amPM[1].toLowerCase()+")";var pe=pa(pa({},t),JSON.parse(JSON.stringify(e.dataset||{})));pe.time_24hr===void 0&&Xi.defaultConfig.time_24hr===void 0&&(r.config.time_24hr=r.l10n.time_24hr),r.formatDate=H$(r),r.parseDate=sE({config:r.config,l10n:r.l10n})}function fe(pe){if(typeof r.config.position=="function")return void r.config.position(r,pe);if(r.calendarContainer!==void 0){At("onPreCalendarPosition");var xe=pe||r._positionElement,De=Array.prototype.reduce.call(r.calendarContainer.children,(function(zt,yr){return zt+yr.offsetHeight}),0),tt=r.calendarContainer.offsetWidth,Le=r.config.position.split(" "),Ke=Le[0],Fe=Le.length>1?Le[1]:null,Ve=xe.getBoundingClientRect(),xt=window.innerHeight-Ve.bottom,dt=Ke==="above"||Ke!=="below"&&xtDe,Tt=window.pageYOffset+Ve.top+(dt?-De-2:xe.offsetHeight+2);if(Ta(r.calendarContainer,"arrowTop",!dt),Ta(r.calendarContainer,"arrowBottom",dt),!r.config.inline){var Mt=window.pageXOffset+Ve.left,fr=!1,hr=!1;Fe==="center"?(Mt-=(tt-Ve.width)/2,fr=!0):Fe==="right"&&(Mt-=tt-Ve.width,hr=!0),Ta(r.calendarContainer,"arrowLeft",!fr&&!hr),Ta(r.calendarContainer,"arrowCenter",fr),Ta(r.calendarContainer,"arrowRight",hr);var Qr=window.document.body.offsetWidth-(window.pageXOffset+Ve.right),Rn=Mt+tt>window.document.body.offsetWidth,to=Qr+tt>window.document.body.offsetWidth;if(Ta(r.calendarContainer,"rightMost",Rn),!r.config.static)if(r.calendarContainer.style.top=Tt+"px",!Rn)r.calendarContainer.style.left=Mt+"px",r.calendarContainer.style.right="auto";else if(!to)r.calendarContainer.style.left="auto",r.calendarContainer.style.right=Qr+"px";else{var Ln=Ie();if(Ln===void 0)return;var vo=window.document.body.offsetWidth,ro=Math.max(0,vo/2-tt/2),ys=".flatpickr-calendar.centerMost:before",zo=".flatpickr-calendar.centerMost:after",$a=Ln.cssRules.length,xa="{left:"+Ve.left+"px;right:auto;}";Ta(r.calendarContainer,"rightMost",!1),Ta(r.calendarContainer,"centerMost",!0),Ln.insertRule(ys+","+zo+xa,$a),r.calendarContainer.style.left=ro+"px",r.calendarContainer.style.right="auto"}}}}function Ie(){for(var pe=null,xe=0;xer.currentMonth+r.config.showMonths-1)&&r.config.mode!=="range";if(r.selectedDateElem=tt,r.config.mode==="single")r.selectedDates=[Le];else if(r.config.mode==="multiple"){var Fe=Se(Le);Fe?r.selectedDates.splice(parseInt(Fe),1):r.selectedDates.push(Le)}else r.config.mode==="range"&&(r.selectedDates.length===2&&r.clear(!1,!1),r.latestSelectedDateObj=Le,r.selectedDates.push(Le),Ms(Le,r.selectedDates[0],!0)!==0&&r.selectedDates.sort(function(Tt,Mt){return Tt.getTime()-Mt.getTime()}));if(f(),Ke){var Ve=r.currentYear!==Le.getFullYear();r.currentYear=Le.getFullYear(),r.currentMonth=Le.getMonth(),Ve&&(At("onYearChange"),F()),At("onMonthChange")}if(gt(),A(),Pe(),!Ke&&r.config.mode!=="range"&&r.config.showMonths===1?O(tt):r.selectedDateElem!==void 0&&r.hourElement===void 0&&r.selectedDateElem&&r.selectedDateElem.focus(),r.hourElement!==void 0&&r.hourElement!==void 0&&r.hourElement.focus(),r.config.closeOnSelect){var xt=r.config.mode==="single"&&!r.config.enableTime,dt=r.config.mode==="range"&&r.selectedDates.length===2&&!r.config.enableTime;(xt||dt)&&qe()}x()}}var Je={locale:[se,ee],showMonths:[z,l,U],minDate:[w],maxDate:[w],positionElement:[wt],clickOpens:[function(){r.config.clickOpens===!0?(m(r._input,"focus",r.open),m(r._input,"click",r.open)):(r._input.removeEventListener("focus",r.open),r._input.removeEventListener("click",r.open))}]};function vt(pe,xe){if(pe!==null&&typeof pe=="object"){Object.assign(r.config,pe);for(var De in pe)Je[De]!==void 0&&Je[De].forEach(function(tt){return tt()})}else r.config[pe]=xe,Je[pe]!==void 0?Je[pe].forEach(function(tt){return tt()}):Vj.indexOf(pe)>-1&&(r.config[pe]=Yj(xe));r.redraw(),Pe(!0)}function Ge(pe,xe){var De=[];if(pe instanceof Array)De=pe.map(function(tt){return r.parseDate(tt,xe)});else if(pe instanceof Date||typeof pe=="number")De=[r.parseDate(pe,xe)];else if(typeof pe=="string")switch(r.config.mode){case"single":case"time":De=[r.parseDate(pe,xe)];break;case"multiple":De=pe.split(r.config.conjunction).map(function(tt){return r.parseDate(tt,xe)});break;case"range":De=pe.split(r.l10n.rangeSeparator).map(function(tt){return r.parseDate(tt,xe)});break}else r.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(pe)));r.selectedDates=r.config.allowInvalidPreload?De:De.filter(function(tt){return tt instanceof Date&&re(tt,!1)}),r.config.mode==="range"&&r.selectedDates.sort(function(tt,Le){return tt.getTime()-Le.getTime()})}function Ot(pe,xe,De){if(xe===void 0&&(xe=!1),De===void 0&&(De=r.config.dateFormat),pe!==0&&!pe||pe instanceof Array&&pe.length===0)return r.clear(xe);Ge(pe,De),r.latestSelectedDateObj=r.selectedDates[r.selectedDates.length-1],r.redraw(),w(void 0,xe),h(),r.selectedDates.length===0&&r.clear(!1),Pe(xe),xe&&At("onChange")}function nt(pe){return pe.slice().map(function(xe){return typeof xe=="string"||typeof xe=="number"||xe instanceof Date?r.parseDate(xe,void 0,!0):xe&&typeof xe=="object"&&xe.from&&xe.to?{from:r.parseDate(xe.from,void 0),to:r.parseDate(xe.to,void 0)}:xe}).filter(function(xe){return xe})}function Ae(){r.selectedDates=[],r.now=r.parseDate(r.config.now)||new Date;var pe=r.config.defaultDate||((r.input.nodeName==="INPUT"||r.input.nodeName==="TEXTAREA")&&r.input.placeholder&&r.input.value===r.input.placeholder?null:r.input.value);pe&&Ge(pe,r.config.dateFormat),r._initialDate=r.selectedDates.length>0?r.selectedDates[0]:r.config.minDate&&r.config.minDate.getTime()>r.now.getTime()?r.config.minDate:r.config.maxDate&&r.config.maxDate.getTime()0&&(r.latestSelectedDateObj=r.selectedDates[0]),r.config.minTime!==void 0&&(r.config.minTime=r.parseDate(r.config.minTime,"H:i")),r.config.maxTime!==void 0&&(r.config.maxTime=r.parseDate(r.config.maxTime,"H:i")),r.minDateHasTime=!!r.config.minDate&&(r.config.minDate.getHours()>0||r.config.minDate.getMinutes()>0||r.config.minDate.getSeconds()>0),r.maxDateHasTime=!!r.config.maxDate&&(r.config.maxDate.getHours()>0||r.config.maxDate.getMinutes()>0||r.config.maxDate.getSeconds()>0)}function Te(){if(r.input=ke(),!r.input){r.config.errorHandler(new Error("Invalid input element specified"));return}r.input._type=r.input.type,r.input.type="text",r.input.classList.add("flatpickr-input"),r._input=r.input,r.config.altInput&&(r.altInput=pn(r.input.nodeName,r.config.altInputClass),r._input=r.altInput,r.altInput.placeholder=r.input.placeholder,r.altInput.disabled=r.input.disabled,r.altInput.required=r.input.required,r.altInput.tabIndex=r.input.tabIndex,r.altInput.type="text",r.input.setAttribute("type","hidden"),!r.config.static&&r.input.parentNode&&r.input.parentNode.insertBefore(r.altInput,r.input.nextSibling)),r.config.allowInput||r._input.setAttribute("readonly","readonly"),wt()}function wt(){r._positionElement=r.config.positionElement||r._input}function ft(){var pe=r.config.enableTime?r.config.noCalendar?"time":"datetime-local":"date";r.mobileInput=pn("input",r.input.className+" flatpickr-mobile"),r.mobileInput.tabIndex=1,r.mobileInput.type=pe,r.mobileInput.disabled=r.input.disabled,r.mobileInput.required=r.input.required,r.mobileInput.placeholder=r.input.placeholder,r.mobileFormatStr=pe==="datetime-local"?"Y-m-d\\TH:i:S":pe==="date"?"Y-m-d":"H:i:S",r.selectedDates.length>0&&(r.mobileInput.defaultValue=r.mobileInput.value=r.formatDate(r.selectedDates[0],r.mobileFormatStr)),r.config.minDate&&(r.mobileInput.min=r.formatDate(r.config.minDate,"Y-m-d")),r.config.maxDate&&(r.mobileInput.max=r.formatDate(r.config.maxDate,"Y-m-d")),r.input.getAttribute("step")&&(r.mobileInput.step=String(r.input.getAttribute("step"))),r.input.type="hidden",r.altInput!==void 0&&(r.altInput.type="hidden");try{r.input.parentNode&&r.input.parentNode.insertBefore(r.mobileInput,r.input.nextSibling)}catch{}m(r.mobileInput,"change",function(xe){r.setDate(Rs(xe).value,!1,r.mobileFormatStr),At("onChange"),At("onClose")})}function Pt(pe){if(r.isOpen===!0)return r.close();r.open(pe)}function At(pe,xe){if(r.config!==void 0){var De=r.config[pe];if(De!==void 0&&De.length>0)for(var tt=0;De[tt]&&tt=0&&Ms(pe,r.selectedDates[1])<=0}function gt(){r.config.noCalendar||r.isMobile||!r.monthNav||(r.yearElements.forEach(function(pe,xe){var De=new Date(r.currentYear,r.currentMonth,1);De.setMonth(r.currentMonth+xe),r.config.showMonths>1||r.config.monthSelectorType==="static"?r.monthElements[xe].textContent=B0(De.getMonth(),r.config.shorthandCurrentMonth,r.l10n)+" ":r.monthsDropdownContainer.value=De.getMonth().toString(),pe.value=De.getFullYear().toString()}),r._hidePrevMonthArrow=r.config.minDate!==void 0&&(r.currentYear===r.config.minDate.getFullYear()?r.currentMonth<=r.config.minDate.getMonth():r.currentYearr.config.maxDate.getMonth():r.currentYear>r.config.maxDate.getFullYear()))}function We(pe){var xe=pe||(r.config.altInput?r.config.altFormat:r.config.dateFormat);return r.selectedDates.map(function(De){return r.formatDate(De,xe)}).filter(function(De,tt,Le){return r.config.mode!=="range"||r.config.enableTime||Le.indexOf(De)===tt}).join(r.config.mode!=="range"?r.config.conjunction:r.l10n.rangeSeparator)}function Pe(pe){pe===void 0&&(pe=!0),r.mobileInput!==void 0&&r.mobileFormatStr&&(r.mobileInput.value=r.latestSelectedDateObj!==void 0?r.formatDate(r.latestSelectedDateObj,r.mobileFormatStr):""),r.input.value=We(r.config.dateFormat),r.altInput!==void 0&&(r.altInput.value=We(r.config.altFormat)),pe!==!1&&At("onValueUpdate")}function rt(pe){var xe=Rs(pe),De=r.prevMonthNav.contains(xe),tt=r.nextMonthNav.contains(xe);De||tt?B(De?-1:1):r.yearElements.indexOf(xe)>=0?xe.select():xe.classList.contains("arrowUp")?r.changeYear(r.currentYear+1):xe.classList.contains("arrowDown")&&r.changeYear(r.currentYear-1)}function Ze(pe){pe.preventDefault();var xe=pe.type==="keydown",De=Rs(pe),tt=De;r.amPM!==void 0&&De===r.amPM&&(r.amPM.textContent=r.l10n.amPM[jl(r.amPM.textContent===r.l10n.amPM[0])]);var Le=parseFloat(tt.getAttribute("min")),Ke=parseFloat(tt.getAttribute("max")),Fe=parseFloat(tt.getAttribute("step")),Ve=parseInt(tt.value,10),xt=pe.delta||(xe?pe.which===38?1:-1:0),dt=Ve+Fe*xt;if(typeof tt.value<"u"&&tt.value.length===2){var Tt=tt===r.hourElement,Mt=tt===r.minuteElement;dtKe&&(dt=tt===r.hourElement?dt-Ke-jl(!r.amPM):Le,Mt&&S(void 0,1,r.hourElement)),r.amPM&&Tt&&(Fe===1?dt+Ve===23:Math.abs(dt-Ve)>Fe)&&(r.amPM.textContent=r.l10n.amPM[jl(r.amPM.textContent===r.l10n.amPM[0])]),tt.value=ss(dt)}}return o(),r}function em(e,t){for(var r=Array.prototype.slice.call(e).filter(function(s){return s instanceof HTMLElement}),n=[],o=0;o{const c=s.current;if(!c)return;const u=Xi(c,{enableTime:!0,time_24hr:!0,dateFormat:"Y-m-d H:i",allowInput:!0,defaultDate:DI(e),onChange:d=>{const f=d[0];t(f?MI(f):"")}});return l.current=u,()=>{u.destroy(),l.current=null}},[]),j.useEffect(()=>{const c=l.current;if(!c)return;const u=c.selectedDates[0],d=u?MI(u):"";if(e===d)return;const f=DI(e);f?c.setDate(f,!1):c.clear(!1)},[e]),j.useEffect(()=>{const c=l.current;if(!c)return;const u=c.input;u.disabled=!!n,c.set("clickOpens",!n)},[n]),i.jsx("input",{ref:s,type:"text",placeholder:o,readOnly:!1,autoComplete:"off",style:{...r,...a?{borderColor:"var(--destructive)"}:{}}})}const da="__unassigned__",jp="__new__",doe=["Presentation","Panel","Keynote","Workshop","Qna","Demo","Debate","Symposium","Other"],foe=["Scheduled","Live","Completed","Cancelled"],poe={Presentation:"panel",Panel:"panel",Keynote:"keynote",Workshop:"workshop",Qna:"networking",Demo:"breakout",Debate:"panel",Symposium:"workshop",Other:"breakout"},hoe={keynote:"Keynote",workshop:"Workshop",panel:"Panel",breakout:"Other",networking:"Qna"},goe={Scheduled:"scheduled",Live:"ongoing",Completed:"completed",Cancelled:"cancelled"},moe={scheduled:"Scheduled",ongoing:"Live",completed:"Completed",cancelled:"Cancelled"};function qg(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const r=n=>String(n).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}`}function voe(e){const t=new Date(e);if(Number.isNaN(t.getTime())){const o=new Date;o.setHours(9,0,0,0);const a=new Date(o);return a.setHours(10,0,0,0),{start:qg(o.toISOString()),end:qg(a.toISOString())}}const r=new Date(t);r.setHours(9,0,0,0);const n=new Date(r);return n.setHours(10,0,0,0),{start:qg(r.toISOString()),end:qg(n.toISOString())}}const To={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"};function df({msg:e}){return e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"4px 0 0",fontFamily:"var(--font-noto-sans)"},children:e}):null}function yoe({n:e,state:t}){const r=t==="todo"?"var(--muted)":"var(--primary)";return i.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:r,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t==="done"?i.jsx(Oi,{size:13,style:{color:"#fff"}}):i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",color:"#fff",fontWeight:"var(--font-weight-medium)"},children:e})})}function xoe(e){var t;return(t=e==null?void 0:e.speakers)!=null&&t.length?e.speakers.map(r=>typeof r=="object"&&r&&"_id"in r?String(r._id):String(r)):[]}function zI(e,t){if(!e)return"";const r=e[t];return r==null||r===""?"":String(r)}function V$({eventId:e,eventName:t,eventStartIso:r,organizationId:n,tracks:o,initialTrackId:a,session:s,onClose:l,onSuccess:c,onTrackCreated:u}){const d=!!(s!=null&&s._id),f=j.useMemo(()=>voe(r),[r]),h=j.useMemo(()=>{if(!(s!=null&&s.track))return da;const zt=s.track;return typeof zt=="object"&&zt&&"_id"in zt?String(zt._id):String(zt)},[s]),[p,y]=j.useState(1),[m,x]=j.useState(()=>d?new Set([1,2,3,4]):new Set),[b,w]=j.useState(!1),[k,S]=j.useState(null),[_,P]=j.useState(()=>d?h:a===da?da:a&&a!==da?a:o.length?o[0]._id:jp),[O,T]=j.useState(""),[R,I]=j.useState(""),[E,A]=j.useState("general"),[F,L]=j.useState(!1),[z,V]=j.useState({}),[Q,U]=j.useState((s==null?void 0:s.title)||""),[ee,H]=j.useState((s==null?void 0:s.type)&&hoe[s.type]||"Presentation"),[B,M]=j.useState((s==null?void 0:s.status)&&moe[s.status]||"Scheduled"),[$,q]=j.useState(s!=null&&s.startTime?qg(s.startTime):f.start),[Y,K]=j.useState(s!=null&&s.endTime?qg(s.endTime):f.end),[G,re]=j.useState((s==null?void 0:s.description)||""),J=zt=>zt!==!1,[ae,le]=j.useState(()=>s?J(s.audienceFeedbackEnabled):!0),[me,Oe]=j.useState(()=>s?J(s.audienceRatingsEnabled):!0),[we,ie]=j.useState(()=>zI(s??null,"audienceFeedbackForm")),[Me,ke]=j.useState(()=>zI(s??null,"audienceRatingsForm")),[se,fe]=j.useState([]),[Ie,ce]=j.useState(!1),[je,qe]=j.useState([]),[Ne,Je]=j.useState(!0),[vt,Ge]=j.useState(()=>xoe(s)),[Ot,nt]=j.useState(""),[Ae,Te]=j.useState(!1),[wt,ft]=j.useState(""),[Pt,At]=j.useState(""),[Ht,Se]=j.useState(""),[ct,gt]=j.useState(""),[We,Pe]=j.useState(""),[rt,Ze]=j.useState({}),[pe,xe]=j.useState(!1);j.useEffect(()=>{let zt=!1;return(async()=>{var Gr;Je(!0);const yr={limit:500};n&&(yr.organization=n);const Xn=await Ef.list(yr);!zt&&((Gr=Xn.data)!=null&&Gr.speakers)&&qe(Xn.data.speakers),zt||Je(!1)})(),()=>{zt=!0}},[n]),j.useEffect(()=>{const zt=n==null?void 0:n.trim();if(!zt){fe([]);return}let yr=!1;return ce(!0),Ma.list({organization:zt}).then(Xn=>{yr||fe(Xn.filter(Gr=>Gr.type==="feedback"))}).catch(()=>{yr||fe([])}).finally(()=>{yr||ce(!1)}),()=>{yr=!0}},[n]);const De=j.useCallback(zt=>{const yr=je.find(Xn=>Xn._id===zt);return yr?`${yr.firstName} ${yr.lastName}`.trim():`Speaker…${zt.slice(-6)}`},[je]),tt=zt=>{!zt||vt.includes(zt)||Ge(yr=>[...yr,zt])},Le=zt=>Ge(yr=>yr.filter(Xn=>Xn!==zt)),Ke=async()=>{const zt={};if(wt.trim()||(zt.firstName="First name is required."),Pt.trim()||(zt.lastName="Last name is required."),Ht.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Ht.trim())||(zt.email="Enter a valid email."):zt.email="Email is required.",Ze(zt),Object.keys(zt).length)return;xe(!0);const yr=await Ef.create({firstName:wt.trim(),lastName:Pt.trim(),email:Ht.trim().toLowerCase(),phone:ct.trim()||void 0,title:We.trim()||void 0,...n?{organization:n}:{}});if(xe(!1),yr.error||!yr.data){Ze({email:yr.error||"Could not create speaker"});return}const Xn=yr.data;qe(Gr=>[Xn,...Gr.filter(Ut=>Ut._id!==Xn._id)]),tt(Xn._id),ft(""),At(""),Se(""),gt(""),Pe(""),Ze({}),Te(!1)},[Fe,Ve]=j.useState({}),[xt,dt]=j.useState({}),[Tt,Mt]=j.useState({}),[fr,hr]=j.useState({}),Qr=j.useCallback(()=>{const zt={};return _===jp?zt.track='Choose "Add new track" and fill the form below, or pick an existing track.':_||(zt.track="Select a track."),Ve(zt),Object.keys(zt).length===0},[_]),Rn=j.useCallback(()=>{const zt={};return Q.trim()||(zt.title="Session title is required."),dt(zt),Object.keys(zt).length===0},[Q]),to=j.useCallback(()=>{const zt={};$||(zt.start="Start date and time required."),Y||(zt.end="End date and time required.");const yr=new Date($).getTime(),Xn=new Date(Y).getTime();return $&&Y&&!(Xn>yr)&&(zt.end="End must be after start."),Mt(zt),Object.keys(zt).length===0},[$,Y]),Ln=j.useCallback(()=>(hr({}),!0),[]),vo=j.useCallback(()=>Qr()&&Rn()&&to()&&Ln(),[Qr,Rn,to,Ln]),ro=async()=>{const zt={};if(O.trim()||(zt.name="Track name is required."),V(zt),Object.keys(zt).length)return;L(!0);const yr=await rh.create(e,{name:O.trim(),hall:R.trim()||void 0,trackType:E,status:"active"});if(L(!1),yr.error||!yr.data){V({name:yr.error||"Could not create track"});return}const Xn=yr.data;u(Xn),P(Xn._id),T(""),I(""),V({})},ys=zt=>{zt===1&&!Qr()||zt===2&&!Rn()||zt===3&&!to()||zt===4&&!Ln()||(x(yr=>new Set([...yr,zt])),zt<4&&y(zt+1))},zo=async()=>{if(S(null),_===jp){y(1),Qr();return}if(!vo()){Qr()?Rn()?to()?y(4):y(3):y(2):y(1);return}const zt={title:Q.trim(),description:G.trim()||void 0,type:poe[ee],startTime:new Date($).toISOString(),endTime:new Date(Y).toISOString(),status:goe[B],track:_===da?null:_,speakers:vt,audienceFeedbackEnabled:ae,audienceRatingsEnabled:me,audienceFeedbackForm:ae&&we.trim()||null,audienceRatingsForm:me&&Me.trim()||null};w(!0);const yr=d?await Da.update(s._id,zt):await Da.create(e,zt);if(w(!1),yr.error){S(yr.error);return}c(),l()},$a=[{n:1,title:"Track",subtitle:"Assign this session to a track. You can create a new track inline."},{n:2,title:"Session details",subtitle:"Title, format, and status."},{n:3,title:"Schedule",subtitle:"Start and end date/time."},{n:4,title:"Speakers & notes",subtitle:"Faculty from your organization; add new speakers as needed."}],xa=()=>i.jsx("button",{type:"button",disabled:b,onClick:zo,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:b?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:b?.85:1},children:b?"Saving…":"Save session"});return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:l,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(560px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)"},children:[i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 4px",fontFamily:"var(--font-noto-sans)"},children:t}),i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:d?"Edit session":"New session"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"6px 0 0",fontFamily:"var(--font-noto-sans)"},children:"Complete each section to continue. Top and bottom Save submit the session."})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:l,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(er,{size:14})}),i.jsx(xa,{})]})]}),k&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-xs)",marginTop:"10px",fontFamily:"var(--font-noto-sans)"},children:k})]}),i.jsx("div",{style:{flex:1,overflowY:"auto"},children:$a.map(zt=>{const yr=p===zt.n,Xn=m.has(zt.n),Gr=yr?"active":Xn?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{type:"button",onClick:()=>y(yr?0:zt.n),style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(yoe,{n:zt.n,state:Gr}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:yr?"var(--primary)":"var(--card-foreground)",margin:0},children:zt.title}),!yr&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:zt.subtitle})]}),yr?i.jsx($f,{size:18,style:{color:"var(--muted)"}}):i.jsx(po,{size:18,style:{color:"var(--muted)"}})]}),yr&&i.jsxs("div",{style:{padding:"0 20px 16px 52px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 14px",fontFamily:"var(--font-noto-sans)"},children:zt.subtitle}),zt.n===1&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("div",{children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:["Track ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsxs("select",{value:_===jp?jp:_,onChange:Ut=>{const $i=Ut.target.value;P($i),Ve({})},style:{...To,cursor:"pointer"},children:[i.jsx("option",{value:da,children:"Unassigned"}),o.map(Ut=>i.jsxs("option",{value:Ut._id,children:[Ut.name,Ut.hall?` · ${Ut.hall}`:""]},Ut._id)),i.jsx("option",{value:jp,children:"+ Add new track"})]}),i.jsx(df,{msg:Fe.track})]}),_===jp&&i.jsxs("div",{style:{padding:"14px",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:"var(--secondary)",display:"flex",flexDirection:"column",gap:"10px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontWeight:"600",margin:0,fontFamily:"var(--font-noto-sans)"},children:"New track"}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Name *"}),i.jsx("input",{value:O,onChange:Ut=>{T(Ut.target.value),z.name&&V({})},placeholder:"Track name",style:To}),i.jsx(df,{msg:z.name})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Type"}),i.jsxs("select",{value:E,onChange:Ut=>A(Ut.target.value),style:{...To,cursor:"pointer"},children:[i.jsx("option",{value:"general",children:"General"}),i.jsx("option",{value:"workshop",children:"Workshop"}),i.jsx("option",{value:"plenary",children:"Plenary"}),i.jsx("option",{value:"symposium",children:"Symposium"})]})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Hall / venue"}),i.jsx("input",{value:R,onChange:Ut=>I(Ut.target.value),placeholder:"Optional",style:To})]}),i.jsxs("button",{type:"button",disabled:F,onClick:ro,style:{display:"inline-flex",alignItems:"center",gap:"6px",alignSelf:"flex-start",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:F?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(wr,{size:14})," ",F?"Creating…":"Create track & select"]})]})]}),zt.n===2&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("div",{children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:["Title ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx("input",{value:Q,onChange:Ut=>{U(Ut.target.value),xt.title&&dt({})},placeholder:"Session title",style:To}),i.jsx(df,{msg:xt.title})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Type"}),i.jsx("select",{value:ee,onChange:Ut=>H(Ut.target.value),style:{...To,cursor:"pointer"},children:doe.map(Ut=>i.jsx("option",{value:Ut,children:Ut},Ut))})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Status"}),i.jsx("select",{value:B,onChange:Ut=>M(Ut.target.value),style:{...To,cursor:"pointer"},children:foe.map(Ut=>i.jsx("option",{value:Ut,children:Ut},Ut))})]})]})]}),zt.n===3&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("div",{children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:["Start ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx(jf,{value:$,onChange:Ut=>{q(Ut),Tt.start&&Mt({})},style:To,hasError:!!Tt.start,disabled:b}),i.jsx(df,{msg:Tt.start})]}),i.jsxs("div",{children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:["End ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx(jf,{value:Y,onChange:Ut=>{K(Ut),Tt.end&&Mt({})},style:To,hasError:!!Tt.end,disabled:b}),i.jsx(df,{msg:Tt.end})]})]}),zt.n===4&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Speakers"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 8px",fontFamily:"var(--font-noto-sans)"},children:"Select from your organization's faculty directory or add someone new."}),vt.length>0&&i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"10px"},children:vt.map(Ut=>i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 8px 4px 10px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[De(Ut),i.jsx("button",{type:"button",onClick:()=>Le(Ut),style:{display:"flex",padding:0,border:"none",background:"none",cursor:"pointer",color:"var(--muted)"},"aria-label":"Remove",children:i.jsx(er,{size:12})})]},Ut))}),Ne?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading faculty…"}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{position:"relative",marginBottom:"8px"},children:[i.jsx(Pi,{size:14,style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)"}}),i.jsx("input",{value:Ot,onChange:Ut=>nt(Ut.target.value),placeholder:"Search by name or email…",style:{...To,paddingLeft:"32px"}})]}),i.jsx("div",{style:{maxHeight:"160px",overflowY:"auto",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)"},children:(()=>{const Ut=je.filter(oi=>!vt.includes(oi._id)),$i=Ot.trim().toLowerCase(),yo=Ut.filter(oi=>$i?`${oi.firstName} ${oi.lastName}`.toLowerCase().includes($i)||(oi.email||"").toLowerCase().includes($i):!0);return je.length===0?i.jsx("p",{style:{padding:"12px",fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:"No speakers in the directory yet. Add one below."}):Ut.length===0?i.jsx("p",{style:{padding:"12px",fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:"Everyone listed is already on this session. Add a new speaker or remove someone above."}):yo.length===0?i.jsx("p",{style:{padding:"12px",fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:"No matches. Try another search."}):yo.slice(0,80).map(oi=>i.jsxs("button",{type:"button",onClick:()=>tt(oi._id),style:{width:"100%",textAlign:"left",padding:"8px 12px",border:"none",borderBottom:"1px solid var(--border)",background:"transparent",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},onMouseEnter:xc=>{xc.currentTarget.style.background="var(--secondary)"},onMouseLeave:xc=>{xc.currentTarget.style.background="transparent"},children:[i.jsxs("span",{style:{fontWeight:"var(--font-weight-medium)"},children:[oi.firstName," ",oi.lastName]}),oi.title&&i.jsx("span",{style:{color:"var(--muted)",fontSize:"var(--text-xs)",marginLeft:"6px"},children:oi.title}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)"},children:oi.email})]},oi._id))})()})]}),i.jsxs("button",{type:"button",onClick:()=>{Te(Ut=>!Ut),Ze({})},style:{display:"inline-flex",alignItems:"center",gap:"6px",marginTop:"4px",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px dashed var(--border)",background:"transparent",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--primary)"},children:[i.jsx(z6,{size:14})," ",Ae?"Hide new speaker form":"Add new speaker"]}),Ae&&i.jsxs("div",{style:{marginTop:"10px",padding:"14px",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:"var(--secondary)",display:"flex",flexDirection:"column",gap:"10px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontWeight:"600",margin:0,fontFamily:"var(--font-noto-sans)"},children:"New faculty member (saved to your organization)"}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"First name *"}),i.jsx("input",{value:wt,onChange:Ut=>{ft(Ut.target.value),rt.firstName&&Ze({})},style:To}),i.jsx(df,{msg:rt.firstName})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Last name *"}),i.jsx("input",{value:Pt,onChange:Ut=>{At(Ut.target.value),rt.lastName&&Ze({})},style:To}),i.jsx(df,{msg:rt.lastName})]})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Email *"}),i.jsx("input",{type:"email",value:Ht,onChange:Ut=>{Se(Ut.target.value),rt.email&&Ze({})},style:To}),i.jsx(df,{msg:rt.email})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Phone"}),i.jsx("input",{value:ct,onChange:Ut=>gt(Ut.target.value),style:To})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Title / role"}),i.jsx("input",{value:We,onChange:Ut=>Pe(Ut.target.value),placeholder:"e.g. Prof. of Medicine",style:To})]})]}),i.jsxs("button",{type:"button",disabled:pe,onClick:Ke,style:{alignSelf:"flex-start",display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:pe?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:14})," ",pe?"Saving…":"Create & attach to session"]})]})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Session notes"}),i.jsx("textarea",{value:G,onChange:Ut=>re(Ut.target.value),rows:2,style:{...To,resize:"vertical"},placeholder:"Optional description for this session"})]}),i.jsxs("div",{style:{marginTop:"4px",padding:"14px",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:"var(--secondary)",display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontWeight:"600",margin:0,fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:"Attendee session page"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)",lineHeight:1.45},children:"Controls whether this session's mobile page shows quick links to feedback and ratings. The event must also have those features turned on in registration settings."}),i.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"10px",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"checkbox",checked:ae,onChange:Ut=>{const $i=Ut.target.checked;le($i),$i||ie("")},style:{marginTop:"3px",width:"16px",height:"16px",flexShrink:0}}),i.jsxs("span",{style:{flex:1,minWidth:0},children:[i.jsx("span",{style:{fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:"Feedback form"}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"2px"},children:"Show a link to submit event feedback from this session page."})]})]}),ae?i.jsxs("div",{style:{margin:"-4px 0 4px 26px"},children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",marginBottom:"6px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Which form?"}),i.jsxs("select",{value:we,onChange:Ut=>ie(Ut.target.value),disabled:Ie,style:{...To,cursor:Ie?"wait":"pointer",maxWidth:"100%"},children:[i.jsx("option",{value:"",children:"Default form"}),se.map(Ut=>i.jsx("option",{value:Ut._id,children:Ut.name},Ut._id))]}),n!=null&&n.trim()?null:i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"6px 0 0",fontFamily:"var(--font-noto-sans)",lineHeight:1.45},children:"Organization is required on the event to load forms from Forms & Workflow → Feedback."})]}):null,i.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"10px",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"checkbox",checked:me,onChange:Ut=>{const $i=Ut.target.checked;Oe($i),$i||ke("")},style:{marginTop:"3px",width:"16px",height:"16px",flexShrink:0}}),i.jsxs("span",{style:{flex:1,minWidth:0},children:[i.jsx("span",{style:{fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:"Ratings section"}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"2px"},children:"Show a link to rate the event from this session page."})]})]}),me?i.jsxs("div",{style:{margin:"-4px 0 0 26px"},children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",marginBottom:"6px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Which form?"}),i.jsxs("select",{value:Me,onChange:Ut=>ke(Ut.target.value),disabled:Ie,style:{...To,cursor:Ie?"wait":"pointer",maxWidth:"100%"},children:[i.jsx("option",{value:"",children:"Default form"}),se.map(Ut=>i.jsx("option",{value:Ut._id,children:Ut.name},Ut._id))]})]}):null]})]}),i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"16px",paddingTop:"12px",borderTop:"1px solid var(--border)"},children:zt.n<4?i.jsx("button",{type:"button",onClick:()=>ys(zt.n),style:{padding:"6px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"Next section"}):i.jsx(xa,{})})]})]},zt.n)})}),i.jsxs("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:"10px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:l,style:{padding:"7px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx(xa,{})]})]})]})}function P1(e){return e==null||Number.isNaN(e)?"—":e.toLocaleString()}function boe({loading:e,participantCount:t,sessionCount:r,quizPollCount:n,pointsAwarded:o,statusCounts:a,upcomingSessionCount:s,pointsRedeemed:l}){const c=qi(),u=c==="mobile"?2:4,d=j.useMemo(()=>{if(e)return;const y=(a==null?void 0:a.checked_in)??0,m=(a==null?void 0:a.confirmed)??0;if(y)return`${y.toLocaleString()} checked in`;if(m)return`${m.toLocaleString()} confirmed`},[e,a]),f=!e&&s!=null&&s>0?`${s} upcoming`:void 0,h=!e&&l!=null&&l>0?`${l.toLocaleString()} redeemed`:void 0,p=[{icon:i.jsx(vi,{size:15}),label:"Participants",value:e?"—":P1(t),trend:d,trendUp:!!(a!=null&&a.checked_in&&a.checked_in>0),accent:"var(--chart-1)"},{icon:i.jsx(Sq,{size:15}),label:"Sessions",value:e?"—":P1(r),trend:f,trendUp:!1,accent:"var(--chart-3)"},{icon:i.jsx(nu,{size:15}),label:"Quizzes & Polls",value:e?"—":P1(n),trend:void 0,trendUp:!1,accent:"var(--chart-4)"},{icon:i.jsx(od,{size:15}),label:"Points Awarded",value:e?"—":P1(o),trend:h,trendUp:!1,accent:"var(--chart-2)"}];return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u}, 1fr)`,gap:c==="mobile"?"10px":"12px"},children:p.map((y,m)=>i.jsxs("div",{style:{background:"var(--card)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"3px",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:y.accent,borderRadius:"var(--radius-card)",padding:c==="mobile"?"14px 14px":"16px 20px",display:"flex",alignItems:"flex-start",gap:"12px"},children:[i.jsx("div",{style:{width:"30px",height:"30px",borderRadius:"var(--radius-button)",background:y.accent+"15",display:"flex",alignItems:"center",justifyContent:"center",color:y.accent,flexShrink:0,marginTop:"2px"},children:y.icon}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:c==="mobile"?"var(--text-xl)":"var(--text-2xl)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.1"},children:y.value}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"3px",lineHeight:"1.3"},children:y.label}),y.trend&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:y.trendUp?"#16a34a":"var(--muted)",marginTop:"6px",lineHeight:"1.2"},children:y.trend})]})]},m))})}const O1={width:"100%",height:"36px",padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)",outline:"none",boxSizing:"border-box"},wg={fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px",display:"block"},Xj=i.jsx("span",{style:{color:"var(--destructive)",marginLeft:"2px"},children:"*"}),woe=["Single Choice","Multiple Choice","True / False"];function Soe(e){return!!(e.text.trim()||e.imageUrl)}function BI({onSave:e,onClose:t,initial:r,eventId:n}){const[o,a]=j.useState((r==null?void 0:r.text)??""),[s,l]=j.useState((r==null?void 0:r.type)??"Single Choice"),[c,u]=j.useState((r==null?void 0:r.order)??0),[d,f]=j.useState((r==null?void 0:r.status)??"Active"),[h,p]=j.useState((r==null?void 0:r.imageUrl)??""),[y,m]=j.useState((r==null?void 0:r.options)??[{id:"o1",text:"",isCorrect:!1},{id:"o2",text:"",isCorrect:!1}]),[x,b]=j.useState(()=>{var U;return(r==null?void 0:r.useImagesOptions)??((U=r==null?void 0:r.options)==null?void 0:U.some(ee=>ee.imageUrl))??!1}),[w,k]=j.useState({}),[S,_]=j.useState(null),[P,O]=j.useState(null),T=j.useRef(null),R=()=>m(U=>[...U,{id:`o${Date.now()}`,text:"",isCorrect:!1}]),I=U=>m(ee=>ee.filter(H=>H.id!==U)),E=(U,ee,H)=>m(B=>B.map(M=>M.id!==U?M:ee==="isCorrect"&&H===!0&&s==="Single Choice"?{...M,isCorrect:!0}:{...M,[ee]:H}).map(M=>ee==="isCorrect"&&H===!0&&s==="Single Choice"&&M.id!==U?{...M,isCorrect:!1}:M)),A=async(U,ee)=>{O(null),_(ee);try{const H=await Ys(U,{eventId:n,module:"quiz-polls"});H!=null&&H.url&&(ee==="question"?p(H.url):E(ee,"imageUrl",H.url))}catch(H){O(H instanceof Error?H.message:"Upload failed")}finally{_(null)}},F=U=>{var H;const ee=(H=U.target.files)==null?void 0:H[0];U.target.value="",ee&&A(ee,"question")},L=(U,ee)=>{var B;const H=(B=ee.target.files)==null?void 0:B[0];ee.target.value="",H&&A(H,U)},z=()=>{const U={};return o.trim()||(U.text="Question text is required."),y.filter(Soe).length<2&&(U.options="At least 2 options with text and/or image are required."),k(U),Object.keys(U).length===0},V=()=>{z()&&(e({id:(r==null?void 0:r.id)??`q${Date.now()}`,text:o.trim(),type:s,order:c,status:d,options:y,imageUrl:h.trim()||void 0,useImagesOptions:x}),t())},Q=S==="question";return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.28)",zIndex:200,display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:"580px",maxHeight:"92vh",display:"flex",flexDirection:"column",boxShadow:"var(--elevation-sm)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 24px",borderBottom:"1px solid var(--border)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:r?"Edit Question":"Add Question"}),i.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex"},children:i.jsx(er,{size:16})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px",display:"flex",flexDirection:"column",gap:"18px"},children:[i.jsxs("div",{children:[i.jsxs("label",{style:wg,children:["Question ",Xj]}),i.jsx("textarea",{value:o,onChange:U=>{a(U.target.value),w.text&&k(ee=>({...ee,text:""}))},rows:3,placeholder:"Enter your question…",style:{...O1,height:"auto",padding:"10px",resize:"vertical",lineHeight:"1.5",borderColor:w.text?"var(--destructive)":"var(--border)"},onFocus:U=>{U.currentTarget.style.borderColor="var(--ring)"},onBlur:U=>{U.currentTarget.style.borderColor=w.text?"var(--destructive)":"var(--border)"}}),w.text&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginTop:"4px"},children:w.text})]}),i.jsxs("div",{children:[i.jsx("label",{style:wg,children:"Question Image"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden"},children:[i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",padding:"0 14px",height:"36px",background:Q?"var(--border)":"var(--secondary)",cursor:Q?"wait":"pointer",borderRight:"1px solid var(--border)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",whiteSpace:"nowrap",flexShrink:0},children:[i.jsx(R0,{size:13,style:{color:"var(--muted)"}}),Q?"Uploading…":"Choose File",i.jsx("input",{ref:T,type:"file",accept:"image/*",disabled:!!Q,onChange:F,style:{display:"none"}})]}),i.jsx("span",{style:{padding:"0 12px",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0},children:h?"Image attached":"No file chosen"}),h&&i.jsx("button",{type:"button",onClick:()=>p(""),style:{padding:"0 10px",height:"36px",border:"none",background:"transparent",color:"var(--destructive)",fontSize:"var(--text-xs)",cursor:"pointer",flexShrink:0},children:"Remove"})]}),h&&i.jsx("img",{src:h,alt:"",style:{marginTop:"8px",maxWidth:"100%",maxHeight:"160px",borderRadius:"var(--radius-button)",objectFit:"contain",border:"1px solid var(--border)"}}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px"},children:"Optional: uploads via media library (S3 / CloudFront)"}),P&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",marginTop:"4px"},children:P})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"14px"},children:[i.jsxs("div",{children:[i.jsxs("label",{style:wg,children:["Question Type ",Xj]}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("select",{value:s,onChange:U=>l(U.target.value),style:{...O1,appearance:"none",paddingRight:"28px",cursor:"pointer"},children:woe.map(U=>i.jsx("option",{value:U,children:U},U))}),i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:"var(--muted)"},fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("path",{d:"M2 4l4 4 4-4"})})]})]}),i.jsxs("div",{children:[i.jsx("label",{style:wg,children:"Order"}),i.jsx("input",{type:"number",min:0,value:c,onChange:U=>u(Number(U.target.value)),style:O1,onFocus:U=>{U.currentTarget.style.borderColor="var(--ring)"},onBlur:U=>{U.currentTarget.style.borderColor="var(--border)"}})]})]}),i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[i.jsxs("label",{style:{...wg,marginBottom:0},children:["Options ",Xj]}),i.jsxs("button",{type:"button",onClick:()=>b(U=>!U),style:{display:"flex",alignItems:"center",gap:"6px",background:"none",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[i.jsx("span",{style:{width:"14px",height:"14px",borderRadius:"50%",background:x?"var(--primary)":"var(--border)",display:"block",flexShrink:0}}),"Use Images in Options"]})]}),w.options&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginBottom:"6px"},children:w.options}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:y.map((U,ee)=>i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",padding:x?"10px":"0",border:x?"1px solid var(--border)":"none",borderRadius:"var(--radius-button)",background:x?"var(--secondary)":"transparent"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("input",{type:"text",placeholder:x?`Label / alt text (option ${ee+1})`:`Enter option ${ee+1}`,value:U.text,onChange:H=>E(U.id,"text",H.target.value),style:{...O1,flex:1},onFocus:H=>{H.currentTarget.style.borderColor="var(--ring)"},onBlur:H=>{H.currentTarget.style.borderColor="var(--border)"}}),i.jsxs("button",{type:"button",onClick:()=>E(U.id,"isCorrect",!U.isCorrect),style:{display:"flex",alignItems:"center",gap:"5px",padding:"0 10px",height:"36px",borderRadius:"var(--radius-button)",border:`1px solid ${U.isCorrect?"#16a34a":"var(--border)"}`,background:U.isCorrect?"#f0fdf4":"var(--card)",color:U.isCorrect?"#15803d":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:U.isCorrect?"var(--font-weight-medium)":"var(--font-weight-normal)",cursor:"pointer",transition:"all 0.12s",whiteSpace:"nowrap",flexShrink:0},children:[U.isCorrect&&i.jsx(Oi,{size:11,strokeWidth:2.5}),"Correct"]}),i.jsx("button",{type:"button",onClick:()=>y.length>2&&I(U.id),disabled:y.length<=2,style:{width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"none",background:y.length<=2?"var(--border)":"var(--destructive)",color:"#fff",cursor:y.length<=2?"not-allowed":"pointer",flexShrink:0},children:i.jsx(gn,{size:13})})]}),x&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"0 12px",height:"32px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:S===U.id?"var(--border)":"var(--card)",cursor:S===U.id?"wait":"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(R0,{size:12}),S===U.id?"Uploading…":"Option image",i.jsx("input",{type:"file",accept:"image/*",disabled:S===U.id,onChange:H=>L(U.id,H),style:{display:"none"}})]}),U.imageUrl&&i.jsxs(i.Fragment,{children:[i.jsx("img",{src:U.imageUrl,alt:"",style:{width:"48px",height:"48px",objectFit:"cover",borderRadius:"6px",border:"1px solid var(--border)"}}),i.jsx("button",{type:"button",onClick:()=>E(U.id,"imageUrl",""),style:{fontSize:"var(--text-xs)",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:"Remove image"})]})]})]},U.id))}),i.jsxs("button",{type:"button",onClick:R,style:{display:"inline-flex",alignItems:"center",gap:"5px",marginTop:"10px",padding:"5px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"transparent",color:"var(--primary)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:[i.jsx(wr,{size:13})," Add Option"]})]}),i.jsxs("div",{children:[i.jsx("label",{style:wg,children:"Status"}),i.jsx("div",{style:{display:"flex",gap:"8px"},children:["Active","Draft"].map(U=>i.jsx("button",{type:"button",onClick:()=>f(U),style:{padding:"6px 16px",borderRadius:"var(--radius-button)",border:`1px solid ${d===U?"var(--primary)":"var(--border)"}`,background:d===U?"var(--accent)":"var(--card)",color:d===U?"var(--primary)":"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:d===U?"var(--font-weight-medium)":"var(--font-weight-normal)",cursor:"pointer"},children:U},U))})]})]}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:V,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:"Save Question"})]})]})})}const Yu={width:"100%",height:"36px",padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)",outline:"none",boxSizing:"border-box"},joe={fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"5px",display:"block"},W0={fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px",lineHeight:"1.45"},koe=i.jsx("span",{style:{color:"var(--destructive)",marginLeft:"2px"},children:"*"}),_oe=["always_live","always_sched","manual","quiz_master"],Coe=[{value:"",label:"-- Select Display Mode --"},{value:"always_live",label:"Always Visible and Live"},{value:"always_sched",label:"Always Visible and Scheduled Live"},{value:"quiz_master",label:"Quiz Master mode (1 question at a time manually)"},{value:"manual",label:"Not Visible and Manual Live"}],lE=["-- Select Status --","Active","Draft"];function nT(){return{title:"",description:"",status:lE[0],displayMode:"",isLive:"No",scheduledStart:"",scheduledEnd:"",timeRestricted:"No",timeLimit:0,showResults:"No",multipleAttempts:"No",rewardQuizPollSubmitted:"",rewardQuizCorrectPerQuestion:"",rewardPollParticipation:""}}function q0(e){if(!e)return"";const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const r=n=>String(n).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}`}function $0(e){if(!(e!=null&&e.trim()))return;const t=new Date(e).getTime();if(!Number.isNaN(t))return new Date(t).toISOString()}function WI(){const e=new Date;e.setMinutes(0,0,0);const t=new Date(e.getTime()+7200*1e3);return{start:q0(e.toISOString()),end:q0(t.toISOString())}}function Eoe(e){return _oe.includes(e)}function Aoe(e,t){const r=e.settings||{},n=r.rewardRules&&typeof r.rewardRules=="object"?r.rewardRules:{};let o=typeof r.displayMode=="string"?r.displayMode:"";(!o||!Eoe(o))&&(r.startTime&&r.endTime?o="always_sched":o="always_live");const a=o==="always_sched",s=typeof r.status=="string"?r.status:"",l=typeof r.isLive=="boolean"?r.isLive:r.isActive===!0,c=s==="draft"||!s&&typeof r.isLive!="boolean"&&r.isActive===!1;return{form:{title:e.title||"",description:e.description||"",status:c?"Draft":"Active",displayMode:o,isLive:l?"Yes":"No",scheduledStart:a?q0(r.startTime):"",scheduledEnd:a?q0(r.endTime):"",timeRestricted:r.timeRestricted===!0?"Yes":"No",timeLimit:typeof r.timeLimit=="number"&&Number.isFinite(r.timeLimit)?r.timeLimit:0,showResults:r.showResults!==!1?"Yes":"No",multipleAttempts:r.allowMultipleAttempts?"Yes":"No",rewardQuizPollSubmitted:n.quizPollSubmitted!=null&&n.quizPollSubmitted!==""?String(n.quizPollSubmitted):"",rewardQuizCorrectPerQuestion:n.quizCorrectPerQuestion!=null&&n.quizCorrectPerQuestion!==""?String(n.quizCorrectPerQuestion):"",rewardPollParticipation:n.pollParticipation!=null&&n.pollParticipation!==""?String(n.pollParticipation):""},questions:t}}function Sg(e){const t=String(e??"").trim();if(t==="")return;const r=Number(t);return Number.isFinite(r)?r:void 0}function iT(e,t){const r=e.displayMode==="always_sched",n={status:e.status==="Draft"?"draft":"active",isLive:e.isLive==="Yes",displayMode:e.displayMode||"always_live",startTime:r?$0(e.scheduledStart)??null:null,endTime:r?$0(e.scheduledEnd)??null:null,showResults:e.showResults==="Yes",allowMultipleAttempts:e.multipleAttempts==="Yes",timeRestricted:e.timeRestricted==="Yes",timeLimit:Math.max(0,Math.floor(Number(e.timeLimit))||0)},o={};if(t==="quiz"){const a=Sg(e.rewardQuizPollSubmitted),s=Sg(e.rewardQuizCorrectPerQuestion);a!==void 0&&(o.quizPollSubmitted=a),s!==void 0&&(o.quizCorrectPerQuestion=s)}else if(t==="poll"){const a=Sg(e.rewardPollParticipation);a!==void 0&&(o.pollParticipation=a)}else{const a=Sg(e.rewardQuizPollSubmitted),s=Sg(e.rewardQuizCorrectPerQuestion),l=Sg(e.rewardPollParticipation);a!==void 0&&(o.quizPollSubmitted=a),s!==void 0&&(o.quizCorrectPerQuestion=s),l!==void 0&&(o.pollParticipation=l)}return Object.keys(o).length&&(n.rewardRules=o),n}function is({label:e,hint:t,required:r,error:n,children:o}){return i.jsxs("div",{children:[i.jsxs("label",{style:joe,children:[e,r&&koe]}),o,t&&!n&&i.jsx("p",{style:W0,children:t}),n&&i.jsx("p",{style:{...W0,color:"var(--destructive)"},children:n})]})}function jg({value:e,onChange:t,options:r,error:n}){const o=r.map(a=>typeof a=="string"?{value:a,label:a}:a);return i.jsxs("div",{style:{position:"relative"},children:[i.jsx("select",{value:e,onChange:a=>t(a.target.value),style:{...Yu,appearance:"none",paddingRight:"28px",cursor:"pointer",borderColor:n?"var(--destructive)":"var(--border)"},children:o.map(a=>i.jsx("option",{value:a.value,children:a.label},a.value))}),i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:"var(--muted)"},fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("path",{d:"M2 4l4 4 4-4"})})]})}function Toe({q:e,index:t,onEdit:r,onDelete:n}){const[o,a]=j.useState(!1);return i.jsxs("div",{onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"12px 14px",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:o?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsx("span",{style:{width:"22px",height:"22px",borderRadius:"50%",background:"var(--accent)",color:"var(--primary)",fontSize:"11px",fontFamily:"var(--font-inter)",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginTop:"1px"},children:t+1}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"flex-start"},children:[e.imageUrl&&i.jsx("img",{src:e.imageUrl,alt:"",style:{width:"44px",height:"44px",objectFit:"cover",borderRadius:"6px",border:"1px solid var(--border)",flexShrink:0}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",lineHeight:"1.4",marginBottom:"4px",flex:1,minWidth:0},children:e.text})]}),i.jsxs("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",padding:"1px 7px",borderRadius:"3px",background:"var(--accent)",color:"var(--accent-foreground)"},children:e.type}),i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[e.options.length," options"]}),e.options.some(s=>s.imageUrl)&&i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"with images"}),i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"#15803d"},children:[e.options.filter(s=>s.isCorrect).length," correct"]})]})]}),i.jsxs("div",{style:{display:"flex",gap:"4px",opacity:o?1:0,transition:"opacity 0.15s",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:r,style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},onMouseEnter:s=>{s.currentTarget.style.borderColor="var(--primary)",s.currentTarget.style.color="var(--primary)"},onMouseLeave:s=>{s.currentTarget.style.borderColor="var(--border)",s.currentTarget.style.color="var(--muted)"},children:i.jsx(Ii,{size:12})}),i.jsx("button",{type:"button",onClick:n,style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},onMouseEnter:s=>{s.currentTarget.style.borderColor="var(--destructive)",s.currentTarget.style.color="var(--destructive)"},onMouseLeave:s=>{s.currentTarget.style.borderColor="var(--border)",s.currentTarget.style.color="var(--muted)"},children:i.jsx(gn,{size:12})})]})]})}function ax({kind:e,initial:t,onClose:r,onSave:n,eventId:o,variant:a="modal"}){const[s,l]=j.useState("settings"),[c,u]=j.useState((t==null?void 0:t.questions)??[]),[d,f]=j.useState(!1),[h,p]=j.useState(null),[y,m]=j.useState({}),[x,b]=j.useState((t==null?void 0:t.form)??nT()),w=e==="poll"?"Poll":"Quiz",k=(A,F)=>{b(L=>({...L,[A]:F})),y[A]&&m(L=>({...L,[A]:""}))},S=()=>{const A={};if(x.title.trim()||(A.title=`${w} title is required.`),x.status===lE[0]&&(A.status="Please select a status."),x.displayMode||(A.displayMode="Please select a display mode."),x.displayMode==="always_sched"){x.scheduledStart.trim()||(A.scheduledStart="Start date & time is required."),x.scheduledEnd.trim()||(A.scheduledEnd="End date & time is required.");const F=new Date(x.scheduledStart).getTime(),L=new Date(x.scheduledEnd).getTime();Number.isFinite(F)&&Number.isFinite(L)&&L<=F&&(A.scheduledEnd="End must be after start.")}return m(A),Object.keys(A).length===0},_=()=>{if(c.length===0){m(A=>({...A,questions:"Add at least one question."}));return}n==null||n({form:x,questions:c})},P=A=>u(F=>[...F,A]),O=A=>u(F=>F.filter(L=>L.id!==A)),T=A=>u(F=>F.map(L=>L.id===A.id?A:L)),R=[{value:"No",label:"No"},{value:"Yes",label:"Yes"}],E=i.jsxs("div",{style:{background:"var(--card)",borderRadius:a==="panel"?0:"var(--radius-card)",width:"100%",maxWidth:a==="panel"?"none":"720px",height:a==="panel"?"100%":void 0,maxHeight:a==="panel"?"100%":"92vh",display:"flex",flexDirection:"column",boxShadow:a==="panel"?"none":"var(--elevation-sm)",minHeight:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 24px",borderBottom:"1px solid var(--border)"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"2px"},children:t?`Edit ${w}`:`Add ${w}`}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Session quiz / poll"})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s==="questions"&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",onClick:_,style:{padding:"7px 16px",borderRadius:"var(--radius-button)",background:"#16a34a",border:"none",color:"#fff",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:["Save ",w]}),i.jsx("button",{type:"button",onClick:()=>l("settings"),style:{padding:"7px 16px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Back"})]}),s==="settings"&&i.jsx("button",{type:"button",onClick:()=>{S()&&l("questions")},style:{padding:"7px 16px",borderRadius:"var(--radius-button)",background:"#16a34a",border:"none",color:"#fff",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:"Next →"}),i.jsx("button",{type:"button",onClick:r,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",marginLeft:"4px"},children:i.jsx(er,{size:16})})]})]}),i.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--border)",padding:"0 24px"},children:["settings","questions"].map((A,F)=>i.jsxs("button",{type:"button",onClick:()=>{A==="questions"?S()&&l("questions"):l("settings")},style:{padding:"10px 0",marginRight:"24px",background:"none",border:"none",borderBottom:`2px solid ${s===A?"var(--primary)":"transparent"}`,cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:s===A?"var(--font-weight-medium)":"var(--font-weight-normal)",color:s===A?"var(--primary)":"var(--muted)",display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx("span",{style:{width:"18px",height:"18px",borderRadius:"50%",background:s===A?"var(--primary)":F===1&&c.length>0?"#16a34a":"var(--border)",color:"#fff",fontSize:"10px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:F===1&&c.length>0?c.length:F+1}),A==="settings"?"Settings":"Questions"]},A))}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px"},children:[s==="settings"&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[i.jsx(is,{label:`${w} Title`,required:!0,error:y.title,children:i.jsx("input",{value:x.title,onChange:A=>k("title",A.target.value),placeholder:`Enter ${w.toLowerCase()} title`,style:{...Yu,borderColor:y.title?"var(--destructive)":"var(--border)"},onFocus:A=>{A.currentTarget.style.borderColor="var(--ring)"},onBlur:A=>{A.currentTarget.style.borderColor=y.title?"var(--destructive)":"var(--border)"}})}),i.jsx(is,{label:"Description",children:i.jsx("textarea",{value:x.description,onChange:A=>k("description",A.target.value),rows:3,placeholder:"Enter description",style:{...Yu,height:"auto",padding:"10px",resize:"vertical",lineHeight:"1.5"},onFocus:A=>{A.currentTarget.style.borderColor="var(--ring)"},onBlur:A=>{A.currentTarget.style.borderColor="var(--border)"}})}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[i.jsx(is,{label:"Status",required:!0,error:y.status,children:i.jsx(jg,{value:x.status,onChange:A=>k("status",A),options:lE.map(A=>({value:A,label:A})),error:y.status})}),i.jsx(is,{label:"Is Live",hint:'Manually set if this item is currently live. For "Not Visible and Manual Live", set to Yes when you want it live.',children:i.jsx(jg,{value:x.isLive,onChange:A=>k("isLive",A),options:R})})]}),i.jsx(is,{label:"Display Mode",required:!0,hint:"Always Visible and Live: visible and live immediately. Always Visible and Scheduled Live: visible; live window uses start/end below. Quiz Master: one question at a time, advanced manually. Not Visible and Manual Live: hidden until you mark live.",error:y.displayMode,children:i.jsx(jg,{value:x.displayMode,onChange:A=>k("displayMode",A),options:Coe,error:y.displayMode})}),x.displayMode==="always_sched"&&i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[i.jsx(is,{label:"Start date & time",required:!0,error:y.scheduledStart,children:i.jsx(jf,{value:x.scheduledStart,onChange:A=>k("scheduledStart",A),style:Yu,hasError:!!y.scheduledStart})}),i.jsx(is,{label:"End date & time",required:!0,error:y.scheduledEnd,children:i.jsx(jf,{value:x.scheduledEnd,onChange:A=>k("scheduledEnd",A),style:Yu,hasError:!!y.scheduledEnd})})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[i.jsx(is,{label:"Time Restricted",required:!0,hint:"If enabled, enforce a time limit when the user takes the quiz/poll (synced to the database and live clients).",children:i.jsx(jg,{value:x.timeRestricted,onChange:A=>k("timeRestricted",A),options:R})}),i.jsx(is,{label:"Time Limit (seconds)",hint:"Only used if Time Restricted is Yes.",children:i.jsx("input",{type:"number",min:0,value:x.timeLimit,onChange:A=>k("timeLimit",Number(A.target.value)),style:Yu,onFocus:A=>{A.currentTarget.style.borderColor="var(--ring)"},onBlur:A=>{A.currentTarget.style.borderColor="var(--border)"}})})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[i.jsx(is,{label:"Show Results After Submission",required:!0,hint:"Show results/score after submit.",children:i.jsx(jg,{value:x.showResults,onChange:A=>k("showResults",A),options:R})}),i.jsx(is,{label:"Allow Multiple Attempts",required:!0,children:i.jsx(jg,{value:x.multipleAttempts,onChange:A=>k("multipleAttempts",A),options:R})})]}),i.jsxs("div",{style:{borderTop:"1px solid var(--border)",paddingTop:"16px",marginTop:"4px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",fontFamily:"var(--font-noto-sans)",marginBottom:"10px",color:"var(--foreground)"},children:"Loyalty points (optional overrides)"}),i.jsx("p",{style:{...W0,marginBottom:"12px"},children:"Leave blank to use session/event defaults. Enter 0 to disable this action for this activity only."}),e==="quiz"?i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[i.jsx(is,{label:"Points per quiz submission",hint:"When a visitor submits this quiz.",children:i.jsx("input",{type:"number",min:0,value:x.rewardQuizPollSubmitted,onChange:A=>k("rewardQuizPollSubmitted",A.target.value),placeholder:"Inherit",style:Yu})}),i.jsx(is,{label:"Points per correct question",hint:"Loyalty only; separate from scoring points per question.",children:i.jsx("input",{type:"number",min:0,value:x.rewardQuizCorrectPerQuestion,onChange:A=>k("rewardQuizCorrectPerQuestion",A.target.value),placeholder:"Inherit",style:Yu})})]}):i.jsx("div",{style:{maxWidth:"360px"},children:i.jsx(is,{label:"Points for poll/survey participation",hint:"When a visitor submits this poll.",children:i.jsx("input",{type:"number",min:0,value:x.rewardPollParticipation,onChange:A=>k("rewardPollParticipation",A.target.value),placeholder:"Inherit",style:Yu})})})]})]}),s==="questions"&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"},children:[i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[c.length," question",c.length!==1?"s":""," added"]}),i.jsxs("button",{type:"button",onClick:()=>f(!0),style:{display:"flex",alignItems:"center",gap:"5px",padding:"6px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:13})," Add Question"]})]}),y.questions&&i.jsx("p",{style:{...W0,color:"var(--destructive)"},children:y.questions}),c.length===0?i.jsxs("div",{style:{textAlign:"center",padding:"48px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(ib,{size:32,style:{color:"var(--border)",margin:"0 auto 12px"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"No questions yet"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"16px"},children:"Add at least one question."}),i.jsxs("button",{type:"button",onClick:()=>f(!0),style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"7px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:13})," Add First Question"]})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[c.map((A,F)=>i.jsx(Toe,{q:A,index:F,onEdit:()=>p(A),onDelete:()=>O(A.id)},A.id)),i.jsxs("button",{type:"button",onClick:()=>f(!0),style:{display:"flex",alignItems:"center",gap:"5px",padding:"10px",borderRadius:"var(--radius-card)",border:"2px dashed var(--border)",background:"transparent",color:"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",justifyContent:"center",transition:"border-color 0.12s, color 0.12s"},onMouseEnter:A=>{A.currentTarget.style.borderColor="var(--primary)",A.currentTarget.style.color="var(--primary)"},onMouseLeave:A=>{A.currentTarget.style.borderColor="var(--border)",A.currentTarget.style.color="var(--muted)"},children:[i.jsx(wr,{size:13})," Add another question"]})]})]})]}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i.jsx("div",{children:s==="questions"&&i.jsx("button",{type:"button",onClick:()=>l("settings"),style:{background:"none",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"← Back"})}),i.jsxs("div",{style:{display:"flex",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:r,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Cancel"}),s==="settings"?i.jsx("button",{type:"button",onClick:()=>{S()&&l("questions")},style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:"Next: Questions →"}):i.jsxs("button",{type:"button",onClick:_,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:["Save ",w]})]})]})]});return i.jsxs(i.Fragment,{children:[a==="panel"?E:i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.28)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",backdropFilter:"blur(2px)"},children:E}),d&&i.jsx(BI,{eventId:o,onClose:()=>f(!1),onSave:P}),h&&i.jsx(BI,{eventId:o,initial:h,onClose:()=>p(null),onSave:T})]})}var kg={},Zj,qI;function Poe(){return qI||(qI=1,Zj=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Zj}var Jj={},ff={},$I;function Th(){if($I)return ff;$I=1;let e;const t=[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];return ff.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17},ff.getSymbolTotalCodewords=function(n){return t[n]},ff.getBCHDigit=function(r){let n=0;for(;r!==0;)n++,r>>>=1;return n},ff.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');e=n},ff.isKanjiModeEnabled=function(){return typeof e<"u"},ff.toSJIS=function(n){return e(n)},ff}var e5={},UI;function oT(){return UI||(UI=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.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: "+r)}}e.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},e.from=function(n,o){if(e.isValid(n))return n;try{return t(n)}catch{return o}}})(e5)),e5}var t5,HI;function Ooe(){if(HI)return t5;HI=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const r=Math.floor(t/8);return(this.buffer[r]>>>7-t%8&1)===1},put:function(t,r){for(let n=0;n>>r-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),t&&(this.buffer[r]|=128>>>this.length%8),this.length++}},t5=e,t5}var r5,VI;function Ioe(){if(VI)return r5;VI=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,r,n,o){const a=t*this.size+r;this.data[a]=n,o&&(this.reservedBit[a]=!0)},e.prototype.get=function(t,r){return this.data[t*this.size+r]},e.prototype.xor=function(t,r,n){this.data[t*this.size+r]^=n},e.prototype.isReserved=function(t,r){return this.reservedBit[t*this.size+r]},r5=e,r5}var n5={},YI;function Noe(){return YI||(YI=1,(function(e){const t=Th().getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const o=Math.floor(n/7)+2,a=t(n),s=a===145?26:Math.ceil((a-13)/(2*o-2))*2,l=[a-7];for(let c=1;c=0&&o<=7},e.from=function(o){return e.isValid(o)?parseInt(o,10):void 0},e.getPenaltyN1=function(o){const a=o.size;let s=0,l=0,c=0,u=null,d=null;for(let f=0;f=5&&(s+=t.N1+(l-5)),u=p,l=1),p=o.get(h,f),p===d?c++:(c>=5&&(s+=t.N1+(c-5)),d=p,c=1)}l>=5&&(s+=t.N1+(l-5)),c>=5&&(s+=t.N1+(c-5))}return s},e.getPenaltyN2=function(o){const a=o.size;let s=0;for(let l=0;l=10&&(l===1488||l===93)&&s++,c=c<<1&2047|o.get(d,u),d>=10&&(c===1488||c===93)&&s++}return s*t.N3},e.getPenaltyN4=function(o){let a=0;const s=o.data.length;for(let c=0;c=0;){const s=a[0];for(let c=0;c0){const l=new Uint8Array(this.degree);return l.set(a,s),l}return a},s5=t,s5}var l5={},c5={},u5={},eN;function G$(){return eN||(eN=1,u5.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),u5}var Mc={},tN;function K$(){if(tN)return Mc;tN=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r -]))+`;Mc.KANJI=new RegExp(r,"g"),Mc.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Mc.BYTE=new RegExp(n,"g"),Mc.NUMERIC=new RegExp(e,"g"),Mc.ALPHANUMERIC=new RegExp(t,"g");const o=new RegExp("^"+r+"$"),a=new RegExp("^"+e+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Mc.testKanji=function(c){return o.test(c)},Mc.testNumeric=function(c){return a.test(c)},Mc.testAlphanumeric=function(c){return s.test(c)},Mc}var rN;function Ph(){return rN||(rN=1,(function(e){const t=G$(),r=K$();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(a,s){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?a.ccBits[0]:s<27?a.ccBits[1]:a.ccBits[2]},e.getBestModeForData=function(a){return r.testNumeric(a)?e.NUMERIC:r.testAlphanumeric(a)?e.ALPHANUMERIC:r.testKanji(a)?e.KANJI:e.BYTE},e.toString=function(a){if(a&&a.id)return a.id;throw new Error("Invalid mode")},e.isValid=function(a){return a&&a.bit&&a.ccBits};function n(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.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: "+o)}}e.from=function(a,s){if(e.isValid(a))return a;try{return n(a)}catch{return s}}})(c5)),c5}var nN;function zoe(){return nN||(nN=1,(function(e){const t=Th(),r=Y$(),n=oT(),o=Ph(),a=G$(),s=7973,l=t.getBCHDigit(s);function c(h,p,y){for(let m=1;m<=40;m++)if(p<=e.getCapacity(m,y,h))return m}function u(h,p){return o.getCharCountIndicator(h,p)+4}function d(h,p){let y=0;return h.forEach(function(m){const x=u(m.mode,p);y+=x+m.getBitsLength()}),y}function f(h,p){for(let y=1;y<=40;y++)if(d(h,y)<=e.getCapacity(y,p,o.MIXED))return y}e.from=function(p,y){return a.isValid(p)?parseInt(p,10):y},e.getCapacity=function(p,y,m){if(!a.isValid(p))throw new Error("Invalid QR Code version");typeof m>"u"&&(m=o.BYTE);const x=t.getSymbolTotalCodewords(p),b=r.getTotalCodewordsCount(p,y),w=(x-b)*8;if(m===o.MIXED)return w;const k=w-u(m,p);switch(m){case o.NUMERIC:return Math.floor(k/10*3);case o.ALPHANUMERIC:return Math.floor(k/11*2);case o.KANJI:return Math.floor(k/13);case o.BYTE:default:return Math.floor(k/8)}},e.getBestVersionForData=function(p,y){let m;const x=n.from(y,n.M);if(Array.isArray(p)){if(p.length>1)return f(p,x);if(p.length===0)return 1;m=p[0]}else m=p;return c(m.mode,m.getLength(),x)},e.getEncodedBits=function(p){if(!a.isValid(p)||p<7)throw new Error("Invalid QR Code version");let y=p<<12;for(;t.getBCHDigit(y)-l>=0;)y^=s<=0;)c^=t<0&&(a=this.data.substr(o),s=parseInt(a,10),n.put(s,l*3+1))},p5=t,p5}var h5,aN;function qoe(){if(aN)return h5;aN=1;const e=Ph(),t=["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 r(n){this.mode=e.ALPHANUMERIC,this.data=n}return r.getBitsLength=function(o){return 11*Math.floor(o/2)+6*(o%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(o){let a;for(a=0;a+2<=this.data.length;a+=2){let s=t.indexOf(this.data[a])*45;s+=t.indexOf(this.data[a+1]),o.put(s,11)}this.data.length%2&&o.put(t.indexOf(this.data[a]),6)},h5=r,h5}var g5,sN;function $oe(){if(sN)return g5;sN=1;const e=Ph();function t(r){this.mode=e.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return t.getBitsLength=function(n){return n*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){for(let n=0,o=this.data.length;n=33088&&a<=40956)a-=33088;else if(a>=57408&&a<=60351)a-=49472;else throw new Error("Invalid SJIS character: "+this.data[o]+` -Make sure your charset is UTF-8`);a=(a>>>8&255)*192+(a&255),n.put(a,13)}},m5=r,m5}var v5={exports:{}},cN;function Hoe(){return cN||(cN=1,(function(e){var t={single_source_shortest_paths:function(r,n,o){var a={},s={};s[n]=0;var l=t.PriorityQueue.make();l.push(n,0);for(var c,u,d,f,h,p,y,m,x;!l.empty();){c=l.pop(),u=c.value,f=c.cost,h=r[u]||{};for(d in h)h.hasOwnProperty(d)&&(p=h[d],y=f+p,m=s[d],x=typeof s[d]>"u",(x||m>y)&&(s[d]=y,l.push(d,y),a[d]=u))}if(typeof o<"u"&&typeof s[o]>"u"){var b=["Could not find a path from ",n," to ",o,"."].join("");throw new Error(b)}return a},extract_shortest_path_from_predecessor_list:function(r,n){for(var o=[],a=n;a;)o.push(a),r[a],a=r[a];return o.reverse(),o},find_path:function(r,n,o){var a=t.single_source_shortest_paths(r,n,o);return t.extract_shortest_path_from_predecessor_list(a,o)},PriorityQueue:{make:function(r){var n=t.PriorityQueue,o={},a;r=r||{};for(a in n)n.hasOwnProperty(a)&&(o[a]=n[a]);return o.queue=[],o.sorter=r.sorter||n.default_sorter,o},default_sorter:function(r,n){return r.cost-n.cost},push:function(r,n){var o={value:r,cost:n};this.queue.push(o),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(v5)),v5.exports}var uN;function Voe(){return uN||(uN=1,(function(e){const t=Ph(),r=Woe(),n=qoe(),o=$oe(),a=Uoe(),s=K$(),l=Th(),c=Hoe();function u(b){return unescape(encodeURIComponent(b)).length}function d(b,w,k){const S=[];let _;for(;(_=b.exec(k))!==null;)S.push({data:_[0],index:_.index,mode:w,length:_[0].length});return S}function f(b){const w=d(s.NUMERIC,t.NUMERIC,b),k=d(s.ALPHANUMERIC,t.ALPHANUMERIC,b);let S,_;return l.isKanjiModeEnabled()?(S=d(s.BYTE,t.BYTE,b),_=d(s.KANJI,t.KANJI,b)):(S=d(s.BYTE_KANJI,t.BYTE,b),_=[]),w.concat(k,S,_).sort(function(O,T){return O.index-T.index}).map(function(O){return{data:O.data,mode:O.mode,length:O.length}})}function h(b,w){switch(w){case t.NUMERIC:return r.getBitsLength(b);case t.ALPHANUMERIC:return n.getBitsLength(b);case t.KANJI:return a.getBitsLength(b);case t.BYTE:return o.getBitsLength(b)}}function p(b){return b.reduce(function(w,k){const S=w.length-1>=0?w[w.length-1]:null;return S&&S.mode===k.mode?(w[w.length-1].data+=k.data,w):(w.push(k),w)},[])}function y(b){const w=[];for(let k=0;k=0&&F<=6&&(L===0||L===6)||L>=0&&L<=6&&(F===0||F===6)||F>=2&&F<=4&&L>=2&&L<=4?P.set(E+F,A+L,!0,!0):P.set(E+F,A+L,!1,!0))}}function y(P){const O=P.size;for(let T=8;T>F&1)===1,P.set(I,E,A,!0),P.set(E,I,A,!0)}function b(P,O,T){const R=P.size,I=d.getEncodedBits(O,T);let E,A;for(E=0;E<15;E++)A=(I>>E&1)===1,E<6?P.set(E,8,A,!0):E<8?P.set(E+1,8,A,!0):P.set(R-15+E,8,A,!0),E<8?P.set(8,R-E-1,A,!0):E<9?P.set(8,15-E-1+1,A,!0):P.set(8,15-E-1,A,!0);P.set(R-8,8,1,!0)}function w(P,O){const T=P.size;let R=-1,I=T-1,E=7,A=0;for(let F=T-1;F>0;F-=2)for(F===6&&F--;;){for(let L=0;L<2;L++)if(!P.isReserved(I,F-L)){let z=!1;A>>E&1)===1),P.set(I,F-L,z),E--,E===-1&&(A++,E=7)}if(I+=R,I<0||T<=I){I-=R,R=-R;break}}}function k(P,O,T){const R=new r;T.forEach(function(L){R.put(L.mode.bit,4),R.put(L.getLength(),f.getCharCountIndicator(L.mode,P)),L.write(R)});const I=e.getSymbolTotalCodewords(P),E=l.getTotalCodewordsCount(P,O),A=(I-E)*8;for(R.getLengthInBits()+4<=A&&R.put(0,4);R.getLengthInBits()%8!==0;)R.putBit(0);const F=(A-R.getLengthInBits())/8;for(let L=0;L=7&&x(L,O),w(L,A),isNaN(R)&&(R=s.getBestMask(L,b.bind(null,L,T))),s.applyMask(R,L),b(L,T,R),{modules:L,version:O,errorCorrectionLevel:T,maskPattern:R,segments:I}}return Jj.create=function(O,T){if(typeof O>"u"||O==="")throw new Error("No input text");let R=t.M,I,E;return typeof T<"u"&&(R=t.from(T.errorCorrectionLevel,t.M),I=u.from(T.version),E=s.from(T.maskPattern),T.toSJISFunc&&e.setToSJISFunction(T.toSJISFunc)),_(O,I,R,E)},Jj}var y5={},x5={},fN;function Q$(){return fN||(fN=1,(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(a){return[a,a]}))),n.length===6&&n.push("F","F");const o=parseInt(n.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+n.slice(0,6).join("")}}e.getOptions=function(n){n||(n={}),n.color||(n.color={});const o=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,a=n.width&&n.width>=21?n.width:void 0,s=n.scale||4;return{width:a,scale:a?4:s,margin:o,color:{dark:t(n.color.dark||"#000000ff"),light:t(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,o){return o.width&&o.width>=n+o.margin*2?o.width/(n+o.margin*2):o.scale},e.getImageWidth=function(n,o){const a=e.getScale(n,o);return Math.floor((n+o.margin*2)*a)},e.qrToImageData=function(n,o,a){const s=o.modules.size,l=o.modules.data,c=e.getScale(s,a),u=Math.floor((s+a.margin*2)*c),d=a.margin*c,f=[a.color.light,a.color.dark];for(let h=0;h=d&&p>=d&&h"u"&&(!s||!s.getContext)&&(c=s,s=void 0),s||(u=n()),c=t.getOptions(c);const d=t.getImageWidth(a.modules.size,c),f=u.getContext("2d"),h=f.createImageData(d,d);return t.qrToImageData(h.data,a,c),r(f,u,d),f.putImageData(h,0,0),u},e.renderToDataURL=function(a,s,l){let c=l;typeof c>"u"&&(!s||!s.getContext)&&(c=s,s=void 0),c||(c={});const u=e.render(a,s,c),d=c.type||"image/png",f=c.rendererOpts||{};return u.toDataURL(d,f.quality)}})(y5)),y5}var b5={},hN;function Koe(){if(hN)return b5;hN=1;const e=Q$();function t(o,a){const s=o.a/255,l=a+'="'+o.hex+'"';return s<1?l+" "+a+'-opacity="'+s.toFixed(2).slice(1)+'"':l}function r(o,a,s){let l=o+a;return typeof s<"u"&&(l+=" "+s),l}function n(o,a,s){let l="",c=0,u=!1,d=0;for(let f=0;f0&&h>0&&o[f-1]||(l+=u?r("M",h+s,.5+p+s):r("m",c,0),c=0,u=!1),h+1':"",p="',y='viewBox="0 0 '+f+" "+f+'"',x=''+h+p+` -`;return typeof l=="function"&&l(null,x),x},b5}var gN;function Qoe(){if(gN)return kg;gN=1;const e=Poe(),t=Yoe(),r=Goe(),n=Koe();function o(a,s,l,c,u){const d=[].slice.call(arguments,1),f=d.length,h=typeof d[f-1]=="function";if(!h&&!e())throw new Error("Callback required as last argument");if(h){if(f<2)throw new Error("Too few arguments provided");f===2?(u=l,l=s,s=c=void 0):f===3&&(s.getContext&&typeof u>"u"?(u=c,c=void 0):(u=c,c=l,l=s,s=void 0))}else{if(f<1)throw new Error("Too few arguments provided");return f===1?(l=s,s=c=void 0):f===2&&!s.getContext&&(c=l,l=s,s=void 0),new Promise(function(p,y){try{const m=t.create(l,c);p(a(m,s,c))}catch(m){y(m)}})}try{const p=t.create(l,c);u(null,a(p,s,c))}catch(p){u(p)}}return kg.create=t.create,kg.toCanvas=o.bind(null,r.render),kg.toDataURL=o.bind(null,r.renderToDataURL),kg.toString=o.bind(null,function(a,s,l){return n.render(a,l)}),kg}var Xoe=Qoe();const Mw=un(Xoe);function Zoe(e){return`https://eventbuzz.live/code/${e}`}function Joe(e,t){return new Promise((r,n)=>{const o=new Image;o.onload=()=>{const a=o.naturalWidth,s=o.naturalHeight,l=32,c=24,u=20,d=28,f=22,h=document.createElement("canvas"),p=h.getContext("2d");if(!p){n(new Error("Canvas not supported"));return}p.font=`bold ${f}px ui-monospace, "Courier New", Courier, monospace`,p.letterSpacing="3px";const y=p.measureText(t).width,m=f+10,x=Math.ceil(Math.max(a+l*2,y+l*2)),b=c+s+u+m+d;h.width=x,h.height=b,p.fillStyle="#ffffff",p.fillRect(0,0,x,b);const w=(x-a)/2;p.drawImage(o,w,c),p.fillStyle="#0f172a",p.font=`bold ${f}px ui-monospace, "Courier New", Courier, monospace`,p.letterSpacing="3px",p.textAlign="center",p.textBaseline="top";const k=c+s+u;p.fillText(t,x/2,k);try{r(h.toDataURL("image/png"))}catch(S){n(S)}},o.onerror=()=>n(new Error("Failed to load QR image")),o.src=e})}function aT({open:e,onClose:t,kind:r,joinCode:n,label:o}){const a=n.trim(),s=a?Zoe(a):"",[l,c]=j.useState(null),[u,d]=j.useState(null),[f,h]=j.useState(!1),[p,y]=j.useState(!1);j.useEffect(()=>{if(!e){c(null),d(null),h(!1);return}if(!s){c(null),d(null);return}let w=!1;return d(null),Mw.toDataURL(s,{width:256,margin:2,color:{dark:"#0f172a",light:"#ffffff"}}).then(k=>{w||c(k)}).catch(()=>{w||d("Could not generate QR code.")}),()=>{w=!0}},[e,s]);const m=()=>{s&&navigator.clipboard.writeText(s).then(()=>{h(!0),window.setTimeout(()=>h(!1),2e3)})},x=async()=>{if(!(!a||!l||p)){y(!0);try{const w=await Joe(l,a),k=document.createElement("a");k.href=w,k.download=`eventbuzz-${r}-${a}.png`,k.click()}catch{const w=document.createElement("a");w.href=l,w.download=`eventbuzz-${r}-${a}.png`,w.click()}finally{y(!1)}}};if(!e)return null;const b=r==="track"?"Track":r==="session"?"Session":"Event";return i.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"agenda-qr-title",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:120,display:"flex",alignItems:"center",justifyContent:"center",padding:"16px"},onClick:t,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:"400px",padding:"20px",boxShadow:"var(--shadow-xl)",border:"1px solid var(--border)"},onClick:w=>w.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:"16px"},children:[i.jsxs("div",{children:[i.jsxs("h2",{id:"agenda-qr-title",style:{fontSize:"var(--text-base)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"4px"},children:[b," QR code"]}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",lineHeight:1.4},children:o}),r==="event"&&a?i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"6px",lineHeight:1.4},children:["Same ",i.jsx("code",{style:{fontSize:"10px"},children:"/code/…"})," flow as sessions: scan resolves session first, then track, then this event."]}):null]}),i.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer",color:"var(--card-foreground)",flexShrink:0},children:i.jsx(er,{size:16})})]}),a?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{textAlign:"center",marginBottom:"16px"},children:[i.jsx("p",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"6px"},children:"Code"}),i.jsx("p",{style:{fontFamily:"ui-monospace, monospace",fontSize:"22px",fontWeight:700,letterSpacing:"0.12em",color:"var(--foreground)",userSelect:"all"},children:a})]}),i.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"200px",background:"var(--secondary)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",marginBottom:"16px"},children:u?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",padding:"16px"},children:u}):l?i.jsx("img",{src:l,alt:`QR code for ${s}`,style:{width:200,height:200,display:"block"}}):i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Generating…"})}),i.jsxs("div",{style:{marginBottom:"12px"},children:[i.jsx("p",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"Link"}),i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"stretch",flexWrap:"wrap"},children:[i.jsx("input",{readOnly:!0,value:s,onFocus:w=>w.target.select(),style:{flex:1,minWidth:"160px",padding:"8px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",fontSize:"12px",fontFamily:"ui-monospace, monospace",color:"var(--foreground)"}}),i.jsxs("button",{type:"button",onClick:m,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:f?"var(--accent)":"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},children:[i.jsx(iu,{size:14})," ",f?"Copied":"Copy"]})]})]}),i.jsxs("button",{type:"button",onClick:()=>void x(),disabled:!l||p,style:{width:"100%",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"10px 14px",borderRadius:"var(--radius-button)",border:"none",background:l&&!p?"var(--primary)":"var(--muted)",color:l&&!p?"var(--primary-foreground)":"var(--card)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:l&&!p?"pointer":"not-allowed"},children:[i.jsx(Al,{size:16})," ",p?"Preparing…":"Download PNG (QR + code)"]}),i.jsx("p",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"8px",textAlign:"center",lineHeight:1.4},children:"The saved image includes your code printed below the QR."})]}):i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",padding:"12px 0",textAlign:"center",lineHeight:1.5},children:r==="event"?i.jsxs(i.Fragment,{children:["This event has no join code yet. Open the event in the dashboard and save once, or run"," ",i.jsx("code",{style:{fontSize:"11px"},children:"npm run backfill:join-codes"})," in the backend."]}):i.jsxs(i.Fragment,{children:["No join code on this record yet. Reload the agenda after save, or run"," ",i.jsx("code",{style:{fontSize:"11px"},children:"npm run backfill:join-codes"})," in the backend once."]})})]})})}function eae(){const{selectedEventId:e}=eo(),[t,r]=j.useState(null),[n,o]=j.useState(!1),[a,s]=j.useState(!1),[l,c]=j.useState(!1),d=qi()==="mobile",[f,h]=j.useState(void 0);j.useEffect(()=>{if(t!=="qr"||!e){h(void 0);return}h(void 0);let m=!1;return zr.get(e).then(x=>{m||h(x.data??null)}),()=>{m=!0}},[t,e]);const p=m=>{if(m==="live"){if(!n&&!window.confirm("Start broadcasting this event as Live? All participants will be notified."))return;o(x=>!x);return}if(m==="qr"&&!e){window.alert("Select an event from the sidebar first.");return}if(m==="addpoll"){s(!0);return}if(m==="addquiz"){c(!0);return}r(m)},y=[{icon:i.jsx(Rf,{size:d?18:15}),label:"Manage Ratings",id:"ratings"},{icon:i.jsx(Zs,{size:d?18:15}),label:"Manage Feedback",id:"feedback"},{icon:i.jsx(lv,{size:d?18:15}),label:"Generate QR Code",id:"qr"},{icon:i.jsx(Eq,{size:d?18:15}),label:"Go Live",id:"live"},{icon:i.jsx(nu,{size:d?18:15}),label:"Add Poll",id:"addpoll"},{icon:i.jsx(M6,{size:d?18:15}),label:"Add Quiz",id:"addquiz"}];return i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:d?"14px":"14px 16px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--muted)",marginBottom:d?"12px":"0"},children:"Quick actions"}),d?i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"8px"},children:y.map(m=>{const x=m.id==="live"&&n;return i.jsxs("button",{onClick:()=>p(m.id),style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"7px",padding:"14px 8px",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:x?"var(--destructive)":"var(--border)",background:x?"var(--destructive)":"var(--secondary)",color:x?"var(--destructive-foreground)":"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer",minHeight:"72px"},children:[x&&i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--destructive-foreground)",display:"block",position:"absolute"}}),i.jsx("span",{style:{color:x?"var(--destructive-foreground)":"var(--primary)",display:"flex"},children:m.icon}),i.jsx("span",{style:{textAlign:"center",lineHeight:"1.3"},children:x?"Stop Live":m.label})]},m.id)})}):i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",flexWrap:"wrap"},children:[i.jsx("div",{style:{width:"1px",height:"18px",background:"var(--border)",flexShrink:0}}),i.jsx("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:y.map(m=>{const x=m.id==="live"&&n;return i.jsxs("button",{onClick:()=>p(m.id),style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 14px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:x?"var(--destructive)":"var(--border)",background:x?"var(--destructive)":"var(--card)",color:x?"var(--destructive-foreground)":"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer",transition:"all 0.15s"},onMouseEnter:b=>{x||(b.currentTarget.style.background="var(--secondary)",b.currentTarget.style.borderColor="var(--primary)",b.currentTarget.style.color="var(--primary)")},onMouseLeave:b=>{x||(b.currentTarget.style.background="var(--card)",b.currentTarget.style.borderColor="var(--border)",b.currentTarget.style.color="var(--card-foreground)")},children:[x&&i.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:"var(--destructive-foreground)",display:"block"}}),m.icon,x?"Stop Live":m.label]},m.id)})})]})]}),t==="qr"&&e&&f!==void 0&&i.jsx(aT,{open:!0,onClose:()=>r(null),kind:"event",joinCode:((f==null?void 0:f.joinCode)??"").trim(),label:(f==null?void 0:f.name)??"Event"}),t==="qr"&&e&&f===void 0&&i.jsx("div",{role:"status","aria-live":"polite",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:120,display:"flex",alignItems:"center",justifyContent:"center",padding:"16px"},children:i.jsx("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",padding:"24px 32px",border:"1px solid var(--border)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Loading event…"})}),t&&t!=="qr"&&i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:50,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>r(null),children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"440px",maxWidth:"92vw",boxShadow:"var(--elevation-sm)"},onClick:m=>m.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:t==="ratings"?"Event Ratings":"Attendee Feedback"}),i.jsx("button",{onClick:()=>r(null),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:"2px"},children:i.jsx(er,{size:16})})]}),i.jsxs("div",{style:{padding:"20px"},children:[t==="ratings"&&i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{user:"Dr. Sharma",rating:5,comment:"Excellent conference, very informative!"},{user:"Prof. Mehta",rating:4,comment:"Well organized, good speakers."},{user:"Dr. Patel",rating:5,comment:"Best conference of the year!"}].map((m,x)=>i.jsxs("div",{style:{padding:"12px 14px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:m.user}),i.jsxs("span",{style:{color:"var(--chart-2)",fontSize:"var(--text-sm)"},children:["★".repeat(m.rating),"☆".repeat(5-m.rating)]})]}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:m.comment})]},x))}),t==="feedback"&&i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{user:"Ananya R.",time:"2h ago",msg:"The morning keynote was excellent."},{user:"Rajesh K.",time:"4h ago",msg:"Please improve the AV setup for Session 3."},{user:"Priya M.",time:"1d ago",msg:"Great networking opportunities. Well done!"}].map((m,x)=>i.jsxs("div",{style:{display:"flex",gap:"10px",padding:"12px 14px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",background:"var(--accent)",color:"var(--accent-foreground)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",flexShrink:0},children:m.user[0]}),i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center",marginBottom:"3px"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:m.user}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:m.time})]}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:m.msg})]})]},x))})]})]})}),a&&i.jsx(ax,{kind:"poll",eventId:e??void 0,onClose:()=>s(!1)}),l&&i.jsx(ax,{kind:"quiz",eventId:e??void 0,onClose:()=>c(!1)})]})}function fv({children:e}){return i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px",display:"flex",flexDirection:"column",gap:"16px"},children:e})}function pv({icon:e,title:t,color:r}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"var(--radius-button)",background:r+"15",display:"flex",alignItems:"center",justifyContent:"center",color:r},children:e}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:t})]}),i.jsxs("button",{style:{display:"flex",alignItems:"center",gap:"3px",background:"none",border:"none",cursor:"pointer",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",padding:"2px 4px"},onMouseEnter:n=>{n.currentTarget.style.color="var(--primary)"},onMouseLeave:n=>{n.currentTarget.style.color="var(--muted)"},children:["View all ",i.jsx(va,{size:12})]})]})}function Py({label:e,pct:t,color:r}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[t,"%"]})]}),i.jsx("div",{style:{height:"4px",background:"var(--border)",borderRadius:"99px",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${t}%`,background:r,borderRadius:"99px"}})})]})}function X$({label:e,bg:t,color:r}){return i.jsx("span",{style:{display:"inline-flex",padding:"2px 8px",borderRadius:"4px",background:t,color:r,fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",whiteSpace:"nowrap"},children:e})}function hv({items:e}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${e.length}, 1fr)`,gap:"1px",background:"var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden"},children:e.map(([t,r])=>i.jsxs("div",{style:{background:"var(--secondary)",padding:"10px 12px",textAlign:"center"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2"},children:t}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px"},children:r})]},r))})}function tae(){return i.jsxs(fv,{children:[i.jsx(pv,{icon:i.jsx(ib,{size:15}),title:"Quiz",color:"var(--chart-3)"}),i.jsx(hv,{items:[["4","Active"],["24","Questions"],["71%","Avg Score"]]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[i.jsx(Py,{label:"Pulmonary Anatomy",pct:82,color:"var(--chart-3)"}),i.jsx(Py,{label:"ICS Guidelines 2025",pct:65,color:"var(--chart-3)"}),i.jsx(Py,{label:"COPD Management",pct:90,color:"var(--chart-3)"}),i.jsx(Py,{label:"Respiratory Physiology",pct:45,color:"var(--chart-3)"})]})]})}function rae(){const[e,t]=j.useState(0),r=[{q:"How would you rate the venue?",votes:62,options:[{l:"Excellent",p:50},{l:"Good",p:31},{l:"Average",p:14},{l:"Poor",p:5}]},{q:"Best session of the day?",votes:48,options:[{l:"Keynote Address",p:46},{l:"COPD Workshop",p:29},{l:"Panel Discussion",p:25}]}],n=r[e];return i.jsxs(fv,{children:[i.jsx(pv,{icon:i.jsx(nu,{size:15}),title:"Polls",color:"var(--chart-4)"}),i.jsx(hv,{items:[["6","Active Polls"],["342","Total Votes"]]}),i.jsx("div",{style:{display:"flex",gap:"6px"},children:r.map((o,a)=>i.jsxs("button",{onClick:()=>t(a),style:{flex:1,padding:"5px 0",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:e===a?"var(--primary)":"var(--card)",color:e===a?"#fff":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:["Poll ",a+1]},a))}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"3px"},children:n.q}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"10px"},children:[n.votes," votes"]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"7px"},children:n.options.map(o=>i.jsx(Py,{label:o.l,pct:o.p,color:"var(--chart-4)"},o.l))})]})]})}function nae(){const e=[{rank:"🥇",name:"Dr. Rajesh Sharma",pts:240},{rank:"🥈",name:"Dr. Priya Mehta",pts:210},{rank:"🥉",name:"Dr. Anil Kumar",pts:185},{rank:"4",name:"Dr. Sunita Patel",pts:160},{rank:"5",name:"Dr. Vikram Singh",pts:145},{rank:"6",name:"Dr. Neha Gupta",pts:130}];return i.jsxs(fv,{children:[i.jsx(pv,{icon:i.jsx(od,{size:15}),title:"Reward Points",color:"var(--chart-2)"}),i.jsx(hv,{items:[["1,240","Total Points"],["18","Earners"]]}),i.jsx("div",{style:{display:"flex",flexDirection:"column"},children:e.map((t,r)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"7px 0",borderBottom:ri.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"7px 0",borderBottom:r0?t.views:"—"})]},r))})]})}function oae(){const e=[{time:"09:00",title:"Opening Keynote",track:"Plenary",typeColor:"#5b21b6",typeBg:"#ede9fe"},{time:"10:30",title:"COPD Management Guidelines 2025",track:"Clinical",typeColor:"#1d4ed8",typeBg:"#dbeafe"},{time:"12:00",title:"Lunch & Networking Break",track:"Break",typeColor:"#6b7280",typeBg:"#f3f4f6"},{time:"13:30",title:"Interstitial Lung Disease Workshop",track:"Workshop",typeColor:"#15803d",typeBg:"#dcfce7"},{time:"15:00",title:"Panel: Future of Respiratory Medicine",track:"Panel",typeColor:"#b91c1c",typeBg:"#fee2e2"}];return i.jsxs(fv,{children:[i.jsx(pv,{icon:i.jsx(Sq,{size:15}),title:"Agenda",color:"var(--chart-5)"}),i.jsx(hv,{items:[["12","Sessions"],["4","Days"],["8","Speakers"]]}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)",marginBottom:"8px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Today"}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:e.map((t,r)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"6px 0",borderBottom:ri.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"7px 0",borderBottom:r-1}return X5=t,X5}var Z5,YN;function kae(){if(YN)return Z5;YN=1;var e=zw();function t(r,n){var o=this.__data__,a=e(o,r);return a<0?(++this.size,o.push([r,n])):o[a][1]=n,this}return Z5=t,Z5}var J5,GN;function Bw(){if(GN)return J5;GN=1;var e=bae(),t=wae(),r=Sae(),n=jae(),o=kae();function a(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l0?1:-1},Kp=function(t){return db(t)&&t.indexOf("%")===t.length-1},Bt=function(t){return Yae(t)&&!fb(t)},ho=function(t){return Bt(t)||db(t)},Gae=0,vv=function(t){var r=++Gae;return"".concat(t||"").concat(r)},Wa=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Bt(t)&&!db(t))return n;var a;if(Kp(t)){var s=t.indexOf("%");a=r*parseFloat(t.slice(0,s))/100}else a=+t;return fb(a)&&(a=n),o&&a>r&&(a=r),a},xf=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},Kae=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function tse(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function uE(e){"@babel/helpers - typeof";return uE=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},uE(e)}var SR={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"},ad=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},jR=null,_k=null,gT=function e(t){if(t===jR&&Array.isArray(_k))return _k;var r=[];return j.Children.forEach(t,function(n){Rr(n)||($ae.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),_k=r,jR=t,r};function Ks(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(o){return ad(o)}):n=[ad(t)],gT(e).forEach(function(o){var a=Gs(o,"type.displayName")||Gs(o,"type.name");n.indexOf(a)!==-1&&r.push(o)}),r}function Bs(e,t){var r=Ks(e,t);return r&&r[0]}var kR=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,o=r.height;return!(!Bt(n)||n<=0||!Bt(o)||o<=0)},rse=["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"],nse=function(t){return t&&t.type&&db(t.type)&&rse.indexOf(t.type)>=0},ise=function(t){return t&&uE(t)==="object"&&"clipDot"in t},ose=function(t,r,n,o){var a,s=(a=kk==null?void 0:kk[o])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!Ar(t)&&(o&&s.includes(r)||Xae.includes(r))||n&&hT.includes(r)},vr=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var o=t;if(j.isValidElement(t)&&(o=t.props),!mv(o))return null;var a={};return Object.keys(o).forEach(function(s){var l;ose((l=o)===null||l===void 0?void 0:l[s],s,r,n)&&(a[s]=o[s])}),a},dE=function e(t,r){if(t===r)return!0;var n=j.Children.count(t);if(n!==j.Children.count(r))return!1;if(n===0)return!0;if(n===1)return _R(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function use(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function pE(e){var t=e.children,r=e.width,n=e.height,o=e.viewBox,a=e.className,s=e.style,l=e.title,c=e.desc,u=cse(e,lse),d=o||{width:r,height:n,x:0,y:0},f=Lr("recharts-surface",a);return ze.createElement("svg",fE({},vr(u,!0,"svg"),{className:f,width:r,height:n,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),ze.createElement("title",null,l),ze.createElement("desc",null,c),t)}var dse=["children","className"];function hE(){return hE=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pse(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var ln=ze.forwardRef(function(e,t){var r=e.children,n=e.className,o=fse(e,dse),a=Lr("recharts-layer",n);return ze.createElement("g",hE({className:a},vr(o,!0),{ref:t}),r)}),ac=function(t,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),a=2;aa?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var s=Array(a);++o=a?r:e(r,n,o)}return Ek=t,Ek}var Ak,TR;function oU(){if(TR)return Ak;TR=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",o=t+r+n,a="\\ufe0e\\ufe0f",s="\\u200d",l=RegExp("["+s+e+o+a+"]");function c(u){return l.test(u)}return Ak=c,Ak}var Tk,PR;function mse(){if(PR)return Tk;PR=1;function e(t){return t.split("")}return Tk=e,Tk}var Pk,OR;function vse(){if(OR)return Pk;OR=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",o=t+r+n,a="\\ufe0e\\ufe0f",s="["+e+"]",l="["+o+"]",c="\\ud83c[\\udffb-\\udfff]",u="(?:"+l+"|"+c+")",d="[^"+e+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",p="\\u200d",y=u+"?",m="["+a+"]?",x="(?:"+p+"(?:"+[d,f,h].join("|")+")"+m+y+")*",b=m+y+x,w="(?:"+[d+l+"?",l,f,h,s].join("|")+")",k=RegExp(c+"(?="+c+")|"+w+b,"g");function S(_){return _.match(k)||[]}return Pk=S,Pk}var Ok,IR;function yse(){if(IR)return Ok;IR=1;var e=mse(),t=oU(),r=vse();function n(o){return t(o)?r(o):e(o)}return Ok=n,Ok}var Ik,NR;function xse(){if(NR)return Ik;NR=1;var e=gse(),t=oU(),r=yse(),n=tU();function o(a){return function(s){s=n(s);var l=t(s)?r(s):void 0,c=l?l[0]:s.charAt(0),u=l?e(l,1).join(""):s.slice(1);return c[a]()+u}}return Ik=o,Ik}var Nk,RR;function bse(){if(RR)return Nk;RR=1;var e=xse(),t=e("toUpperCase");return Nk=t,Nk}var wse=bse();const $w=un(wse);function Vn(e){return function(){return e}}const aU=Math.cos,V0=Math.sin,gc=Math.sqrt,Y0=Math.PI,Uw=2*Y0,gE=Math.PI,mE=2*gE,Dp=1e-6,Sse=mE-Dp;function sU(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return sU;const r=10**t;return function(n){this._+=n[0];for(let o=1,a=n.length;oDp)if(!(Math.abs(f*c-u*d)>Dp)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-s,y=o-l,m=c*c+u*u,x=p*p+y*y,b=Math.sqrt(m),w=Math.sqrt(h),k=a*Math.tan((gE-Math.acos((m+h-x)/(2*b*w)))/2),S=k/w,_=k/b;Math.abs(S-1)>Dp&&this._append`L${t+S*d},${r+S*f}`,this._append`A${a},${a},0,0,${+(f*p>d*y)},${this._x1=t+_*c},${this._y1=r+_*u}`}}arc(t,r,n,o,a,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(o),c=n*Math.sin(o),u=t+l,d=r+c,f=1^s,h=s?o-a:a-o;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Dp||Math.abs(this._y1-d)>Dp)&&this._append`L${u},${d}`,n&&(h<0&&(h=h%mE+mE),h>Sse?this._append`A${n},${n},0,1,${f},${t-l},${r-c}A${n},${n},0,1,${f},${this._x1=u},${this._y1=d}`:h>Dp&&this._append`A${n},${n},0,${+(h>=gE)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,o){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+o}h${-n}Z`}toString(){return this._}};function mT(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new kse(t)}function vT(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lU(e){this._context=e}lU.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 Hw(e){return new lU(e)}function cU(e){return e[0]}function uU(e){return e[1]}function dU(e,t){var r=Vn(!0),n=null,o=Hw,a=null,s=mT(l);e=typeof e=="function"?e:e===void 0?cU:Vn(e),t=typeof t=="function"?t:t===void 0?uU:Vn(t);function l(c){var u,d=(c=vT(c)).length,f,h=!1,p;for(n==null&&(a=o(p=s())),u=0;u<=d;++u)!(u=p;--y)l.point(k[y],S[y]);l.lineEnd(),l.areaEnd()}b&&(k[h]=+e(x,h,f),S[h]=+t(x,h,f),l.point(n?+n(x,h,f):k[h],r?+r(x,h,f):S[h]))}if(w)return l=null,w+""||null}function d(){return dU().defined(o).curve(s).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Vn(+f),n=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Vn(+f),u):e},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Vn(+f),u):n},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Vn(+f),r=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Vn(+f),u):t},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Vn(+f),u):r},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(r)},u.lineX1=function(){return d().x(n).y(t)},u.defined=function(f){return arguments.length?(o=typeof f=="function"?f:Vn(!!f),u):o},u.curve=function(f){return arguments.length?(s=f,a!=null&&(l=s(a)),u):s},u.context=function(f){return arguments.length?(f==null?a=l=null:l=s(a=f),u):a},u}class fU{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function _se(e){return new fU(e,!0)}function Cse(e){return new fU(e,!1)}const yT={draw(e,t){const r=gc(t/Y0);e.moveTo(r,0),e.arc(0,0,r,0,Uw)}},Ese={draw(e,t){const r=gc(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},pU=gc(1/3),Ase=pU*2,Tse={draw(e,t){const r=gc(t/Ase),n=r*pU;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},Pse={draw(e,t){const r=gc(t),n=-r/2;e.rect(n,n,r,r)}},Ose=.8908130915292852,hU=V0(Y0/10)/V0(7*Y0/10),Ise=V0(Uw/10)*hU,Nse=-aU(Uw/10)*hU,Rse={draw(e,t){const r=gc(t*Ose),n=Ise*r,o=Nse*r;e.moveTo(0,-r),e.lineTo(n,o);for(let a=1;a<5;++a){const s=Uw*a/5,l=aU(s),c=V0(s);e.lineTo(c*r,-l*r),e.lineTo(l*n-c*o,c*n+l*o)}e.closePath()}},Rk=gc(3),Lse={draw(e,t){const r=-gc(t/(Rk*3));e.moveTo(0,r*2),e.lineTo(-Rk*r,-r),e.lineTo(Rk*r,-r),e.closePath()}},vl=-.5,yl=gc(3)/2,vE=1/gc(12),Fse=(vE/2+1)*3,Mse={draw(e,t){const r=gc(t/Fse),n=r/2,o=r*vE,a=n,s=r*vE+r,l=-a,c=s;e.moveTo(n,o),e.lineTo(a,s),e.lineTo(l,c),e.lineTo(vl*n-yl*o,yl*n+vl*o),e.lineTo(vl*a-yl*s,yl*a+vl*s),e.lineTo(vl*l-yl*c,yl*l+vl*c),e.lineTo(vl*n+yl*o,vl*o-yl*n),e.lineTo(vl*a+yl*s,vl*s-yl*a),e.lineTo(vl*l+yl*c,vl*c-yl*l),e.closePath()}};function Dse(e,t){let r=null,n=mT(o);e=typeof e=="function"?e:Vn(e||yT),t=typeof t=="function"?t:Vn(t===void 0?64:+t);function o(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return o.type=function(a){return arguments.length?(e=typeof a=="function"?a:Vn(a),o):e},o.size=function(a){return arguments.length?(t=typeof a=="function"?a:Vn(+a),o):t},o.context=function(a){return arguments.length?(r=a??null,o):r},o}function G0(){}function K0(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function gU(e){this._context=e}gU.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:K0(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:K0(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function zse(e){return new gU(e)}function mU(e){this._context=e}mU.prototype={areaStart:G0,areaEnd:G0,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:K0(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Bse(e){return new mU(e)}function vU(e){this._context=e}vU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:K0(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Wse(e){return new vU(e)}function yU(e){this._context=e}yU.prototype={areaStart:G0,areaEnd:G0,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 qse(e){return new yU(e)}function LR(e){return e<0?-1:1}function FR(e,t,r){var n=e._x1-e._x0,o=t-e._x1,a=(e._y1-e._y0)/(n||o<0&&-0),s=(r-e._y1)/(o||n<0&&-0),l=(a*o+s*n)/(n+o);return(LR(a)+LR(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(l))||0}function MR(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Lk(e,t,r){var n=e._x0,o=e._y0,a=e._x1,s=e._y1,l=(a-n)/3;e._context.bezierCurveTo(n+l,o+l*t,a-l,s-l*r,a,s)}function Q0(e){this._context=e}Q0.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:Lk(this,this._t0,MR(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Lk(this,MR(this,r=FR(this,e,t)),r);break;default:Lk(this,this._t0,r=FR(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function xU(e){this._context=new bU(e)}(xU.prototype=Object.create(Q0.prototype)).point=function(e,t){Q0.prototype.point.call(this,t,e)};function bU(e){this._context=e}bU.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,o,a){this._context.bezierCurveTo(t,e,n,r,a,o)}};function $se(e){return new Q0(e)}function Use(e){return new xU(e)}function wU(e){this._context=e}wU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=DR(e),o=DR(t),a=0,s=1;s=0;--t)o[t]=(s[t]-o[t+1])/a[t];for(a[r-1]=(e[r]+o[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function Vse(e){return new Vw(e,.5)}function Yse(e){return new Vw(e,0)}function Gse(e){return new Vw(e,1)}function xm(e,t){if((s=e.length)>1)for(var r=1,n,o,a=e[t[0]],s,l=a.length;r=0;)r[t]=t;return r}function Kse(e,t){return e[t]}function Qse(e){const t=[];return t.key=e,t}function Xse(){var e=Vn([]),t=yE,r=xm,n=Kse;function o(a){var s=Array.from(e.apply(this,arguments),Qse),l,c=s.length,u=-1,d;for(const f of a)for(l=0,++u;l0){for(var r,n,o=0,a=e[0].length,s;o0){for(var r=0,n=e[t[0]],o,a=n.length;r0)||!((a=(o=e[t[0]]).length)>0))){for(var r=0,n=1,o,a,s;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function ale(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var SU={symbolCircle:yT,symbolCross:Ese,symbolDiamond:Tse,symbolSquare:Pse,symbolStar:Rse,symbolTriangle:Lse,symbolWye:Mse},sle=Math.PI/180,lle=function(t){var r="symbol".concat($w(t));return SU[r]||yT},cle=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var o=18*sle;return 1.25*t*t*(Math.tan(o)-Math.tan(o*2)*Math.pow(Math.tan(o),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}},ule=function(t,r){SU["symbol".concat($w(t))]=r},xT=function(t){var r=t.type,n=r===void 0?"circle":r,o=t.size,a=o===void 0?64:o,s=t.sizeType,l=s===void 0?"area":s,c=ole(t,tle),u=BR(BR({},c),{},{type:n,size:a,sizeType:l}),d=function(){var x=lle(n),b=Dse().type(x).size(cle(a,l,n));return b()},f=u.className,h=u.cx,p=u.cy,y=vr(u,!0);return h===+h&&p===+p&&a===+a?ze.createElement("path",xE({},y,{className:Lr("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};xT.registerSymbol=ule;function bm(e){"@babel/helpers - typeof";return bm=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},bm(e)}function bE(){return bE=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var w=p.inactive?u:p.color;return ze.createElement("li",bE({className:x,style:f,key:"legend-item-".concat(y)},hh(n.props,p,y)),ze.createElement(pE,{width:s,height:s,viewBox:d,style:h},n.renderIcon(p)),ze.createElement("span",{className:"recharts-legend-item-text",style:{color:w}},m?m(b,p,y):b))})}},{key:"render",value:function(){var n=this.props,o=n.payload,a=n.layout,s=n.align;if(!o||!o.length)return null;var l={padding:0,margin:0,textAlign:a==="horizontal"?s:"left"};return ze.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])})(j.PureComponent);lx(bT,"displayName","Legend");lx(bT,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Fk,qR;function ble(){if(qR)return Fk;qR=1;var e=Bw();function t(){this.__data__=new e,this.size=0}return Fk=t,Fk}var Mk,$R;function wle(){if($R)return Mk;$R=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return Mk=e,Mk}var Dk,UR;function Sle(){if(UR)return Dk;UR=1;function e(t){return this.__data__.get(t)}return Dk=e,Dk}var zk,HR;function jle(){if(HR)return zk;HR=1;function e(t){return this.__data__.has(t)}return zk=e,zk}var Bk,VR;function kle(){if(VR)return Bk;VR=1;var e=Bw(),t=uT(),r=dT(),n=200;function o(a,s){var l=this.__data__;if(l instanceof e){var c=l.__data__;if(!t||c.lengthp))return!1;var m=f.get(s),x=f.get(l);if(m&&x)return m==l&&x==s;var b=-1,w=!0,k=c&o?new e:void 0;for(f.set(s,l),f.set(l,s);++b-1&&n%1==0&&n-1&&r%1==0&&r<=e}return l_=t,l_}var c_,mL;function Mle(){if(mL)return c_;mL=1;var e=wd(),t=kT(),r=Sd(),n="[object Arguments]",o="[object Array]",a="[object Boolean]",s="[object Date]",l="[object Error]",c="[object Function]",u="[object Map]",d="[object Number]",f="[object Object]",h="[object RegExp]",p="[object Set]",y="[object String]",m="[object WeakMap]",x="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",k="[object Float64Array]",S="[object Int8Array]",_="[object Int16Array]",P="[object Int32Array]",O="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",I="[object Uint32Array]",E={};E[w]=E[k]=E[S]=E[_]=E[P]=E[O]=E[T]=E[R]=E[I]=!0,E[n]=E[o]=E[x]=E[a]=E[b]=E[s]=E[l]=E[c]=E[u]=E[d]=E[f]=E[h]=E[p]=E[y]=E[m]=!1;function A(F){return r(F)&&t(F.length)&&!!E[e(F)]}return c_=A,c_}var u_,vL;function IU(){if(vL)return u_;vL=1;function e(t){return function(r){return t(r)}}return u_=e,u_}var Iy={exports:{}};Iy.exports;var yL;function Dle(){return yL||(yL=1,(function(e,t){var r=Z$(),n=t&&!t.nodeType&&t,o=n&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===n,s=a&&r.process,l=(function(){try{var c=o&&o.require&&o.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}})();e.exports=l})(Iy,Iy.exports)),Iy.exports}var d_,xL;function NU(){if(xL)return d_;xL=1;var e=Mle(),t=IU(),r=Dle(),n=r&&r.isTypedArray,o=n?t(n):e;return d_=o,d_}var f_,bL;function zle(){if(bL)return f_;bL=1;var e=Rle(),t=ST(),r=ms(),n=OU(),o=jT(),a=NU(),s=Object.prototype,l=s.hasOwnProperty;function c(u,d){var f=r(u),h=!f&&t(u),p=!f&&!h&&n(u),y=!f&&!h&&!p&&a(u),m=f||h||p||y,x=m?e(u.length,String):[],b=x.length;for(var w in u)(d||l.call(u,w))&&!(m&&(w=="length"||p&&(w=="offset"||w=="parent")||y&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||o(w,b)))&&x.push(w);return x}return f_=c,f_}var p_,wL;function Ble(){if(wL)return p_;wL=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,o=typeof n=="function"&&n.prototype||e;return r===o}return p_=t,p_}var h_,SL;function RU(){if(SL)return h_;SL=1;function e(t,r){return function(n){return t(r(n))}}return h_=e,h_}var g_,jL;function Wle(){if(jL)return g_;jL=1;var e=RU(),t=e(Object.keys,Object);return g_=t,g_}var m_,kL;function qle(){if(kL)return m_;kL=1;var e=Ble(),t=Wle(),r=Object.prototype,n=r.hasOwnProperty;function o(a){if(!e(a))return t(a);var s=[];for(var l in Object(a))n.call(a,l)&&l!="constructor"&&s.push(l);return s}return m_=o,m_}var v_,_L;function pb(){if(_L)return v_;_L=1;var e=lT(),t=kT();function r(n){return n!=null&&t(n.length)&&!e(n)}return v_=r,v_}var y_,CL;function Yw(){if(CL)return y_;CL=1;var e=zle(),t=qle(),r=pb();function n(o){return r(o)?e(o):t(o)}return y_=n,y_}var x_,EL;function $le(){if(EL)return x_;EL=1;var e=Ple(),t=Nle(),r=Yw();function n(o){return e(o,r,t)}return x_=n,x_}var b_,AL;function Ule(){if(AL)return b_;AL=1;var e=$le(),t=1,r=Object.prototype,n=r.hasOwnProperty;function o(a,s,l,c,u,d){var f=l&t,h=e(a),p=h.length,y=e(s),m=y.length;if(p!=m&&!f)return!1;for(var x=p;x--;){var b=h[x];if(!(f?b in s:n.call(s,b)))return!1}var w=d.get(a),k=d.get(s);if(w&&k)return w==s&&k==a;var S=!0;d.set(a,s),d.set(s,a);for(var _=f;++x-1}return V_=t,V_}var Y_,tF;function uce(){if(tF)return Y_;tF=1;function e(t,r,n){for(var o=-1,a=t==null?0:t.length;++o=s){var b=u?null:o(c);if(b)return a(b);y=!1,h=n,x=new e}else x=u?[]:m;e:for(;++f=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function _ce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Cce(e){return e.value}function Ece(e,t){if(ze.isValidElement(e))return ze.cloneElement(e,t);if(typeof e=="function")return ze.createElement(e,t);t.ref;var r=kce(t,mce);return ze.createElement(bT,r)}var cF=1,Af=(function(e){function t(){var r;vce(this,t);for(var n=arguments.length,o=new Array(n),a=0;acF||Math.abs(o.height-this.lastBoundingBox.height)>cF)&&(this.lastBoundingBox.width=o.width,this.lastBoundingBox.height=o.height,n&&n(o)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?qu({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var o=this.props,a=o.layout,s=o.align,l=o.verticalAlign,c=o.margin,u=o.chartWidth,d=o.chartHeight,f,h;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(s==="center"&&a==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=s==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(l==="middle"){var y=this.getBBoxSnapshot();h={top:((d||0)-y.height)/2}}else h=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return qu(qu({},f),h)}},{key:"render",value:function(){var n=this,o=this.props,a=o.content,s=o.width,l=o.height,c=o.wrapperStyle,u=o.payloadUniqBy,d=o.payload,f=qu(qu({position:"absolute",width:s||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return ze.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){n.wrapperNode=p}},Ece(a,qu(qu({},this.props),{},{payload:zU(d,u,Cce)})))}}],[{key:"getWithHeight",value:function(n,o){var a=qu(qu({},this.defaultProps),n.props),s=a.layout;return s==="vertical"&&Bt(n.props.height)?{height:n.props.height}:s==="horizontal"?{width:n.props.width||o}:null}}])})(j.PureComponent);Gw(Af,"displayName","Legend");Gw(Af,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var Z_,uF;function Ace(){if(uF)return Z_;uF=1;var e=ub(),t=ST(),r=ms(),n=e?e.isConcatSpreadable:void 0;function o(a){return r(a)||t(a)||!!(n&&a&&a[n])}return Z_=o,Z_}var J_,dF;function qU(){if(dF)return J_;dF=1;var e=PU(),t=Ace();function r(n,o,a,s,l){var c=-1,u=n.length;for(a||(a=t),l||(l=[]);++c0&&a(d)?o>1?r(d,o-1,a,s,l):e(l,d):s||(l[l.length]=d)}return l}return J_=r,J_}var eC,fF;function Tce(){if(fF)return eC;fF=1;function e(t){return function(r,n,o){for(var a=-1,s=Object(r),l=o(r),c=l.length;c--;){var u=l[t?c:++a];if(n(s[u],u,s)===!1)break}return r}}return eC=e,eC}var tC,pF;function Pce(){if(pF)return tC;pF=1;var e=Tce(),t=e();return tC=t,tC}var rC,hF;function $U(){if(hF)return rC;hF=1;var e=Pce(),t=Yw();function r(n,o){return n&&e(n,o,t)}return rC=r,rC}var nC,gF;function Oce(){if(gF)return nC;gF=1;var e=pb();function t(r,n){return function(o,a){if(o==null)return o;if(!e(o))return r(o,a);for(var s=o.length,l=n?s:-1,c=Object(o);(n?l--:++ln||l&&c&&d&&!u&&!f||a&&c&&d||!o&&d||!s)return 1;if(!a&&!l&&!f&&r=u)return d;var f=o[a];return d*(f=="desc"?-1:1)}}return r.index-n.index}return lC=t,lC}var cC,wF;function Lce(){if(wF)return cC;wF=1;var e=fT(),t=pT(),r=su(),n=UU(),o=Ice(),a=IU(),s=Rce(),l=yv(),c=ms();function u(d,f,h){f.length?f=e(f,function(m){return c(m)?function(x){return t(x,m.length===1?m[0]:m)}:m}):f=[l];var p=-1;f=e(f,a(r));var y=n(d,function(m,x,b){var w=e(f,function(k){return k(m)});return{criteria:w,index:++p,value:m}});return o(y,function(m,x){return s(m,x,h)})}return cC=u,cC}var uC,SF;function Fce(){if(SF)return uC;SF=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return uC=e,uC}var dC,jF;function Mce(){if(jF)return dC;jF=1;var e=Fce(),t=Math.max;function r(n,o,a){return o=t(o===void 0?n.length-1:o,0),function(){for(var s=arguments,l=-1,c=t(s.length-o,0),u=Array(c);++l0){if(++a>=e)return arguments[0]}else a=0;return o.apply(void 0,arguments)}}return gC=n,gC}var mC,AF;function Wce(){if(AF)return mC;AF=1;var e=zce(),t=Bce(),r=t(e);return mC=r,mC}var vC,TF;function qce(){if(TF)return vC;TF=1;var e=yv(),t=Mce(),r=Wce();function n(o,a){return r(t(o,a,e),o+"")}return vC=n,vC}var yC,PF;function Kw(){if(PF)return yC;PF=1;var e=cT(),t=pb(),r=jT(),n=Hf();function o(a,s,l){if(!n(l))return!1;var c=typeof s;return(c=="number"?t(l)&&r(s,l.length):c=="string"&&s in l)?e(l[s],a):!1}return yC=o,yC}var xC,OF;function $ce(){if(OF)return xC;OF=1;var e=qU(),t=Lce(),r=qce(),n=Kw(),o=r(function(a,s){if(a==null)return[];var l=s.length;return l>1&&n(a,s[0],s[1])?s=[]:l>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),t(a,e(s,1),[])});return xC=o,xC}var Uce=$ce();const ET=un(Uce);function cx(e){"@babel/helpers - typeof";return cx=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},cx(e)}function jE(){return jE=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t.x),"".concat(ly,"-left"),Bt(r)&&t&&Bt(t.x)&&r=t.y),"".concat(ly,"-top"),Bt(n)&&t&&Bt(t.y)&&nm?Math.max(d,c[n]):Math.max(f,c[n])}function oue(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function aue(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,o=e.position,a=e.reverseDirection,s=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,d,f;return s.height>0&&s.width>0&&r?(d=RF({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:o,reverseDirection:a,tooltipDimension:s.width,viewBox:c,viewBoxDimension:c.width}),f=RF({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:o,reverseDirection:a,tooltipDimension:s.height,viewBox:c,viewBoxDimension:c.height}),u=oue({translateX:d,translateY:f,useTranslate3d:l})):u=nue,{cssProperties:u,cssClasses:iue({translateX:d,translateY:f,coordinate:r})}}function Sm(e){"@babel/helpers - typeof";return Sm=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},Sm(e)}function LF(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function FF(e){for(var t=1;tMF||Math.abs(n.height-this.state.lastBoundingBox.height)>MF)&&this.setState({lastBoundingBox:{width:n.width,height:n.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 n,o;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((o=this.props.coordinate)===null||o===void 0?void 0:o.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,o=this.props,a=o.active,s=o.allowEscapeViewBox,l=o.animationDuration,c=o.animationEasing,u=o.children,d=o.coordinate,f=o.hasPayload,h=o.isAnimationActive,p=o.offset,y=o.position,m=o.reverseDirection,x=o.useTranslate3d,b=o.viewBox,w=o.wrapperStyle,k=aue({allowEscapeViewBox:s,coordinate:d,offsetTopLeft:p,position:y,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:x,viewBox:b}),S=k.cssClasses,_=k.cssProperties,P=FF(FF({transition:h&&a?"transform ".concat(l,"ms ").concat(c):void 0},_),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&f?"visible":"hidden",position:"absolute",top:0,left:0},w);return ze.createElement("div",{tabIndex:-1,className:S,style:P,ref:function(T){n.wrapperNode=T}},u)}}])})(j.PureComponent),mue=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Ih={isSsr:mue()};function jm(e){"@babel/helpers - typeof";return jm=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},jm(e)}function DF(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function zF(e){for(var t=1;t0;return ze.createElement(gue,{allowEscapeViewBox:s,animationDuration:l,animationEasing:c,isAnimationActive:h,active:a,coordinate:d,hasPayload:P,offset:p,position:x,reverseDirection:b,useTranslate3d:w,viewBox:k,wrapperStyle:S},Cue(u,zF(zF({},this.props),{},{payload:_})))}}])})(j.PureComponent);AT(kl,"displayName","Tooltip");AT(kl,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Ih.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var wC,BF;function Eue(){if(BF)return wC;BF=1;var e=au(),t=function(){return e.Date.now()};return wC=t,wC}var SC,WF;function Aue(){if(WF)return SC;WF=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return SC=t,SC}var jC,qF;function Tue(){if(qF)return jC;qF=1;var e=Aue(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return jC=r,jC}var kC,$F;function QU(){if($F)return kC;$F=1;var e=Tue(),t=Hf(),r=gv(),n=NaN,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt;function c(u){if(typeof u=="number")return u;if(r(u))return n;if(t(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=t(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=e(u);var f=a.test(u);return f||s.test(u)?l(u.slice(2),f?2:8):o.test(u)?n:+u}return kC=c,kC}var _C,UF;function Pue(){if(UF)return _C;UF=1;var e=Hf(),t=Eue(),r=QU(),n="Expected a function",o=Math.max,a=Math.min;function s(l,c,u){var d,f,h,p,y,m,x=0,b=!1,w=!1,k=!0;if(typeof l!="function")throw new TypeError(n);c=r(c)||0,e(u)&&(b=!!u.leading,w="maxWait"in u,h=w?o(r(u.maxWait)||0,c):h,k="trailing"in u?!!u.trailing:k);function S(F){var L=d,z=f;return d=f=void 0,x=F,p=l.apply(z,L),p}function _(F){return x=F,y=setTimeout(T,c),b?S(F):p}function P(F){var L=F-m,z=F-x,V=c-L;return w?a(V,h-z):V}function O(F){var L=F-m,z=F-x;return m===void 0||L>=c||L<0||w&&z>=h}function T(){var F=t();if(O(F))return R(F);y=setTimeout(T,P(F))}function R(F){return y=void 0,k&&d?S(F):(d=f=void 0,p)}function I(){y!==void 0&&clearTimeout(y),x=0,d=m=f=y=void 0}function E(){return y===void 0?p:R(t())}function A(){var F=t(),L=O(F);if(d=arguments,f=this,m=F,L){if(y===void 0)return _(m);if(w)return clearTimeout(y),y=setTimeout(T,c),S(m)}return y===void 0&&(y=setTimeout(T,c)),p}return A.cancel=I,A.flush=E,A}return _C=s,_C}var CC,HF;function Oue(){if(HF)return CC;HF=1;var e=Pue(),t=Hf(),r="Expected a function";function n(o,a,s){var l=!0,c=!0;if(typeof o!="function")throw new TypeError(r);return t(s)&&(l="leading"in s?!!s.leading:l,c="trailing"in s?!!s.trailing:c),e(o,a,{leading:l,maxWait:a,trailing:c})}return CC=n,CC}var Iue=Oue();const XU=un(Iue);function dx(e){"@babel/helpers - typeof";return dx=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},dx(e)}function VF(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function L1(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(F=XU(F,m,{trailing:!0,leading:!1}));var L=new ResizeObserver(F),z=_.current.getBoundingClientRect(),V=z.width,Q=z.height;return E(V,Q),L.observe(_.current),function(){L.disconnect()}},[E,m]);var A=j.useMemo(function(){var F=R.containerWidth,L=R.containerHeight;if(F<0||L<0)return null;ac(Kp(s)||Kp(c),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,s,c),ac(!r||r>0,"The aspect(%s) must be greater than zero.",r);var z=Kp(s)?F:s,V=Kp(c)?L:c;r&&r>0&&(z?V=z/r:V&&(z=V*r),h&&V>h&&(V=h)),ac(z>0||V>0,`The width(%s) and height(%s) of chart should be greater than 0, - please check the style of container, or the props width(%s) and height(%s), - or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,z,V,s,c,d,f,r);var Q=!Array.isArray(p)&&ad(p.type).endsWith("Chart");return ze.Children.map(p,function(U){return ze.isValidElement(U)?j.cloneElement(U,L1({width:z,height:V},Q?{style:L1({height:"100%",width:"100%",maxHeight:V,maxWidth:z},U.props.style)}:{})):U})},[r,p,c,h,f,d,R,s]);return ze.createElement("div",{id:x?"".concat(x):void 0,className:Lr("recharts-responsive-container",b),style:L1(L1({},S),{},{width:s,height:c,minWidth:d,minHeight:f,maxHeight:h}),ref:_},A)}),Qw=function(t){return null};Qw.displayName="Cell";function fx(e){"@babel/helpers - typeof";return fx=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},fx(e)}function GF(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function EE(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Ih.isSsr)return{width:0,height:0};var n=Vue(r),o=JSON.stringify({text:t,copyStyle:n});if(_g.widthCache[o])return _g.widthCache[o];try{var a=document.getElementById(KF);a||(a=document.createElement("span"),a.setAttribute("id",KF),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var s=EE(EE({},Hue),n);Object.assign(a.style,s),a.textContent="".concat(t);var l=a.getBoundingClientRect(),c={width:l.width,height:l.height};return _g.widthCache[o]=c,++_g.cacheCount>Uue&&(_g.cacheCount=0,_g.widthCache={}),c}catch{return{width:0,height:0}}},Yue=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function px(e){"@babel/helpers - typeof";return px=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},px(e)}function t2(e,t){return Xue(e)||Que(e,t)||Kue(e,t)||Gue()}function Gue(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kue(e,t){if(e){if(typeof e=="string")return QF(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return QF(e,t)}}function QF(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function dde(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function rM(e,t){return gde(e)||hde(e,t)||pde(e,t)||fde()}function fde(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pde(e,t){if(e){if(typeof e=="string")return nM(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nM(e,t)}}function nM(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[];return z.reduce(function(V,Q){var U=Q.word,ee=Q.width,H=V[V.length-1];if(H&&(o==null||a||H.width+ee+nQ.width?V:Q})};if(!d)return p;for(var m="…",x=function(z){var V=f.slice(0,z),Q=tH({breakAll:u,style:c,children:V+m}).wordsWithComputedWidth,U=h(Q),ee=U.length>s||y(U).width>Number(o);return[ee,U]},b=0,w=f.length-1,k=0,S;b<=w&&k<=f.length-1;){var _=Math.floor((b+w)/2),P=_-1,O=x(P),T=rM(O,2),R=T[0],I=T[1],E=x(_),A=rM(E,1),F=A[0];if(!R&&!F&&(b=_+1),R&&F&&(w=_-1),!R&&F){S=I;break}k++}return S||p},iM=function(t){var r=Rr(t)?[]:t.toString().split(eH);return[{words:r}]},vde=function(t){var r=t.width,n=t.scaleToFit,o=t.children,a=t.style,s=t.breakAll,l=t.maxLines;if((r||n)&&!Ih.isSsr){var c,u,d=tH({breakAll:s,children:o,style:a});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;c=f,u=h}else return iM(o);return mde({breakAll:s,children:o,maxLines:l,style:a},c,u,r,n)}return iM(o)},oM="#808080",gh=function(t){var r=t.x,n=r===void 0?0:r,o=t.y,a=o===void 0?0:o,s=t.lineHeight,l=s===void 0?"1em":s,c=t.capHeight,u=c===void 0?"0.71em":c,d=t.scaleToFit,f=d===void 0?!1:d,h=t.textAnchor,p=h===void 0?"start":h,y=t.verticalAnchor,m=y===void 0?"end":y,x=t.fill,b=x===void 0?oM:x,w=tM(t,cde),k=j.useMemo(function(){return vde({breakAll:w.breakAll,children:w.children,maxLines:w.maxLines,scaleToFit:f,style:w.style,width:w.width})},[w.breakAll,w.children,w.maxLines,f,w.style,w.width]),S=w.dx,_=w.dy,P=w.angle,O=w.className,T=w.breakAll,R=tM(w,ude);if(!ho(n)||!ho(a))return null;var I=n+(Bt(S)?S:0),E=a+(Bt(_)?_:0),A;switch(m){case"start":A=AC("calc(".concat(u,")"));break;case"middle":A=AC("calc(".concat((k.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:A=AC("calc(".concat(k.length-1," * -").concat(l,")"));break}var F=[];if(f){var L=k[0].width,z=w.width;F.push("scale(".concat((Bt(z)?z/L:1)/L,")"))}return P&&F.push("rotate(".concat(P,", ").concat(I,", ").concat(E,")")),F.length&&(R.transform=F.join(" ")),ze.createElement("text",AE({},vr(R,!0),{x:I,y:E,className:Lr("recharts-text",O),textAnchor:p,fill:b.includes("url")?oM:b}),k.map(function(V,Q){var U=V.words.join(T?"":" ");return ze.createElement("tspan",{x:I,dy:Q===0?A:l,key:"".concat(U,"-").concat(Q)},U)}))};function Tf(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function yde(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function TT(e){let t,r,n;e.length!==2?(t=Tf,r=(l,c)=>Tf(e(l),c),n=(l,c)=>e(l)-c):(t=e===Tf||e===yde?e:xde,r=e,n=e);function o(l,c,u=0,d=l.length){if(u>>1;r(l[f],c)<0?u=f+1:d=f}while(u>>1;r(l[f],c)<=0?u=f+1:d=f}while(uu&&n(l[f-1],c)>-n(l[f],c)?f-1:f}return{left:o,center:s,right:a}}function xde(){return 0}function rH(e){return e===null?NaN:+e}function*bde(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const wde=TT(Tf),hb=wde.right;TT(rH).center;class aM extends Map{constructor(t,r=kde){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,o]of t)this.set(n,o)}get(t){return super.get(sM(this,t))}has(t){return super.has(sM(this,t))}set(t,r){return super.set(Sde(this,t),r)}delete(t){return super.delete(jde(this,t))}}function sM({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function Sde({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function jde({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function kde(e){return e!==null&&typeof e=="object"?e.valueOf():e}function _de(e=Tf){if(e===Tf)return nH;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function nH(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const Cde=Math.sqrt(50),Ede=Math.sqrt(10),Ade=Math.sqrt(2);function r2(e,t,r){const n=(t-e)/Math.max(0,r),o=Math.floor(Math.log10(n)),a=n/Math.pow(10,o),s=a>=Cde?10:a>=Ede?5:a>=Ade?2:1;let l,c,u;return o<0?(u=Math.pow(10,-o)/s,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,o)*s,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const n=t=o))return[];const l=a-o+1,c=new Array(l);if(n)if(s<0)for(let u=0;u=n)&&(r=n);return r}function cM(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function iH(e,t,r=0,n=1/0,o){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(o=o===void 0?nH:_de(o);n>r;){if(n-r>600){const c=n-r+1,u=t-r+1,d=Math.log(c),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),p=Math.max(r,Math.floor(t-u*f/c+h)),y=Math.min(n,Math.floor(t+(c-u)*f/c+h));iH(e,t,p,y,o)}const a=e[t];let s=r,l=n;for(cy(e,r,t),o(e[n],a)>0&&cy(e,r,n);s0;)--l}o(e[r],a)===0?cy(e,r,l):(++l,cy(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function cy(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function Tde(e,t,r){if(e=Float64Array.from(bde(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return cM(e);if(t>=1)return lM(e);var n,o=(n-1)*t,a=Math.floor(o),s=lM(iH(e,a).subarray(0,a+1)),l=cM(e.subarray(a+1));return s+(l-s)*(o-a)}}function Pde(e,t,r=rH){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,o=(n-1)*t,a=Math.floor(o),s=+r(e[a],a,e),l=+r(e[a+1],a+1,e);return s+(l-s)*(o-a)}}function Ode(e,t,r){e=+e,t=+t,r=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+r;for(var n=-1,o=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(o);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?M1(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?M1(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=Nde.exec(e))?new cs(t[1],t[2],t[3],1):(t=Rde.exec(e))?new cs(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Lde.exec(e))?M1(t[1],t[2],t[3],t[4]):(t=Fde.exec(e))?M1(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Mde.exec(e))?mM(t[1],t[2]/100,t[3]/100,1):(t=Dde.exec(e))?mM(t[1],t[2]/100,t[3]/100,t[4]):uM.hasOwnProperty(e)?pM(uM[e]):e==="transparent"?new cs(NaN,NaN,NaN,0):null}function pM(e){return new cs(e>>16&255,e>>8&255,e&255,1)}function M1(e,t,r,n){return n<=0&&(e=t=r=NaN),new cs(e,t,r,n)}function Wde(e){return e instanceof gb||(e=vx(e)),e?(e=e.rgb(),new cs(e.r,e.g,e.b,e.opacity)):new cs}function NE(e,t,r,n){return arguments.length===1?Wde(e):new cs(e,t,r,n??1)}function cs(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}OT(cs,NE,aH(gb,{brighter(e){return e=e==null?n2:Math.pow(n2,e),new cs(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?gx:Math.pow(gx,e),new cs(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new cs(nh(this.r),nh(this.g),nh(this.b),i2(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:hM,formatHex:hM,formatHex8:qde,formatRgb:gM,toString:gM}));function hM(){return`#${Qp(this.r)}${Qp(this.g)}${Qp(this.b)}`}function qde(){return`#${Qp(this.r)}${Qp(this.g)}${Qp(this.b)}${Qp((isNaN(this.opacity)?1:this.opacity)*255)}`}function gM(){const e=i2(this.opacity);return`${e===1?"rgb(":"rgba("}${nh(this.r)}, ${nh(this.g)}, ${nh(this.b)}${e===1?")":`, ${e})`}`}function i2(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nh(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Qp(e){return e=nh(e),(e<16?"0":"")+e.toString(16)}function mM(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new tc(e,t,r,n)}function sH(e){if(e instanceof tc)return new tc(e.h,e.s,e.l,e.opacity);if(e instanceof gb||(e=vx(e)),!e)return new tc;if(e instanceof tc)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,o=Math.min(t,r,n),a=Math.max(t,r,n),s=NaN,l=a-o,c=(a+o)/2;return l?(t===a?s=(r-n)/l+(r0&&c<1?0:s,new tc(s,l,c,e.opacity)}function $de(e,t,r,n){return arguments.length===1?sH(e):new tc(e,t,r,n??1)}function tc(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}OT(tc,$de,aH(gb,{brighter(e){return e=e==null?n2:Math.pow(n2,e),new tc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?gx:Math.pow(gx,e),new tc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,o=2*r-n;return new cs(TC(e>=240?e-240:e+120,o,n),TC(e,o,n),TC(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new tc(vM(this.h),D1(this.s),D1(this.l),i2(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=i2(this.opacity);return`${e===1?"hsl(":"hsla("}${vM(this.h)}, ${D1(this.s)*100}%, ${D1(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vM(e){return e=(e||0)%360,e<0?e+360:e}function D1(e){return Math.max(0,Math.min(1,e||0))}function TC(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const IT=e=>()=>e;function Ude(e,t){return function(r){return e+r*t}}function Hde(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function Vde(e){return(e=+e)==1?lH:function(t,r){return r-t?Hde(t,r,e):IT(isNaN(t)?r:t)}}function lH(e,t){var r=t-e;return r?Ude(e,r):IT(isNaN(e)?t:e)}const yM=(function e(t){var r=Vde(t);function n(o,a){var s=r((o=NE(o)).r,(a=NE(a)).r),l=r(o.g,a.g),c=r(o.b,a.b),u=lH(o.opacity,a.opacity);return function(d){return o.r=s(d),o.g=l(d),o.b=c(d),o.opacity=u(d),o+""}}return n.gamma=e,n})(1);function Yde(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),o;return function(a){for(o=0;or&&(a=t.slice(r,a),l[s]?l[s]+=a:l[++s]=a),(n=n[0])===(o=o[0])?l[s]?l[s]+=o:l[++s]=o:(l[++s]=null,c.push({i:s,x:o2(n,o)})),r=PC.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function ife(e,t,r){var n=e[0],o=e[1],a=t[0],s=t[1];return o2?ofe:ife,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?a:(c||(c=l(e.map(n),t,r)))(n(s(h)))}return f.invert=function(h){return s(o((u||(u=l(t,e.map(n),o2)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,a2),d()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),d()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),r=NT,d()},f.clamp=function(h){return arguments.length?(s=h?!0:qa,d()):s!==qa},f.interpolate=function(h){return arguments.length?(r=h,d()):r},f.unknown=function(h){return arguments.length?(a=h,f):a},function(h,p){return n=h,o=p,d()}}function RT(){return Xw()(qa,qa)}function afe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function s2(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function km(e){return e=s2(Math.abs(e)),e?e[1]:NaN}function sfe(e,t){return function(r,n){for(var o=r.length,a=[],s=0,l=e[0],c=0;o>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),a.push(r.substring(o-=l,o+l)),!((c+=l+1)>n));)l=e[s=(s+1)%e.length];return a.reverse().join(t)}}function lfe(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var cfe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function yx(e){if(!(t=cfe.exec(e)))throw new Error("invalid format: "+e);var t;return new LT({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]})}yx.prototype=LT.prototype;function LT(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+""}LT.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 ufe(e){e:for(var t=e.length,r=1,n=-1,o;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(o+1):e}var l2;function dfe(e,t){var r=s2(e,t);if(!r)return l2=void 0,e.toPrecision(t);var n=r[0],o=r[1],a=o-(l2=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,s=n.length;return a===s?n:a>s?n+new Array(a-s+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+s2(e,Math.max(0,t+a-1))[0]}function bM(e,t){var r=s2(e,t);if(!r)return e+"";var n=r[0],o=r[1];return o<0?"0."+new Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+new Array(o-n.length+2).join("0")}const wM={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:afe,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)=>bM(e*100,t),r:bM,s:dfe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function SM(e){return e}var jM=Array.prototype.map,kM=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ffe(e){var t=e.grouping===void 0||e.thousands===void 0?SM:sfe(jM.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",o=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?SM:lfe(jM.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,h){f=yx(f);var p=f.fill,y=f.align,m=f.sign,x=f.symbol,b=f.zero,w=f.width,k=f.comma,S=f.precision,_=f.trim,P=f.type;P==="n"?(k=!0,P="g"):wM[P]||(S===void 0&&(S=12),_=!0,P="g"),(b||p==="0"&&y==="=")&&(b=!0,p="0",y="=");var O=(h&&h.prefix!==void 0?h.prefix:"")+(x==="$"?r:x==="#"&&/[boxX]/.test(P)?"0"+P.toLowerCase():""),T=(x==="$"?n:/[%p]/.test(P)?s:"")+(h&&h.suffix!==void 0?h.suffix:""),R=wM[P],I=/[defgprs%]/.test(P);S=S===void 0?6:/[gprs]/.test(P)?Math.max(1,Math.min(21,S)):Math.max(0,Math.min(20,S));function E(A){var F=O,L=T,z,V,Q;if(P==="c")L=R(A)+L,A="";else{A=+A;var U=A<0||1/A<0;if(A=isNaN(A)?c:R(Math.abs(A),S),_&&(A=ufe(A)),U&&+A==0&&m!=="+"&&(U=!1),F=(U?m==="("?m:l:m==="-"||m==="("?"":m)+F,L=(P==="s"&&!isNaN(A)&&l2!==void 0?kM[8+l2/3]:"")+L+(U&&m==="("?")":""),I){for(z=-1,V=A.length;++zQ||Q>57){L=(Q===46?o+A.slice(z+1):A.slice(z))+L,A=A.slice(0,z);break}}}k&&!b&&(A=t(A,1/0));var ee=F.length+A.length+L.length,H=ee>1)+F+A+L+H.slice(ee);break;default:A=H+F+A+L;break}return a(A)}return E.toString=function(){return f+""},E}function d(f,h){var p=Math.max(-8,Math.min(8,Math.floor(km(h)/3)))*3,y=Math.pow(10,-p),m=u((f=yx(f),f.type="f",f),{suffix:kM[8+p/3]});return function(x){return m(y*x)}}return{format:u,formatPrefix:d}}var z1,FT,cH;pfe({thousands:",",grouping:[3],currency:["$",""]});function pfe(e){return z1=ffe(e),FT=z1.format,cH=z1.formatPrefix,z1}function hfe(e){return Math.max(0,-km(Math.abs(e)))}function gfe(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(km(t)/3)))*3-km(Math.abs(e)))}function mfe(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,km(t)-km(e))+1}function uH(e,t,r,n){var o=OE(e,t,r),a;switch(n=yx(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=gfe(o,s))&&(n.precision=a),cH(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=mfe(o,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=hfe(o))&&(n.precision=a-(n.type==="%")*2);break}}return FT(n)}function Vf(e){var t=e.domain;return e.ticks=function(r){var n=t();return TE(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var o=t();return uH(o[0],o[o.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),o=0,a=n.length-1,s=n[o],l=n[a],c,u,d=10;for(l0;){if(u=PE(s,l,r),u===c)return n[o]=s,n[a]=l,t(n);if(u>0)s=Math.floor(s/u)*u,l=Math.ceil(l/u)*u;else if(u<0)s=Math.ceil(s*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function c2(){var e=RT();return e.copy=function(){return mb(e,c2())},Rl.apply(e,arguments),Vf(e)}function dH(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,a2),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return dH(e).unknown(t)},e=arguments.length?Array.from(e,a2):[0,1],Vf(r)}function fH(e,t){e=e.slice();var r=0,n=e.length-1,o=e[r],a=e[n],s;return aMath.pow(e,t)}function wfe(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 EM(e){return(t,r)=>-e(-t,r)}function MT(e){const t=e(_M,CM),r=t.domain;let n=10,o,a;function s(){return o=wfe(n),a=bfe(n),r()[0]<0?(o=EM(o),a=EM(a),e(vfe,yfe)):e(_M,CM),t}return t.base=function(l){return arguments.length?(n=+l,s()):n},t.domain=function(l){return arguments.length?(r(l),s()):r()},t.ticks=l=>{const c=r();let u=c[0],d=c[c.length-1];const f=d0){for(;h<=p;++h)for(y=1;yd)break;b.push(m)}}else for(;h<=p;++h)for(y=n-1;y>=1;--y)if(m=h>0?y/a(-h):y*a(h),!(md)break;b.push(m)}b.length*2{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=yx(c)).precision==null&&(c.trim=!0),c=FT(c)),l===1/0)return c;const u=Math.max(1,n*l/t.ticks().length);return d=>{let f=d/a(Math.round(o(d)));return f*nr(fH(r(),{floor:l=>a(Math.floor(o(l))),ceil:l=>a(Math.ceil(o(l)))})),t}function pH(){const e=MT(Xw()).domain([1,10]);return e.copy=()=>mb(e,pH()).base(e.base()),Rl.apply(e,arguments),e}function AM(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function TM(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function DT(e){var t=1,r=e(AM(t),TM(t));return r.constant=function(n){return arguments.length?e(AM(t=+n),TM(t)):t},Vf(r)}function hH(){var e=DT(Xw());return e.copy=function(){return mb(e,hH()).constant(e.constant())},Rl.apply(e,arguments)}function PM(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Sfe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function jfe(e){return e<0?-e*e:e*e}function zT(e){var t=e(qa,qa),r=1;function n(){return r===1?e(qa,qa):r===.5?e(Sfe,jfe):e(PM(r),PM(1/r))}return t.exponent=function(o){return arguments.length?(r=+o,n()):r},Vf(t)}function BT(){var e=zT(Xw());return e.copy=function(){return mb(e,BT()).exponent(e.exponent())},Rl.apply(e,arguments),e}function kfe(){return BT.apply(null,arguments).exponent(.5)}function OM(e){return Math.sign(e)*e*e}function _fe(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function gH(){var e=RT(),t=[0,1],r=!1,n;function o(a){var s=_fe(e(a));return isNaN(s)?n:r?Math.round(s):s}return o.invert=function(a){return e.invert(OM(a))},o.domain=function(a){return arguments.length?(e.domain(a),o):e.domain()},o.range=function(a){return arguments.length?(e.range((t=Array.from(a,a2)).map(OM)),o):t.slice()},o.rangeRound=function(a){return o.range(a).round(!0)},o.round=function(a){return arguments.length?(r=!!a,o):r},o.clamp=function(a){return arguments.length?(e.clamp(a),o):e.clamp()},o.unknown=function(a){return arguments.length?(n=a,o):n},o.copy=function(){return gH(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Rl.apply(o,arguments),Vf(o)}function mH(){var e=[],t=[],r=[],n;function o(){var s=0,l=Math.max(1,t.length);for(r=new Array(l-1);++s0?r[l-1]:e[0],l=r?[n[r-1],t]:[n[u-1],n[u]]},s.unknown=function(c){return arguments.length&&(a=c),s},s.thresholds=function(){return n.slice()},s.copy=function(){return vH().domain([e,t]).range(o).unknown(a)},Rl.apply(Vf(s),arguments)}function yH(){var e=[.5],t=[0,1],r,n=1;function o(a){return a!=null&&a<=a?t[hb(e,a,0,n)]:r}return o.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),o):e.slice()},o.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),o):t.slice()},o.invertExtent=function(a){var s=t.indexOf(a);return[e[s-1],e[s]]},o.unknown=function(a){return arguments.length?(r=a,o):r},o.copy=function(){return yH().domain(e).range(t).unknown(r)},Rl.apply(o,arguments)}const OC=new Date,IC=new Date;function mo(e,t,r,n){function o(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return o.floor=a=>(e(a=new Date(+a)),a),o.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),o.round=a=>{const s=o(a),l=o.ceil(a);return a-s(t(a=new Date(+a),s==null?1:Math.floor(s)),a),o.range=(a,s,l)=>{const c=[];if(a=o.ceil(a),l=l==null?1:Math.floor(l),!(a0))return c;let u;do c.push(u=new Date(+a)),t(a,l),e(a);while(umo(s=>{if(s>=s)for(;e(s),!a(s);)s.setTime(s-1)},(s,l)=>{if(s>=s)if(l<0)for(;++l<=0;)for(;t(s,-1),!a(s););else for(;--l>=0;)for(;t(s,1),!a(s););}),r&&(o.count=(a,s)=>(OC.setTime(+a),IC.setTime(+s),e(OC),e(IC),Math.floor(r(OC,IC))),o.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?o.filter(n?s=>n(s)%a===0:s=>o.count(0,s)%a===0):o)),o}const u2=mo(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);u2.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?mo(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):u2);u2.range;const Ju=1e3,Cl=Ju*60,ed=Cl*60,dd=ed*24,WT=dd*7,IM=dd*30,NC=dd*365,Xp=mo(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Ju)},(e,t)=>(t-e)/Ju,e=>e.getUTCSeconds());Xp.range;const qT=mo(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ju)},(e,t)=>{e.setTime(+e+t*Cl)},(e,t)=>(t-e)/Cl,e=>e.getMinutes());qT.range;const $T=mo(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Cl)},(e,t)=>(t-e)/Cl,e=>e.getUTCMinutes());$T.range;const UT=mo(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ju-e.getMinutes()*Cl)},(e,t)=>{e.setTime(+e+t*ed)},(e,t)=>(t-e)/ed,e=>e.getHours());UT.range;const HT=mo(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ed)},(e,t)=>(t-e)/ed,e=>e.getUTCHours());HT.range;const vb=mo(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Cl)/dd,e=>e.getDate()-1);vb.range;const Zw=mo(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/dd,e=>e.getUTCDate()-1);Zw.range;const xH=mo(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/dd,e=>Math.floor(e/dd));xH.range;function Nh(e){return mo(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Cl)/WT)}const Jw=Nh(0),d2=Nh(1),Cfe=Nh(2),Efe=Nh(3),_m=Nh(4),Afe=Nh(5),Tfe=Nh(6);Jw.range;d2.range;Cfe.range;Efe.range;_m.range;Afe.range;Tfe.range;function Rh(e){return mo(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/WT)}const eS=Rh(0),f2=Rh(1),Pfe=Rh(2),Ofe=Rh(3),Cm=Rh(4),Ife=Rh(5),Nfe=Rh(6);eS.range;f2.range;Pfe.range;Ofe.range;Cm.range;Ife.range;Nfe.range;const VT=mo(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());VT.range;const YT=mo(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());YT.range;const fd=mo(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());fd.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:mo(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});fd.range;const pd=mo(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());pd.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:mo(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});pd.range;function bH(e,t,r,n,o,a){const s=[[Xp,1,Ju],[Xp,5,5*Ju],[Xp,15,15*Ju],[Xp,30,30*Ju],[a,1,Cl],[a,5,5*Cl],[a,15,15*Cl],[a,30,30*Cl],[o,1,ed],[o,3,3*ed],[o,6,6*ed],[o,12,12*ed],[n,1,dd],[n,2,2*dd],[r,1,WT],[t,1,IM],[t,3,3*IM],[e,1,NC]];function l(u,d,f){const h=dx).right(s,h);if(p===s.length)return e.every(OE(u/NC,d/NC,f));if(p===0)return u2.every(Math.max(OE(u,d,f),1));const[y,m]=s[h/s[p-1][2]53)return null;"w"in me||(me.w=1),"Z"in me?(we=LC(uy(me.y,0,1)),ie=we.getUTCDay(),we=ie>4||ie===0?f2.ceil(we):f2(we),we=Zw.offset(we,(me.V-1)*7),me.y=we.getUTCFullYear(),me.m=we.getUTCMonth(),me.d=we.getUTCDate()+(me.w+6)%7):(we=RC(uy(me.y,0,1)),ie=we.getDay(),we=ie>4||ie===0?d2.ceil(we):d2(we),we=vb.offset(we,(me.V-1)*7),me.y=we.getFullYear(),me.m=we.getMonth(),me.d=we.getDate()+(me.w+6)%7)}else("W"in me||"U"in me)&&("w"in me||(me.w="u"in me?me.u%7:"W"in me?1:0),ie="Z"in me?LC(uy(me.y,0,1)).getUTCDay():RC(uy(me.y,0,1)).getDay(),me.m=0,me.d="W"in me?(me.w+6)%7+me.W*7-(ie+5)%7:me.w+me.U*7-(ie+6)%7);return"Z"in me?(me.H+=me.Z/100|0,me.M+=me.Z%100,LC(me)):RC(me)}}function T(J,ae,le,me){for(var Oe=0,we=ae.length,ie=le.length,Me,ke;Oe=ie)return-1;if(Me=ae.charCodeAt(Oe++),Me===37){if(Me=ae.charAt(Oe++),ke=_[Me in NM?ae.charAt(Oe++):Me],!ke||(me=ke(J,le,me))<0)return-1}else if(Me!=le.charCodeAt(me++))return-1}return me}function R(J,ae,le){var me=u.exec(ae.slice(le));return me?(J.p=d.get(me[0].toLowerCase()),le+me[0].length):-1}function I(J,ae,le){var me=p.exec(ae.slice(le));return me?(J.w=y.get(me[0].toLowerCase()),le+me[0].length):-1}function E(J,ae,le){var me=f.exec(ae.slice(le));return me?(J.w=h.get(me[0].toLowerCase()),le+me[0].length):-1}function A(J,ae,le){var me=b.exec(ae.slice(le));return me?(J.m=w.get(me[0].toLowerCase()),le+me[0].length):-1}function F(J,ae,le){var me=m.exec(ae.slice(le));return me?(J.m=x.get(me[0].toLowerCase()),le+me[0].length):-1}function L(J,ae,le){return T(J,t,ae,le)}function z(J,ae,le){return T(J,r,ae,le)}function V(J,ae,le){return T(J,n,ae,le)}function Q(J){return s[J.getDay()]}function U(J){return a[J.getDay()]}function ee(J){return c[J.getMonth()]}function H(J){return l[J.getMonth()]}function B(J){return o[+(J.getHours()>=12)]}function M(J){return 1+~~(J.getMonth()/3)}function $(J){return s[J.getUTCDay()]}function q(J){return a[J.getUTCDay()]}function Y(J){return c[J.getUTCMonth()]}function K(J){return l[J.getUTCMonth()]}function G(J){return o[+(J.getUTCHours()>=12)]}function re(J){return 1+~~(J.getUTCMonth()/3)}return{format:function(J){var ae=P(J+="",k);return ae.toString=function(){return J},ae},parse:function(J){var ae=O(J+="",!1);return ae.toString=function(){return J},ae},utcFormat:function(J){var ae=P(J+="",S);return ae.toString=function(){return J},ae},utcParse:function(J){var ae=O(J+="",!0);return ae.toString=function(){return J},ae}}}var NM={"-":"",_:" ",0:"0"},Do=/^\s*\d+/,zfe=/^%/,Bfe=/[\\^$*+?|[\]().{}]/g;function cn(e,t,r){var n=e<0?"-":"",o=(n?-e:e)+"",a=o.length;return n+(a[t.toLowerCase(),r]))}function qfe(e,t,r){var n=Do.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function $fe(e,t,r){var n=Do.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function Ufe(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Hfe(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function Vfe(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function RM(e,t,r){var n=Do.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function LM(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function Yfe(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Gfe(e,t,r){var n=Do.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Kfe(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function FM(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Qfe(e,t,r){var n=Do.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function MM(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function Xfe(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Zfe(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Jfe(e,t,r){var n=Do.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function epe(e,t,r){var n=Do.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function tpe(e,t,r){var n=zfe.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function rpe(e,t,r){var n=Do.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function npe(e,t,r){var n=Do.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function DM(e,t){return cn(e.getDate(),t,2)}function ipe(e,t){return cn(e.getHours(),t,2)}function ope(e,t){return cn(e.getHours()%12||12,t,2)}function ape(e,t){return cn(1+vb.count(fd(e),e),t,3)}function wH(e,t){return cn(e.getMilliseconds(),t,3)}function spe(e,t){return wH(e,t)+"000"}function lpe(e,t){return cn(e.getMonth()+1,t,2)}function cpe(e,t){return cn(e.getMinutes(),t,2)}function upe(e,t){return cn(e.getSeconds(),t,2)}function dpe(e){var t=e.getDay();return t===0?7:t}function fpe(e,t){return cn(Jw.count(fd(e)-1,e),t,2)}function SH(e){var t=e.getDay();return t>=4||t===0?_m(e):_m.ceil(e)}function ppe(e,t){return e=SH(e),cn(_m.count(fd(e),e)+(fd(e).getDay()===4),t,2)}function hpe(e){return e.getDay()}function gpe(e,t){return cn(d2.count(fd(e)-1,e),t,2)}function mpe(e,t){return cn(e.getFullYear()%100,t,2)}function vpe(e,t){return e=SH(e),cn(e.getFullYear()%100,t,2)}function ype(e,t){return cn(e.getFullYear()%1e4,t,4)}function xpe(e,t){var r=e.getDay();return e=r>=4||r===0?_m(e):_m.ceil(e),cn(e.getFullYear()%1e4,t,4)}function bpe(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+cn(t/60|0,"0",2)+cn(t%60,"0",2)}function zM(e,t){return cn(e.getUTCDate(),t,2)}function wpe(e,t){return cn(e.getUTCHours(),t,2)}function Spe(e,t){return cn(e.getUTCHours()%12||12,t,2)}function jpe(e,t){return cn(1+Zw.count(pd(e),e),t,3)}function jH(e,t){return cn(e.getUTCMilliseconds(),t,3)}function kpe(e,t){return jH(e,t)+"000"}function _pe(e,t){return cn(e.getUTCMonth()+1,t,2)}function Cpe(e,t){return cn(e.getUTCMinutes(),t,2)}function Epe(e,t){return cn(e.getUTCSeconds(),t,2)}function Ape(e){var t=e.getUTCDay();return t===0?7:t}function Tpe(e,t){return cn(eS.count(pd(e)-1,e),t,2)}function kH(e){var t=e.getUTCDay();return t>=4||t===0?Cm(e):Cm.ceil(e)}function Ppe(e,t){return e=kH(e),cn(Cm.count(pd(e),e)+(pd(e).getUTCDay()===4),t,2)}function Ope(e){return e.getUTCDay()}function Ipe(e,t){return cn(f2.count(pd(e)-1,e),t,2)}function Npe(e,t){return cn(e.getUTCFullYear()%100,t,2)}function Rpe(e,t){return e=kH(e),cn(e.getUTCFullYear()%100,t,2)}function Lpe(e,t){return cn(e.getUTCFullYear()%1e4,t,4)}function Fpe(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Cm(e):Cm.ceil(e),cn(e.getUTCFullYear()%1e4,t,4)}function Mpe(){return"+0000"}function BM(){return"%"}function WM(e){return+e}function qM(e){return Math.floor(+e/1e3)}var Cg,_H,CH;Dpe({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Dpe(e){return Cg=Dfe(e),_H=Cg.format,Cg.parse,CH=Cg.utcFormat,Cg.utcParse,Cg}function zpe(e){return new Date(e)}function Bpe(e){return e instanceof Date?+e:+new Date(+e)}function GT(e,t,r,n,o,a,s,l,c,u){var d=RT(),f=d.invert,h=d.domain,p=u(".%L"),y=u(":%S"),m=u("%I:%M"),x=u("%I %p"),b=u("%a %d"),w=u("%b %d"),k=u("%B"),S=u("%Y");function _(P){return(c(P)t(o/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(o,a)=>Tde(e,a/n))},r.copy=function(){return PH(t).domain(e)},jd.apply(r,arguments)}function rS(){var e=0,t=.5,r=1,n=1,o,a,s,l,c,u=qa,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-a)*(n*mr}return MC=e,MC}var DC,VM;function Hpe(){if(VM)return DC;VM=1;var e=nS(),t=RH(),r=yv();function n(o){return o&&o.length?e(o,r,t):void 0}return DC=n,DC}var Vpe=Hpe();const iS=un(Vpe);var zC,YM;function LH(){if(YM)return zC;YM=1;function e(t,r){return te.e^a.s<0?1:-1;for(n=a.d.length,o=e.d.length,t=0,r=ne.d[t]^a.s<0?1:-1;return n===o?0:n>o^a.s<0?1:-1};Zt.decimalPlaces=Zt.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*ni;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};Zt.dividedBy=Zt.div=function(e){return sd(this,new this.constructor(e))};Zt.dividedToIntegerBy=Zt.idiv=function(e){var t=this,r=t.constructor;return Bn(sd(t,new r(e),0,1),r.precision)};Zt.equals=Zt.eq=function(e){return!this.cmp(e)};Zt.exponent=function(){return Ji(this)};Zt.greaterThan=Zt.gt=function(e){return this.cmp(e)>0};Zt.greaterThanOrEqualTo=Zt.gte=function(e){return this.cmp(e)>=0};Zt.isInteger=Zt.isint=function(){return this.e>this.d.length-2};Zt.isNegative=Zt.isneg=function(){return this.s<0};Zt.isPositive=Zt.ispos=function(){return this.s>0};Zt.isZero=function(){return this.s===0};Zt.lessThan=Zt.lt=function(e){return this.cmp(e)<0};Zt.lessThanOrEqualTo=Zt.lte=function(e){return this.cmp(e)<1};Zt.logarithm=Zt.log=function(e){var t,r=this,n=r.constructor,o=n.precision,a=o+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq($s))throw Error(Ol+"NaN");if(r.s<1)throw Error(Ol+(r.s?"NaN":"-Infinity"));return r.eq($s)?new n(0):(ui=!1,t=sd(xx(r,a),xx(e,a),a),ui=!0,Bn(t,o))};Zt.minus=Zt.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?BH(t,e):DH(t,(e.s=-e.s,e))};Zt.modulo=Zt.mod=function(e){var t,r=this,n=r.constructor,o=n.precision;if(e=new n(e),!e.s)throw Error(Ol+"NaN");return r.s?(ui=!1,t=sd(r,e,0,1).times(e),ui=!0,r.minus(t)):Bn(new n(r),o)};Zt.naturalExponential=Zt.exp=function(){return zH(this)};Zt.naturalLogarithm=Zt.ln=function(){return xx(this)};Zt.negated=Zt.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Zt.plus=Zt.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?DH(t,e):BH(t,(e.s=-e.s,e))};Zt.precision=Zt.sd=function(e){var t,r,n,o=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ih+e);if(t=Ji(o)+1,n=o.d.length-1,r=n*ni+1,n=o.d[n],n){for(;n%10==0;n/=10)r--;for(n=o.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};Zt.squareRoot=Zt.sqrt=function(){var e,t,r,n,o,a,s,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Ol+"NaN")}for(e=Ji(l),ui=!1,o=Math.sqrt(+l),o==0||o==1/0?(t=Vc(l.d),(t.length+e)%2==0&&(t+="0"),o=Math.sqrt(t),e=wv((e+1)/2)-(e<0||e%2),o==1/0?t="5e"+e:(t=o.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(o.toString()),r=c.precision,o=s=r+3;;)if(a=n,n=a.plus(sd(l,a,s+2)).times(.5),Vc(a.d).slice(0,s)===(t=Vc(n.d)).slice(0,s)){if(t=t.slice(s-3,s+1),o==s&&t=="4999"){if(Bn(a,r+1,0),a.times(a).eq(l)){n=a;break}}else if(t!="9999")break;s+=4}return ui=!0,Bn(n,r)};Zt.times=Zt.mul=function(e){var t,r,n,o,a,s,l,c,u,d=this,f=d.constructor,h=d.d,p=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,r=d.e+e.e,c=h.length,u=p.length,c=0;){for(t=0,o=c+n;o>n;)l=a[o]+p[n]*h[o-n-1]+t,a[o--]=l%Io|0,t=l/Io|0;a[o]=(a[o]+t)%Io|0}for(;!a[--s];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,ui?Bn(e,f.precision):e};Zt.toDecimalPlaces=Zt.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Jc(e,0,bv),t===void 0?t=n.rounding:Jc(t,0,8),Bn(r,e+Ji(r)+1,t))};Zt.toExponential=function(e,t){var r,n=this,o=n.constructor;return e===void 0?r=mh(n,!0):(Jc(e,0,bv),t===void 0?t=o.rounding:Jc(t,0,8),n=Bn(new o(n),e+1,t),r=mh(n,!0,e+1)),r};Zt.toFixed=function(e,t){var r,n,o=this,a=o.constructor;return e===void 0?mh(o):(Jc(e,0,bv),t===void 0?t=a.rounding:Jc(t,0,8),n=Bn(new a(o),e+Ji(o)+1,t),r=mh(n.abs(),!1,e+Ji(n)+1),o.isneg()&&!o.isZero()?"-"+r:r)};Zt.toInteger=Zt.toint=function(){var e=this,t=e.constructor;return Bn(new t(e),Ji(e)+1,t.rounding)};Zt.toNumber=function(){return+this};Zt.toPower=Zt.pow=function(e){var t,r,n,o,a,s,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c($s);if(l=new c(l),!l.s){if(e.s<1)throw Error(Ol+"Infinity");return l}if(l.eq($s))return l;if(n=c.precision,e.eq($s))return Bn(l,n);if(t=e.e,r=e.d.length-1,s=t>=r,a=l.s,s){if((r=d<0?-d:d)<=MH){for(o=new c($s),t=Math.ceil(n/ni+4),ui=!1;r%2&&(o=o.times(l),JM(o.d,t)),r=wv(r/2),r!==0;)l=l.times(l),JM(l.d,t);return ui=!0,e.s<0?new c($s).div(o):Bn(o,n)}}else if(a<0)throw Error(Ol+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,ui=!1,o=e.times(xx(l,n+u)),ui=!0,o=zH(o),o.s=a,o};Zt.toPrecision=function(e,t){var r,n,o=this,a=o.constructor;return e===void 0?(r=Ji(o),n=mh(o,r<=a.toExpNeg||r>=a.toExpPos)):(Jc(e,1,bv),t===void 0?t=a.rounding:Jc(t,0,8),o=Bn(new a(o),e,t),r=Ji(o),n=mh(o,e<=r||r<=a.toExpNeg,e)),n};Zt.toSignificantDigits=Zt.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Jc(e,1,bv),t===void 0?t=n.rounding:Jc(t,0,8)),Bn(new n(r),e,t)};Zt.toString=Zt.valueOf=Zt.val=Zt.toJSON=Zt[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Ji(e),r=e.constructor;return mh(e,t<=r.toExpNeg||t>=r.toExpPos)};function DH(e,t){var r,n,o,a,s,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),ui?Bn(t,f):t;if(c=e.d,u=t.d,s=e.e,o=t.e,c=c.slice(),a=s-o,a){for(a<0?(n=c,a=-a,l=u.length):(n=u,o=s,l=c.length),s=Math.ceil(f/ni),l=s>l?s+1:l+1,a>l&&(a=l,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(l=c.length,a=u.length,l-a<0&&(a=l,n=u,u=c,c=n),r=0;a;)r=(c[--a]=c[a]+u[a]+r)/Io|0,c[a]%=Io;for(r&&(c.unshift(r),++o),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=o,ui?Bn(t,f):t}function Jc(e,t,r){if(e!==~~e||er)throw Error(ih+e)}function Vc(e){var t,r,n,o=e.length-1,a="",s=e[0];if(o>0){for(a+=s,t=1;ts?1:-1;else for(l=c=0;lo[l]?1:-1;break}return c}function r(n,o,a){for(var s=0;a--;)n[a]-=s,s=n[a]1;)n.shift()}return function(n,o,a,s){var l,c,u,d,f,h,p,y,m,x,b,w,k,S,_,P,O,T,R=n.constructor,I=n.s==o.s?1:-1,E=n.d,A=o.d;if(!n.s)return new R(n);if(!o.s)throw Error(Ol+"Division by zero");for(c=n.e-o.e,O=A.length,_=E.length,p=new R(I),y=p.d=[],u=0;A[u]==(E[u]||0);)++u;if(A[u]>(E[u]||0)&&--c,a==null?w=a=R.precision:s?w=a+(Ji(n)-Ji(o))+1:w=a,w<0)return new R(0);if(w=w/ni+2|0,u=0,O==1)for(d=0,A=A[0],w++;(u<_||d)&&w--;u++)k=d*Io+(E[u]||0),y[u]=k/A|0,d=k%A|0;else{for(d=Io/(A[0]+1)|0,d>1&&(A=e(A,d),E=e(E,d),O=A.length,_=E.length),S=O,m=E.slice(0,O),x=m.length;x=Io/2&&++P;do d=0,l=t(A,m,O,x),l<0?(b=m[0],O!=x&&(b=b*Io+(m[1]||0)),d=b/P|0,d>1?(d>=Io&&(d=Io-1),f=e(A,d),h=f.length,x=m.length,l=t(f,m,h,x),l==1&&(d--,r(f,O16)throw Error(XT+Ji(e));if(!e.s)return new d($s);for(ui=!1,l=f,s=new d(.03125);e.abs().gte(.1);)e=e.times(s),u+=5;for(n=Math.log(zp(2,u))/Math.LN10*2+5|0,l+=n,r=o=a=new d($s),d.precision=l;;){if(o=Bn(o.times(e),l),r=r.times(++c),s=a.plus(sd(o,r,l)),Vc(s.d).slice(0,l)===Vc(a.d).slice(0,l)){for(;u--;)a=Bn(a.times(a),l);return d.precision=f,t==null?(ui=!0,Bn(a,f)):a}a=s}}function Ji(e){for(var t=e.e*ni,r=e.d[0];r>=10;r/=10)t++;return t}function UC(e,t,r){if(t>e.LN10.sd())throw ui=!0,r&&(e.precision=r),Error(Ol+"LN10 precision limit exceeded");return Bn(new e(e.LN10),t)}function yf(e){for(var t="";e--;)t+="0";return t}function xx(e,t){var r,n,o,a,s,l,c,u,d,f=1,h=10,p=e,y=p.d,m=p.constructor,x=m.precision;if(p.s<1)throw Error(Ol+(p.s?"NaN":"-Infinity"));if(p.eq($s))return new m(0);if(t==null?(ui=!1,u=x):u=t,p.eq(10))return t==null&&(ui=!0),UC(m,u);if(u+=h,m.precision=u,r=Vc(y),n=r.charAt(0),a=Ji(p),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(e),r=Vc(p.d),n=r.charAt(0),f++;a=Ji(p),n>1?(p=new m("0."+r),a++):p=new m(n+"."+r.slice(1))}else return c=UC(m,u+2,x).times(a+""),p=xx(new m(n+"."+r.slice(1)),u-h).plus(c),m.precision=x,t==null?(ui=!0,Bn(p,x)):p;for(l=s=p=sd(p.minus($s),p.plus($s),u),d=Bn(p.times(p),u),o=3;;){if(s=Bn(s.times(d),u),c=l.plus(sd(s,new m(o),u)),Vc(c.d).slice(0,u)===Vc(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(UC(m,u+2,x).times(a+""))),l=sd(l,new m(f),u),m.precision=x,t==null?(ui=!0,Bn(l,x)):l;l=c,o+=2}}function ZM(e,t){var r,n,o;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(o=t.length;t.charCodeAt(o-1)===48;)--o;if(t=t.slice(n,o),t){if(o-=n,r=r-n-1,e.e=wv(r/ni),e.d=[],n=(r+1)%ni,r<0&&(n+=ni),np2||e.e<-p2))throw Error(XT+r)}else e.s=0,e.e=0,e.d=[0];return e}function Bn(e,t,r){var n,o,a,s,l,c,u,d,f=e.d;for(s=1,a=f[0];a>=10;a/=10)s++;if(n=t-s,n<0)n+=ni,o=t,u=f[d=0];else{if(d=Math.ceil((n+1)/ni),a=f.length,d>=a)return e;for(u=a=f[d],s=1;a>=10;a/=10)s++;n%=ni,o=n-ni+s}if(r!==void 0&&(a=zp(10,s-o-1),l=u/a%10|0,c=t<0||f[d+1]!==void 0||u%a,c=r<4?(l||c)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?o>0?u/zp(10,s-o):0:f[d-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(a=Ji(e),f.length=1,t=t-a-1,f[0]=zp(10,(ni-t%ni)%ni),e.e=wv(-t/ni)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=d,a=1,d--):(f.length=d+1,a=zp(10,ni-n),f[d]=o>0?(u/zp(10,s-o)%zp(10,o)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==Io&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=Io)break;f[d--]=0,a=1}for(n=f.length;f[--n]===0;)f.pop();if(ui&&(e.e>p2||e.e<-p2))throw Error(XT+Ji(e));return e}function BH(e,t){var r,n,o,a,s,l,c,u,d,f,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),ui?Bn(t,p):t;if(c=e.d,f=t.d,n=t.e,u=e.e,c=c.slice(),s=u-n,s){for(d=s<0,d?(r=c,s=-s,l=f.length):(r=f,n=u,l=c.length),o=Math.max(Math.ceil(p/ni),l)+2,s>o&&(s=o,r.length=1),r.reverse(),o=s;o--;)r.push(0);r.reverse()}else{for(o=c.length,l=f.length,d=o0;--o)c[l++]=0;for(o=f.length;o>s;){if(c[--o]0?a=a.charAt(0)+"."+a.slice(1)+yf(n):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(o<0?"e":"e+")+o):o<0?(a="0."+yf(-o-1)+a,r&&(n=r-s)>0&&(a+=yf(n))):o>=s?(a+=yf(o+1-s),r&&(n=r-o-1)>0&&(a=a+"."+yf(n))):((n=o+1)0&&(o+1===s&&(a+="."),a+=yf(n))),e.s<0?"-"+a:a}function JM(e,t){if(e.length>t)return e.length=t,!0}function WH(e){var t,r,n;function o(a){var s=this;if(!(s instanceof o))return new o(a);if(s.constructor=o,a instanceof o){s.s=a.s,s.e=a.e,s.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(ih+a);if(a>0)s.s=1;else if(a<0)a=-a,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(a===~~a&&a<1e7){s.e=0,s.d=[a];return}return ZM(s,a.toString())}else if(typeof a!="string")throw Error(ih+a);if(a.charCodeAt(0)===45?(a=a.slice(1),s.s=-1):s.s=1,the.test(a))ZM(s,a);else throw Error(ih+a)}if(o.prototype=Zt,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.clone=WH,o.config=o.set=rhe,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(ih+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(ih+r+": "+n);return this}var ZT=WH(ehe);$s=new ZT(1);const Nn=ZT;function nhe(e){return she(e)||ahe(e)||ohe(e)||ihe()}function ihe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ohe(e,t){if(e){if(typeof e=="string")return FE(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return FE(e,t)}}function ahe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function she(e){if(Array.isArray(e))return FE(e)}function FE(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t?r.apply(void 0,o):e(t-s,eD(function(){for(var l=arguments.length,c=new Array(l),u=0;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,o=!1,a=void 0;try{for(var s=e[Symbol.iterator](),l;!(n=(l=s.next()).done)&&(r.push(l.value),!(t&&r.length===t));n=!0);}catch(c){o=!0,a=c}finally{try{!n&&s.return!=null&&s.return()}finally{if(o)throw a}}return r}}function She(e){if(Array.isArray(e))return e}function VH(e){var t=bx(e,2),r=t[0],n=t[1],o=r,a=n;return r>n&&(o=n,a=r),[o,a]}function YH(e,t,r){if(e.lte(0))return new Nn(0);var n=sS.getDigitCount(e.toNumber()),o=new Nn(10).pow(n),a=e.div(o),s=n!==1?.05:.1,l=new Nn(Math.ceil(a.div(s).toNumber())).add(r).mul(s),c=l.mul(o);return t?c:new Nn(Math.ceil(c))}function jhe(e,t,r){var n=1,o=new Nn(e);if(!o.isint()&&r){var a=Math.abs(e);a<1?(n=new Nn(10).pow(sS.getDigitCount(e)-1),o=new Nn(Math.floor(o.div(n).toNumber())).mul(n)):a>1&&(o=new Nn(Math.floor(e)))}else e===0?o=new Nn(Math.floor((t-1)/2)):r||(o=new Nn(Math.floor(e)));var s=Math.floor((t-1)/2),l=dhe(uhe(function(c){return o.add(new Nn(c-s).mul(n)).toNumber()}),ME);return l(0,t)}function GH(e,t,r,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new Nn(0),tickMin:new Nn(0),tickMax:new Nn(0)};var a=YH(new Nn(t).sub(e).div(r-1),n,o),s;e<=0&&t>=0?s=new Nn(0):(s=new Nn(e).add(t).div(2),s=s.sub(new Nn(s).mod(a)));var l=Math.ceil(s.sub(e).div(a).toNumber()),c=Math.ceil(new Nn(t).sub(s).div(a).toNumber()),u=l+c+1;return u>r?GH(e,t,r,n,o+1):(u0?c+(r-u):c,l=t>0?l:l+(r-u)),{step:a,tickMin:s.sub(new Nn(l).mul(a)),tickMax:s.add(new Nn(c).mul(a))})}function khe(e){var t=bx(e,2),r=t[0],n=t[1],o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(o,2),l=VH([r,n]),c=bx(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(zE(ME(0,o-1).map(function(){return 1/0}))):[].concat(zE(ME(0,o-1).map(function(){return-1/0})),[d]);return r>n?DE(f):f}if(u===d)return jhe(u,o,a);var h=GH(u,d,s,a),p=h.step,y=h.tickMin,m=h.tickMax,x=sS.rangeStep(y,m.add(new Nn(.1).mul(p)),p);return r>n?DE(x):x}function _he(e,t){var r=bx(e,2),n=r[0],o=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=VH([n,o]),l=bx(s,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[n,o];if(c===u)return[c];var d=Math.max(t,2),f=YH(new Nn(u).sub(c).div(d-1),a,0),h=[].concat(zE(sS.rangeStep(new Nn(c),new Nn(u).sub(new Nn(.99).mul(f)),f)),[u]);return n>o?DE(h):h}var Che=UH(khe),Ehe=UH(_he),Ahe="Invariant failed";function vh(e,t){throw new Error(Ahe)}var The=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Em(e){"@babel/helpers - typeof";return Em=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},Em(e)}function h2(){return h2=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Fhe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Mhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dhe(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,s=-1,l=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0;if(l<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,u=0;u0?o[u-1].coordinate:o[l-1].coordinate,f=o[u].coordinate,h=u>=l-1?o[0].coordinate:o[u+1].coordinate,p=void 0;if(Ba(f-d)!==Ba(h-f)){var y=[];if(Ba(h-f)===Ba(c[1]-c[0])){p=h;var m=f+c[1]-c[0];y[0]=Math.min(m,(m+d)/2),y[1]=Math.max(m,(m+d)/2)}else{p=d;var x=h+c[1]-c[0];y[0]=Math.min(f,(x+f)/2),y[1]=Math.max(f,(x+f)/2)}var b=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(t>b[0]&&t<=b[1]||t>=y[0]&&t<=y[1]){s=o[u].index;break}}else{var w=Math.min(d,h),k=Math.max(d,h);if(t>(w+f)/2&&t<=(k+f)/2){s=o[u].index;break}}}else for(var S=0;S0&&S(n[S].coordinate+n[S-1].coordinate)/2&&t<=(n[S].coordinate+n[S+1].coordinate)/2||S===l-1&&t>(n[S].coordinate+n[S-1].coordinate)/2){s=n[S].index;break}return s},JT=function(t){var r,n=t,o=n.type.displayName,a=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Ai(Ai({},t.type.defaultProps),t.props):t.props,s=a.stroke,l=a.fill,c;switch(o){case"Line":c=s;break;case"Area":case"Radar":c=s&&s!=="none"?s:l;break;default:c=l;break}return c},tge=function(t){var r=t.barSize,n=t.totalSize,o=t.stackGroups,a=o===void 0?{}:o;if(!a)return{};for(var s={},l=Object.keys(a),c=0,u=l.length;c=0});if(b&&b.length){var w=b[0].type.defaultProps,k=w!==void 0?Ai(Ai({},w),b[0].props):b[0].props,S=k.barSize,_=k[x];s[_]||(s[_]=[]);var P=Rr(S)?r:S;s[_].push({item:b[0],stackList:b.slice(1),barSize:Rr(P)?void 0:Wa(P,n,0)})}}return s},rge=function(t){var r=t.barGap,n=t.barCategoryGap,o=t.bandSize,a=t.sizeList,s=a===void 0?[]:a,l=t.maxBarSize,c=s.length;if(c<1)return null;var u=Wa(r,o,0,!0),d,f=[];if(s[0].barSize===+s[0].barSize){var h=!1,p=o/c,y=s.reduce(function(S,_){return S+_.barSize||0},0);y+=(c-1)*u,y>=o&&(y-=(c-1)*u,u=0),y>=o&&p>0&&(h=!0,p*=.9,y=c*p);var m=(o-y)/2>>0,x={offset:m-u,size:0};d=s.reduce(function(S,_){var P={item:_.item,position:{offset:x.offset+x.size+u,size:h?p:_.barSize}},O=[].concat(nD(S),[P]);return x=O[O.length-1].position,_.stackList&&_.stackList.length&&_.stackList.forEach(function(T){O.push({item:T,position:x})}),O},f)}else{var b=Wa(n,o,0,!0);o-2*b-(c-1)*u<=0&&(u=0);var w=(o-2*b-(c-1)*u)/c;w>1&&(w>>=0);var k=l===+l?Math.min(w,l):w;d=s.reduce(function(S,_,P){var O=[].concat(nD(S),[{item:_.item,position:{offset:b+(w+u)*P+(w-k)/2,size:k}}]);return _.stackList&&_.stackList.length&&_.stackList.forEach(function(T){O.push({item:T,position:O[O.length-1].position})}),O},f)}return d},nge=function(t,r,n,o){var a=n.children,s=n.width,l=n.margin,c=s-(l.left||0)-(l.right||0),u=ZH({children:a,legendWidth:c});if(u){var d=o||{},f=d.width,h=d.height,p=u.align,y=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&y==="middle")&&p!=="center"&&Bt(t[p]))return Ai(Ai({},t),{},nm({},p,t[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&y!=="middle"&&Bt(t[y]))return Ai(Ai({},t),{},nm({},y,t[y]+(h||0)))}return t},ige=function(t,r,n){return Rr(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},JH=function(t,r,n,o,a){var s=r.props.children,l=Ks(s,xb).filter(function(u){return ige(o,a,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return t.reduce(function(u,d){var f=uo(d,n);if(Rr(f))return u;var h=Array.isArray(f)?[oS(f),iS(f)]:[f,f],p=c.reduce(function(y,m){var x=uo(d,m,0),b=h[0]-Math.abs(Array.isArray(x)?x[0]:x),w=h[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(b,y[0]),Math.max(w,y[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},oge=function(t,r,n,o,a){var s=r.map(function(l){return JH(t,l,n,a,o)}).filter(function(l){return!Rr(l)});return s&&s.length?s.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},eV=function(t,r,n,o,a){var s=r.map(function(c){var u=c.props.dataKey;return n==="number"&&u&&JH(t,c,u,o)||qy(t,u,n,a)});if(n==="number")return s.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return s.reduce(function(c,u){for(var d=0,f=u.length;d=2?Ba(l[0]-l[1])*2*u:u,r&&(t.ticks||t.niceTicks)){var d=(t.ticks||t.niceTicks).map(function(f){var h=a?a.indexOf(f):f;return{coordinate:o(h)+u,value:f,offset:u}});return d.filter(function(f){return!fb(f.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(f,h){return{coordinate:o(f)+u,value:f,index:h,offset:u}}):o.ticks&&!n?o.ticks(t.tickCount).map(function(f){return{coordinate:o(f)+u,value:f,offset:u}}):o.domain().map(function(f,h){return{coordinate:o(f)+u,value:a?a[f]:f,index:h,offset:u}})},HC=new WeakMap,B1=function(t,r){if(typeof r!="function")return t;HC.has(t)||HC.set(t,new WeakMap);var n=HC.get(t);if(n.has(r))return n.get(r);var o=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,o),o},nV=function(t,r,n){var o=t.scale,a=t.type,s=t.layout,l=t.axisType;if(o==="auto")return s==="radial"&&l==="radiusAxis"?{scale:hx(),realScaleType:"band"}:s==="radial"&&l==="angleAxis"?{scale:c2(),realScaleType:"linear"}:a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:Wy(),realScaleType:"point"}:a==="category"?{scale:hx(),realScaleType:"band"}:{scale:c2(),realScaleType:"linear"};if(db(o)){var c="scale".concat($w(o));return{scale:($M[c]||Wy)(),realScaleType:$M[c]?c:"point"}}return Ar(o)?{scale:o}:{scale:Wy(),realScaleType:"point"}},oD=1e-4,iV=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,o=t.range(),a=Math.min(o[0],o[1])-oD,s=Math.max(o[0],o[1])+oD,l=t(r[0]),c=t(r[n-1]);(ls||cs)&&t.domain([r[0],r[n-1]])}},age=function(t,r){if(!t)return null;for(var n=0,o=t.length;no)&&(a[1]=o),a[0]>o&&(a[0]=o),a[1]=0?(t[l][n][0]=a,t[l][n][1]=a+c,a=t[l][n][1]):(t[l][n][0]=s,t[l][n][1]=s+c,s=t[l][n][1])}},cge=function(t){var r=t.length;if(!(r<=0))for(var n=0,o=t[0].length;n=0?(t[s][n][0]=a,t[s][n][1]=a+l,a=t[s][n][1]):(t[s][n][0]=0,t[s][n][1]=0)}},uge={sign:lge,expand:Zse,none:xm,silhouette:Jse,wiggle:ele,positive:cge},dge=function(t,r,n){var o=r.map(function(l){return l.props.dataKey}),a=uge[n],s=Xse().keys(o).value(function(l,c){return+uo(l,c,0)}).order(yE).offset(a);return s(t)},fge=function(t,r,n,o,a,s){if(!t)return null;var l=s?r.reverse():r,c={},u=l.reduce(function(f,h){var p,y=(p=h.type)!==null&&p!==void 0&&p.defaultProps?Ai(Ai({},h.type.defaultProps),h.props):h.props,m=y.stackId,x=y.hide;if(x)return f;var b=y[n],w=f[b]||{hasStack:!1,stackGroups:{}};if(ho(m)){var k=w.stackGroups[m]||{numericAxisId:n,cateAxisId:o,items:[]};k.items.push(h),w.hasStack=!0,w.stackGroups[m]=k}else w.stackGroups[vv("_stackId_")]={numericAxisId:n,cateAxisId:o,items:[h]};return Ai(Ai({},f),{},nm({},b,w))},c),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var y={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,x){var b=p.stackGroups[x];return Ai(Ai({},m),{},nm({},x,{numericAxisId:n,cateAxisId:o,items:b.items,stackedData:dge(t,b.items,a)}))},y)}return Ai(Ai({},f),{},nm({},h,p))},d)},oV=function(t,r){var n=r.realScaleType,o=r.type,a=r.tickCount,s=r.originalDomain,l=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(a&&o==="number"&&s&&(s[0]==="auto"||s[1]==="auto")){var u=t.domain();if(!u.length)return null;var d=Che(u,a,l);return t.domain([oS(d),iS(d)]),{niceTicks:d}}if(a&&o==="number"){var f=t.domain(),h=Ehe(f,a,l);return{niceTicks:h}}return null};function aD(e){var t=e.axis,r=e.ticks,n=e.bandSize,o=e.entry,a=e.index,s=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Rr(o[t.dataKey])){var l=U0(r,"value",o[t.dataKey]);if(l)return l.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var c=uo(o,Rr(s)?t.dataKey:s);return Rr(c)?null:t.scale(c)}var sD=function(t){var r=t.axis,n=t.ticks,o=t.offset,a=t.bandSize,s=t.entry,l=t.index;if(r.type==="category")return n[l]?n[l].coordinate+o:null;var c=uo(s,r.dataKey,r.domain[l]);return Rr(c)?null:r.scale(c)-a/2+o},pge=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var o=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return o<=0&&a>=0?0:a<0?a:o}return n[0]},hge=function(t,r){var n,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Ai(Ai({},t.type.defaultProps),t.props):t.props,a=o.stackId;if(ho(a)){var s=r[a];if(s){var l=s.items.indexOf(t);return l>=0?s.stackedData[l]:null}}return null},gge=function(t){return t.reduce(function(r,n){return[oS(n.concat([r[0]]).filter(Bt)),iS(n.concat([r[1]]).filter(Bt))]},[1/0,-1/0])},aV=function(t,r,n){return Object.keys(t).reduce(function(o,a){var s=t[a],l=s.stackedData,c=l.reduce(function(u,d){var f=gge(d.slice(r,n+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(c[0],o[0]),Math.max(c[1],o[1])]},[1/0,-1/0]).map(function(o){return o===1/0||o===-1/0?0:o})},lD=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,cD=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,$E=function(t,r,n){if(Ar(t))return t(r,n);if(!Array.isArray(t))return r;var o=[];if(Bt(t[0]))o[0]=n?t[0]:Math.min(t[0],r[0]);else if(lD.test(t[0])){var a=+lD.exec(t[0])[1];o[0]=r[0]-a}else Ar(t[0])?o[0]=t[0](r[0]):o[0]=r[0];if(Bt(t[1]))o[1]=n?t[1]:Math.max(t[1],r[1]);else if(cD.test(t[1])){var s=+cD.exec(t[1])[1];o[1]=r[1]+s}else Ar(t[1])?o[1]=t[1](r[1]):o[1]=r[1];return o},m2=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var o=t.scale.bandwidth();if(!n||o>0)return o}if(t&&r&&r.length>=2){for(var a=ET(r,function(f){return f.coordinate}),s=1/0,l=1,c=a.length;le.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},kge=function(t,r,n,o,a){var s=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=Wa(t.cx,s,s/2),f=Wa(t.cy,l,l/2),h=cV(s,l,n),p=Wa(t.innerRadius,h,0),y=Wa(t.outerRadius,h,h*.8),m=Object.keys(r);return m.reduce(function(x,b){var w=r[b],k=w.domain,S=w.reversed,_;if(Rr(w.range))o==="angleAxis"?_=[c,u]:o==="radiusAxis"&&(_=[p,y]),S&&(_=[_[1],_[0]]);else{_=w.range;var P=_,O=yge(P,2);c=O[0],u=O[1]}var T=nV(w,a),R=T.realScaleType,I=T.scale;I.domain(k).range(_),iV(I);var E=oV(I,Gu(Gu({},w),{},{realScaleType:R})),A=Gu(Gu(Gu({},w),E),{},{range:_,radius:y,realScaleType:R,scale:I,cx:d,cy:f,innerRadius:p,outerRadius:y,startAngle:c,endAngle:u});return Gu(Gu({},x),{},lV({},b,A))},{})},_ge=function(t,r){var n=t.x,o=t.y,a=r.x,s=r.y;return Math.sqrt(Math.pow(n-a,2)+Math.pow(o-s,2))},Cge=function(t,r){var n=t.x,o=t.y,a=r.cx,s=r.cy,l=_ge({x:n,y:o},{x:a,y:s});if(l<=0)return{radius:l};var c=(n-a)/l,u=Math.acos(c);return o>s&&(u=2*Math.PI-u),{radius:l,angle:jge(u),angleInRadian:u}},Ege=function(t){var r=t.startAngle,n=t.endAngle,o=Math.floor(r/360),a=Math.floor(n/360),s=Math.min(o,a);return{startAngle:r-s*360,endAngle:n-s*360}},Age=function(t,r){var n=r.startAngle,o=r.endAngle,a=Math.floor(n/360),s=Math.floor(o/360),l=Math.min(a,s);return t+l*360},pD=function(t,r){var n=t.x,o=t.y,a=Cge({x:n,y:o},r),s=a.radius,l=a.angle,c=r.innerRadius,u=r.outerRadius;if(su)return!1;if(s===0)return!0;var d=Ege(r),f=d.startAngle,h=d.endAngle,p=l,y;if(f<=h){for(;p>h;)p-=360;for(;p=f&&p<=h}else{for(;p>f;)p-=360;for(;p=h&&p<=f}return y?Gu(Gu({},r),{},{radius:s,angle:Age(p,r)}):null},uV=function(t){return!j.isValidElement(t)&&!Ar(t)&&typeof t!="boolean"?t.className:""};function kx(e){"@babel/helpers - typeof";return kx=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},kx(e)}var Tge=["offset"];function Pge(e){return Rge(e)||Nge(e)||Ige(e)||Oge()}function Oge(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ige(e,t){if(e){if(typeof e=="string")return UE(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return UE(e,t)}}function Nge(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Rge(e){if(Array.isArray(e))return UE(e)}function UE(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Fge(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function hD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function lo(e){for(var t=1;t=0?1:-1,k,S;o==="insideStart"?(k=p+w*s,S=m):o==="insideEnd"?(k=y-w*s,S=!m):o==="end"&&(k=y+w*s,S=m),S=b<=0?S:!S;var _=Kn(u,d,x,k),P=Kn(u,d,x,k+(S?1:-1)*359),O="M".concat(_.x,",").concat(_.y,` - A`).concat(x,",").concat(x,",0,1,").concat(S?0:1,`, - `).concat(P.x,",").concat(P.y),T=Rr(t.id)?vv("recharts-radial-line-"):t.id;return ze.createElement("text",_x({},n,{dominantBaseline:"central",className:Lr("recharts-radial-bar-label",l)}),ze.createElement("defs",null,ze.createElement("path",{id:T,d:O})),ze.createElement("textPath",{xlinkHref:"#".concat(T)},r))},$ge=function(t){var r=t.viewBox,n=t.offset,o=t.position,a=r,s=a.cx,l=a.cy,c=a.innerRadius,u=a.outerRadius,d=a.startAngle,f=a.endAngle,h=(d+f)/2;if(o==="outside"){var p=Kn(s,l,u+n,h),y=p.x,m=p.y;return{x:y,y:m,textAnchor:y>=s?"start":"end",verticalAnchor:"middle"}}if(o==="center")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(o==="centerTop")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"start"};if(o==="centerBottom")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"end"};var x=(c+u)/2,b=Kn(s,l,x,h),w=b.x,k=b.y;return{x:w,y:k,textAnchor:"middle",verticalAnchor:"middle"}},Uge=function(t){var r=t.viewBox,n=t.parentViewBox,o=t.offset,a=t.position,s=r,l=s.x,c=s.y,u=s.width,d=s.height,f=d>=0?1:-1,h=f*o,p=f>0?"end":"start",y=f>0?"start":"end",m=u>=0?1:-1,x=m*o,b=m>0?"end":"start",w=m>0?"start":"end";if(a==="top"){var k={x:l+u/2,y:c-f*o,textAnchor:"middle",verticalAnchor:p};return lo(lo({},k),n?{height:Math.max(c-n.y,0),width:u}:{})}if(a==="bottom"){var S={x:l+u/2,y:c+d+h,textAnchor:"middle",verticalAnchor:y};return lo(lo({},S),n?{height:Math.max(n.y+n.height-(c+d),0),width:u}:{})}if(a==="left"){var _={x:l-x,y:c+d/2,textAnchor:b,verticalAnchor:"middle"};return lo(lo({},_),n?{width:Math.max(_.x-n.x,0),height:d}:{})}if(a==="right"){var P={x:l+u+x,y:c+d/2,textAnchor:w,verticalAnchor:"middle"};return lo(lo({},P),n?{width:Math.max(n.x+n.width-P.x,0),height:d}:{})}var O=n?{width:u,height:d}:{};return a==="insideLeft"?lo({x:l+x,y:c+d/2,textAnchor:w,verticalAnchor:"middle"},O):a==="insideRight"?lo({x:l+u-x,y:c+d/2,textAnchor:b,verticalAnchor:"middle"},O):a==="insideTop"?lo({x:l+u/2,y:c+h,textAnchor:"middle",verticalAnchor:y},O):a==="insideBottom"?lo({x:l+u/2,y:c+d-h,textAnchor:"middle",verticalAnchor:p},O):a==="insideTopLeft"?lo({x:l+x,y:c+h,textAnchor:w,verticalAnchor:y},O):a==="insideTopRight"?lo({x:l+u-x,y:c+h,textAnchor:b,verticalAnchor:y},O):a==="insideBottomLeft"?lo({x:l+x,y:c+d-h,textAnchor:w,verticalAnchor:p},O):a==="insideBottomRight"?lo({x:l+u-x,y:c+d-h,textAnchor:b,verticalAnchor:p},O):mv(a)&&(Bt(a.x)||Kp(a.x))&&(Bt(a.y)||Kp(a.y))?lo({x:l+Wa(a.x,u),y:c+Wa(a.y,d),textAnchor:"end",verticalAnchor:"end"},O):lo({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},O)},Hge=function(t){return"cx"in t&&Bt(t.cx)};function Fo(e){var t=e.offset,r=t===void 0?5:t,n=Lge(e,Tge),o=lo({offset:r},n),a=o.viewBox,s=o.position,l=o.value,c=o.children,u=o.content,d=o.className,f=d===void 0?"":d,h=o.textBreakAll;if(!a||Rr(l)&&Rr(c)&&!j.isValidElement(u)&&!Ar(u))return null;if(j.isValidElement(u))return j.cloneElement(u,o);var p;if(Ar(u)){if(p=j.createElement(u,o),j.isValidElement(p))return p}else p=Bge(o);var y=Hge(a),m=vr(o,!0);if(y&&(s==="insideStart"||s==="insideEnd"||s==="end"))return qge(o,p,m);var x=y?$ge(o):Uge(o);return ze.createElement(gh,_x({className:Lr("recharts-label",f)},m,x,{breakAll:h}),p)}Fo.displayName="Label";var dV=function(t){var r=t.cx,n=t.cy,o=t.angle,a=t.startAngle,s=t.endAngle,l=t.r,c=t.radius,u=t.innerRadius,d=t.outerRadius,f=t.x,h=t.y,p=t.top,y=t.left,m=t.width,x=t.height,b=t.clockWise,w=t.labelViewBox;if(w)return w;if(Bt(m)&&Bt(x)){if(Bt(f)&&Bt(h))return{x:f,y:h,width:m,height:x};if(Bt(p)&&Bt(y))return{x:p,y,width:m,height:x}}return Bt(f)&&Bt(h)?{x:f,y:h,width:0,height:0}:Bt(r)&&Bt(n)?{cx:r,cy:n,startAngle:a||o||0,endAngle:s||o||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:b}:t.viewBox?t.viewBox:{}},Vge=function(t,r){return t?t===!0?ze.createElement(Fo,{key:"label-implicit",viewBox:r}):ho(t)?ze.createElement(Fo,{key:"label-implicit",viewBox:r,value:t}):j.isValidElement(t)?t.type===Fo?j.cloneElement(t,{key:"label-implicit",viewBox:r}):ze.createElement(Fo,{key:"label-implicit",content:t,viewBox:r}):Ar(t)?ze.createElement(Fo,{key:"label-implicit",content:t,viewBox:r}):mv(t)?ze.createElement(Fo,_x({viewBox:r},t,{key:"label-implicit"})):null:null},Yge=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var o=t.children,a=dV(t),s=Ks(o,Fo).map(function(c,u){return j.cloneElement(c,{viewBox:r||a,key:"label-".concat(u)})});if(!n)return s;var l=Vge(t.label,r||a);return[l].concat(Pge(s))};Fo.parseViewBox=dV;Fo.renderCallByParent=Yge;var VC,gD;function Gge(){if(gD)return VC;gD=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return VC=e,VC}var Kge=Gge();const Qge=un(Kge);function Cx(e){"@babel/helpers - typeof";return Cx=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},Cx(e)}var Xge=["valueAccessor"],Zge=["data","dataKey","clockWise","id","textBreakAll"];function Jge(e){return nme(e)||rme(e)||tme(e)||eme()}function eme(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tme(e,t){if(e){if(typeof e=="string")return HE(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return HE(e,t)}}function rme(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function nme(e){if(Array.isArray(e))return HE(e)}function HE(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function sme(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var lme=function(t){return Array.isArray(t.value)?Qge(t.value):t.value};function ld(e){var t=e.valueAccessor,r=t===void 0?lme:t,n=yD(e,Xge),o=n.data,a=n.dataKey,s=n.clockWise,l=n.id,c=n.textBreakAll,u=yD(n,Zge);return!o||!o.length?null:ze.createElement(ln,{className:"recharts-label-list"},o.map(function(d,f){var h=Rr(a)?r(d,f):uo(d&&d.payload,a),p=Rr(l)?{}:{id:"".concat(l,"-").concat(f)};return ze.createElement(Fo,y2({},vr(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:c,viewBox:Fo.parseViewBox(Rr(s)?d:vD(vD({},d),{},{clockWise:s})),key:"label-".concat(f),index:f}))}))}ld.displayName="LabelList";function cme(e,t){return e?e===!0?ze.createElement(ld,{key:"labelList-implicit",data:t}):ze.isValidElement(e)||Ar(e)?ze.createElement(ld,{key:"labelList-implicit",data:t,content:e}):mv(e)?ze.createElement(ld,y2({data:t},e,{key:"labelList-implicit"})):null:null}function ume(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,o=Ks(n,ld).map(function(s,l){return j.cloneElement(s,{data:t,key:"labelList-".concat(l)})});if(!r)return o;var a=cme(e.label,t);return[a].concat(Jge(o))}ld.renderCallByParent=ume;function Ex(e){"@babel/helpers - typeof";return Ex=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},Ex(e)}function VE(){return VE=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(s>u),`, - `).concat(f.x,",").concat(f.y,` - `);if(o>0){var p=Kn(r,n,o,s),y=Kn(r,n,o,u);h+="L ".concat(y.x,",").concat(y.y,` - A `).concat(o,",").concat(o,`,0, - `).concat(+(Math.abs(c)>180),",").concat(+(s<=u),`, - `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},gme=function(t){var r=t.cx,n=t.cy,o=t.innerRadius,a=t.outerRadius,s=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=Ba(d-u),h=W1({cx:r,cy:n,radius:a,angle:u,sign:f,cornerRadius:s,cornerIsExternal:c}),p=h.circleTangency,y=h.lineTangency,m=h.theta,x=W1({cx:r,cy:n,radius:a,angle:d,sign:-f,cornerRadius:s,cornerIsExternal:c}),b=x.circleTangency,w=x.lineTangency,k=x.theta,S=c?Math.abs(u-d):Math.abs(u-d)-m-k;if(S<0)return l?"M ".concat(y.x,",").concat(y.y,` - a`).concat(s,",").concat(s,",0,0,1,").concat(s*2,`,0 - a`).concat(s,",").concat(s,",0,0,1,").concat(-s*2,`,0 - `):fV({cx:r,cy:n,innerRadius:o,outerRadius:a,startAngle:u,endAngle:d});var _="M ".concat(y.x,",").concat(y.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` - A`).concat(a,",").concat(a,",0,").concat(+(S>180),",").concat(+(f<0),",").concat(b.x,",").concat(b.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(w.x,",").concat(w.y,` - `);if(o>0){var P=W1({cx:r,cy:n,radius:o,angle:u,sign:f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),O=P.circleTangency,T=P.lineTangency,R=P.theta,I=W1({cx:r,cy:n,radius:o,angle:d,sign:-f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),E=I.circleTangency,A=I.lineTangency,F=I.theta,L=c?Math.abs(u-d):Math.abs(u-d)-R-F;if(L<0&&s===0)return"".concat(_,"L").concat(r,",").concat(n,"Z");_+="L".concat(A.x,",").concat(A.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(E.x,",").concat(E.y,` - A`).concat(o,",").concat(o,",0,").concat(+(L>180),",").concat(+(f>0),",").concat(O.x,",").concat(O.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(T.x,",").concat(T.y,"Z")}else _+="L".concat(r,",").concat(n,"Z");return _},mme={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},pV=function(t){var r=bD(bD({},mme),t),n=r.cx,o=r.cy,a=r.innerRadius,s=r.outerRadius,l=r.cornerRadius,c=r.forceCornerRadius,u=r.cornerIsExternal,d=r.startAngle,f=r.endAngle,h=r.className;if(s0&&Math.abs(d-f)<360?x=gme({cx:n,cy:o,innerRadius:a,outerRadius:s,cornerRadius:Math.min(m,y/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):x=fV({cx:n,cy:o,innerRadius:a,outerRadius:s,startAngle:d,endAngle:f}),ze.createElement("path",VE({},vr(r,!0),{className:p,d:x,role:"img"}))};function Ax(e){"@babel/helpers - typeof";return Ax=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},Ax(e)}function YE(){return YE=Object.assign?Object.assign.bind():function(e){for(var t=1;tAme.call(e,t));function Lh(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const Ome="__v",Ime="__o",Nme="_owner",{getOwnPropertyDescriptor:AD,keys:TD}=Object;function Rme(e,t){return e.byteLength===t.byteLength&&b2(new Uint8Array(e),new Uint8Array(t))}function Lme(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function Fme(e,t){return e.byteLength===t.byteLength&&b2(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Mme(e,t){return Lh(e.getTime(),t.getTime())}function Dme(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function zme(e,t){return e===t}function PD(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const o=new Array(n),a=e.entries();let s,l,c=0;for(;(s=a.next())&&!s.done;){const u=t.entries();let d=!1,f=0;for(;(l=u.next())&&!l.done;){if(o[f]){f++;continue}const h=s.value,p=l.value;if(r.equals(h[0],p[0],c,f,e,t,r)&&r.equals(h[1],p[1],h[0],p[0],e,t,r)){d=o[f]=!0;break}f++}if(!d)return!1;c++}return!0}const Bme=Lh;function Wme(e,t,r){const n=TD(e);let o=n.length;if(TD(t).length!==o)return!1;for(;o-- >0;)if(!hV(e,t,r,n[o]))return!1;return!0}function gy(e,t,r){const n=ED(e);let o=n.length;if(ED(t).length!==o)return!1;let a,s,l;for(;o-- >0;)if(a=n[o],!hV(e,t,r,a)||(s=AD(e,a),l=AD(t,a),(s||l)&&(!s||!l||s.configurable!==l.configurable||s.enumerable!==l.enumerable||s.writable!==l.writable)))return!1;return!0}function qme(e,t){return Lh(e.valueOf(),t.valueOf())}function $me(e,t){return e.source===t.source&&e.flags===t.flags}function OD(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const o=new Array(n),a=e.values();let s,l;for(;(s=a.next())&&!s.done;){const c=t.values();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(!o[d]&&r.equals(s.value,l.value,s.value,l.value,e,t,r)){u=o[d]=!0;break}d++}if(!u)return!1}return!0}function b2(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function Ume(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 hV(e,t,r,n){return(n===Nme||n===Ime||n===Ome)&&(e.$$typeof||t.$$typeof)?!0:Pme(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}const Hme="[object ArrayBuffer]",Vme="[object Arguments]",Yme="[object Boolean]",Gme="[object DataView]",Kme="[object Date]",Qme="[object Error]",Xme="[object Map]",Zme="[object Number]",Jme="[object Object]",eve="[object RegExp]",tve="[object Set]",rve="[object String]",nve={"[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},ive="[object URL]",ove=Object.prototype.toString;function ave({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:a,areMapsEqual:s,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:u,areRegExpsEqual:d,areSetsEqual:f,areTypedArraysEqual:h,areUrlsEqual:p,unknownTagComparators:y}){return function(x,b,w){if(x===b)return!0;if(x==null||b==null)return!1;const k=typeof x;if(k!==typeof b)return!1;if(k!=="object")return k==="number"?l(x,b,w):k==="function"?a(x,b,w):!1;const S=x.constructor;if(S!==b.constructor)return!1;if(S===Object)return c(x,b,w);if(Array.isArray(x))return t(x,b,w);if(S===Date)return n(x,b,w);if(S===RegExp)return d(x,b,w);if(S===Map)return s(x,b,w);if(S===Set)return f(x,b,w);const _=ove.call(x);if(_===Kme)return n(x,b,w);if(_===eve)return d(x,b,w);if(_===Xme)return s(x,b,w);if(_===tve)return f(x,b,w);if(_===Jme)return typeof x.then!="function"&&typeof b.then!="function"&&c(x,b,w);if(_===ive)return p(x,b,w);if(_===Qme)return o(x,b,w);if(_===Vme)return c(x,b,w);if(nve[_])return h(x,b,w);if(_===Hme)return e(x,b,w);if(_===Gme)return r(x,b,w);if(_===Yme||_===Zme||_===rve)return u(x,b,w);if(y){let P=y[_];if(!P){const O=Tme(x);O&&(P=y[O])}if(P)return P(x,b,w)}return!1}}function sve({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:Rme,areArraysEqual:r?gy:Lme,areDataViewsEqual:Fme,areDatesEqual:Mme,areErrorsEqual:Dme,areFunctionsEqual:zme,areMapsEqual:r?QC(PD,gy):PD,areNumbersEqual:Bme,areObjectsEqual:r?gy:Wme,arePrimitiveWrappersEqual:qme,areRegExpsEqual:$me,areSetsEqual:r?QC(OD,gy):OD,areTypedArraysEqual:r?QC(b2,gy):b2,areUrlsEqual:Ume,unknownTagComparators:void 0};if(t&&(n=Object.assign({},n,t(n))),e){const o=$1(n.areArraysEqual),a=$1(n.areMapsEqual),s=$1(n.areObjectsEqual),l=$1(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areMapsEqual:a,areObjectsEqual:s,areSetsEqual:l})}return n}function lve(e){return function(t,r,n,o,a,s,l){return e(t,r,l)}}function cve({circular:e,comparator:t,createState:r,equals:n,strict:o}){if(r)return function(l,c){const{cache:u=e?new WeakMap:void 0,meta:d}=r();return t(l,c,{cache:u,equals:n,meta:d,strict:o})};if(e)return function(l,c){return t(l,c,{cache:new WeakMap,equals:n,meta:void 0,strict:o})};const a={cache:void 0,equals:n,meta:void 0,strict:o};return function(l,c){return t(l,c,a)}}const uve=Gf();Gf({strict:!0});Gf({circular:!0});Gf({circular:!0,strict:!0});Gf({createInternalComparator:()=>Lh});Gf({strict:!0,createInternalComparator:()=>Lh});Gf({circular:!0,createInternalComparator:()=>Lh});Gf({circular:!0,createInternalComparator:()=>Lh,strict:!0});function Gf(e={}){const{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=sve(e),s=ave(a),l=r?r(s):lve(s);return cve({circular:t,comparator:s,createState:n,equals:l,strict:o})}function dve(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function ID(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function o(a){r<0&&(r=a),a-r>t?(e(a),r=-1):dve(o)};requestAnimationFrame(n)}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)}function fve(e){return mve(e)||gve(e)||hve(e)||pve()}function pve(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hve(e,t){if(e){if(typeof e=="string")return ND(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ND(e,t)}}function ND(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?1:b<0?0:b},m=function(b){for(var w=b>1?1:b,k=w,S=0;S<8;++S){var _=f(k)-w,P=p(k);if(Math.abs(_-w)0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,o=t.damping,a=o===void 0?8:o,s=t.dt,l=s===void 0?17:s,c=function(d,f,h){var p=-(d-f)*n,y=h*a,m=h+(p-y)*l/1e3,x=h*l/1e3+d;return Math.abs(x-f)e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Yve(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a=0)&&(r[o]=e[o]);return r}function XC(e){return Xve(e)||Qve(e)||Kve(e)||Gve()}function Gve(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kve(e,t){if(e){if(typeof e=="string")return JE(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return JE(e,t)}}function Qve(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Xve(e){if(Array.isArray(e))return JE(e)}function JE(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r"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 j2(e){return j2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},j2(e)}var eu=(function(e){rye(r,e);var t=nye(r);function r(n,o){var a;Zve(this,r),a=t.call(this,n,o);var s=a.props,l=s.isActive,c=s.attributeName,u=s.from,d=s.to,f=s.steps,h=s.children,p=s.duration;if(a.handleStyleChange=a.handleStyleChange.bind(rA(a)),a.changeStyle=a.changeStyle.bind(rA(a)),!l||p<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:d}),tA(a);if(f&&f.length)a.state={style:f[0].style};else if(u){if(typeof h=="function")return a.state={style:u},tA(a);a.state={style:c?Ny({},c,u):u}}else a.state={style:{}};return a}return eye(r,[{key:"componentDidMount",value:function(){var o=this.props,a=o.isActive,s=o.canBegin;this.mounted=!0,!(!a||!s)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(o){var a=this.props,s=a.isActive,l=a.canBegin,c=a.attributeName,u=a.shouldReAnimate,d=a.to,f=a.from,h=this.state.style;if(l){if(!s){var p={style:c?Ny({},c,d):d};this.state&&h&&(c&&h[c]!==d||!c&&h!==d)&&this.setState(p);return}if(!(uve(o.to,d)&&o.canBegin&&o.isActive)){var y=!o.canBegin||!o.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var m=y||u?f:o.to;if(this.state&&h){var x={style:c?Ny({},c,m):m};(c&&h[c]!==m||!c&&h!==m)&&this.setState(x)}this.runAnimation(Kl(Kl({},this.props),{},{from:m,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var o=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),o&&o()}},{key:"handleStyleChange",value:function(o){this.changeStyle(o)}},{key:"changeStyle",value:function(o){this.mounted&&this.setState({style:o})}},{key:"runJSAnimation",value:function(o){var a=this,s=o.from,l=o.to,c=o.duration,u=o.easing,d=o.begin,f=o.onAnimationEnd,h=o.onAnimationStart,p=Uve(s,l,Nve(u),c,this.changeStyle),y=function(){a.stopJSAnimation=p()};this.manager.start([h,d,y,c,f])}},{key:"runStepAnimation",value:function(o){var a=this,s=o.steps,l=o.begin,c=o.onAnimationStart,u=s[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(m,x,b){if(b===0)return m;var w=x.duration,k=x.easing,S=k===void 0?"ease":k,_=x.style,P=x.properties,O=x.onAnimationEnd,T=b>0?s[b-1]:x,R=P||Object.keys(_);if(typeof S=="function"||S==="spring")return[].concat(XC(m),[a.runJSAnimation.bind(a,{from:T.style,to:_,duration:w,easing:S}),w]);var I=FD(R,w,S),E=Kl(Kl(Kl({},T.style),_),{},{transition:I});return[].concat(XC(m),[E,w,O]).filter(wve)};return this.manager.start([c].concat(XC(s.reduce(p,[d,Math.max(h,l)])),[o.onAnimationEnd]))}},{key:"runAnimation",value:function(o){this.manager||(this.manager=vve());var a=o.begin,s=o.duration,l=o.attributeName,c=o.to,u=o.easing,d=o.onAnimationStart,f=o.onAnimationEnd,h=o.steps,p=o.children,y=this.manager;if(this.unSubscribe=y.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(o);return}if(h.length>1){this.runStepAnimation(o);return}var m=l?Ny({},l,c):c,x=FD(Object.keys(m),s,u);y.start([d,a,Kl(Kl({},m),{},{transition:x}),s,f])}},{key:"render",value:function(){var o=this.props,a=o.children;o.begin;var s=o.duration;o.attributeName,o.easing;var l=o.isActive;o.steps,o.from,o.to,o.canBegin,o.onAnimationEnd,o.shouldReAnimate,o.onAnimationReStart;var c=Vve(o,Hve),u=j.Children.count(a),d=this.state.style;if(typeof a=="function")return a(d);if(!l||u===0||s<=0)return a;var f=function(p){var y=p.props,m=y.style,x=m===void 0?{}:m,b=y.className,w=j.cloneElement(p,Kl(Kl({},c),{},{style:Kl(Kl({},x),d),className:b}));return w};return u===1?f(j.Children.only(a)):ze.createElement("div",null,j.Children.map(a,function(h){return f(h)}))}}]),r})(j.PureComponent);eu.displayName="Animate";eu.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};eu.propTypes={from:bn.oneOfType([bn.object,bn.string]),to:bn.oneOfType([bn.object,bn.string]),attributeName:bn.string,duration:bn.number,begin:bn.number,easing:bn.oneOfType([bn.string,bn.func]),steps:bn.arrayOf(bn.shape({duration:bn.number.isRequired,style:bn.object.isRequired,easing:bn.oneOfType([bn.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),bn.func]),properties:bn.arrayOf("string"),onAnimationEnd:bn.func})),children:bn.oneOfType([bn.node,bn.func]),isActive:bn.bool,canBegin:bn.bool,onAnimationEnd:bn.func,shouldReAnimate:bn.bool,onAnimationStart:bn.func,onAnimationReStart:bn.func};function Ox(e){"@babel/helpers - typeof";return Ox=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},Ox(e)}function k2(){return k2=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0?1:-1,c=n>=0?1:-1,u=o>=0&&n>=0||o<0&&n<0?1:0,d;if(s>0&&a instanceof Array){for(var f=[0,0,0,0],h=0,p=4;hs?s:a[h];d="M".concat(t,",").concat(r+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+c*f[0],",").concat(r)),d+="L ".concat(t+n-c*f[1],",").concat(r),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, - `).concat(t+n,",").concat(r+l*f[1])),d+="L ".concat(t+n,",").concat(r+o-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, - `).concat(t+n-c*f[2],",").concat(r+o)),d+="L ".concat(t+c*f[3],",").concat(r+o),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, - `).concat(t,",").concat(r+o-l*f[3])),d+="Z"}else if(s>0&&a===+a&&a>0){var y=Math.min(s,a);d="M ".concat(t,",").concat(r+l*y,` - A `).concat(y,",").concat(y,",0,0,").concat(u,",").concat(t+c*y,",").concat(r,` - L `).concat(t+n-c*y,",").concat(r,` - A `).concat(y,",").concat(y,",0,0,").concat(u,",").concat(t+n,",").concat(r+l*y,` - L `).concat(t+n,",").concat(r+o-l*y,` - A `).concat(y,",").concat(y,",0,0,").concat(u,",").concat(t+n-c*y,",").concat(r+o,` - L `).concat(t+c*y,",").concat(r+o,` - A `).concat(y,",").concat(y,",0,0,").concat(u,",").concat(t,",").concat(r+o-l*y," Z")}else d="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(o," h ").concat(-n," Z");return d},pye=function(t,r){if(!t||!r)return!1;var n=t.x,o=t.y,a=r.x,s=r.y,l=r.width,c=r.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(a,a+l),d=Math.max(a,a+l),f=Math.min(s,s+c),h=Math.max(s,s+c);return n>=u&&n<=d&&o>=f&&o<=h}return!1},hye={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},eP=function(t){var r=UD(UD({},hye),t),n=j.useRef(),o=j.useState(-1),a=oye(o,2),s=a[0],l=a[1];j.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var S=n.current.getTotalLength();S&&l(S)}catch{}},[]);var c=r.x,u=r.y,d=r.width,f=r.height,h=r.radius,p=r.className,y=r.animationEasing,m=r.animationDuration,x=r.animationBegin,b=r.isAnimationActive,w=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var k=Lr("recharts-rectangle",p);return w?ze.createElement(eu,{canBegin:s>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:m,animationEasing:y,isActive:w},function(S){var _=S.width,P=S.height,O=S.x,T=S.y;return ze.createElement(eu,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:m,isActive:b,easing:y},ze.createElement("path",k2({},vr(r,!0),{className:k,d:HD(O,T,_,P,h),ref:n})))}):ze.createElement("path",k2({},vr(r,!0),{className:k,d:HD(c,u,d,f,h)}))},gye=["points","className","baseLinePoints","connectNulls"];function Ug(){return Ug=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function vye(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function VD(e){return wye(e)||bye(e)||xye(e)||yye()}function yye(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xye(e,t){if(e){if(typeof e=="string")return nA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nA(e,t)}}function bye(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function wye(e){if(Array.isArray(e))return nA(e)}function nA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){YD(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),YD(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},Uy=function(t,r){var n=Sye(t);r&&(n=[n.reduce(function(a,s){return[].concat(VD(a),VD(s))},[])]);var o=n.map(function(a){return a.reduce(function(s,l,c){return"".concat(s).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return n.length===1?"".concat(o,"Z"):o},jye=function(t,r,n){var o=Uy(t,n);return"".concat(o.slice(-1)==="Z"?o.slice(0,-1):o,"L").concat(Uy(r.reverse(),n).slice(1))},kye=function(t){var r=t.points,n=t.className,o=t.baseLinePoints,a=t.connectNulls,s=mye(t,gye);if(!r||!r.length)return null;var l=Lr("recharts-polygon",n);if(o&&o.length){var c=s.stroke&&s.stroke!=="none",u=jye(r,o,a);return ze.createElement("g",{className:l},ze.createElement("path",Ug({},vr(s,!0),{fill:u.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:u})),c?ze.createElement("path",Ug({},vr(s,!0),{fill:"none",d:Uy(r,a)})):null,c?ze.createElement("path",Ug({},vr(s,!0),{fill:"none",d:Uy(o,a)})):null)}var d=Uy(r,a);return ze.createElement("path",Ug({},vr(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:l,d}))};function iA(){return iA=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Oye(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Iye=function(t,r,n,o,a,s){return"M".concat(t,",").concat(a,"v").concat(o,"M").concat(s,",").concat(r,"h").concat(n)},Nye=function(t){var r=t.x,n=r===void 0?0:r,o=t.y,a=o===void 0?0:o,s=t.top,l=s===void 0?0:s,c=t.left,u=c===void 0?0:c,d=t.width,f=d===void 0?0:d,h=t.height,p=h===void 0?0:h,y=t.className,m=Pye(t,_ye),x=Cye({x:n,y:a,top:l,left:u,width:f,height:p},m);return!Bt(n)||!Bt(a)||!Bt(f)||!Bt(p)||!Bt(l)||!Bt(u)?null:ze.createElement("path",oA({},vr(x,!0),{className:Lr("recharts-cross",y),d:Iye(n,a,f,p,l,u)}))},ZC,KD;function Rye(){if(KD)return ZC;KD=1;var e=nS(),t=RH(),r=su();function n(o,a){return o&&o.length?e(o,r(a,2),t):void 0}return ZC=n,ZC}var Lye=Rye();const Fye=un(Lye);var JC,QD;function Mye(){if(QD)return JC;QD=1;var e=nS(),t=su(),r=LH();function n(o,a){return o&&o.length?e(o,t(a,2),r):void 0}return JC=n,JC}var Dye=Mye();const zye=un(Dye);var Bye=["cx","cy","angle","ticks","axisLine"],Wye=["ticks","tick","angle","tickFormatter","stroke"];function Tm(e){"@babel/helpers - typeof";return Tm=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},Tm(e)}function Hy(){return Hy=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function qye(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function $ye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function JD(e,t){for(var r=0;rrz?s=o==="outer"?"start":"end":a<-rz?s=o==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var n=this.props,o=n.cx,a=n.cy,s=n.radius,l=n.axisLine,c=n.axisLineType,u=Cp(Cp({},vr(this.props,!1)),{},{fill:"none"},vr(l,!1));if(c==="circle")return ze.createElement(lS,Vp({className:"recharts-polar-angle-axis-line"},u,{cx:o,cy:a,r:s}));var d=this.props.ticks,f=d.map(function(h){return Kn(o,a,s,h.coordinate)});return ze.createElement(kye,Vp({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var n=this,o=this.props,a=o.ticks,s=o.tick,l=o.tickLine,c=o.tickFormatter,u=o.stroke,d=vr(this.props,!1),f=vr(s,!1),h=Cp(Cp({},d),{},{fill:"none"},vr(l,!1)),p=a.map(function(y,m){var x=n.getTickLineCoord(y),b=n.getTickTextAnchor(y),w=Cp(Cp(Cp({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:y,x:x.x2,y:x.y2});return ze.createElement(ln,Vp({className:Lr("recharts-polar-angle-axis-tick",uV(s)),key:"tick-".concat(y.coordinate)},hh(n.props,y,m)),l&&ze.createElement("line",Vp({className:"recharts-polar-angle-axis-tick-line"},h,x)),s&&t.renderTickItem(s,w,c?c(y.value,m):y.value))});return ze.createElement(ln,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var n=this.props,o=n.ticks,a=n.radius,s=n.axisLine;return a<=0||!o||!o.length?null:ze.createElement(ln,{className:Lr("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,o,a){var s;return ze.isValidElement(n)?s=ze.cloneElement(n,o):Ar(n)?s=n(o):s=ze.createElement(gh,Vp({},o,{className:"recharts-polar-angle-axis-tick-value"}),a),s}}])})(j.PureComponent);dS(fS,"displayName","PolarAngleAxis");dS(fS,"axisType","angleAxis");dS(fS,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var e4,nz;function ixe(){if(nz)return e4;nz=1;var e=RU(),t=e(Object.getPrototypeOf,Object);return e4=t,e4}var t4,iz;function oxe(){if(iz)return t4;iz=1;var e=wd(),t=ixe(),r=Sd(),n="[object Object]",o=Function.prototype,a=Object.prototype,s=o.toString,l=a.hasOwnProperty,c=s.call(Object);function u(d){if(!r(d)||e(d)!=n)return!1;var f=t(d);if(f===null)return!0;var h=l.call(f,"constructor")&&f.constructor;return typeof h=="function"&&h instanceof h&&s.call(h)==c}return t4=u,t4}var axe=oxe();const sxe=un(axe);var r4,oz;function lxe(){if(oz)return r4;oz=1;var e=wd(),t=Sd(),r="[object Boolean]";function n(o){return o===!0||o===!1||t(o)&&e(o)==r}return r4=n,r4}var cxe=lxe();const uxe=un(cxe);function Nx(e){"@babel/helpers - typeof";return Nx=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},Nx(e)}function E2(){return E2=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:c,y:u},duration:m,animationEasing:y,isActive:b},function(k){var S=k.upperWidth,_=k.lowerWidth,P=k.height,O=k.x,T=k.y;return ze.createElement(eu,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:m,easing:y},ze.createElement("path",E2({},vr(r,!0),{className:w,d:cz(O,T,S,_,P),ref:n})))}):ze.createElement("g",null,ze.createElement("path",E2({},vr(r,!0),{className:w,d:cz(c,u,d,f,h)})))},wxe=["option","shapeType","propTransformer","activeClassName","isActive"];function Rx(e){"@babel/helpers - typeof";return Rx=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},Rx(e)}function Sxe(e,t){if(e==null)return{};var r=jxe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function jxe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function uz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function A2(e){for(var t=1;t0?Gs(k,"paddingAngle",0):0;if(_){var O=Ws(_.endAngle-_.startAngle,k.endAngle-k.startAngle),T=Hn(Hn({},k),{},{startAngle:w+P,endAngle:w+O(m)+P});x.push(T),w=T.endAngle}else{var R=k.endAngle,I=k.startAngle,E=Ws(0,R-I),A=E(m),F=Hn(Hn({},k),{},{startAngle:w+P,endAngle:w+A+P});x.push(F),w=F.endAngle}}),ze.createElement(ln,null,n.renderSectorsStatically(x))})}},{key:"attachKeyboardHandlers",value:function(n){var o=this;n.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var s=++o.state.sectorToFocus%o.sectorRefs.length;o.sectorRefs[s].focus(),o.setState({sectorToFocus:s});break}case"ArrowRight":{var l=--o.state.sectorToFocus<0?o.sectorRefs.length-1:o.state.sectorToFocus%o.sectorRefs.length;o.sectorRefs[l].focus(),o.setState({sectorToFocus:l});break}case"Escape":{o.sectorRefs[o.state.sectorToFocus].blur(),o.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,o=n.sectors,a=n.isAnimationActive,s=this.state.prevSectors;return a&&o&&o.length&&(!s||!yb(s,o))?this.renderSectorsWithAnimation():this.renderSectorsStatically(o)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,o=this.props,a=o.hide,s=o.sectors,l=o.className,c=o.label,u=o.cx,d=o.cy,f=o.innerRadius,h=o.outerRadius,p=o.isAnimationActive,y=this.state.isAnimationFinished;if(a||!s||!s.length||!Bt(u)||!Bt(d)||!Bt(f)||!Bt(h))return null;var m=Lr("recharts-pie",l);return ze.createElement(ln,{tabIndex:this.props.rootTabIndex,className:m,ref:function(b){n.pieRef=b}},this.renderSectors(),c&&this.renderLabels(s),Fo.renderCallByParent(this.props,null,!1),(!p||y)&&ld.renderCallByParent(this.props,s,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,o){return o.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==o.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:o.curSectors,isAnimationFinished:!0}:n.sectors!==o.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,o){return n>o?"start":n=360?w:w-1)*c,S=x-w*p-k,_=o.reduce(function(T,R){var I=uo(R,b,0);return T+(Bt(I)?I:0)},0),P;if(_>0){var O;P=o.map(function(T,R){var I=uo(T,b,0),E=uo(T,d,R),A=(Bt(I)?I:0)/_,F;R?F=O.endAngle+Ba(m)*c*(I!==0?1:0):F=s;var L=F+Ba(m)*((I!==0?p:0)+A*S),z=(F+L)/2,V=(y.innerRadius+y.outerRadius)/2,Q=[{name:E,value:I,payload:T,dataKey:b,type:h}],U=Kn(y.cx,y.cy,V,z);return O=Hn(Hn(Hn({percent:A,cornerRadius:a,name:E,tooltipPayload:Q,midAngle:z,middleRadius:V,tooltipPosition:U},T),y),{},{value:uo(T,b),startAngle:F,endAngle:L,payload:T,paddingAngle:Ba(m)*c}),O})}return Hn(Hn({},y),{},{sectors:P,data:o})});var n4,hz;function Uxe(){if(hz)return n4;hz=1;var e=Math.ceil,t=Math.max;function r(n,o,a,s){for(var l=-1,c=t(e((o-n)/(a||1)),0),u=Array(c);c--;)u[s?c:++l]=n,n+=a;return u}return n4=r,n4}var i4,gz;function AV(){if(gz)return i4;gz=1;var e=QU(),t=1/0,r=17976931348623157e292;function n(o){if(!o)return o===0?o:0;if(o=e(o),o===t||o===-t){var a=o<0?-1:1;return a*r}return o===o?o:0}return i4=n,i4}var o4,mz;function Hxe(){if(mz)return o4;mz=1;var e=Uxe(),t=Kw(),r=AV();function n(o){return function(a,s,l){return l&&typeof l!="number"&&t(a,s,l)&&(s=l=void 0),a=r(a),s===void 0?(s=a,a=0):s=r(s),l=l===void 0?a0&&n.handleDrag(o.changedTouches[0])}),zs(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var o=n.props,a=o.endIndex,s=o.onDragEnd,l=o.startIndex;s==null||s({endIndex:a,startIndex:l})}),n.detachDragEndListener()}),zs(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),zs(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),zs(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),zs(n,"handleSlideDragStart",function(o){var a=Sz(o)?o.changedTouches[0]:o;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return nbe(t,e),Jxe(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var o=n.startX,a=n.endX,s=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(o,a),h=Math.max(o,a),p=t.getIndexInRange(s,f),y=t.getIndexInRange(s,h);return{startIndex:p-p%c,endIndex:y===d?d:y-y%c}}},{key:"getTextOfTick",value:function(n){var o=this.props,a=o.data,s=o.tickFormatter,l=o.dataKey,c=uo(a[n],l,n);return Ar(s)?s(c,n):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(n){var o=this.state,a=o.slideMoveStartX,s=o.startX,l=o.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,h=c.startIndex,p=c.endIndex,y=c.onChange,m=n.pageX-a;m>0?m=Math.min(m,u+d-f-l,u+d-f-s):m<0&&(m=Math.max(m,u-s,u-l));var x=this.getIndex({startX:s+m,endX:l+m});(x.startIndex!==h||x.endIndex!==p)&&y&&y(x),this.setState({startX:s+m,endX:l+m,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,o){var a=Sz(o)?o.changedTouches[0]:o;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var o=this.state,a=o.brushMoveStartX,s=o.movingTravellerId,l=o.endX,c=o.startX,u=this.state[s],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,y=d.onChange,m=d.gap,x=d.data,b={startX:this.state.startX,endX:this.state.endX},w=n.pageX-a;w>0?w=Math.min(w,f+h-p-u):w<0&&(w=Math.max(w,f-u)),b[s]=u+w;var k=this.getIndex(b),S=k.startIndex,_=k.endIndex,P=function(){var T=x.length-1;return s==="startX"&&(l>c?S%m===0:_%m===0)||lc?_%m===0:S%m===0)||l>c&&_===T};this.setState(zs(zs({},s,u+w),"brushMoveStartX",n.pageX),function(){y&&P()&&y(k)})}},{key:"handleTravellerMoveKeyboard",value:function(n,o){var a=this,s=this.state,l=s.scaleValues,c=s.startX,u=s.endX,d=this.state[o],f=l.indexOf(d);if(f!==-1){var h=f+n;if(!(h===-1||h>=l.length)){var p=l[h];o==="startX"&&p>=u||o==="endX"&&p<=c||this.setState(zs({},o,p),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,o=n.x,a=n.y,s=n.width,l=n.height,c=n.fill,u=n.stroke;return ze.createElement("rect",{stroke:u,fill:c,x:o,y:a,width:s,height:l})}},{key:"renderPanorama",value:function(){var n=this.props,o=n.x,a=n.y,s=n.width,l=n.height,c=n.data,u=n.children,d=n.padding,f=j.Children.only(u);return f?ze.cloneElement(f,{x:o,y:a,width:s,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,o){var a,s,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,h=c.traveller,p=c.ariaLabel,y=c.data,m=c.startIndex,x=c.endIndex,b=Math.max(n,this.props.x),w=s4(s4({},vr(this.props,!1)),{},{x:b,y:u,width:d,height:f}),k=p||"Min value: ".concat((a=y[m])===null||a===void 0?void 0:a.name,", Max value: ").concat((s=y[x])===null||s===void 0?void 0:s.name);return ze.createElement(ln,{tabIndex:0,role:"slider","aria-label":k,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[o],onTouchStart:this.travellerDragStartHandlers[o],onKeyDown:function(_){["ArrowLeft","ArrowRight"].includes(_.key)&&(_.preventDefault(),_.stopPropagation(),l.handleTravellerMoveKeyboard(_.key==="ArrowRight"?1:-1,o))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,w))}},{key:"renderSlide",value:function(n,o){var a=this.props,s=a.y,l=a.height,c=a.stroke,u=a.travellerWidth,d=Math.min(n,o)+u,f=Math.max(Math.abs(o-n)-u,0);return ze.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:d,y:s,width:f,height:l})}},{key:"renderText",value:function(){var n=this.props,o=n.startIndex,a=n.endIndex,s=n.y,l=n.height,c=n.travellerWidth,u=n.stroke,d=this.state,f=d.startX,h=d.endX,p=5,y={pointerEvents:"none",fill:u};return ze.createElement(ln,{className:"recharts-brush-texts"},ze.createElement(gh,O2({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:s+l/2},y),this.getTextOfTick(o)),ze.createElement(gh,O2({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+c+p,y:s+l/2},y),this.getTextOfTick(a)))}},{key:"render",value:function(){var n=this.props,o=n.data,a=n.className,s=n.children,l=n.x,c=n.y,u=n.width,d=n.height,f=n.alwaysShowText,h=this.state,p=h.startX,y=h.endX,m=h.isTextActive,x=h.isSlideMoving,b=h.isTravellerMoving,w=h.isTravellerFocused;if(!o||!o.length||!Bt(l)||!Bt(c)||!Bt(u)||!Bt(d)||u<=0||d<=0)return null;var k=Lr("recharts-brush",a),S=ze.Children.count(s)===1,_=Xxe("userSelect","none");return ze.createElement(ln,{className:k,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:_},this.renderBackground(),S&&this.renderPanorama(),this.renderSlide(p,y),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(y,"endX"),(m||x||b||w||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var o=n.x,a=n.y,s=n.width,l=n.height,c=n.stroke,u=Math.floor(a+l/2)-1;return ze.createElement(ze.Fragment,null,ze.createElement("rect",{x:o,y:a,width:s,height:l,fill:c,stroke:"none"}),ze.createElement("line",{x1:o+1,y1:u,x2:o+s-1,y2:u,fill:"none",stroke:"#fff"}),ze.createElement("line",{x1:o+1,y1:u+2,x2:o+s-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,o){var a;return ze.isValidElement(n)?a=ze.cloneElement(n,o):Ar(n)?a=n(o):a=t.renderDefaultTraveller(o),a}},{key:"getDerivedStateFromProps",value:function(n,o){var a=n.data,s=n.width,l=n.x,c=n.travellerWidth,u=n.updateId,d=n.startIndex,f=n.endIndex;if(a!==o.prevData||u!==o.prevUpdateId)return s4({prevData:a,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:s},a&&a.length?obe({data:a,width:s,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(o.scale&&(s!==o.prevWidth||l!==o.prevX||c!==o.prevTravellerWidth)){o.scale.range([l,l+s-c]);var h=o.scale.domain().map(function(p){return o.scale(p)});return{prevData:a,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:s,startX:o.scale(n.startIndex),endX:o.scale(n.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(n,o){for(var a=n.length,s=0,l=a-1;l-s>1;){var c=Math.floor((s+l)/2);n[c]>o?l=c:s=c}return o>=n[l]?l:s}}])})(j.PureComponent);zs(Nm,"displayName","Brush");zs(Nm,"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 l4,jz;function abe(){if(jz)return l4;jz=1;var e=CT();function t(r,n){var o;return e(r,function(a,s,l){return o=n(a,s,l),!o}),!!o}return l4=t,l4}var c4,kz;function sbe(){if(kz)return c4;kz=1;var e=EU(),t=su(),r=abe(),n=ms(),o=Kw();function a(s,l,c){var u=n(s)?e:r;return c&&o(s,l,c)&&(l=void 0),u(s,t(l,3))}return c4=a,c4}var lbe=sbe();const cbe=un(lbe);var Xc=function(t,r){var n=t.alwaysShow,o=t.ifOverflow;return n&&(o="extendDomain"),o===r},u4,_z;function ube(){if(_z)return u4;_z=1;var e=HU();function t(r,n,o){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[n]=o}return u4=t,u4}var d4,Cz;function dbe(){if(Cz)return d4;Cz=1;var e=ube(),t=$U(),r=su();function n(o,a){var s={};return a=r(a,3),t(o,function(l,c,u){e(s,c,a(l,c,u))}),s}return d4=n,d4}var fbe=dbe();const pbe=un(fbe);var f4,Ez;function hbe(){if(Ez)return f4;Ez=1;function e(t,r){for(var n=-1,o=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function jbe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function kbe(e,t){var r=e.x,n=e.y,o=Sbe(e,ybe),a="".concat(r),s=parseInt(a,10),l="".concat(n),c=parseInt(l,10),u="".concat(t.height||o.height),d=parseInt(u,10),f="".concat(t.width||o.width),h=parseInt(f,10);return my(my(my(my(my({},t),o),s?{x:s}:{}),c?{y:c}:{}),{},{height:d,width:h,name:t.name,radius:t.radius})}function Oz(e){return ze.createElement(_V,uA({shapeType:"rectangle",propTransformer:kbe,activeClassName:"recharts-active-bar"},e))}var _be=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,o){if(typeof t=="number")return t;var a=typeof n=="number";return a?t(n,o):(a||vh(),r)}},Cbe=["value","background"],NV;function Rm(e){"@babel/helpers - typeof";return Rm=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},Rm(e)}function Ebe(e,t){if(e==null)return{};var r=Abe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Abe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function N2(){return N2=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(z)0&&Math.abs(L)0&&(F=Math.min((q||0)-(L[Y-1]||0),F))}),Number.isFinite(F)){var z=F/A,V=m.layout==="vertical"?n.height:n.width;if(m.padding==="gap"&&(O=z*V/2),m.padding==="no-gap"){var Q=Wa(t.barCategoryGap,z*V),U=z*V/2;O=U-Q-(U-Q)/V*Q}}}o==="xAxis"?T=[n.left+(k.left||0)+(O||0),n.left+n.width-(k.right||0)-(O||0)]:o==="yAxis"?T=c==="horizontal"?[n.top+n.height-(k.bottom||0),n.top+(k.top||0)]:[n.top+(k.top||0)+(O||0),n.top+n.height-(k.bottom||0)-(O||0)]:T=m.range,_&&(T=[T[1],T[0]]);var ee=nV(m,a,h),H=ee.scale,B=ee.realScaleType;H.domain(b).range(T),iV(H);var M=oV(H,Jl(Jl({},m),{},{realScaleType:B}));o==="xAxis"?(E=x==="top"&&!S||x==="bottom"&&S,R=n.left,I=f[P]-E*m.height):o==="yAxis"&&(E=x==="left"&&!S||x==="right"&&S,R=f[P]-E*m.width,I=n.top);var $=Jl(Jl(Jl({},m),M),{},{realScaleType:B,x:R,y:I,scale:H,width:o==="xAxis"?n.width:m.width,height:o==="yAxis"?n.height:m.height});return $.bandSize=m2($,M),!m.hide&&o==="xAxis"?f[P]+=(E?-1:1)*$.height:m.hide||(f[P]+=(E?-1:1)*$.width),Jl(Jl({},p),{},gS({},y,$))},{})},DV=function(t,r){var n=t.x,o=t.y,a=r.x,s=r.y;return{x:Math.min(n,a),y:Math.min(o,s),width:Math.abs(a-n),height:Math.abs(s-o)}},zbe=function(t){var r=t.x1,n=t.y1,o=t.x2,a=t.y2;return DV({x:r,y:n},{x:o,y:a})},zV=(function(){function e(t){Fbe(this,e),this.scale=t}return Mbe(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(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=n.bandAware,a=n.position;if(r!==void 0){if(a)switch(a){case"start":return this.scale(r);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+s}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(r)+l}default:return this.scale(r)}if(o){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),o=n[0],a=n[n.length-1];return o<=a?r>=o&&r<=a:r>=a&&r<=o}}],[{key:"create",value:function(r){return new e(r)}}])})();gS(zV,"EPS",1e-4);var tP=function(t){var r=Object.keys(t).reduce(function(n,o){return Jl(Jl({},n),{},gS({},o,zV.create(t[o])))},{});return Jl(Jl({},r),{},{apply:function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=a.bandAware,l=a.position;return pbe(o,function(c,u){return r[u].apply(c,{bandAware:s,position:l})})},isInRange:function(o){return IV(o,function(a,s){return r[s].isInRange(a)})}})};function Bbe(e){return(e%180+180)%180}var Wbe=function(t){var r=t.width,n=t.height,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=Bbe(o),s=a*Math.PI/180,l=Math.atan(n/r),c=s>l&&s-1?c[u?a[d]:d]:void 0}}return g4=n,g4}var m4,Mz;function $be(){if(Mz)return m4;Mz=1;var e=AV();function t(r){var n=e(r),o=n%1;return n===n?o?n-o:n:0}return m4=t,m4}var v4,Dz;function Ube(){if(Dz)return v4;Dz=1;var e=DU(),t=su(),r=$be(),n=Math.max;function o(a,s,l){var c=a==null?0:a.length;if(!c)return-1;var u=l==null?0:r(l);return u<0&&(u=n(c+u,0)),e(a,t(s,3),u)}return v4=o,v4}var y4,zz;function Hbe(){if(zz)return y4;zz=1;var e=qbe(),t=Ube(),r=e(t);return y4=r,y4}var Vbe=Hbe();const Ybe=un(Vbe);var Gbe=eU();const Kbe=un(Gbe);var Qbe=Kbe(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("")}),rP=j.createContext(void 0),nP=j.createContext(void 0),BV=j.createContext(void 0),WV=j.createContext({}),qV=j.createContext(void 0),$V=j.createContext(0),UV=j.createContext(0),Bz=function(t){var r=t.state,n=r.xAxisMap,o=r.yAxisMap,a=r.offset,s=t.clipPathId,l=t.children,c=t.width,u=t.height,d=Qbe(a);return ze.createElement(rP.Provider,{value:n},ze.createElement(nP.Provider,{value:o},ze.createElement(WV.Provider,{value:a},ze.createElement(BV.Provider,{value:d},ze.createElement(qV.Provider,{value:s},ze.createElement($V.Provider,{value:u},ze.createElement(UV.Provider,{value:c},l)))))))},Xbe=function(){return j.useContext(qV)},HV=function(t){var r=j.useContext(rP);r==null&&vh();var n=r[t];return n==null&&vh(),n},Zbe=function(){var t=j.useContext(rP);return xf(t)},Jbe=function(){var t=j.useContext(nP),r=Ybe(t,function(n){return IV(n.domain,Number.isFinite)});return r||xf(t)},VV=function(t){var r=j.useContext(nP);r==null&&vh();var n=r[t];return n==null&&vh(),n},e1e=function(){var t=j.useContext(BV);return t},t1e=function(){return j.useContext(WV)},iP=function(){return j.useContext(UV)},oP=function(){return j.useContext($V)};function Lm(e){"@babel/helpers - typeof";return Lm=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},Lm(e)}function r1e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n1e(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);re*o)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-o)<=0}function D1e(e,t){return JV(e,t+1)}function z1e(e,t,r,n,o){for(var a=(n||[]).slice(),s=t.start,l=t.end,c=0,u=1,d=s,f=function(){var y=n==null?void 0:n[c];if(y===void 0)return{v:JV(n,u)};var m=c,x,b=function(){return x===void 0&&(x=r(y,m)),x},w=y.coordinate,k=c===0||D2(e,w,b,d,l);k||(c=0,d=s,u+=1),k&&(d=w+e*(b()/2+o),c+=u)},h;u<=a.length;)if(h=f(),h)return h.v;return[]}function zx(e){"@babel/helpers - typeof";return zx=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},zx(e)}function Gz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function fa(e){for(var t=1;t0?p.coordinate-x*e:p.coordinate})}else a[h]=p=fa(fa({},p),{},{tickCoord:p.coordinate});var b=D2(e,p.tickCoord,m,l,c);b&&(c=p.tickCoord-e*(m()/2+o),a[h]=fa(fa({},p),{},{isShow:!0}))},d=s-1;d>=0;d--)u(d);return a}function U1e(e,t,r,n,o,a){var s=(n||[]).slice(),l=s.length,c=t.start,u=t.end;if(a){var d=n[l-1],f=r(d,l-1),h=e*(d.coordinate+e*f/2-u);s[l-1]=d=fa(fa({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate});var p=D2(e,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-e*(f/2+o),s[l-1]=fa(fa({},d),{},{isShow:!0}))}for(var y=a?l-1:l,m=function(w){var k=s[w],S,_=function(){return S===void 0&&(S=r(k,w)),S};if(w===0){var P=e*(k.coordinate-e*_()/2-c);s[w]=k=fa(fa({},k),{},{tickCoord:P<0?k.coordinate-P*e:k.coordinate})}else s[w]=k=fa(fa({},k),{},{tickCoord:k.coordinate});var O=D2(e,k.tickCoord,_,c,u);O&&(c=k.tickCoord+e*(_()/2+o),s[w]=fa(fa({},k),{},{isShow:!0}))},x=0;x=2?Ba(o[1].coordinate-o[0].coordinate):1,b=M1e(a,x,p);return c==="equidistantPreserveStart"?z1e(x,b,m,o,s):(c==="preserveStart"||c==="preserveStartEnd"?h=U1e(x,b,m,o,s,c==="preserveStartEnd"):h=$1e(x,b,m,o,s),h.filter(function(w){return w.isShow}))}var H1e=["viewBox"],V1e=["viewBox"],Y1e=["ticks"];function Dm(e){"@babel/helpers - typeof";return Dm=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},Dm(e)}function Vg(){return Vg=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function G1e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function K1e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qz(e,t){for(var r=0;r0?c(this.props):c(p)),s<=0||l<=0||!y||!y.length?null:ze.createElement(ln,{className:Lr("recharts-cartesian-axis",u),ref:function(x){n.layerReference=x}},a&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),Fo.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,o,a){var s;return ze.isValidElement(n)?s=ze.cloneElement(n,o):Ar(n)?s=n(o):s=ze.createElement(gh,Vg({},o,{className:"recharts-cartesian-axis-tick-value"}),a),s}}])})(j.Component);cP(Sv,"displayName","CartesianAxis");cP(Sv,"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 r0e=["x1","y1","x2","y2","key"],n0e=["offset"];function yh(e){"@babel/helpers - typeof";return yh=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},yh(e)}function Xz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ha(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function s0e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var l0e=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,o=t.x,a=t.y,s=t.width,l=t.height,c=t.ry;return ze.createElement("rect",{x:o,y:a,ry:c,width:s,height:l,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function rY(e,t){var r;if(ze.isValidElement(e))r=ze.cloneElement(e,t);else if(Ar(e))r=e(t);else{var n=t.x1,o=t.y1,a=t.x2,s=t.y2,l=t.key,c=Zz(t,r0e),u=vr(c,!1);u.offset;var d=Zz(u,n0e);r=ze.createElement("line",Zp({},d,{x1:n,y1:o,x2:a,y2:s,fill:"none",key:l}))}return r}function c0e(e){var t=e.x,r=e.width,n=e.horizontal,o=n===void 0?!0:n,a=e.horizontalPoints;if(!o||!a||!a.length)return null;var s=a.map(function(l,c){var u=ha(ha({},e),{},{x1:t,y1:l,x2:t+r,y2:l,key:"line-".concat(c),index:c});return rY(o,u)});return ze.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function u0e(e){var t=e.y,r=e.height,n=e.vertical,o=n===void 0?!0:n,a=e.verticalPoints;if(!o||!a||!a.length)return null;var s=a.map(function(l,c){var u=ha(ha({},e),{},{x1:l,y1:t,x2:l,y2:t+r,key:"line-".concat(c),index:c});return rY(o,u)});return ze.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function d0e(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,o=e.y,a=e.width,s=e.height,l=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var d=l.map(function(h){return Math.round(h+o-o)}).sort(function(h,p){return h-p});o!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var y=!d[p+1],m=y?o+s-h:d[p+1]-h;if(m<=0)return null;var x=p%t.length;return ze.createElement("rect",{key:"react-".concat(p),y:h,x:n,height:m,width:a,stroke:"none",fill:t[x],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return ze.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function f0e(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,o=e.fillOpacity,a=e.x,s=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!r||!n||!n.length)return null;var d=u.map(function(h){return Math.round(h+a-a)}).sort(function(h,p){return h-p});a!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var y=!d[p+1],m=y?a+l-h:d[p+1]-h;if(m<=0)return null;var x=p%n.length;return ze.createElement("rect",{key:"react-".concat(p),x:h,y:s,width:m,height:c,stroke:"none",fill:n[x],fillOpacity:o,className:"recharts-cartesian-grid-bg"})});return ze.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var p0e=function(t,r){var n=t.xAxis,o=t.width,a=t.height,s=t.offset;return rV(lP(ha(ha(ha({},Sv.defaultProps),n),{},{ticks:td(n,!0),viewBox:{x:0,y:0,width:o,height:a}})),s.left,s.left+s.width,r)},h0e=function(t,r){var n=t.yAxis,o=t.width,a=t.height,s=t.offset;return rV(lP(ha(ha(ha({},Sv.defaultProps),n),{},{ticks:td(n,!0),viewBox:{x:0,y:0,width:o,height:a}})),s.top,s.top+s.height,r)},Eg={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function xA(e){var t,r,n,o,a,s,l=iP(),c=oP(),u=t1e(),d=ha(ha({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Eg.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:Eg.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:Eg.horizontal,horizontalFill:(o=e.horizontalFill)!==null&&o!==void 0?o:Eg.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:Eg.vertical,verticalFill:(s=e.verticalFill)!==null&&s!==void 0?s:Eg.verticalFill,x:Bt(e.x)?e.x:u.left,y:Bt(e.y)?e.y:u.top,width:Bt(e.width)?e.width:u.width,height:Bt(e.height)?e.height:u.height}),f=d.x,h=d.y,p=d.width,y=d.height,m=d.syncWithTicks,x=d.horizontalValues,b=d.verticalValues,w=Zbe(),k=Jbe();if(!Bt(p)||p<=0||!Bt(y)||y<=0||!Bt(f)||f!==+f||!Bt(h)||h!==+h)return null;var S=d.verticalCoordinatesGenerator||p0e,_=d.horizontalCoordinatesGenerator||h0e,P=d.horizontalPoints,O=d.verticalPoints;if((!P||!P.length)&&Ar(_)){var T=x&&x.length,R=_({yAxis:k?ha(ha({},k),{},{ticks:T?x:k.ticks}):void 0,width:l,height:c,offset:u},T?!0:m);ac(Array.isArray(R),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(yh(R),"]")),Array.isArray(R)&&(P=R)}if((!O||!O.length)&&Ar(S)){var I=b&&b.length,E=S({xAxis:w?ha(ha({},w),{},{ticks:I?b:w.ticks}):void 0,width:l,height:c,offset:u},I?!0:m);ac(Array.isArray(E),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(yh(E),"]")),Array.isArray(E)&&(O=E)}return ze.createElement("g",{className:"recharts-cartesian-grid"},ze.createElement(l0e,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),ze.createElement(c0e,Zp({},d,{offset:u,horizontalPoints:P,xAxis:w,yAxis:k})),ze.createElement(u0e,Zp({},d,{offset:u,verticalPoints:O,xAxis:w,yAxis:k})),ze.createElement(d0e,Zp({},d,{horizontalPoints:P})),ze.createElement(f0e,Zp({},d,{verticalPoints:O})))}xA.displayName="CartesianGrid";var g0e=["type","layout","connectNulls","ref"],m0e=["key"];function zm(e){"@babel/helpers - typeof";return zm=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},zm(e)}function Jz(e,t){if(e==null)return{};var r=v0e(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function v0e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Vy(){return Vy=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);rf){p=[].concat(Ag(c.slice(0,y)),[f-m]);break}var x=p.length%2===0?[0,h]:[h];return[].concat(Ag(t.repeat(c,d)),Ag(p),x).map(function(b){return"".concat(b,"px")}).join(", ")}),ec(r,"id",vv("recharts-line-")),ec(r,"pathRef",function(s){r.mainCurve=s}),ec(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),ec(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return E0e(t,e),j0e(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,o){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,s=a.points,l=a.xAxis,c=a.yAxis,u=a.layout,d=a.children,f=Ks(d,xb);if(!f)return null;var h=function(m,x){return{x:m.x,y:m.y,value:m.value,errorVal:uo(m.payload,x)}},p={clipPath:n?"url(#clipPath-".concat(o,")"):null};return ze.createElement(ln,p,f.map(function(y){return ze.cloneElement(y,{key:"bar-".concat(y.props.dataKey),data:s,xAxis:l,yAxis:c,layout:u,dataPointFormatter:h})}))}},{key:"renderDots",value:function(n,o,a){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,u=l.points,d=l.dataKey,f=vr(this.props,!1),h=vr(c,!0),p=u.map(function(m,x){var b=Ds(Ds(Ds({key:"dot-".concat(x),r:3},f),h),{},{index:x,cx:m.x,cy:m.y,value:m.value,dataKey:d,payload:m.payload,points:u});return t.renderDotItem(c,b)}),y={clipPath:n?"url(#clipPath-".concat(o?"":"dots-").concat(a,")"):null};return ze.createElement(ln,Vy({className:"recharts-line-dots",key:"dots"},y),p)}},{key:"renderCurveStatically",value:function(n,o,a,s){var l=this.props,c=l.type,u=l.layout,d=l.connectNulls;l.ref;var f=Jz(l,g0e),h=Ds(Ds(Ds({},vr(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:o?"url(#clipPath-".concat(a,")"):null,points:n},s),{},{type:c,layout:u,connectNulls:d});return ze.createElement(x2,Vy({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,o){var a=this,s=this.props,l=s.points,c=s.strokeDasharray,u=s.isAnimationActive,d=s.animationBegin,f=s.animationDuration,h=s.animationEasing,p=s.animationId,y=s.animateNewValues,m=s.width,x=s.height,b=this.state,w=b.prevPoints,k=b.totalLength;return ze.createElement(eu,{begin:d,duration:f,isActive:u,easing:h,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(S){var _=S.t;if(w){var P=w.length/l.length,O=l.map(function(A,F){var L=Math.floor(F*P);if(w[L]){var z=w[L],V=Ws(z.x,A.x),Q=Ws(z.y,A.y);return Ds(Ds({},A),{},{x:V(_),y:Q(_)})}if(y){var U=Ws(m*2,A.x),ee=Ws(x/2,A.y);return Ds(Ds({},A),{},{x:U(_),y:ee(_)})}return Ds(Ds({},A),{},{x:A.x,y:A.y})});return a.renderCurveStatically(O,n,o)}var T=Ws(0,k),R=T(_),I;if(c){var E="".concat(c).split(/[,\s]+/gim).map(function(A){return parseFloat(A)});I=a.getStrokeDasharray(R,k,E)}else I=a.generateSimpleStrokeDasharray(k,R);return a.renderCurveStatically(l,n,o,{strokeDasharray:I})})}},{key:"renderCurve",value:function(n,o){var a=this.props,s=a.points,l=a.isAnimationActive,c=this.state,u=c.prevPoints,d=c.totalLength;return l&&s&&s.length&&(!u&&d>0||!yb(u,s))?this.renderCurveWithAnimation(n,o):this.renderCurveStatically(s,n,o)}},{key:"render",value:function(){var n,o=this.props,a=o.hide,s=o.dot,l=o.points,c=o.className,u=o.xAxis,d=o.yAxis,f=o.top,h=o.left,p=o.width,y=o.height,m=o.isAnimationActive,x=o.id;if(a||!l||!l.length)return null;var b=this.state.isAnimationFinished,w=l.length===1,k=Lr("recharts-line",c),S=u&&u.allowDataOverflow,_=d&&d.allowDataOverflow,P=S||_,O=Rr(x)?this.id:x,T=(n=vr(s,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},R=T.r,I=R===void 0?3:R,E=T.strokeWidth,A=E===void 0?2:E,F=ise(s)?s:{},L=F.clipDot,z=L===void 0?!0:L,V=I*2+A;return ze.createElement(ln,{className:k},S||_?ze.createElement("defs",null,ze.createElement("clipPath",{id:"clipPath-".concat(O)},ze.createElement("rect",{x:S?h:h-p/2,y:_?f:f-y/2,width:S?p:p*2,height:_?y:y*2})),!z&&ze.createElement("clipPath",{id:"clipPath-dots-".concat(O)},ze.createElement("rect",{x:h-V/2,y:f-V/2,width:p+V,height:y+V}))):null,!w&&this.renderCurve(P,O),this.renderErrorBar(P,O),(w||s)&&this.renderDots(P,z,O),(!m||b)&&ld.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(n,o){return n.animationId!==o.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:o.curPoints}:n.points!==o.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,o){for(var a=n.length%2!==0?[].concat(Ag(n),[0]):n,s=[],l=0;le.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function v2e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function y2e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x2e(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?s:t&&t.length&&Bt(o)&&Bt(a)?t.slice(o,a+1):[]};function vY(e){return e==="number"?[0,"auto"]:void 0}var PA=function(t,r,n,o){var a=t.graphicalItems,s=t.tooltipAxis,l=bS(r,t);return n<0||!a||!a.length||n>=l.length?null:a.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:r;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(s.dataKey&&!s.allowDuplicatedCategory){var p=f===void 0?l:f;h=U0(p,s.dataKey,o)}else h=f&&f[n]||l[n];return h?[].concat(Vm(c),[sV(u,h)]):c},[])},l7=function(t,r,n,o){var a=o||{x:t.chartX,y:t.chartY},s=O2e(a,n),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=ege(s,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,h=PA(t,r,d,f),p=I2e(n,l,d,a);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},N2e=function(t,r){var n=r.axes,o=r.graphicalItems,a=r.axisType,s=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.layout,f=t.children,h=t.stackOffset,p=tV(d,a);return n.reduce(function(y,m){var x,b=m.type.defaultProps!==void 0?St(St({},m.type.defaultProps),m.props):m.props,w=b.type,k=b.dataKey,S=b.allowDataOverflow,_=b.allowDuplicatedCategory,P=b.scale,O=b.ticks,T=b.includeHidden,R=b[s];if(y[R])return y;var I=bS(t.data,{graphicalItems:o.filter(function(M){var $,q=s in M.props?M.props[s]:($=M.type.defaultProps)===null||$===void 0?void 0:$[s];return q===R}),dataStartIndex:c,dataEndIndex:u}),E=I.length,A,F,L;o2e(b.domain,S,w)&&(A=$E(b.domain,null,S),p&&(w==="number"||P!=="auto")&&(L=qy(I,k,"category")));var z=vY(w);if(!A||A.length===0){var V,Q=(V=b.domain)!==null&&V!==void 0?V:z;if(k){if(A=qy(I,k,w),w==="category"&&p){var U=Kae(A);_&&U?(F=A,A=P2(0,E)):_||(A=uD(Q,A,m).reduce(function(M,$){return M.indexOf($)>=0?M:[].concat(Vm(M),[$])},[]))}else if(w==="category")_?A=A.filter(function(M){return M!==""&&!Rr(M)}):A=uD(Q,A,m).reduce(function(M,$){return M.indexOf($)>=0||$===""||Rr($)?M:[].concat(Vm(M),[$])},[]);else if(w==="number"){var ee=oge(I,o.filter(function(M){var $,q,Y=s in M.props?M.props[s]:($=M.type.defaultProps)===null||$===void 0?void 0:$[s],K="hide"in M.props?M.props.hide:(q=M.type.defaultProps)===null||q===void 0?void 0:q.hide;return Y===R&&(T||!K)}),k,a,d);ee&&(A=ee)}p&&(w==="number"||P!=="auto")&&(L=qy(I,k,"category"))}else p?A=P2(0,E):l&&l[R]&&l[R].hasStack&&w==="number"?A=h==="expand"?[0,1]:aV(l[R].stackGroups,c,u):A=eV(I,o.filter(function(M){var $=s in M.props?M.props[s]:M.type.defaultProps[s],q="hide"in M.props?M.props.hide:M.type.defaultProps.hide;return $===R&&(T||!q)}),w,d,!0);if(w==="number")A=EA(f,A,R,a,O),Q&&(A=$E(Q,A,S));else if(w==="category"&&Q){var H=Q,B=A.every(function(M){return H.indexOf(M)>=0});B&&(A=H)}}return St(St({},y),{},xr({},R,St(St({},b),{},{axisType:a,domain:A,categoricalDomain:L,duplicateDomain:F,originalDomain:(x=b.domain)!==null&&x!==void 0?x:z,isCategorical:p,layout:d})))},{})},R2e=function(t,r){var n=r.graphicalItems,o=r.Axis,a=r.axisType,s=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.layout,f=t.children,h=bS(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:u}),p=h.length,y=tV(d,a),m=-1;return n.reduce(function(x,b){var w=b.type.defaultProps!==void 0?St(St({},b.type.defaultProps),b.props):b.props,k=w[s],S=vY("number");if(!x[k]){m++;var _;return y?_=P2(0,p):l&&l[k]&&l[k].hasStack?(_=aV(l[k].stackGroups,c,u),_=EA(f,_,k,a)):(_=$E(S,eV(h,n.filter(function(P){var O,T,R=s in P.props?P.props[s]:(O=P.type.defaultProps)===null||O===void 0?void 0:O[s],I="hide"in P.props?P.props.hide:(T=P.type.defaultProps)===null||T===void 0?void 0:T.hide;return R===k&&!I}),"number",d),o.defaultProps.allowDataOverflow),_=EA(f,_,k,a)),St(St({},x),{},xr({},k,St(St({axisType:a},o.defaultProps),{},{hide:!0,orientation:Gs(T2e,"".concat(a,".").concat(m%2),null),domain:_,originalDomain:S,isCategorical:y,layout:d})))}return x},{})},L2e=function(t,r){var n=r.axisType,o=n===void 0?"xAxis":n,a=r.AxisComp,s=r.graphicalItems,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.children,f="".concat(o,"Id"),h=Ks(d,a),p={};return h&&h.length?p=N2e(t,{axes:h,graphicalItems:s,axisType:o,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):s&&s.length&&(p=R2e(t,{Axis:a,graphicalItems:s,axisType:o,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},F2e=function(t){var r=xf(t),n=td(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:ET(n,function(o){return o.coordinate}),tooltipAxis:r,tooltipAxisBandSize:m2(r,n)}},c7=function(t){var r=t.children,n=t.defaultShowTooltip,o=Bs(r,Nm),a=0,s=0;return t.data&&t.data.length!==0&&(s=t.data.length-1),o&&o.props&&(o.props.startIndex>=0&&(a=o.props.startIndex),o.props.endIndex>=0&&(s=o.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!n}},M2e=function(t){return!t||!t.length?!1:t.some(function(r){var n=ad(r&&r.type);return n&&n.indexOf("Bar")>=0})},u7=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"}},D2e=function(t,r){var n=t.props,o=t.graphicalItems,a=t.xAxisMap,s=a===void 0?{}:a,l=t.yAxisMap,c=l===void 0?{}:l,u=n.width,d=n.height,f=n.children,h=n.margin||{},p=Bs(f,Nm),y=Bs(f,Af),m=Object.keys(c).reduce(function(_,P){var O=c[P],T=O.orientation;return!O.mirror&&!O.hide?St(St({},_),{},xr({},T,_[T]+O.width)):_},{left:h.left||0,right:h.right||0}),x=Object.keys(s).reduce(function(_,P){var O=s[P],T=O.orientation;return!O.mirror&&!O.hide?St(St({},_),{},xr({},T,Gs(_,"".concat(T))+O.height)):_},{top:h.top||0,bottom:h.bottom||0}),b=St(St({},x),m),w=b.bottom;p&&(b.bottom+=p.props.height||Nm.defaultProps.height),y&&r&&(b=nge(b,o,n,r));var k=u-b.left-b.right,S=d-b.top-b.bottom;return St(St({brushBottom:w},b),{},{width:Math.max(k,0),height:Math.max(S,0)})},z2e=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},uP=function(t){var r=t.chartName,n=t.GraphicalChild,o=t.defaultTooltipEventType,a=o===void 0?"axis":o,s=t.validateTooltipEventTypes,l=s===void 0?["axis"]:s,c=t.axisComponents,u=t.legendContent,d=t.formatAxisMap,f=t.defaultProps,h=function(b,w){var k=w.graphicalItems,S=w.stackGroups,_=w.offset,P=w.updateId,O=w.dataStartIndex,T=w.dataEndIndex,R=b.barSize,I=b.layout,E=b.barGap,A=b.barCategoryGap,F=b.maxBarSize,L=u7(I),z=L.numericAxisName,V=L.cateAxisName,Q=M2e(k),U=[];return k.forEach(function(ee,H){var B=bS(b.data,{graphicalItems:[ee],dataStartIndex:O,dataEndIndex:T}),M=ee.type.defaultProps!==void 0?St(St({},ee.type.defaultProps),ee.props):ee.props,$=M.dataKey,q=M.maxBarSize,Y=M["".concat(z,"Id")],K=M["".concat(V,"Id")],G={},re=c.reduce(function(ce,je){var qe=w["".concat(je.axisType,"Map")],Ne=M["".concat(je.axisType,"Id")];qe&&qe[Ne]||je.axisType==="zAxis"||vh();var Je=qe[Ne];return St(St({},ce),{},xr(xr({},je.axisType,Je),"".concat(je.axisType,"Ticks"),td(Je)))},G),J=re[V],ae=re["".concat(V,"Ticks")],le=S&&S[Y]&&S[Y].hasStack&&hge(ee,S[Y].stackGroups),me=ad(ee.type).indexOf("Bar")>=0,Oe=m2(J,ae),we=[],ie=Q&&tge({barSize:R,stackGroups:S,totalSize:z2e(re,V)});if(me){var Me,ke,se=Rr(q)?F:q,fe=(Me=(ke=m2(J,ae,!0))!==null&&ke!==void 0?ke:se)!==null&&Me!==void 0?Me:0;we=rge({barGap:E,barCategoryGap:A,bandSize:fe!==Oe?fe:Oe,sizeList:ie[K],maxBarSize:se}),fe!==Oe&&(we=we.map(function(ce){return St(St({},ce),{},{position:St(St({},ce.position),{},{offset:ce.position.offset-fe/2})})}))}var Ie=ee&&ee.type&&ee.type.getComposedData;Ie&&U.push({props:St(St({},Ie(St(St({},re),{},{displayedData:B,props:b,dataKey:$,item:ee,bandSize:Oe,barPosition:we,offset:_,stackedData:le,layout:I,dataStartIndex:O,dataEndIndex:T}))),{},xr(xr(xr({key:ee.key||"item-".concat(H)},z,re[z]),V,re[V]),"animationId",P)),childIndex:sse(ee,b.children),item:ee})}),U},p=function(b,w){var k=b.props,S=b.dataStartIndex,_=b.dataEndIndex,P=b.updateId;if(!kR({props:k}))return null;var O=k.children,T=k.layout,R=k.stackOffset,I=k.data,E=k.reverseStackOrder,A=u7(T),F=A.numericAxisName,L=A.cateAxisName,z=Ks(O,n),V=fge(I,z,"".concat(F,"Id"),"".concat(L,"Id"),R,E),Q=c.reduce(function(M,$){var q="".concat($.axisType,"Map");return St(St({},M),{},xr({},q,L2e(k,St(St({},$),{},{graphicalItems:z,stackGroups:$.axisType===F&&V,dataStartIndex:S,dataEndIndex:_}))))},{}),U=D2e(St(St({},Q),{},{props:k,graphicalItems:z}),w==null?void 0:w.legendBBox);Object.keys(Q).forEach(function(M){Q[M]=d(k,Q[M],U,M.replace("Map",""),r)});var ee=Q["".concat(L,"Map")],H=F2e(ee),B=h(k,St(St({},Q),{},{dataStartIndex:S,dataEndIndex:_,updateId:P,graphicalItems:z,stackGroups:V,offset:U}));return St(St({formattedGraphicalItems:B,graphicalItems:z,offset:U,stackGroups:V},H),Q)},y=(function(x){function b(w){var k,S,_;return y2e(this,b),_=w2e(this,b,[w]),xr(_,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),xr(_,"accessibilityManager",new i2e),xr(_,"handleLegendBBoxUpdate",function(P){if(P){var O=_.state,T=O.dataStartIndex,R=O.dataEndIndex,I=O.updateId;_.setState(St({legendBBox:P},p({props:_.props,dataStartIndex:T,dataEndIndex:R,updateId:I},St(St({},_.state),{},{legendBBox:P}))))}}),xr(_,"handleReceiveSyncEvent",function(P,O,T){if(_.props.syncId===P){if(T===_.eventEmitterSymbol&&typeof _.props.syncMethod!="function")return;_.applySyncEvent(O)}}),xr(_,"handleBrushChange",function(P){var O=P.startIndex,T=P.endIndex;if(O!==_.state.dataStartIndex||T!==_.state.dataEndIndex){var R=_.state.updateId;_.setState(function(){return St({dataStartIndex:O,dataEndIndex:T},p({props:_.props,dataStartIndex:O,dataEndIndex:T,updateId:R},_.state))}),_.triggerSyncEvent({dataStartIndex:O,dataEndIndex:T})}}),xr(_,"handleMouseEnter",function(P){var O=_.getMouseInfo(P);if(O){var T=St(St({},O),{},{isTooltipActive:!0});_.setState(T),_.triggerSyncEvent(T);var R=_.props.onMouseEnter;Ar(R)&&R(T,P)}}),xr(_,"triggeredAfterMouseMove",function(P){var O=_.getMouseInfo(P),T=O?St(St({},O),{},{isTooltipActive:!0}):{isTooltipActive:!1};_.setState(T),_.triggerSyncEvent(T);var R=_.props.onMouseMove;Ar(R)&&R(T,P)}),xr(_,"handleItemMouseEnter",function(P){_.setState(function(){return{isTooltipActive:!0,activeItem:P,activePayload:P.tooltipPayload,activeCoordinate:P.tooltipPosition||{x:P.cx,y:P.cy}}})}),xr(_,"handleItemMouseLeave",function(){_.setState(function(){return{isTooltipActive:!1}})}),xr(_,"handleMouseMove",function(P){P.persist(),_.throttleTriggeredAfterMouseMove(P)}),xr(_,"handleMouseLeave",function(P){_.throttleTriggeredAfterMouseMove.cancel();var O={isTooltipActive:!1};_.setState(O),_.triggerSyncEvent(O);var T=_.props.onMouseLeave;Ar(T)&&T(O,P)}),xr(_,"handleOuterEvent",function(P){var O=ase(P),T=Gs(_.props,"".concat(O));if(O&&Ar(T)){var R,I;/.*touch.*/i.test(O)?I=_.getMouseInfo(P.changedTouches[0]):I=_.getMouseInfo(P),T((R=I)!==null&&R!==void 0?R:{},P)}}),xr(_,"handleClick",function(P){var O=_.getMouseInfo(P);if(O){var T=St(St({},O),{},{isTooltipActive:!0});_.setState(T),_.triggerSyncEvent(T);var R=_.props.onClick;Ar(R)&&R(T,P)}}),xr(_,"handleMouseDown",function(P){var O=_.props.onMouseDown;if(Ar(O)){var T=_.getMouseInfo(P);O(T,P)}}),xr(_,"handleMouseUp",function(P){var O=_.props.onMouseUp;if(Ar(O)){var T=_.getMouseInfo(P);O(T,P)}}),xr(_,"handleTouchMove",function(P){P.changedTouches!=null&&P.changedTouches.length>0&&_.throttleTriggeredAfterMouseMove(P.changedTouches[0])}),xr(_,"handleTouchStart",function(P){P.changedTouches!=null&&P.changedTouches.length>0&&_.handleMouseDown(P.changedTouches[0])}),xr(_,"handleTouchEnd",function(P){P.changedTouches!=null&&P.changedTouches.length>0&&_.handleMouseUp(P.changedTouches[0])}),xr(_,"handleDoubleClick",function(P){var O=_.props.onDoubleClick;if(Ar(O)){var T=_.getMouseInfo(P);O(T,P)}}),xr(_,"handleContextMenu",function(P){var O=_.props.onContextMenu;if(Ar(O)){var T=_.getMouseInfo(P);O(T,P)}}),xr(_,"triggerSyncEvent",function(P){_.props.syncId!==void 0&&w4.emit(S4,_.props.syncId,P,_.eventEmitterSymbol)}),xr(_,"applySyncEvent",function(P){var O=_.props,T=O.layout,R=O.syncMethod,I=_.state.updateId,E=P.dataStartIndex,A=P.dataEndIndex;if(P.dataStartIndex!==void 0||P.dataEndIndex!==void 0)_.setState(St({dataStartIndex:E,dataEndIndex:A},p({props:_.props,dataStartIndex:E,dataEndIndex:A,updateId:I},_.state)));else if(P.activeTooltipIndex!==void 0){var F=P.chartX,L=P.chartY,z=P.activeTooltipIndex,V=_.state,Q=V.offset,U=V.tooltipTicks;if(!Q)return;if(typeof R=="function")z=R(U,P);else if(R==="value"){z=-1;for(var ee=0;ee=0){var le,me;if(F.dataKey&&!F.allowDuplicatedCategory){var Oe=typeof F.dataKey=="function"?ae:"payload.".concat(F.dataKey.toString());le=U0(ee,Oe,z),me=H&&B&&U0(B,Oe,z)}else le=ee==null?void 0:ee[L],me=H&&B&&B[L];if(K||Y){var we=P.props.activeIndex!==void 0?P.props.activeIndex:L;return[j.cloneElement(P,St(St(St({},R.props),re),{},{activeIndex:we})),null,null]}if(!Rr(le))return[J].concat(Vm(_.renderActivePoints({item:R,activePoint:le,basePoint:me,childIndex:L,isRange:H})))}else{var ie,Me=(ie=_.getItemByXY(_.state.activeCoordinate))!==null&&ie!==void 0?ie:{graphicalItem:J},ke=Me.graphicalItem,se=ke.item,fe=se===void 0?P:se,Ie=ke.childIndex,ce=St(St(St({},R.props),re),{},{activeIndex:Ie});return[j.cloneElement(fe,ce),null,null]}return H?[J,null,null]:[J,null]}),xr(_,"renderCustomized",function(P,O,T){return j.cloneElement(P,St(St({key:"recharts-customized-".concat(T)},_.props),_.state))}),xr(_,"renderMap",{CartesianGrid:{handler:H1,once:!0},ReferenceArea:{handler:_.renderReferenceElement},ReferenceLine:{handler:H1},ReferenceDot:{handler:_.renderReferenceElement},XAxis:{handler:H1},YAxis:{handler:H1},Brush:{handler:_.renderBrush,once:!0},Bar:{handler:_.renderGraphicChild},Line:{handler:_.renderGraphicChild},Area:{handler:_.renderGraphicChild},Radar:{handler:_.renderGraphicChild},RadialBar:{handler:_.renderGraphicChild},Scatter:{handler:_.renderGraphicChild},Pie:{handler:_.renderGraphicChild},Funnel:{handler:_.renderGraphicChild},Tooltip:{handler:_.renderCursor,once:!0},PolarGrid:{handler:_.renderPolarGrid,once:!0},PolarAngleAxis:{handler:_.renderPolarAxis},PolarRadiusAxis:{handler:_.renderPolarAxis},Customized:{handler:_.renderCustomized}}),_.clipPathId="".concat((k=w.id)!==null&&k!==void 0?k:vv("recharts"),"-clip"),_.throttleTriggeredAfterMouseMove=XU(_.triggeredAfterMouseMove,(S=w.throttleDelay)!==null&&S!==void 0?S:1e3/60),_.state={},_}return k2e(b,x),b2e(b,[{key:"componentDidMount",value:function(){var k,S;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(k=this.props.margin.left)!==null&&k!==void 0?k:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var k=this.props,S=k.children,_=k.data,P=k.height,O=k.layout,T=Bs(S,kl);if(T){var R=T.props.defaultIndex;if(!(typeof R!="number"||R<0||R>this.state.tooltipTicks.length-1)){var I=this.state.tooltipTicks[R]&&this.state.tooltipTicks[R].value,E=PA(this.state,_,R,I),A=this.state.tooltipTicks[R].coordinate,F=(this.state.offset.top+P)/2,L=O==="horizontal",z=L?{x:A,y:F}:{y:A,x:F},V=this.state.formattedGraphicalItems.find(function(U){var ee=U.item;return ee.type.name==="Scatter"});V&&(z=St(St({},z),V.props.points[R].tooltipPosition),E=V.props.points[R].tooltipPayload);var Q={activeTooltipIndex:R,isTooltipActive:!0,activeLabel:I,activePayload:E,activeCoordinate:z};this.setState(Q),this.renderCursor(T),this.accessibilityManager.setIndex(R)}}}},{key:"getSnapshotBeforeUpdate",value:function(k,S){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==S.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==k.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==k.margin){var _,P;this.accessibilityManager.setDetails({offset:{left:(_=this.props.margin.left)!==null&&_!==void 0?_:0,top:(P=this.props.margin.top)!==null&&P!==void 0?P:0}})}return null}},{key:"componentDidUpdate",value:function(k){dE([Bs(k.children,kl)],[Bs(this.props.children,kl)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var k=Bs(this.props.children,kl);if(k&&typeof k.props.shared=="boolean"){var S=k.props.shared?"axis":"item";return l.indexOf(S)>=0?S:a}return a}},{key:"getMouseInfo",value:function(k){if(!this.container)return null;var S=this.container,_=S.getBoundingClientRect(),P=Yue(_),O={chartX:Math.round(k.pageX-P.left),chartY:Math.round(k.pageY-P.top)},T=_.width/S.offsetWidth||1,R=this.inRange(O.chartX,O.chartY,T);if(!R)return null;var I=this.state,E=I.xAxisMap,A=I.yAxisMap,F=this.getTooltipEventType(),L=l7(this.state,this.props.data,this.props.layout,R);if(F!=="axis"&&E&&A){var z=xf(E).scale,V=xf(A).scale,Q=z&&z.invert?z.invert(O.chartX):null,U=V&&V.invert?V.invert(O.chartY):null;return St(St({},O),{},{xValue:Q,yValue:U},L)}return L?St(St({},O),L):null}},{key:"inRange",value:function(k,S){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,P=this.props.layout,O=k/_,T=S/_;if(P==="horizontal"||P==="vertical"){var R=this.state.offset,I=O>=R.left&&O<=R.left+R.width&&T>=R.top&&T<=R.top+R.height;return I?{x:O,y:T}:null}var E=this.state,A=E.angleAxisMap,F=E.radiusAxisMap;if(A&&F){var L=xf(A);return pD({x:O,y:T},L)}return null}},{key:"parseEventsOfWrapper",value:function(){var k=this.props.children,S=this.getTooltipEventType(),_=Bs(k,kl),P={};_&&S==="axis"&&(_.props.trigger==="click"?P={onClick:this.handleClick}:P={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 O=H0(this.props,this.handleOuterEvent);return St(St({},O),P)}},{key:"addListener",value:function(){w4.on(S4,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){w4.removeListener(S4,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(k,S,_){for(var P=this.state.formattedGraphicalItems,O=0,T=P.length;Oi.jsx(Qw,{fill:V1[s%V1.length]},`cell-${a.name}`))}),i.jsx(kl,{contentStyle:_4})]})}),i.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"7px"},children:k4.map((a,s)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px"},children:[i.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:V1[s%V1.length],flexShrink:0}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",flex:1},children:a.name}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)"},children:a.value})]},`legend-${a.name}`))})]})})})]})}const V2e={conference:"Conference",workshop:"Workshop",summit:"Summit",cme:"CME",webinar:"Webinar"},d7={draft:{label:"Draft",bg:"#64748b"},upcoming:{label:"Upcoming",bg:"#2563eb"},live:{label:"Live",bg:"#16a34a"},completed:{label:"Completed",bg:"#475569"}},Y2e={physical:"Physical",virtual:"Virtual",hybrid:"Hybrid"};function G2e(e,t){const r=new Date(e),n=new Date(t);if(Number.isNaN(r.getTime())||Number.isNaN(n.getTime()))return"—";const o=r.toDateString()===n.toDateString(),a=r.getFullYear(),s=n.getFullYear(),l=u=>u.toLocaleDateString(void 0,{month:"short"}),c=u=>u.getDate();return o?r.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):r.getMonth()===n.getMonth()&&a===s?`${l(r)} ${c(r)}–${c(n)}, ${a}`:a===s?`${l(r)} ${c(r)} – ${l(n)} ${c(n)}, ${a}`:`${l(r)} ${c(r)}, ${a} – ${l(n)} ${c(n)}, ${s}`}function K2e(e){var n,o,a,s;const t=(n=e.bannerImage)==null?void 0:n.trim();if(t)return t;const r=(s=(a=(o=e.website)==null?void 0:o.banners)==null?void 0:a[0])==null?void 0:s.trim();return r||null}function Q2e(e){return null}function X2e({event:e,loading:t=!1,onEditEvent:r,canEdit:n=!0}){var b,w,k,S,_,P,O,T,R,I;const a=qi()==="mobile",[s,l]=j.useState(!1);j.useEffect(()=>{l(!1)},[e==null?void 0:e._id,e==null?void 0:e.bannerImage,(w=(b=e==null?void 0:e.website)==null?void 0:b.banners)==null?void 0:w[0]]);const c=e?K2e(e):null,u=e!=null&&e.status&&d7[e.status]?e.status:"draft",d=d7[u],f=e!=null&&e.type?V2e[e.type]??e.type:"Event",h=e!=null&&e.locationType?Y2e[e.locationType]??e.locationType:"",p=e!=null&&e.startDate&&(e!=null&&e.endDate)?G2e(e.startDate,e.endDate):"—",y=(e==null?void 0:e.locationType)==="virtual"?((k=e.virtualLink)==null?void 0:k.trim())||"Virtual event":(e==null?void 0:e.locationType)==="hybrid"?[(S=e.location)==null?void 0:S.trim(),(_=e.virtualLink)==null?void 0:_.trim()].filter(Boolean).join(" · ")||"Hybrid":((P=e==null?void 0:e.location)==null?void 0:P.trim())||"—",m=(O=e==null?void 0:e.website)!=null&&O.folder?Q2e(e.website.folder):null,x=(e==null?void 0:e.status)==="live"?{dot:"#16a34a",text:a?"Live":"Live now"}:(e==null?void 0:e.status)==="upcoming"?{dot:"#2563eb",text:"Upcoming"}:(e==null?void 0:e.status)==="completed"?{dot:"#64748b",text:a?"Ended":"Completed"}:{dot:"#94a3b8",text:"Draft"};return i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden",display:"flex",flexDirection:"column"},children:[i.jsxs("div",{style:{position:"relative",height:a?"110px":"140px",overflow:"hidden",background:c&&!s?void 0:"linear-gradient(135deg, #1e293b 0%, #334155 50%, #0f172a 100%)"},children:[c&&!s?i.jsx("img",{src:c,alt:"",onError:()=>l(!0),style:{width:"100%",height:"100%",objectFit:"cover"}}):null,i.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(to right, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.15) 100%)",display:"flex",alignItems:"flex-end",padding:a?"12px 14px":"16px 20px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"space-between",width:"100%",gap:"10px"},children:[i.jsxs("div",{style:{overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"5px",flexWrap:"wrap"},children:[t?i.jsx("span",{style:{display:"inline-block",width:"72px",height:"18px",borderRadius:"999px",background:"rgba(255,255,255,0.2)"}}):i.jsx("span",{style:{background:d.bg,color:"#fff",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",padding:"2px 8px",borderRadius:"999px"},children:d.label}),!a&&i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"rgba(255,255,255,0.65)"},children:[h,f].filter(Boolean).join(" · ")})]}),i.jsx("h2",{style:{fontFamily:"var(--font-inter)",fontSize:a?"var(--text-base)":"var(--text-xl)",fontWeight:"var(--font-weight-medium)",color:"#fff",lineHeight:"1.2",marginBottom:"2px"},children:t?"…":(e==null?void 0:e.name)??"Select an event"}),!a&&i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:"rgba(255,255,255,0.7)"},children:t?" ":((T=e==null?void 0:e.subtitle)==null?void 0:T.trim())||((I=(R=e==null?void 0:e.description)==null?void 0:R.trim())==null?void 0:I.slice(0,120))||" "})]}),i.jsxs("div",{style:{display:"flex",gap:"6px",flexShrink:0,flexWrap:a?"wrap":"nowrap"},children:[!a&&m?i.jsxs("a",{href:m,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:"5px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"rgba(255,255,255,0.15)",backdropFilter:"blur(4px)",color:"#fff",border:"1px solid rgba(255,255,255,0.25)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer",textDecoration:"none"},children:[i.jsx(av,{size:12})," View Website"]}):null,i.jsxs("button",{type:"button",disabled:!n||!e,onClick:()=>n&&e&&(r==null?void 0:r()),style:{display:"flex",alignItems:"center",gap:"5px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:n&&e?"var(--primary)":"var(--secondary)",color:n&&e?"var(--primary-foreground)":"var(--muted)",border:"none",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:n&&e?"pointer":"not-allowed",opacity:n&&e?1:.7},children:[i.jsx(Ii,{size:12})," Edit"]})]})]})})]}),i.jsxs("div",{style:{padding:a?"8px 14px":"10px 20px",display:"flex",alignItems:"center",gap:a?"12px":"20px",flexWrap:"wrap"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx(Wi,{size:12,style:{color:"var(--muted)"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:t?"…":p})]}),!a&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx(lb,{size:12,style:{color:"var(--muted)"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:t?"…":y})]}),i.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:x.dot,display:"block"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:x.dot,fontWeight:"var(--font-weight-medium)"},children:t?"…":x.text})]})]})]})}const G1={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"};function K1({msg:e}){return e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"4px 0 0",fontFamily:"var(--font-noto-sans)"},children:e}):null}function Z2e({n:e,state:t}){const r=t==="todo"?"var(--muted)":"var(--primary)";return i.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:r,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t==="done"?i.jsx(Oi,{size:13,style:{color:"#fff"}}):i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",color:"#fff",fontWeight:"var(--font-weight-medium)"},children:e})})}function J2e({eventId:e,existingTrack:t,onClose:r,onSuccess:n}){const o=!!(t!=null&&t._id),[a,s]=j.useState(1),[l,c]=j.useState(()=>o?new Set([1,2,3]):new Set),[u,d]=j.useState(!1),[f,h]=j.useState(null),[p,y]=j.useState((t==null?void 0:t.name)||""),[m,x]=j.useState((t==null?void 0:t.trackType)||"general"),[b,w]=j.useState((t==null?void 0:t.hall)||""),[k,S]=j.useState((t==null?void 0:t.status)||"active"),[_,P]=j.useState({}),[O,T]=j.useState({}),[R,I]=j.useState({}),E=j.useCallback(()=>{const ee={};return p.trim()?p.trim().length<2&&(ee.name="Use at least 2 characters."):ee.name="Track name is required.",P(ee),Object.keys(ee).length===0},[p]),A=j.useCallback(()=>(T({}),!0),[]),F=j.useCallback(()=>(I({}),!0),[]),L=j.useCallback(()=>{const ee=E(),H=A(),B=F();return ee&&H&&B},[E,A,F]),z=ee=>{ee===1&&!E()||ee===2&&!A()||(c(H=>new Set([...H,ee])),ee<3&&s(ee+1))},V=async()=>{if(h(null),!L()){E()?A()?s(3):s(2):s(1);return}d(!0);const ee={name:p.trim(),hall:b.trim()||void 0,trackType:m,status:k},H=o?await rh.update(t._id,ee):await rh.create(e,ee);if(d(!1),H.error){h(H.error);return}n(),r()},Q=[{n:1,title:"Track name",subtitle:"How this track appears on the agenda."},{n:2,title:"Type & venue",subtitle:"Track category and hall or room."},{n:3,title:"Status",subtitle:"Active tracks show on the public agenda."}],U=({className:ee})=>i.jsx("button",{type:"button",disabled:u,onClick:V,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:u?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:u?.85:1,...ee?{}:{}},children:u?"Saving…":o?"Save changes":"Save track"});return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:r,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(520px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)"},children:[i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:o?"Edit track":"Add track"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"6px 0 0",fontFamily:"var(--font-noto-sans)"},children:"Complete each section before continuing. Save submits the track."})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:r,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(er,{size:14})}),i.jsx(U,{})]})]}),f&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-xs)",marginTop:"10px",fontFamily:"var(--font-noto-sans)"},children:f})]}),i.jsx("div",{style:{flex:1,overflowY:"auto"},children:Q.map(ee=>{const H=a===ee.n,B=l.has(ee.n),M=H?"active":B?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{type:"button",onClick:()=>s(H?0:ee.n),style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(Z2e,{n:ee.n,state:M}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:H?"var(--primary)":"var(--card-foreground)",margin:0},children:ee.title}),!H&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:ee.subtitle})]}),H?i.jsx($f,{size:18,style:{color:"var(--muted)"}}):i.jsx(po,{size:18,style:{color:"var(--muted)"}})]}),H&&i.jsxs("div",{style:{padding:"0 20px 16px 52px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 14px",fontFamily:"var(--font-noto-sans)"},children:ee.subtitle}),ee.n===1&&i.jsxs("div",{children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:["Track name ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx("input",{value:p,onChange:$=>{y($.target.value),_.name&&P({})},placeholder:"e.g. Main hall track",style:G1}),i.jsx(K1,{msg:_.name})]}),ee.n===2&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Track type"}),i.jsxs("select",{value:m,onChange:$=>x($.target.value),style:{...G1,cursor:"pointer"},children:[i.jsx("option",{value:"general",children:"General"}),i.jsx("option",{value:"workshop",children:"Workshop"}),i.jsx("option",{value:"plenary",children:"Plenary"}),i.jsx("option",{value:"symposium",children:"Symposium"})]}),i.jsx(K1,{msg:O.trackType})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Hall / venue"}),i.jsx("input",{value:b,onChange:$=>w($.target.value),placeholder:"Optional",style:G1}),i.jsx(K1,{msg:O.hall})]})]}),ee.n===3&&i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Status"}),i.jsxs("select",{value:k,onChange:$=>S($.target.value),style:{...G1,cursor:"pointer"},children:[i.jsx("option",{value:"active",children:"Active"}),i.jsx("option",{value:"inactive",children:"Inactive"})]}),i.jsx(K1,{msg:R.status})]}),i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"16px",paddingTop:"12px",borderTop:"1px solid var(--border)"},children:ee.n<3?i.jsx("button",{type:"button",onClick:()=>z(ee.n),style:{padding:"6px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"Next section"}):i.jsx(U,{})})]})]},ee.n)})}),i.jsxs("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:"10px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:r,style:{padding:"7px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx(U,{})]})]})]})}const ewe={keynote:"Keynote",workshop:"Workshop",panel:"Panel",breakout:"Other",networking:"Qna"},twe={scheduled:"Scheduled",ongoing:"Live",completed:"Completed",cancelled:"Cancelled"};function rwe(e){return{general:"General",workshop:"Workshop",plenary:"Plenary",symposium:"Symposium"}[e]||"General"}function nwe(e){if(e&&typeof e=="object"&&"firstName"in e){const t=e;return`${t.firstName||""} ${t.lastName||""}`.trim()}return""}function iwe(e){var r,n;if((r=e.speakers)!=null&&r.length){const o=e.speakers.map(nwe).filter(Boolean);if(o.length===1)return o[0];if(o.length===2)return`${o[0]} & ${o[1]}`;if(o.length>2)return`${o[0]}, ${o[1]} +${o.length-2}`}const t=(e.description||"").match(/Speaker:\s*(.+?)(?:\n|$)/i);return(n=t==null?void 0:t[1])==null?void 0:n.trim()}function owe(e){const t=new Date(e.startTime),r=new Date(e.endTime),n=s=>Number.isNaN(s.getTime())?{date:"—",time:"—"}:{date:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),time:s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})},o=n(t),a=n(r);return{id:e._id,joinCode:e.joinCode,title:e.title,type:ewe[e.type]||"Other",startDate:o.date,startTime:o.time,endDate:a.date,endTime:a.time,status:twe[e.status]||"Scheduled",speaker:iwe(e),description:e.description}}const OA={Presentation:{bg:"#dbeafe",color:"#1d4ed8"},Panel:{bg:"#dcfce7",color:"#15803d"},Keynote:{bg:"#ede9fe",color:"#5b21b6"},Workshop:{bg:"#ffedd5",color:"#c2410c"},Qna:{bg:"#ccfbf1",color:"#0d9488"},Demo:{bg:"#f1f5f9",color:"#475569"},Other:{bg:"#f3f4f6",color:"#6b7280"},Debate:{bg:"#fce7f3",color:"#be185d"},Symposium:{bg:"#dbeafe",color:"#1d4ed8"}},awe={Scheduled:{bg:"#e0e7ff",color:"#3730a3"},Live:{bg:"#dcfce7",color:"#15803d"},Completed:{bg:"#f1f5f9",color:"#475569"},Cancelled:{bg:"#fee2e2",color:"#b91c1c"}};function yY({type:e}){const t=OA[e]||OA.Other;return i.jsx("span",{style:{display:"inline-flex",padding:"2px 7px",borderRadius:"3px",background:t.bg,color:t.color,fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:e})}function xY({status:e}){const t=awe[e];return i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"999px",background:t.bg,color:t.color,fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:[e==="Live"&&i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"#16a34a",display:"block"}}),e]})}const Us={width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--card-foreground)",flexShrink:0};function swe({session:e,onEdit:t,onDelete:r,onDuplicate:n,onOpenQr:o,duplicateLoading:a}){var c,u,d,f;const[s,l]=j.useState(!1);return i.jsxs("tr",{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{background:s?"var(--secondary)":"transparent",transition:"background 0.12s",borderBottom:"1px solid var(--border)"},children:[i.jsx("td",{style:{width:"32px",paddingLeft:"12px"},children:i.jsx("div",{style:{opacity:s?1:0,transition:"opacity 0.15s",color:"var(--muted)",cursor:"grab",display:"flex"},children:i.jsx(sv,{size:14})})}),i.jsxs("td",{style:{padding:"10px 12px 10px 4px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",fontWeight:"var(--font-weight-medium)",lineHeight:"1.4"},children:e.title}),e.speaker&&i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px",display:"flex",alignItems:"center",gap:"3px"},children:[i.jsx(ym,{size:10})," ",e.speaker]})]}),i.jsx("td",{style:{padding:"10px 12px",whiteSpace:"nowrap"},children:i.jsx(yY,{type:e.type})}),i.jsx("td",{style:{padding:"10px 12px",whiteSpace:"nowrap"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx(ob,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[e.startDate,", ",e.startTime," – ",e.endTime]})]})}),i.jsx("td",{style:{padding:"10px 12px",whiteSpace:"nowrap"},children:i.jsx(xY,{status:e.status})}),i.jsx("td",{style:{padding:"10px 12px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"4px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:h=>{h.stopPropagation(),t()},title:"Edit",style:{display:"flex",alignItems:"center",gap:"4px",padding:"3px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(Ii,{size:11})," Edit"]}),i.jsx("button",{type:"button",title:(c=e.joinCode)!=null&&c.trim()?"QR code":"Join code not available yet",disabled:!((u=e.joinCode)!=null&&u.trim()),onClick:h=>{h.stopPropagation(),o()},style:{...Us,opacity:(d=e.joinCode)!=null&&d.trim()?1:.35,cursor:(f=e.joinCode)!=null&&f.trim()?"pointer":"not-allowed"},onMouseEnter:h=>{var p;(p=e.joinCode)!=null&&p.trim()&&(h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)")},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--card-foreground)"},children:i.jsx(lv,{size:13})}),i.jsx("button",{type:"button",title:"Duplicate",disabled:a,onClick:h=>{h.stopPropagation(),n()},style:{...Us,opacity:a?.7:1,cursor:a?"wait":"pointer"},onMouseEnter:h=>{a||(h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)")},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--card-foreground)"},children:a?i.jsx(ix,{size:13,className:"animate-spin"}):i.jsx(iu,{size:13})}),i.jsx("button",{type:"button",title:"View Feedback",onClick:h=>{h.stopPropagation()},style:Us,onMouseEnter:h=>{h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--card-foreground)"},children:i.jsx(Zs,{size:13})}),i.jsx("button",{type:"button",title:"View Ratings",onClick:h=>{h.stopPropagation()},style:Us,onMouseEnter:h=>{h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--card-foreground)"},children:i.jsx(Rf,{size:13})}),i.jsx("button",{type:"button",title:"Delete",onClick:h=>{h.stopPropagation(),r()},style:{...Us,color:"var(--destructive)",borderColor:"var(--border)"},onMouseEnter:h=>{h.currentTarget.style.background="#fef2f2",h.currentTarget.style.borderColor="var(--destructive)"},onMouseLeave:h=>{h.currentTarget.style.background="var(--card)",h.currentTarget.style.borderColor="var(--border)"},children:i.jsx(gn,{size:13})})]})})]})}function lwe({session:e,onEdit:t,onDelete:r,onDuplicate:n,onOpenQr:o,duplicateLoading:a}){var c,u,d,f,h;const[s,l]=j.useState(!1);return i.jsxs("div",{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"14px 16px",display:"flex",flexDirection:"column",gap:"8px",borderTop:`3px solid ${((c=OA[e.type])==null?void 0:c.color)||"#94a3b8"}`,transition:"box-shadow 0.15s",boxShadow:s?"var(--elevation-sm)":"none"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"8px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.4",flex:1},children:e.title}),i.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:i.jsx(yY,{type:e.type})})]}),e.speaker&&i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx(ym,{size:10})," ",e.speaker]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"8px",borderTop:"1px solid var(--border)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx(ob,{size:11,style:{color:"var(--muted)"}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[e.startDate,", ",e.startTime," – ",e.endTime]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap",justifyContent:"flex-end"},children:[i.jsx(xY,{status:e.status}),i.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"center",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:t,title:"Edit",style:{...Us,width:"28px",height:"28px"},onMouseEnter:p=>{p.currentTarget.style.borderColor="var(--primary)",p.currentTarget.style.color="var(--primary)"},onMouseLeave:p=>{p.currentTarget.style.borderColor="var(--border)",p.currentTarget.style.color="var(--card-foreground)"},children:i.jsx(Ii,{size:11})}),i.jsx("button",{type:"button",title:(u=e.joinCode)!=null&&u.trim()?"QR code":"Join code not available yet",disabled:!((d=e.joinCode)!=null&&d.trim()),onClick:o,style:{...Us,width:"28px",height:"28px",opacity:(f=e.joinCode)!=null&&f.trim()?1:.35,cursor:(h=e.joinCode)!=null&&h.trim()?"pointer":"not-allowed"},onMouseEnter:p=>{var y;(y=e.joinCode)!=null&&y.trim()&&(p.currentTarget.style.borderColor="var(--primary)",p.currentTarget.style.color="var(--primary)")},onMouseLeave:p=>{p.currentTarget.style.borderColor="var(--border)",p.currentTarget.style.color="var(--card-foreground)"},children:i.jsx(lv,{size:11})}),i.jsx("button",{type:"button",title:"Duplicate",disabled:a,onClick:n,style:{...Us,width:"28px",height:"28px",opacity:a?.7:1,cursor:a?"wait":"pointer"},onMouseEnter:p=>{a||(p.currentTarget.style.borderColor="var(--primary)",p.currentTarget.style.color="var(--primary)")},onMouseLeave:p=>{p.currentTarget.style.borderColor="var(--border)",p.currentTarget.style.color="var(--card-foreground)"},children:a?i.jsx(ix,{size:13,className:"animate-spin"}):i.jsx(iu,{size:13})}),i.jsx("button",{type:"button",title:"Delete",onClick:r,style:{...Us,width:"28px",height:"28px",color:"var(--destructive)"},onMouseEnter:p=>{p.currentTarget.style.background="#fef2f2",p.currentTarget.style.borderColor="var(--destructive)"},onMouseLeave:p=>{p.currentTarget.style.background="var(--card)",p.currentTarget.style.borderColor="var(--border)",p.currentTarget.style.color="var(--destructive)"},children:i.jsx(gn,{size:13})})]})]})]})]})}function cwe({title:e,message:t,confirmLabel:r,variant:n,onConfirm:o,onCancel:a}){const s=n==="danger";return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:110,display:"flex",alignItems:"center",justifyContent:"center"},onClick:a,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"min(400px, calc(100vw - 32px))",padding:"20px",boxShadow:"var(--shadow-xl)"},onClick:l=>l.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",gap:"12px",alignItems:"flex-start",marginBottom:"20px"},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:s?"#fee2e2":"var(--secondary)",border:s?"none":"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:s?i.jsx(nv,{size:16,style:{color:"var(--destructive)"}}):i.jsx(iu,{size:16,style:{color:"var(--primary)"}})}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"5px"},children:e}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:t})]})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:a,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:()=>void Promise.resolve(o()),style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"none",background:s?"var(--destructive)":"var(--primary)",color:s?"#fff":"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:r})]})]})})}function uwe({track:e,isOpen:t,virtual:r,onToggle:n,onEdit:o,onDelete:a,onDuplicate:s,onOpenTrackQr:l,duplicateTrackLoading:c,onAddSession:u,onEditSession:d,onDeleteSession:f,onDuplicateSession:h,onOpenSessionQr:p,duplicatingSessionId:y}){var k,S,_,P;const x=qi()==="mobile",[b,w]=j.useState(x?"card":"list");return i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:"var(--card)",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:x?"0 12px":"0 16px",background:"var(--card)",borderBottom:t?"1px solid var(--border)":"none",minHeight:x?"56px":"52px"},children:[i.jsx("button",{onClick:n,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"22px",height:"22px",borderRadius:"4px",background:"var(--secondary)",border:"none",cursor:"pointer",color:"var(--muted)",flexShrink:0},children:t?i.jsx(po,{size:13}):i.jsx(va,{size:13})}),i.jsxs("button",{onClick:n,style:{display:"flex",alignItems:"center",gap:"8px",flex:1,background:"none",border:"none",cursor:"pointer",textAlign:"left",padding:"0",minWidth:0},children:[i.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--primary)",flexShrink:0}}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),!x&&i.jsx("span",{style:{display:"inline-flex",padding:"1px 7px",borderRadius:"3px",background:"var(--accent)",color:"var(--accent-foreground)",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0},children:e.type}),!x&&i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"3px",flexShrink:0},children:[i.jsx(lb,{size:11,style:{color:"var(--muted)"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:e.hall})]}),i.jsx("span",{style:{marginLeft:"auto",fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",background:"var(--secondary)",border:"1px solid var(--border)",padding:"1px 8px",borderRadius:"99px",flexShrink:0},children:e.sessions.length}),!x&&e.status==="Active"&&i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"#15803d",flexShrink:0},children:[i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"#16a34a",display:"block"}}),"Active"]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexShrink:0,flexWrap:"wrap",justifyContent:"flex-end"},children:[i.jsxs("button",{type:"button",onClick:O=>{O.stopPropagation(),u()},style:{display:"flex",alignItems:"center",gap:"5px",padding:x?"8px":"5px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:12}),!x&&" Add Session"]}),!r&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",title:"Edit track",onClick:O=>{O.stopPropagation(),o()},style:{...Us},onMouseEnter:O=>{O.currentTarget.style.borderColor="var(--primary)",O.currentTarget.style.color="var(--primary)"},onMouseLeave:O=>{O.currentTarget.style.borderColor="var(--border)",O.currentTarget.style.color="var(--card-foreground)"},children:i.jsx(Ii,{size:13})}),i.jsx("button",{type:"button",title:(k=e.joinCode)!=null&&k.trim()?"QR code":"Join code not available yet",disabled:!((S=e.joinCode)!=null&&S.trim()),onClick:O=>{O.stopPropagation(),l()},style:{...Us,opacity:(_=e.joinCode)!=null&&_.trim()?1:.35,cursor:(P=e.joinCode)!=null&&P.trim()?"pointer":"not-allowed"},onMouseEnter:O=>{var T;(T=e.joinCode)!=null&&T.trim()&&(O.currentTarget.style.borderColor="var(--primary)",O.currentTarget.style.color="var(--primary)")},onMouseLeave:O=>{O.currentTarget.style.borderColor="var(--border)",O.currentTarget.style.color="var(--card-foreground)"},children:i.jsx(lv,{size:13})}),i.jsx("button",{type:"button",title:"Duplicate track",disabled:c,onClick:O=>{O.stopPropagation(),s()},style:{...Us,opacity:c?.7:1,cursor:c?"wait":"pointer"},onMouseEnter:O=>{c||(O.currentTarget.style.borderColor="var(--primary)",O.currentTarget.style.color="var(--primary)")},onMouseLeave:O=>{O.currentTarget.style.borderColor="var(--border)",O.currentTarget.style.color="var(--card-foreground)"},children:c?i.jsx(ix,{size:13,className:"animate-spin"}):i.jsx(iu,{size:13})}),i.jsx("button",{type:"button",title:"Delete track",onClick:O=>{O.stopPropagation(),a()},style:{...Us,color:"var(--destructive)"},onMouseEnter:O=>{O.currentTarget.style.background="#fef2f2",O.currentTarget.style.borderColor="var(--destructive)"},onMouseLeave:O=>{O.currentTarget.style.background="var(--card)",O.currentTarget.style.borderColor="var(--border)",O.currentTarget.style.color="var(--destructive)"},children:i.jsx(gn,{size:13})})]})]})]}),t&&i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px",borderBottom:"1px solid var(--border)",background:"var(--secondary)"},children:[i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[e.sessions.length," session",e.sessions.length!==1?"s":""," in this track"]}),i.jsx("div",{style:{display:"flex",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden",background:"var(--card)"},children:["list","card"].map(O=>i.jsxs("button",{onClick:()=>w(O),style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",background:b===O?"var(--primary)":"transparent",color:b===O?"#fff":"var(--muted)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",borderLeft:O==="card"?"1px solid var(--border)":"none"},children:[O==="list"?i.jsx(sb,{size:13}):i.jsx(ab,{size:13}),O==="list"?"List":"Cards"]},O))})]}),e.sessions.length===0?i.jsxs("div",{style:{padding:"36px 16px",textAlign:"center"},children:[i.jsx(Wi,{size:28,style:{color:"var(--border)",margin:"0 auto 10px"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"14px"},children:"No sessions yet"}),i.jsxs("button",{onClick:u,style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:13})," Add First Session"]})]}):b==="list"?i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{background:"var(--secondary)"},children:[i.jsx("th",{style:{width:"32px",padding:"8px 0 8px 12px"}}),["Session","Type","Time","Status",""].map(O=>i.jsx("th",{style:{padding:"8px 12px",textAlign:"left",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",letterSpacing:"0.04em",textTransform:"uppercase",whiteSpace:"nowrap",borderBottom:"1px solid var(--border)"},children:O},O))]})}),i.jsx("tbody",{children:e.sessions.map(O=>i.jsx(swe,{session:O,onEdit:()=>d(O),onDelete:()=>f(O.id),onDuplicate:()=>h(O),onOpenQr:()=>p(O),duplicateLoading:y===O.id},O.id))})]})}):i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"12px",padding:"14px 16px"},children:e.sessions.map(O=>i.jsx(lwe,{session:O,onEdit:()=>d(O),onDelete:()=>f(O.id),onDuplicate:()=>h(O),onOpenQr:()=>p(O),duplicateLoading:y===O.id},O.id))})]})]})}function f7({embedInDashboard:e=!1}={}){const{selectedEventId:t,openAgendaSessionPanelOnce:r,setOpenAgendaSessionPanelOnce:n}=eo(),o=qi(),a=o==="mobile",s=o==="mobile"||o==="tablet",[l,c]=j.useState(""),[u,d]=j.useState(new Date().toISOString()),[f,h]=j.useState(""),[p,y]=j.useState([]),[m,x]=j.useState({}),[b,w]=j.useState([]),[k,S]=j.useState(new Set),[_,P]=j.useState(!1),[O,T]=j.useState(null),[R,I]=j.useState(null),[E,A]=j.useState(null),[F,L]=j.useState(null),[z,V]=j.useState(null),[Q,U]=j.useState(null),[ee,H]=j.useState(null),[B,M]=j.useState(!1),$=j.useRef(null);j.useEffect(()=>{!t||!r||(I({initialTrackId:da}),n(!1))},[t,r,n]);const q=j.useCallback(async()=>{var Ge,Ot;if(!t)return;P(!0),T(null);const[ie,Me,ke]=await Promise.all([zr.get(t),rh.list(t),Da.list(t)]);if(P(!1),ie.error||!ie.data){T(ie.error||"Could not load event");return}const se=ie.data;c(se.name||"Event"),d(se.startDate||new Date().toISOString());const fe=typeof se.organization=="object"&&se.organization&&"_id"in se.organization?String(se.organization._id):se.organization?String(se.organization):"";h(fe);const Ie=((Ge=Me.data)==null?void 0:Ge.tracks)||[];y(Ie);const ce=((Ot=ke.data)==null?void 0:Ot.sessions)||[],je={};ce.forEach(nt=>{je[nt._id]=nt}),x(je);const qe=[...Ie].sort((nt,Ae)=>(nt.sortOrder??0)-(Ae.sortOrder??0)||nt.name.localeCompare(Ae.name)),Ne=new Map;qe.forEach(nt=>{Ne.set(nt._id,{id:nt._id,joinCode:nt.joinCode,name:nt.name,type:rwe(nt.trackType),hall:nt.hall||"—",status:nt.status==="active"?"Active":"Inactive",sessions:[]})});const Je={id:da,name:"Unassigned",type:"General",hall:"—",status:"Active",sessions:[]};ce.forEach(nt=>{const Ae=owe(nt),Te=typeof nt.track=="object"&&nt.track&&"_id"in nt.track?String(nt.track._id):nt.track?String(nt.track):"";Te&&Ne.has(Te)?Ne.get(Te).sessions.push(Ae):Je.sessions.push(Ae)});const vt=[...Ne.values()];Je.sessions.sort((nt,Ae)=>nt.startDate.localeCompare(Ae.startDate)||nt.startTime.localeCompare(Ae.startTime)),vt.forEach(nt=>{nt.sessions.sort((Ae,Te)=>Ae.startDate.localeCompare(Te.startDate)||Ae.startTime.localeCompare(Te.startTime))}),Je.sessions.length&&vt.push(Je),w(vt),S(nt=>nt.size===0&&vt.length?new Set([vt[0].id]):nt)},[t]);j.useEffect(()=>{q()},[q]),j.useEffect(()=>{const ie=Me=>{$.current&&!$.current.contains(Me.target)&&M(!1)};return document.addEventListener("mousedown",ie),()=>document.removeEventListener("mousedown",ie)},[]);const Y=ie=>S(Me=>{const ke=new Set(Me);return ke.has(ie)?ke.delete(ie):ke.add(ie),ke}),K=()=>A({editTrack:null}),G=ie=>{if(ie.id===da)return;const Me=p.find(ke=>ke._id===ie.id);Me&&A({editTrack:Me})},re=ie=>{if(ie===da)return;const Me=b.find(ke=>ke.id===ie);L({title:"Confirm Delete",msg:`Delete "${Me==null?void 0:Me.name}"? Sessions in this track become unassigned.`,confirmLabel:"Delete",variant:"danger",onConfirm:async()=>{const ke=await rh.remove(ie);L(null),ke.error||await q()}})},J=async ie=>{if(ie.id===da||!t)return;const Me=p.find(fe=>fe._id===ie.id);if(!Me)return;const ke=await rh.create(t,{name:`${Me.name} (Copy)`,hall:Me.hall,trackType:Me.trackType,status:"active",sortOrder:(Me.sortOrder??0)+1});if(ke.error||!ke.data)return;const se=ke.data;for(const fe of ie.sessions){const Ie=m[fe.id];if(!Ie)continue;typeof Ie.track=="object"&&Ie.track&&"_id"in Ie.track?String(Ie.track._id):Ie.track&&String(Ie.track);const ce=(Ie.speakers||[]).map(je=>typeof je=="object"&&je&&"_id"in je?String(je._id):String(je));await Da.create(t,{title:`${Ie.title} (Copy)`,description:Ie.description,type:Ie.type,startTime:Ie.startTime,endTime:Ie.endTime,location:Ie.location,status:Ie.status,track:se._id,speakers:ce.filter(Boolean)})}await q()},ae=ie=>{ie.id===da||!t||L({title:"Duplicate track",msg:`Create a copy of "${ie.name}" including all ${ie.sessions.length} session(s)? This may take a moment.`,confirmLabel:"Duplicate",variant:"primary",onConfirm:async()=>{L(null),U(ie.id);try{await J(ie)}finally{U(null)}}})},le=(ie,Me)=>{const ke=m[Me];L({title:"Confirm Delete",msg:`Delete "${(ke==null?void 0:ke.title)||"session"}"?`,confirmLabel:"Delete",variant:"danger",onConfirm:async()=>{const se=await Da.remove(Me);L(null),se.error||await q()}})},me=async(ie,Me)=>{if(!t)return;const ke=m[Me.id];if(!ke)return;const se=typeof ke.track=="object"&&ke.track&&"_id"in ke.track?ke.track._id:ke.track||null,fe=(ke.speakers||[]).map(Ie=>typeof Ie=="object"&&Ie&&"_id"in Ie?String(Ie._id):String(Ie));await Da.create(t,{title:`${ke.title} (Copy)`,description:ke.description,type:ke.type,startTime:ke.startTime,endTime:ke.endTime,location:ke.location,status:ke.status,track:se?String(se):null,speakers:fe.filter(Boolean),audienceFeedbackEnabled:ke.audienceFeedbackEnabled,audienceRatingsEnabled:ke.audienceRatingsEnabled,audienceFeedbackForm:ke.audienceFeedbackForm??null,audienceRatingsForm:ke.audienceRatingsForm??null}),await q()},Oe=(ie,Me)=>{L({title:"Duplicate session",msg:`Create a copy of "${Me.title}"?`,confirmLabel:"Duplicate",variant:"primary",onConfirm:async()=>{L(null),H(Me.id);try{await me(ie,Me)}finally{H(null)}}})},we=b.reduce((ie,Me)=>ie+Me.sessions.length,0);return t?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:_?"…":l}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:a?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2",marginBottom:"4px"},children:e?"Agenda":"Dashboard"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:O?i.jsx("span",{style:{color:"var(--destructive)"},children:O}):`${b.filter(ie=>ie.id!==da).length} tracks · ${we} sessions`})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[!s&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:ie=>{ie.currentTarget.style.borderColor="var(--primary)",ie.currentTarget.style.color="var(--primary)"},onMouseLeave:ie=>{ie.currentTarget.style.borderColor="var(--border)",ie.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(Zs,{size:14})," Feedback"]}),i.jsxs("button",{style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:ie=>{ie.currentTarget.style.borderColor="var(--primary)",ie.currentTarget.style.color="var(--primary)"},onMouseLeave:ie=>{ie.currentTarget.style.borderColor="var(--border)",ie.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(Rf,{size:14})," Ratings"]}),i.jsx("div",{style:{width:"1px",height:"20px",background:"var(--border)",flexShrink:0}}),i.jsxs("button",{onClick:K,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:ie=>{ie.currentTarget.style.borderColor="var(--primary)",ie.currentTarget.style.color="var(--primary)"},onMouseLeave:ie=>{ie.currentTarget.style.borderColor="var(--border)",ie.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(wr,{size:14})," Add Track"]})]}),s&&i.jsxs("div",{ref:$,style:{position:"relative"},children:[i.jsx("button",{onClick:()=>M(ie=>!ie),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"36px",height:"36px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",cursor:"pointer"},children:"···"}),B&&i.jsx("div",{style:{position:"absolute",right:0,top:"calc(100% + 6px)",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",boxShadow:"var(--elevation-sm)",zIndex:50,minWidth:"160px",overflow:"hidden"},children:[{label:"Feedback",icon:i.jsx(Zs,{size:13}),action:()=>M(!1)},{label:"Ratings",icon:i.jsx(Rf,{size:13}),action:()=>M(!1)},{label:"Add Track",icon:i.jsx(wr,{size:13}),action:()=>{K(),M(!1)}}].map((ie,Me,ke)=>i.jsxs("button",{onClick:ie.action,style:{width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"10px 14px",background:"none",border:"none",cursor:"pointer",textAlign:"left",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",borderBottom:Me{se.currentTarget.style.background="var(--secondary)"},onMouseLeave:se=>{se.currentTarget.style.background="none"},children:[ie.icon," ",ie.label]},ie.label))})]}),i.jsxs("button",{onClick:()=>I({}),style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:14})," ",s?"New Session":"Create New Session"]})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("button",{onClick:()=>S(new Set(b.map(ie=>ie.id))),style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",background:"none",border:"none",cursor:"pointer",padding:"0 4px"},onMouseEnter:ie=>{ie.currentTarget.style.color="var(--foreground)"},onMouseLeave:ie=>{ie.currentTarget.style.color="var(--muted)"},children:"Expand all"}),i.jsx("span",{style:{color:"var(--border)"},children:"·"}),i.jsx("button",{onClick:()=>S(new Set),style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",background:"none",border:"none",cursor:"pointer",padding:"0 4px"},onMouseEnter:ie=>{ie.currentTarget.style.color="var(--foreground)"},onMouseLeave:ie=>{ie.currentTarget.style.color="var(--muted)"},children:"Collapse all"})]}),b.length===0?i.jsxs("div",{style:{textAlign:"center",padding:"60px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(Wi,{size:32,style:{color:"var(--border)",margin:"0 auto 12px"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"No tracks yet"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"16px"},children:"Create your first track to start organizing sessions."}),i.jsxs("button",{onClick:K,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:14})," Add First Track"]})]}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:b.map(ie=>i.jsx(uwe,{track:ie,virtual:ie.id===da,isOpen:k.has(ie.id),onToggle:()=>Y(ie.id),onEdit:()=>G(ie),onDelete:()=>re(ie.id),onDuplicate:()=>ae(ie),onOpenTrackQr:()=>V({kind:"track",label:ie.name,joinCode:ie.joinCode||""}),duplicateTrackLoading:Q===ie.id,onAddSession:()=>I({initialTrackId:ie.id===da?da:ie.id}),onEditSession:Me=>I({initialTrackId:ie.id,sessionId:Me.id}),onDeleteSession:Me=>le(ie.id,Me),onDuplicateSession:Me=>Oe(ie.id,Me),onOpenSessionQr:Me=>V({kind:"session",label:Me.title,joinCode:Me.joinCode||""}),duplicatingSessionId:ee},ie.id))}),!e&&i.jsx("div",{style:{paddingTop:"16px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})}),R&&t&&i.jsx(V$,{eventId:t,eventName:l,eventStartIso:u,organizationId:f,tracks:p,initialTrackId:R.initialTrackId??void 0,session:R.sessionId?m[R.sessionId]??null:null,onClose:()=>I(null),onSuccess:()=>q(),onTrackCreated:ie=>y(Me=>[...Me,ie])}),E&&t&&i.jsx(J2e,{eventId:t,existingTrack:E.editTrack,onClose:()=>A(null),onSuccess:()=>q()}),F&&i.jsx(cwe,{title:F.title,message:F.msg,confirmLabel:F.confirmLabel,variant:F.variant,onConfirm:F.onConfirm,onCancel:()=>L(null)}),z&&i.jsx(aT,{open:!0,onClose:()=>V(null),kind:z.kind,joinCode:z.joinCode,label:z.label})]}):i.jsxs("div",{style:{textAlign:"center",padding:"80px 24px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(Wi,{size:40,style:{color:"var(--border)",margin:"0 auto 16px"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Select an event"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",marginTop:"8px",fontFamily:"var(--font-noto-sans)"},children:"Choose an event in the sidebar to manage its agenda."})]})}const Ep={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"};function Ap({text:e,required:t}){return i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",marginBottom:"5px"},children:[t&&i.jsx("span",{style:{color:"var(--destructive)",marginRight:"3px"},children:"*"}),e]})}function Q1({msg:e}){return e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"4px 0 0",fontFamily:"var(--font-noto-sans)"},children:e}):null}function Tp({children:e}){return i.jsx("div",{style:{display:"flex",flexDirection:"column"},children:e})}function p7({children:e,cols:t=2}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"12px"},children:e})}function dwe({n:e,state:t}){return i.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:t==="todo"?"var(--muted)":"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t==="done"?i.jsx(Oi,{size:13,style:{color:"#fff"}}):i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",color:"#fff",fontWeight:"var(--font-weight-medium)"},children:e})})}function E4({n:e,title:t,subtitle:r,open:n,completed:o,onToggle:a,children:s,onNext:l,nextLabel:c,nextDisabled:u}){const d=n?"active":o?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{type:"button",onClick:a,style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(dwe,{n:e,state:d}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",margin:0},children:t}),!n&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:r})]}),n?i.jsx($f,{size:18,style:{color:"var(--muted)",flexShrink:0}}):i.jsx(po,{size:18,style:{color:"var(--muted)",flexShrink:0}})]}),n&&i.jsxs("div",{style:{padding:"0 20px 16px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 16px 40px"},children:r}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:s}),i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"20px",paddingTop:"14px",borderTop:"1px solid var(--border)"},children:i.jsx("button",{type:"button",disabled:u,onClick:l,style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 18px",borderRadius:"var(--radius-button)",background:u?"var(--secondary)":"var(--primary)",color:u?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:u?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:c})})]})]})}const fwe={firstName:"",lastName:"",email:"",phone:"",organization:"",designation:"",notes:""},pwe=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function h7(e){const t={};e.firstName.trim()||(t.firstName="First name is required."),e.lastName.trim()||(t.lastName="Last name is required."),e.email.trim()?pwe.test(e.email.trim())||(t.email="Enter a valid email address."):t.email="Email is required.";const r=e.phone.trim();return r&&!/^[\d\s+().-]{6,}$/.test(r)&&(t.phone="Enter a valid phone number."),t}function g7(e){return{}}function hwe({eventId:e,onClose:t,participantId:r,onSuccess:n}){const o=!!r,a=3,[s,l]=j.useState(1),[c,u]=j.useState(()=>o?new Set([1,2,3]):new Set),[d,f]=j.useState(fwe),[h,p]=j.useState(!1),[y,m]=j.useState({}),[x,b]=j.useState(null);j.useEffect(()=>{r&&Ei.get(r).then(R=>{const I=R.data;I&&(f({firstName:I.firstName??"",lastName:I.lastName??"",email:I.email??"",phone:I.phone??"",organization:I.organization??"",designation:I.designation??"",notes:I.notes??""}),u(new Set([1,2,3])))})},[r]);const w=j.useCallback((R,I)=>{f(E=>({...E,[R]:I})),m(E=>{if(!E[R])return E;const A={...E};return delete A[R],A}),b(null)},[]),k=j.useCallback(()=>{const R=h7(d),I=g7(),E={...R,...I};return m(E),Object.keys(R).length?{ok:!1,section:1}:Object.keys(I).length?{ok:!1,section:2}:{ok:!0,section:0}},[d]),S=R=>{if(R===1){const I=h7(d);if(m(E=>({...E,...I})),Object.keys(I).length)return;u(E=>new Set([...E,1])),l(2);return}if(R===2){const I=g7();if(m(E=>({...E,...I})),Object.keys(I).length)return;u(E=>new Set([...E,2])),l(3);return}R===3&&_()},_=async()=>{const R=k();if(!R.ok){l(R.section);return}p(!0),b(null);const I={firstName:d.firstName.trim(),lastName:d.lastName.trim(),email:d.email.trim(),phone:d.phone.trim()||void 0,organization:d.organization.trim()||void 0,designation:d.designation.trim()||void 0,notes:d.notes.trim()||void 0},E=o&&r?await Ei.update(r,I):await Ei.create(e,I);if(p(!1),E.error){b(E.error),/email|duplicate|exists/i.test(E.error)&&m(A=>({...A,email:E.error||"This email may already be registered for this event."}));return}n==null||n(),t()},P=R=>l(I=>I===R?0:R),O=!h,T=({compact:R})=>i.jsx("button",{type:"button",disabled:!O,onClick:_,style:{padding:R?"6px 16px":"7px 18px",borderRadius:"var(--radius-button)",background:O?"var(--primary)":"var(--secondary)",color:O?"var(--primary-foreground)":"var(--muted)",border:"none",cursor:O?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:h?"Saving…":o?"Save changes":"Save participant"});return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:t,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.50)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(520px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.20)"},children:[i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0,background:"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:"14px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 3px"},children:"Participants"}),i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:o?"Edit participant":"Add participant"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"5px 0 0"},children:["Complete each section to continue. Use ",i.jsx("strong",{children:"Next"})," or ",i.jsx("strong",{children:"Save"})," (top or bottom) to submit."]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:t,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(er,{size:14})}),i.jsx(T,{compact:!0})]})]}),x&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",marginBottom:"8px",fontFamily:"var(--font-noto-sans)"},children:x}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[c.size," of ",a," sections passed"]}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:[Math.round(c.size/a*100),"%"]})]}),i.jsx("div",{style:{height:"6px",borderRadius:"99px",background:"var(--border)",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${Math.round(c.size/a*100)}%`,background:"var(--primary)",borderRadius:"99px",transition:"width 0.35s ease"}})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[i.jsx(E4,{n:1,title:"Personal information",subtitle:"Name and contact details",open:s===1,completed:c.has(1),onToggle:()=>P(1),onNext:()=>S(1),nextLabel:"Next: Professional details",children:i.jsxs(p7,{cols:2,children:[i.jsxs(Tp,{children:[i.jsx(Ap,{text:"First name",required:!0}),i.jsx("input",{style:Ep,placeholder:"John",value:d.firstName,onChange:R=>w("firstName",R.target.value)}),i.jsx(Q1,{msg:y.firstName})]}),i.jsxs(Tp,{children:[i.jsx(Ap,{text:"Last name",required:!0}),i.jsx("input",{style:Ep,placeholder:"Smith",value:d.lastName,onChange:R=>w("lastName",R.target.value)}),i.jsx(Q1,{msg:y.lastName})]}),i.jsxs(Tp,{children:[i.jsx(Ap,{text:"Email",required:!0}),i.jsx("input",{type:"email",style:Ep,placeholder:"john@example.com",value:d.email,onChange:R=>w("email",R.target.value)}),i.jsx(Q1,{msg:y.email})]}),i.jsxs(Tp,{children:[i.jsx(Ap,{text:"Phone"}),i.jsx("input",{type:"tel",style:Ep,placeholder:"+91 9800000000",value:d.phone,onChange:R=>w("phone",R.target.value)}),i.jsx(Q1,{msg:y.phone})]})]})}),i.jsx(E4,{n:2,title:"Professional details",subtitle:"Organization and designation",open:s===2,completed:c.has(2),onToggle:()=>P(2),onNext:()=>S(2),nextLabel:"Next: Additional info",children:i.jsxs(p7,{cols:2,children:[i.jsxs(Tp,{children:[i.jsx(Ap,{text:"Organization"}),i.jsx("input",{style:Ep,placeholder:"Company or institution",value:d.organization,onChange:R=>w("organization",R.target.value)})]}),i.jsxs(Tp,{children:[i.jsx(Ap,{text:"Designation"}),i.jsx("input",{style:Ep,placeholder:"e.g. Delegate, Speaker",value:d.designation,onChange:R=>w("designation",R.target.value)})]})]})}),i.jsx(E4,{n:3,title:"Additional info",subtitle:"Internal notes (optional)",open:s===3,completed:c.has(3),onToggle:()=>P(3),onNext:()=>S(3),nextLabel:"Save participant",nextDisabled:h,children:i.jsxs(Tp,{children:[i.jsx(Ap,{text:"Notes"}),i.jsx("textarea",{style:{...Ep,resize:"vertical",minHeight:"80px"},placeholder:"Internal notes (optional)",value:d.notes,onChange:R=>w("notes",R.target.value)})]})})]}),i.jsxs("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:"10px",flexShrink:0,background:"var(--card)"},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"7px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx(T,{})]})]})]})}function gwe(e){var o;const t=[e.firstName,e.lastName].filter(Boolean).join(" ").trim()||"—",r=e.registrationDate?new Date(e.registrationDate).toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"}):null,n={pending:"Pending",confirmed:"Confirmed",checked_in:"Checked In",cancelled:"Cancelled"}[e.status]??e.status;return{id:e._id,name:t,email:e.email??"",phone:e.phone??"",role:((o=e.designation)==null?void 0:o.trim())||"—",status:n,checkedIn:e.status==="checked_in"||!!e.checkedIn,registrationDate:r}}const m7=[20,50,100];function v7(e,t){if(t<=5)return Array.from({length:t},(a,s)=>s+1);const r=Math.max(1,e-2),n=Math.min(t,e+2),o=[];r>1&&(o.push(1),r>2&&o.push("ellipsis"));for(let a=r;a<=n;a++)o.push(a);return n32?"var(--text-sm)":"11px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",flexShrink:0},children:wY(e)})}function dP({role:e}){const t=vwe[e]??mwe;return i.jsx("span",{style:{display:"inline-flex",padding:"2px 8px",borderRadius:"3px",background:t.bg,color:t.color,fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:e})}function jY({checked:e}){return i.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"999px",background:e?"#dcfce7":"#f1f5f9",color:e?"#15803d":"#6b7280",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:e?i.jsxs(i.Fragment,{children:[i.jsx(iv,{size:10})," Yes"]}):i.jsxs(i.Fragment,{children:[i.jsx(ob,{size:10})," No"]})})}function fP({status:e}){const t=e==="Cancelled"?"var(--muted)":e==="Checked In"?"#15803d":e==="Confirmed"?"#2563eb":"var(--card-foreground)",r=e==="Cancelled"?"#9ca3af":e==="Checked In"?"#16a34a":e==="Confirmed"?"#2563eb":"#94a3b8";return i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:t},children:[i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:r,display:"block"}}),e]})}function x7({label:e,value:t,options:r,onChange:n}){return i.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[i.jsxs("select",{value:t,onChange:o=>n(o.target.value),style:{appearance:"none",padding:"6px 28px 6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",color:t!=="All"?"var(--foreground)":"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",outline:"none",height:"34px",borderColor:t!=="All"?"var(--primary)":"var(--border)"},children:[i.jsx("option",{value:"All",children:e}),r.map(o=>i.jsx("option",{value:o,children:o},o))]}),i.jsx(po,{size:12,style:{position:"absolute",right:"8px",pointerEvents:"none",color:"var(--muted)"}})]})}function ywe({p:e,onView:t,onEdit:r,onDelete:n,onToggleCheckIn:o,canEdit:a}){const[s,l]=j.useState(!1);return i.jsxs("tr",{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{background:s?"var(--secondary)":"transparent",transition:"background 0.12s",cursor:"default",borderBottom:"1px solid var(--border)"},children:[i.jsx("td",{style:{padding:"12px 16px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[i.jsx(SY,{name:e.name,size:32}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.3"},children:e.name}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"1px"},children:e.email})]})]})}),i.jsx("td",{style:{padding:"12px 12px",whiteSpace:"nowrap"},children:i.jsx(dP,{role:e.role})}),i.jsx("td",{style:{padding:"12px 12px"},children:i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.phone})}),i.jsx("td",{style:{padding:"12px 12px"},children:i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:e.registrationDate?"var(--card-foreground)":"var(--muted)"},children:e.registrationDate??"—"})}),i.jsx("td",{style:{padding:"12px 12px",whiteSpace:"nowrap"},children:i.jsx(fP,{status:e.status})}),i.jsx("td",{style:{padding:"12px 12px",whiteSpace:"nowrap"},children:i.jsx(jY,{checked:e.checkedIn})}),i.jsx("td",{style:{padding:"12px 16px 12px 8px",whiteSpace:"nowrap"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsxs("button",{onClick:o,title:e.checkedIn?"Undo check-in":"Mark checked in",style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:e.checkedIn?"var(--secondary)":"#dcfce7",border:`1px solid ${e.checkedIn?"var(--border)":"#86efac"}`,color:e.checkedIn?"var(--muted)":"#15803d",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",fontWeight:"var(--font-weight-medium)"},children:[e.checkedIn?i.jsx(er,{size:11}):i.jsx(Oi,{size:11}),e.checkedIn?"Undo":"Check In"]}),i.jsxs("button",{onClick:t,title:"View profile",style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:c=>{c.currentTarget.style.borderColor="var(--primary)",c.currentTarget.style.color="var(--primary)"},onMouseLeave:c=>{c.currentTarget.style.borderColor="var(--border)",c.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(Ah,{size:11})," View"]}),a&&i.jsxs("button",{onClick:r,title:"Edit participant",style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:c=>{c.currentTarget.style.borderColor="var(--primary)",c.currentTarget.style.color="var(--primary)"},onMouseLeave:c=>{c.currentTarget.style.borderColor="var(--border)",c.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(Ii,{size:11})," Edit"]}),i.jsxs("button",{onClick:n,title:"Delete participant",style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--destructive)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:c=>{c.currentTarget.style.background="#fef2f2",c.currentTarget.style.borderColor="var(--destructive)"},onMouseLeave:c=>{c.currentTarget.style.background="var(--card)",c.currentTarget.style.borderColor="var(--border)"},children:[i.jsx(gn,{size:11})," Delete"]})]})})]})}function xwe({p:e,onView:t,onEdit:r,onDelete:n,onToggleCheckIn:o,canEdit:a}){const[s,l]=j.useState(!1);return i.jsxs("div",{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px",display:"flex",flexDirection:"column",gap:"12px",transition:"box-shadow 0.15s, border-color 0.15s",boxShadow:s?"var(--elevation-sm)":"none",borderColor:s?"var(--primary)":"var(--border)",cursor:"default"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"},children:[i.jsx(SY,{name:e.name,size:42}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"4px"},children:[i.jsx(dP,{role:e.role}),i.jsx(fP,{status:e.status})]})]}),i.jsx("button",{onClick:o,title:e.checkedIn?"Undo check-in":"Mark as checked in",style:{width:"28px",height:"28px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",background:e.checkedIn?"#dcfce7":"var(--secondary)",border:`1px solid ${e.checkedIn?"#86efac":"var(--border)"}`,color:e.checkedIn?"#15803d":"var(--muted)",cursor:"pointer"},children:i.jsx(Oi,{size:13})})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"5px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx(Uf,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.email})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx(Iw,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:e.phone})]}),e.registrationDate&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx(Wi,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:e.registrationDate})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"10px",borderTop:"1px solid var(--border)"},children:[i.jsx(jY,{checked:e.checkedIn}),i.jsxs("div",{style:{display:"flex",gap:"4px"},children:[i.jsx("button",{onClick:t,title:"View",style:{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:c=>{c.currentTarget.style.color="var(--primary)"},onMouseLeave:c=>{c.currentTarget.style.color="var(--muted)"},children:i.jsx(Ah,{size:12})}),a&&i.jsx("button",{onClick:r,title:"Edit",style:{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:c=>{c.currentTarget.style.color="var(--primary)"},onMouseLeave:c=>{c.currentTarget.style.color="var(--muted)"},children:i.jsx(Ii,{size:12})}),i.jsx("button",{onClick:n,title:"Delete",style:{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:c=>{c.currentTarget.style.color="var(--destructive)"},onMouseLeave:c=>{c.currentTarget.style.color="var(--muted)"},children:i.jsx(gn,{size:12})})]})]})]})}function bwe({p:e,onClose:t,onEdit:r,canEdit:n}){const o=bY(e.name);return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},onClick:t,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"420px",maxWidth:"94vw",boxShadow:"var(--shadow-xl)",overflow:"hidden"},onClick:a=>a.stopPropagation(),children:[i.jsxs("div",{style:{background:o.bg,padding:"24px 24px 16px",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"14px"},children:[i.jsx("div",{style:{width:"52px",height:"52px",borderRadius:"50%",background:o.color+"20",border:`2px solid ${o.color}40`,display:"flex",alignItems:"center",justifyContent:"center",color:o.color,fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-xl)"},children:wY(e.name)}),i.jsxs("div",{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:o.color,lineHeight:"1.3"},children:e.name}),i.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"5px"},children:[i.jsx(dP,{role:e.role}),i.jsx(fP,{status:e.status})]})]})]}),i.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:o.color,padding:"2px",opacity:.6},children:i.jsx(er,{size:16})})]}),i.jsx("div",{style:{padding:"20px 24px",display:"flex",flexDirection:"column",gap:"0"},children:[{icon:i.jsx(Uf,{size:14}),label:"Email",value:e.email},{icon:i.jsx(Iw,{size:14}),label:"Phone",value:e.phone},{icon:i.jsx(Wi,{size:14}),label:"Registered",value:e.registrationDate||"—"},{icon:i.jsx(Iq,{size:14}),label:"Checked In",value:e.checkedIn?"Yes":"Not yet"}].map((a,s,l)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"11px 0",borderBottom:sn.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",gap:"12px",alignItems:"flex-start",marginBottom:"20px"},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:"#fee2e2",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx(nv,{size:16,style:{color:"var(--destructive)"}})}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"5px"},children:"Confirm Delete"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e})]})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{onClick:r,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Cancel"}),i.jsx("button",{onClick:t,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--destructive)",color:"#fff",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:"Delete"})]})]})})}function kY({compactChrome:e=!1}={}){const{selectedEventId:t}=eo(),{user:r}=Ur(),o=qi()==="mobile",a=(r==null?void 0:r.role)==="super_admin",[s,l]=j.useState([]),[c,u]=j.useState(0),[d,f]=j.useState(1),[h,p]=j.useState(20),[y,m]=j.useState(""),[x,b]=j.useState(""),[w,k]=j.useState("All"),[S,_]=j.useState("All"),[P,O]=j.useState(!1),[T,R]=j.useState(o?"card":"list"),[I,E]=j.useState(!1),[A,F]=j.useState(!1),[L,z]=j.useState(null),[V,Q]=j.useState(!1),[U,ee]=j.useState(null),[H,B]=j.useState(null),[M,$]=j.useState(!1),[q,Y]=j.useState(!1),K=j.useRef(null),[G,re]=j.useState(null),[J,ae]=j.useState(null),le=j.useCallback(()=>{t&&(O(!0),Ei.list(t,{page:d,limit:h,q:x||void 0,status:w!=="All"?Swe[w]??w:void 0,designation:S!=="All"?S:void 0}).then(ce=>{var je;O(!1),(je=ce.data)!=null&&je.participants&&(l(ce.data.participants.map(gwe)),u(ce.data.total??0))}).catch(()=>O(!1)))},[t,d,h,x,w,S]);j.useEffect(()=>{le()},[le]);const me=j.useRef();j.useEffect(()=>(me.current=setTimeout(()=>b(y.trim()),300),()=>{me.current&&clearTimeout(me.current)}),[y]),j.useEffect(()=>{f(1)},[x,w,S,h]);const Oe=Math.max(1,Math.ceil(c/h)),we=s.filter(ce=>ce.checkedIn).length,ie=s.filter(ce=>["Speaker","Moderator","Panelist"].includes(ce.role)).length,Me=ce=>{const je=s.find(qe=>qe.id===ce);B({msg:`Remove "${je==null?void 0:je.name}" from this event?`,onConfirm:()=>{t&&Ei.remove(ce,t).then(()=>{le(),B(null)})}})},ke=ce=>{t&&Ei.checkIn(ce,t).then(()=>le())},se=async()=>{if(!t||M)return;$(!0);const ce=await Ei.downloadExport(t);$(!1),!ce.ok&&"error"in ce?ae(ce.error||"Export failed"):ae(null)},fe=async ce=>{var qe;const je=(qe=ce.target.files)==null?void 0:qe[0];if(!(!je||!t)){Y(!0);try{const Ne=await je.text(),Je=await Ei.importCsv(t,Ne);Je.data?(re(Je.data),le()):ae(Je.error||"Import failed")}catch{ae("Could not read file.")}Y(!1),ce.target.value=""}},Ie=w!=="All"||S!=="All";return t?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[J&&i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"10px 14px",borderRadius:"var(--radius-button)",background:"#fef2f2",border:"1px solid #fecaca",color:"#b91c1c",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("span",{children:J}),i.jsx("button",{type:"button",onClick:()=>ae(null),style:{background:"none",border:"none",cursor:"pointer",color:"inherit",padding:"4px"},children:i.jsx(er,{size:16})})]}),i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[e?i.jsxs("div",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[c," registered · ",we," checked in on this page"]}):i.jsxs("div",{children:[i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2",marginBottom:"4px"},children:"Participants"}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[c," registered · ",we," checked in on this page"]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsx("input",{ref:K,type:"file",accept:".csv,text/csv",style:{display:"none"},onChange:fe}),i.jsxs("button",{type:"button",disabled:M,onClick:se,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:M?"wait":"pointer",opacity:M?.8:1},onMouseEnter:ce=>{M||(ce.currentTarget.style.borderColor="var(--primary)",ce.currentTarget.style.color="var(--primary)")},onMouseLeave:ce=>{ce.currentTarget.style.borderColor="var(--border)",ce.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(Al,{size:14})," ",M?"Exporting…":o?"Export":"Export CSV"]}),a&&i.jsxs("button",{type:"button",disabled:q,onClick:()=>{var ce;return(ce=K.current)==null?void 0:ce.click()},style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:q?"wait":"pointer"},onMouseEnter:ce=>{q||(ce.currentTarget.style.borderColor="var(--primary)",ce.currentTarget.style.color="var(--primary)")},onMouseLeave:ce=>{ce.currentTarget.style.borderColor="var(--border)",ce.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(ou,{size:14})," ",q?"Importing…":o?"Import":"Import CSV"]}),a&&i.jsxs("button",{type:"button",onClick:()=>{ee(null),Q(!0)},style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:14})," ",o?"Add":"Add Participant"]})]})]}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:o?"repeat(2, 1fr)":"repeat(4, 1fr)",gap:o?"10px":"12px"},children:[{icon:i.jsx(vi,{size:14}),label:"Total Registered",value:c,accent:"var(--chart-1)"},{icon:i.jsx(Iq,{size:14}),label:"Checked In (this page)",value:we,accent:"var(--chart-2)",sub:s.length?`${Math.round(we/s.length*100)}%`:""},{icon:i.jsx(ore,{size:14}),label:"Not Checked In (this page)",value:s.length-we,accent:"var(--chart-3)"},{icon:i.jsx(ym,{size:14}),label:"Speakers & Staff (this page)",value:ie,accent:"var(--chart-4)"}].map(ce=>i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"14px 16px",display:"flex",alignItems:"center",gap:"12px",borderLeft:`3px solid ${ce.accent}`},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"var(--radius-button)",background:ce.accent+"15",display:"flex",alignItems:"center",justifyContent:"center",color:ce.accent,flexShrink:0},children:ce.icon}),i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.1"},children:ce.value}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px"},children:ce.label}),ce.sub&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"#16a34a",marginTop:"3px"},children:ce.sub})]})]},ce.label))}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px",padding:"0 10px",height:"36px",flex:1,background:"var(--card)",border:`1px solid ${I?"var(--ring)":"var(--border)"}`,borderRadius:"var(--radius-button)",transition:"border-color 0.15s"},children:[i.jsx(Pi,{size:13,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:y,onChange:ce=>m(ce.target.value),placeholder:o?"Search…":"Search by name, email or phone…",onFocus:()=>E(!0),onBlur:()=>E(!1),style:{background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",width:"100%"}}),y&&i.jsx("button",{onClick:()=>m(""),type:"button",style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:0,display:"flex"},children:i.jsx(er,{size:12})})]}),o&&i.jsxs("button",{onClick:()=>F(ce=>!ce),style:{display:"flex",alignItems:"center",gap:"5px",padding:"0 12px",height:"36px",borderRadius:"var(--radius-button)",border:`1px solid ${Ie?"var(--primary)":"var(--border)"}`,background:Ie?"var(--accent)":"var(--card)",color:Ie?"var(--primary)":"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",flexShrink:0},children:[i.jsx(Wee,{size:13})," ",Ie?"Filtered":"Filter"]}),i.jsx("div",{style:{display:"flex",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden",background:"var(--card)",flexShrink:0},children:["list","card"].map(ce=>i.jsxs("button",{onClick:()=>R(ce),style:{display:"flex",alignItems:"center",gap:"4px",padding:"0 10px",height:"36px",background:T===ce?"var(--primary)":"transparent",color:T===ce?"#fff":"var(--muted)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",borderLeft:ce==="card"?"1px solid var(--border)":"none"},children:[ce==="list"?i.jsx(sb,{size:13}):i.jsx(ab,{size:13}),!o&&(ce==="list"?"List":"Cards")]},ce))})]}),(!o||A)&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsx(x7,{label:"All Statuses",value:w,options:wwe,onChange:k}),i.jsx(x7,{label:"All Designations",value:S,options:jwe,onChange:_}),Ie&&i.jsxs("button",{type:"button",onClick:()=>{k("All"),_("All")},style:{display:"flex",alignItems:"center",gap:"4px",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:[i.jsx(er,{size:11})," Clear"]})]})]}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Showing ",i.jsx("strong",{style:{color:"var(--foreground)"},children:(d-1)*h+1}),"–",i.jsx("strong",{children:Math.min(d*h,c)})," of ",c," participants"]}),P?i.jsx("div",{style:{textAlign:"center",padding:"48px 20px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading…"}):s.length===0?i.jsxs("div",{style:{textAlign:"center",padding:"60px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(vi,{size:32,style:{color:"var(--border)",margin:"0 auto 12px"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"No participants found"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"16px"},children:"Try adjusting your search or filters."}),i.jsxs("button",{type:"button",onClick:()=>{m(""),b(""),k("All"),_("All"),f(1)},style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--card-foreground)",border:"1px solid var(--border)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(er,{size:13})," Clear all filters"]})]}):T==="list"?i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsx("tr",{style:{background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:["Participant","Role","Phone","Registered","Status","Checked In",""].map(ce=>i.jsx("th",{style:{padding:"9px 12px",textAlign:"left",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",letterSpacing:"0.04em",textTransform:"uppercase",whiteSpace:"nowrap"},children:ce},ce))})}),i.jsx("tbody",{children:s.map(ce=>i.jsx(ywe,{p:ce,onView:()=>z(ce),onEdit:()=>{ee(ce.id),Q(!0)},onDelete:()=>Me(ce.id),onToggleCheckIn:()=>ke(ce.id),canEdit:a},ce.id))})]})}),i.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Per page"}),i.jsx("select",{value:h,onChange:ce=>{p(Number(ce.target.value)),f(1)},style:{padding:"4px 8px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:m7.map(ce=>i.jsx("option",{value:ce,children:ce},ce))})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("button",{type:"button",disabled:d<=1,onClick:()=>f(ce=>Math.max(1,ce-1)),style:{display:"flex",alignItems:"center",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:d<=1?"not-allowed":"pointer",color:d<=1?"var(--muted)":"var(--foreground)"},children:i.jsx(Nf,{size:16})}),v7(d,Oe).map((ce,je)=>ce==="ellipsis"?i.jsx("span",{style:{padding:"0 4px",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"…"},`e-${je}`):i.jsx("button",{type:"button",onClick:()=>f(ce),style:{minWidth:"32px",padding:"6px 8px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:d===ce?"var(--primary)":"var(--card)",color:d===ce?"var(--primary-foreground)":"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:ce},ce)),i.jsx("button",{type:"button",disabled:d>=Oe,onClick:()=>f(ce=>Math.min(Oe,ce+1)),style:{display:"flex",alignItems:"center",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:d>=Oe?"not-allowed":"pointer",color:d>=Oe?"var(--muted)":"var(--foreground)"},children:i.jsx(va,{size:16})})]})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))",gap:"14px"},children:s.map(ce=>i.jsx(xwe,{p:ce,onView:()=>z(ce),onEdit:()=>{ee(ce.id),Q(!0)},onDelete:()=>Me(ce.id),onToggleCheckIn:()=>ke(ce.id),canEdit:a},ce.id))}),i.jsxs("div",{style:{padding:"12px 16px",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:"var(--card)",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Per page"}),i.jsx("select",{value:h,onChange:ce=>{p(Number(ce.target.value)),f(1)},style:{padding:"4px 8px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:m7.map(ce=>i.jsx("option",{value:ce,children:ce},ce))})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("button",{type:"button",disabled:d<=1,onClick:()=>f(ce=>Math.max(1,ce-1)),style:{display:"flex",alignItems:"center",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:d<=1?"not-allowed":"pointer",color:d<=1?"var(--muted)":"var(--foreground)"},children:i.jsx(Nf,{size:16})}),v7(d,Oe).map((ce,je)=>ce==="ellipsis"?i.jsx("span",{style:{padding:"0 4px",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"…"},`e2-${je}`):i.jsx("button",{type:"button",onClick:()=>f(ce),style:{minWidth:"32px",padding:"6px 8px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:d===ce?"var(--primary)":"var(--card)",color:d===ce?"var(--primary-foreground)":"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:ce},ce)),i.jsx("button",{type:"button",disabled:d>=Oe,onClick:()=>f(ce=>Math.min(Oe,ce+1)),style:{display:"flex",alignItems:"center",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:d>=Oe?"not-allowed":"pointer",color:d>=Oe?"var(--muted)":"var(--foreground)"},children:i.jsx(va,{size:16})})]})]})]}),e?null:i.jsx("div",{style:{paddingTop:"16px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})}),L&&i.jsx(bwe,{p:L,onClose:()=>z(null),onEdit:()=>{ee(L.id),z(null),Q(!0)},canEdit:a}),V&&t&&i.jsx(hwe,{eventId:t,participantId:U??void 0,onClose:()=>{Q(!1),ee(null)},onSuccess:()=>{le(),Q(!1),ee(null)}}),H&&i.jsx(kwe,{message:H.msg,onConfirm:H.onConfirm,onCancel:()=>B(null)}),G&&i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:120,display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},onClick:()=>re(null),children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",maxWidth:"440px",width:"100%",padding:"22px",boxShadow:"var(--shadow-xl)",border:"1px solid var(--border)"},onClick:ce=>ce.stopPropagation(),children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 12px"},children:"Import finished"}),i.jsxs("ul",{style:{margin:"0 0 14px",paddingLeft:"18px",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",lineHeight:1.6},children:[i.jsxs("li",{children:[i.jsx("strong",{children:G.created})," added"]}),i.jsxs("li",{children:[i.jsx("strong",{children:G.skippedDuplicate})," skipped (email already registered for this event)"]}),G.failed>0&&i.jsxs("li",{children:[i.jsx("strong",{children:G.failed})," rows failed validation"]})]}),G.errors.length>0&&i.jsxs("div",{style:{maxHeight:"160px",overflowY:"auto",marginBottom:"14px",padding:"10px",background:"var(--secondary)",borderRadius:"var(--radius-button)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[G.errors.map((ce,je)=>i.jsxs("div",{style:{marginBottom:"6px"},children:["Line ",ce.line,": ",ce.message]},je)),G.failed>G.errors.length&&i.jsx("div",{children:"…and more"})]}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 14px",fontFamily:"var(--font-noto-sans)"},children:["Required columns: ",i.jsx("code",{style:{fontSize:"11px"},children:"email"}),", ",i.jsx("code",{children:"firstName"})," (or First name), ",i.jsx("code",{children:"lastName"})," (or Last name). Optional: phone, organization, designation, tags, notes."]}),i.jsx("button",{type:"button",onClick:()=>re(null),style:{padding:"8px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"OK"})]})})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px",alignItems:"center",justifyContent:"center",minHeight:"280px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(vi,{size:40,style:{opacity:.5}}),i.jsx("p",{style:{fontSize:"var(--text-base)"},children:"Select an event to view participants."})]})}const _we={id:"venue",prompt:"What is the venue or address for the in-person part of this event?"},Cwe={id:"virtualLink",prompt:"What is the meeting or stream URL (e.g. https://…)?"};function _Y(e){const t=e.trim();if(!t)return!1;try{return new URL(t.startsWith("http")?t:`https://${t}`),!0}catch{return!1}}function Ewe(e,t){const r=[],n=(t.location||"").trim(),o=(t.virtualLink||"").trim();return(e==="Physical"||e==="Hybrid")&&(n||r.push(_we)),(e==="Virtual"||e==="Hybrid")&&(_Y(o)||r.push(Cwe)),r}function Awe(e,t,r){const n=new Set(e.slice(t+1).map(a=>a.id)),o=r.filter(a=>!n.has(a.id));return[...e.slice(0,t+1),...o,...e.slice(t+1)]}function Twe({gaps:e,mergedPreview:t,organizationId:r,onClose:n,onCreated:o}){const a=j.useMemo(()=>z$(t),[t]),[s,l]=j.useState(()=>[...e]),[c,u]=j.useState(0),[d,f]=j.useState({}),[h,p]=j.useState({}),[y,m]=j.useState(!1),[x,b]=j.useState(null),[w,k]=j.useState(""),[S,_]=j.useState(""),[P,O]=j.useState(""),[T,R]=j.useState(""),[I,E]=j.useState(""),[A,F]=j.useState(""),L=s[c],z=c>=s.length;j.useEffect(()=>{!L||z||(p({}),L.id==="eventName"&&k(d.eventName??a.name??""),L.id==="startEnd"&&(_(d.startLocal??""),O(d.endLocal??"")),L.id==="locationType"&&R(d.locationType||""),L.id==="venue"&&E(d.venue??a.location??""),L.id==="virtualLink"&&F(d.virtualLink??a.virtualLink??""))},[L,z,d,a]);const V=j.useCallback($=>h[$],[h]),Q=j.useCallback(()=>{const $={};if(!L)return $;if(L.id==="eventName"&&w.trim().length<3&&($.eventName="Name must be at least 3 characters."),L.id==="startEnd"&&(S.trim()||($.startLocal="Start is required."),P.trim()||($.endLocal="End is required."),S&&P)){const q=new Date(S).getTime(),Y=new Date(P).getTime();!Number.isNaN(q)&&!Number.isNaN(Y)&&Y<=q&&($.endLocal="End must be after start.")}return L.id==="locationType"&&(T||($.locationType="Select a type.")),L.id==="venue"&&(I.trim()||($.venue="Venue or address is required.")),L.id==="virtualLink"&&(A.trim()?_Y(A)||($.virtualLink="Enter a valid URL (e.g. https://…)."):$.virtualLink="URL is required."),$},[L,w,S,P,T,I,A]),U=j.useCallback(()=>{if(!L)return d;const $={...d};return L.id==="eventName"&&($.eventName=w.trim()),L.id==="startEnd"&&($.startLocal=S,$.endLocal=P),L.id==="locationType"&&($.locationType=T),L.id==="venue"&&($.venue=I.trim()),L.id==="virtualLink"&&($.virtualLink=A.trim()),$},[d,L,w,S,P,T,I,A]),ee=()=>{const $=Q();if(Object.keys($).length>0){p($);return}const q=U();if(f(q),(L==null?void 0:L.id)==="locationType"&&T){const Y=Ewe(T,a);Y.length>0&&l(K=>Awe(K,c,Y))}u(Y=>Y+1)},H=()=>{b(null),p({}),u($=>Math.max(0,$-1))},B=j.useMemo(()=>{const $=(a.locationType||"physical").toLowerCase(),q={physical:"Physical",virtual:"Virtual",hybrid:"Hybrid"},Y=d.locationType||q[$]||"Physical",K=(d.eventName??a.name).trim(),G=(a.description||"").trim()||"—";let re=d.startLocal,J=d.endLocal;if(!re||!J)try{re=new Date(a.startDate).toLocaleString(),J=new Date(a.endDate).toLocaleString()}catch{re=a.startDate,J=a.endDate}const ae=(d.venue??a.location??"").trim()||"—",le=(d.virtualLink??a.virtualLink??"").trim()||"—";return[{k:"Name",v:K},{k:"Description",v:G},{k:"Type",v:Y},{k:"Venue",v:ae},{k:"Virtual link",v:le},{k:"Start",v:re},{k:"End",v:J},{k:"Event type (program)",v:a.type||"conference"},{k:"Status",v:a.status||"draft"}]},[d,a]),M=async()=>{b(null);let $;try{$=D$(a,d,r)}catch(Y){b(Y instanceof Error?Y.message:"Invalid event data.");return}m(!0);const q=await zr.create($);if(m(!1),q.data!=null&&!q.error){const Y=q.data._id;Y?(o(Y),n()):b("Could not create the event.")}else b(q.error||"Could not create the event.")};return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:n,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(520px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)"},children:[i.jsx("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"A few details needed"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"4px 0 0",fontFamily:"var(--font-noto-sans)"},children:["Step ",z?s.length+1:c+1," of ",s.length+1]})]}),i.jsx("button",{type:"button",onClick:n,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(er,{size:14})})]})}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px 24px",display:"flex",flexDirection:"column",gap:"14px"},children:[!z&&L&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{alignSelf:"flex-start",maxWidth:"100%",padding:"12px 14px",borderRadius:"12px",background:"var(--secondary)",border:"1px solid var(--border)"},children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)",marginBottom:"6px"},children:"Assistant"}),i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",color:"var(--foreground)",fontFamily:"var(--font-noto-sans)",lineHeight:1.5},children:L.prompt})]}),L.id==="eventName"&&i.jsxs(lr,{error:V("eventName"),children:[i.jsx(ur,{text:"Event name",required:!0}),i.jsx("input",{style:{...Xr,...V("eventName")?{borderColor:"var(--destructive)"}:{}},value:w,onChange:$=>k($.target.value)})]}),L.id==="startEnd"&&i.jsxs(No,{children:[i.jsxs(lr,{error:V("startLocal"),children:[i.jsx(ur,{text:"Start date & time",required:!0}),i.jsx("input",{type:"datetime-local",style:{...Xr,...V("startLocal")?{borderColor:"var(--destructive)"}:{}},value:S,onChange:$=>_($.target.value)})]}),i.jsxs(lr,{error:V("endLocal"),children:[i.jsx(ur,{text:"End date & time",required:!0}),i.jsx("input",{type:"datetime-local",style:{...Xr,...V("endLocal")?{borderColor:"var(--destructive)"}:{}},value:P,onChange:$=>O($.target.value)})]})]}),L.id==="locationType"&&i.jsxs(lr,{error:V("locationType"),children:[i.jsx(ur,{text:"Type",required:!0}),i.jsx(La,{children:i.jsxs("select",{style:{...Ra,...V("locationType")?{borderColor:"var(--destructive)"}:{}},value:T,onChange:$=>R($.target.value),children:[i.jsx("option",{value:"",children:"Select"}),i.jsx("option",{value:"Physical",children:"Physical"}),i.jsx("option",{value:"Virtual",children:"Virtual"}),i.jsx("option",{value:"Hybrid",children:"Hybrid"})]})})]}),L.id==="venue"&&i.jsxs(lr,{error:V("venue"),children:[i.jsx(ur,{text:"Location / venue",required:!0}),i.jsx("input",{style:{...Xr,...V("venue")?{borderColor:"var(--destructive)"}:{}},value:I,onChange:$=>E($.target.value)})]}),L.id==="virtualLink"&&i.jsxs(lr,{error:V("virtualLink"),children:[i.jsx(ur,{text:"Virtual link",required:!0}),i.jsx("input",{style:{...Xr,...V("virtualLink")?{borderColor:"var(--destructive)"}:{}},placeholder:"https://…",value:A,onChange:$=>F($.target.value)})]})]}),z&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{alignSelf:"flex-start",maxWidth:"100%",padding:"12px 14px",borderRadius:"12px",background:"var(--secondary)",border:"1px solid var(--border)"},children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)",marginBottom:"6px"},children:"Assistant"}),i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",color:"var(--foreground)",fontFamily:"var(--font-noto-sans)",lineHeight:1.5},children:"Here is a summary of your event. When you are ready, create the draft and open your dashboard."})]}),i.jsx("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-button)",padding:"12px 14px",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:B.map($=>i.jsxs("div",{style:{display:"flex",gap:"10px",padding:"6px 0",borderBottom:"1px solid var(--border)"},children:[i.jsx("span",{style:{color:"var(--muted)",minWidth:"120px",flexShrink:0},children:$.k}),i.jsx("span",{style:{color:"var(--foreground)",wordBreak:"break-word"},children:$.v})]},$.k))})]}),x&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:0,fontFamily:"var(--font-noto-sans)"},children:x})]}),i.jsxs("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--border)",display:"flex",gap:"10px",justifyContent:"flex-end",flexShrink:0},children:[!z&&c>0&&i.jsx("button",{type:"button",onClick:H,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Back"}),!z&&i.jsx("button",{type:"button",onClick:ee,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:c>=s.length-1?"Review":"Next"}),z&&i.jsx("button",{type:"button",disabled:y,onClick:()=>void M(),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:y?"var(--muted)":"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:y?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:y?"Creating…":"Create event"})]})]})]})}function Pwe({organizationId:e,onCreated:t}){const[r,n]=j.useState(""),[o,a]=j.useState(!1),[s,l]=j.useState(null),[c,u]=j.useState(!1),[d,f]=j.useState([]),[h,p]=j.useState(null),y=()=>{(async()=>{var x;l(null);const m=r.trim();if(m.length<10){l("Add a bit more detail (at least 10 characters).");return}a(!0);try{const b=await zr.aiExtractPreview({description:m,organization:e});if(b.error!=null||b.data==null){l(b.error||"Could not analyze the description.");return}const{gaps:w,mergedPreview:k}=b.data,S=Array.isArray(w)?w:[],_=k!=null&&typeof k=="object"?k:{};if(S.length===0)try{const P=z$(_),O=D$(P,{},e),T=await zr.create(O);if(T.error!=null||!((x=T.data)!=null&&x._id)){l(T.error||"Could not create the event.");return}t(String(T.data._id)),n("")}catch(P){l(P instanceof Error?P.message:"Could not create the event.")}else f(S),p(_),u(!0)}finally{a(!1)}})()};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"16px 20px",marginBottom:"14px"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"Describe your Event, Session and other details"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"12px",lineHeight:1.45},children:"Include the event name, what it is about, dates, venue or online link, and anything else relevant. We infer fields from your description. If something important is missing, we will ask a few short questions before creating your draft event with a default track and opening session."}),i.jsx("textarea",{value:r,onChange:m=>n(m.target.value),rows:5,disabled:o,placeholder:"Example: Annual cardiometabolic summit on 15–16 June 2026 at Hyderabad International Convention Centre, keynote on GLP-1 therapies…",style:{width:"100%",boxSizing:"border-box",resize:"vertical",minHeight:"120px",padding:"12px 14px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",lineHeight:1.45,marginBottom:"12px"}}),s&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginBottom:"10px"},children:s}),i.jsxs("button",{type:"button",onClick:y,disabled:o,style:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"8px 18px",borderRadius:"var(--radius-button)",background:o?"var(--muted)":"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:o?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:o?.85:1},children:[i.jsx(Wte,{size:16}),o?"Analyzing…":"Generate your Event using AI"]})]}),c&&h!=null&&i.jsx(Twe,{gaps:d,mergedPreview:h,organizationId:e,onClose:()=>{u(!1),p(null)},onCreated:m=>{u(!1),p(null),n(""),t(m)}})]})}function CY({onClose:e,onSuccess:t,onCreated:r,organizationId:n}){const{user:o}=Ur(),a=zn(o),s=n??a??void 0,[l,c]=j.useState(""),[u,d]=j.useState(""),[f,h]=j.useState(""),[p,y]=j.useState(""),[m,x]=j.useState(""),[b,w]=j.useState(""),[k,S]=j.useState(""),[_,P]=j.useState({}),[O,T]=j.useState(!1),[R,I]=j.useState(null),E=j.useCallback(L=>_[L],[_]),A=j.useCallback(()=>{const L={};if(l.trim().length<3&&(L.eventName="Name must be at least 3 characters."),f||(L.locationType="Select a type."),(f==="Physical"||f==="Hybrid")&&(p.trim()||(L.venue="Venue or address is required.")),(f==="Virtual"||f==="Hybrid")&&(m.trim()||(L.virtualLink="Virtual link is required.")),b.trim()||(L.startLocal="Start date and time are required."),k.trim()||(L.endLocal="End date and time are required."),b&&k){const V=new Date(b).getTime(),Q=new Date(k).getTime();!Number.isNaN(V)&&!Number.isNaN(Q)&&Q<=V&&(L.endLocal="End must be after start.")}return L},[l,f,p,m,b,k]),F=async()=>{I(null);const L=A();if(Object.keys(L).length>0){P(L);return}P({});let z;try{z=Vie({eventName:l,description:u,locationTypeLabel:f,venue:p,virtualLink:m,startLocal:b,endLocal:k,organizationId:s})}catch(Q){I(Q instanceof Error?Q.message:"Invalid dates.");return}T(!0);const V=await zr.create(z);if(T(!1),V.data!=null&&!V.error){const Q=V.data._id;Q&&(r==null||r(Q)),t==null||t(),e()}else I(V.error||"Could not create event. Please try again.")};return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:e,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(520px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)",animation:"slideInRightQuick 0.25s ease"},children:[i.jsx("style",{children:"@keyframes slideInRightQuick { from { transform: translateX(100%); } to { transform: translateX(0); } }"}),i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"Create event"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0",lineHeight:1.45},children:"A default track and opening session are added automatically."})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:e,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(er,{size:14})}),i.jsx("button",{type:"button",disabled:O,onClick:()=>void F(),style:{padding:"6px 14px",borderRadius:"var(--radius-button)",background:O?"var(--secondary)":"var(--primary)",color:O?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:O?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:O?"Creating…":"Create event"})]})]}),R?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"10px 0 0"},children:R}):null]}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px 24px",display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs(lr,{error:E("eventName"),children:[i.jsx(ur,{text:"Event name",required:!0}),i.jsx("input",{style:{...Xr,...E("eventName")?{borderColor:"var(--destructive)"}:{}},value:l,onChange:L=>c(L.target.value),autoComplete:"off"})]}),i.jsxs(lr,{error:E("description"),children:[i.jsx(ur,{text:"Description"}),i.jsx("textarea",{style:{...Xr,resize:"vertical",minHeight:"72px",...E("description")?{borderColor:"var(--destructive)"}:{}},value:u,onChange:L=>d(L.target.value)})]}),i.jsxs(lr,{error:E("locationType"),children:[i.jsx(ur,{text:"Type",required:!0}),i.jsx(La,{children:i.jsxs("select",{style:{...Ra,...E("locationType")?{borderColor:"var(--destructive)"}:{}},value:f,onChange:L=>h(L.target.value),children:[i.jsx("option",{value:"",children:"Physical / Virtual / Hybrid"}),i.jsx("option",{value:"Physical",children:"Physical"}),i.jsx("option",{value:"Virtual",children:"Virtual"}),i.jsx("option",{value:"Hybrid",children:"Hybrid"})]})})]}),(f==="Physical"||f==="Hybrid")&&i.jsxs(lr,{error:E("venue"),children:[i.jsx(ur,{text:"Location / venue",required:!0}),i.jsx("input",{style:{...Xr,...E("venue")?{borderColor:"var(--destructive)"}:{}},value:p,onChange:L=>y(L.target.value)})]}),(f==="Virtual"||f==="Hybrid")&&i.jsxs(lr,{error:E("virtualLink"),children:[i.jsx(ur,{text:"Virtual link",required:!0}),i.jsx("input",{style:{...Xr,...E("virtualLink")?{borderColor:"var(--destructive)"}:{}},placeholder:"https://…",value:m,onChange:L=>x(L.target.value)})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:E("startLocal"),children:[i.jsx(ur,{text:"Start date & time",required:!0}),i.jsx("input",{type:"datetime-local",style:{...Xr,...E("startLocal")?{borderColor:"var(--destructive)"}:{}},value:b,onChange:L=>w(L.target.value)})]}),i.jsxs(lr,{error:E("endLocal"),children:[i.jsx(ur,{text:"End date & time",required:!0}),i.jsx("input",{type:"datetime-local",style:{...Xr,...E("endLocal")?{borderColor:"var(--destructive)"}:{}},value:k,onChange:L=>S(L.target.value)})]})]})]})]})]})}function Owe(e){var t;return e?e.firstName||e.lastName?[e.firstName,e.lastName].filter(Boolean).join(" ").trim():((t=e.email)==null?void 0:t.split("@")[0])??"there":"there"}function Iwe({msg:e,onDone:t}){return j.useEffect(()=>{const r=setTimeout(t,3e3);return()=>clearTimeout(r)},[]),i.jsxs("div",{style:{position:"fixed",bottom:"24px",left:"50%",transform:"translateX(-50%)",background:"var(--foreground)",color:"var(--background)",padding:"10px 20px",borderRadius:"var(--radius-button)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",boxShadow:"var(--shadow-xl)",zIndex:200,display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx(av,{size:13})," ",e]})}function Nwe(){const{setActiveNav:e,setSelectedEventId:t}=eo(),{user:r}=Ur(),n=zn(r),o=Owe(r??null),[a,s]=j.useState(null),[l,c]=j.useState(!1),[u,d]=j.useState(!1),h=qi()==="mobile",p=y=>{y==="event"?c(!0):(y==="qna"||y==="quiz-poll")&&d(!0)};return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:h?"32px":"40px",maxWidth:"1200px",margin:"0 auto"},children:[i.jsx("div",{children:i.jsxs("h1",{style:{fontFamily:"var(--font-inter)",fontSize:h?"var(--text-2xl)":"var(--text-3xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 8px"},children:["Hi, ",o]})}),i.jsxs("div",{children:[i.jsx("h2",{style:{fontFamily:"var(--font-noto-sans)",fontSize:h?"var(--text-lg)":"var(--text-xl)",fontWeight:"var(--font-weight-normal)",color:"var(--foreground)",margin:"0 0 20px",lineHeight:1.4},children:"Tell us about your event or activity, we will create it for you."}),n?i.jsx(Pwe,{organizationId:n,onCreated:y=>{t(y),e("dashboard"),s("Event, track, and opening session created from your description.")}}):i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,lineHeight:1.5},children:"Set up an organization in your portfolio to generate events with AI from here."})]}),i.jsx("div",{children:i.jsxs("div",{style:{display:"grid",gridTemplateColumns:h?"1fr":"repeat(3, 1fr)",gap:h?"12px":"20px"},children:[i.jsx(A4,{icon:i.jsx(Wi,{size:32}),title:"Create new event",onClick:()=>p("event")}),i.jsx(A4,{icon:i.jsx(Zs,{size:32}),title:"Create Q&A Session",onClick:()=>p("qna")}),i.jsx(A4,{icon:i.jsx(N6,{size:32}),title:"Create quiz or poll",onClick:()=>p("quiz-poll")})]})}),u&&i.jsx(Rwe,{onClose:()=>d(!1)}),l&&i.jsx(CY,{organizationId:n,onClose:()=>c(!1),onCreated:y=>{t(y),e("dashboard")}}),a&&i.jsx(Iwe,{msg:a,onDone:()=>s(null)})]})}function A4({icon:e,title:t,onClick:r}){return i.jsxs("button",{type:"button",onClick:r,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"20px",padding:"48px 24px",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",cursor:"pointer",transition:"border-color 0.15s, background 0.15s, box-shadow 0.15s",minHeight:"200px"},onMouseEnter:n=>{n.currentTarget.style.borderColor="var(--primary)",n.currentTarget.style.background="var(--accent)",n.currentTarget.style.boxShadow="0 4px 12px rgba(11,77,209,0.15)"},onMouseLeave:n=>{n.currentTarget.style.borderColor="var(--border)",n.currentTarget.style.background="var(--card)",n.currentTarget.style.boxShadow="none"},children:[i.jsx("div",{style:{color:"var(--primary)"},children:e}),i.jsx("p",{style:{fontSize:"var(--text-lg)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,textAlign:"center"},children:t})]})}function Rwe({onClose:e}){return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:e,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.50)",zIndex:200},role:"presentation"}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(480px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.20)",animation:"homePanelIn 0.25s cubic-bezier(0.4, 0, 0.2, 1)"},children:[i.jsx("style",{children:"@keyframes homePanelIn { from { transform:translateX(100%); opacity:.6 } to { transform:translateX(0); opacity:1 } }"}),i.jsxs("div",{style:{padding:"20px 24px",borderBottom:"1px solid var(--border)"},children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"Quick activity creation"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"6px 0 0"},children:"Create a Q&A session, quiz, or poll in seconds"})]}),i.jsx("div",{style:{flex:1,overflowY:"auto",padding:"24px"},children:i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",textAlign:"center",marginTop:"60px"},children:"Quick activity creation interface coming soon!"})}),i.jsxs("div",{style:{padding:"16px 24px",borderTop:"1px solid var(--border)",display:"flex",gap:"12px"},children:[i.jsx("button",{type:"button",onClick:e,style:{flex:1,padding:"10px 20px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",color:"var(--card-foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",transition:"background 0.15s"},onMouseEnter:t=>{t.currentTarget.style.background="var(--secondary)"},onMouseLeave:t=>{t.currentTarget.style.background="var(--card)"},children:"Cancel"}),i.jsx("button",{type:"button",style:{flex:1,padding:"10px 20px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",transition:"opacity 0.15s ease",opacity:1},onMouseEnter:t=>{t.currentTarget.style.opacity="0.88"},onMouseLeave:t=>{t.currentTarget.style.opacity="1"},children:"Create Activity"})]})]})]})}function nn(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 Js(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Na(e,t){const r=nn(e);return isNaN(t)?Js(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function cc(e,t){const r=nn(e);if(isNaN(t))return Js(e,NaN);if(!t)return r;const n=r.getDate(),o=Js(e,r.getTime());o.setMonth(r.getMonth()+t+1,0);const a=o.getDate();return n>=a?o:(r.setFullYear(o.getFullYear(),o.getMonth(),n),r)}const pP=6048e5,Lwe=864e5;let Fwe={};function bb(){return Fwe}function tu(e,t){var l,c,u,d;const r=bb(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,o=nn(e),a=o.getDay(),s=(a=o.getTime()?r+1:t.getTime()>=s.getTime()?r:r-1}function Ym(e){const t=nn(e);return t.setHours(0,0,0,0),t}function U2(e){const t=nn(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function Yc(e,t){const r=Ym(e),n=Ym(t),o=+r-U2(r),a=+n-U2(n);return Math.round((o-a)/Lwe)}function Mwe(e){const t=EY(e),r=Js(e,0);return r.setFullYear(t,0,4),r.setHours(0,0,0,0),xh(r)}function IA(e,t){const r=t*7;return Na(e,r)}function Dwe(e,t){return cc(e,t*12)}function zwe(e){let t;return e.forEach(function(r){const n=nn(r);(t===void 0||t{const n=nn(r);(!t||t>n||isNaN(+n))&&(t=n)}),t||new Date(NaN)}function us(e,t){const r=Ym(e),n=Ym(t);return+r==+n}function hP(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Wwe(e){if(!hP(e)&&typeof e!="number")return!1;const t=nn(e);return!isNaN(Number(t))}function qx(e,t){const r=nn(e),n=nn(t),o=r.getFullYear()-n.getFullYear(),a=r.getMonth()-n.getMonth();return o*12+a}function qwe(e,t,r){const n=tu(e,r),o=tu(t,r),a=+n-U2(n),s=+o-U2(o);return Math.round((a-s)/pP)}function gP(e){const t=nn(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function hs(e){const t=nn(e);return t.setDate(1),t.setHours(0,0,0,0),t}function AY(e){const t=nn(e),r=Js(e,0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}function mP(e,t){var l,c,u,d;const r=bb(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,o=nn(e),a=o.getDay(),s=(a{let n;const o=$we[e];return typeof o=="string"?n=o:t===1?n=o.one:n=o.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function T4(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const Hwe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Vwe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ywe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Gwe={date:T4({formats:Hwe,defaultWidth:"full"}),time:T4({formats:Vwe,defaultWidth:"full"}),dateTime:T4({formats:Ywe,defaultWidth:"full"})},Kwe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Qwe=(e,t,r,n)=>Kwe[e];function vy(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let o;if(n==="formatting"&&e.formattingValues){const s=e.defaultFormattingWidth||e.defaultWidth,l=r!=null&&r.width?String(r.width):s;o=e.formattingValues[l]||e.formattingValues[s]}else{const s=e.defaultWidth,l=r!=null&&r.width?String(r.width):e.defaultWidth;o=e.values[l]||e.values[s]}const a=e.argumentCallback?e.argumentCallback(t):t;return o[a]}}const Xwe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Zwe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Jwe={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"]},eSe={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"]},tSe={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"}},rSe={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"}},nSe=(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},iSe={ordinalNumber:nSe,era:vy({values:Xwe,defaultWidth:"wide"}),quarter:vy({values:Zwe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:vy({values:Jwe,defaultWidth:"wide"}),day:vy({values:eSe,defaultWidth:"wide"}),dayPeriod:vy({values:tSe,defaultWidth:"wide",formattingValues:rSe,defaultFormattingWidth:"wide"})};function yy(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],a=t.match(o);if(!a)return null;const s=a[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?aSe(l,f=>f.test(s)):oSe(l,f=>f.test(s));let u;u=e.valueCallback?e.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;const d=t.slice(s.length);return{value:u,rest:d}}}function oSe(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function aSe(e,t){for(let r=0;r{const n=t.match(e.matchPattern);if(!n)return null;const o=n[0],a=t.match(e.parsePattern);if(!a)return null;let s=e.valueCallback?e.valueCallback(a[0]):a[0];s=r.valueCallback?r.valueCallback(s):s;const l=t.slice(o.length);return{value:s,rest:l}}}const lSe=/^(\d+)(th|st|nd|rd)?/i,cSe=/\d+/i,uSe={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},dSe={any:[/^b/i,/^(a|c)/i]},fSe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},pSe={any:[/1/i,/2/i,/3/i,/4/i]},hSe={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},gSe={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]},mSe={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},vSe={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]},ySe={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},xSe={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}},bSe={ordinalNumber:sSe({matchPattern:lSe,parsePattern:cSe,valueCallback:e=>parseInt(e,10)}),era:yy({matchPatterns:uSe,defaultMatchWidth:"wide",parsePatterns:dSe,defaultParseWidth:"any"}),quarter:yy({matchPatterns:fSe,defaultMatchWidth:"wide",parsePatterns:pSe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:yy({matchPatterns:hSe,defaultMatchWidth:"wide",parsePatterns:gSe,defaultParseWidth:"any"}),day:yy({matchPatterns:mSe,defaultMatchWidth:"wide",parsePatterns:vSe,defaultParseWidth:"any"}),dayPeriod:yy({matchPatterns:ySe,defaultMatchWidth:"any",parsePatterns:xSe,defaultParseWidth:"any"})},PY={code:"en-US",formatDistance:Uwe,formatLong:Gwe,formatRelative:Qwe,localize:iSe,match:bSe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function wSe(e){const t=nn(e);return Yc(t,AY(t))+1}function OY(e){const t=nn(e),r=+xh(t)-+Mwe(t);return Math.round(r/pP)+1}function IY(e,t){var d,f,h,p;const r=nn(e),n=r.getFullYear(),o=bb(),a=(t==null?void 0:t.firstWeekContainsDate)??((f=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??o.firstWeekContainsDate??((p=(h=o.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,s=Js(e,0);s.setFullYear(n+1,0,a),s.setHours(0,0,0,0);const l=tu(s,t),c=Js(e,0);c.setFullYear(n,0,a),c.setHours(0,0,0,0);const u=tu(c,t);return r.getTime()>=l.getTime()?n+1:r.getTime()>=u.getTime()?n:n-1}function SSe(e,t){var l,c,u,d;const r=bb(),n=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,o=IY(e,t),a=Js(e,0);return a.setFullYear(o,0,n),a.setHours(0,0,0,0),tu(a,t)}function NY(e,t){const r=nn(e),n=+tu(r,t)-+SSe(r,t);return Math.round(n/pP)+1}function Pn(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const pf={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return Pn(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):Pn(r+1,2)},d(e,t){return Pn(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return Pn(e.getHours()%12||12,t.length)},H(e,t){return Pn(e.getHours(),t.length)},m(e,t){return Pn(e.getMinutes(),t.length)},s(e,t){return Pn(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),o=Math.trunc(n*Math.pow(10,r-3));return Pn(o,t.length)}},Tg={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},b7={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),o=n>0?n:1-n;return r.ordinalNumber(o,{unit:"year"})}return pf.y(e,t)},Y:function(e,t,r,n){const o=IY(e,n),a=o>0?o:1-o;if(t==="YY"){const s=a%100;return Pn(s,2)}return t==="Yo"?r.ordinalNumber(a,{unit:"year"}):Pn(a,t.length)},R:function(e,t){const r=EY(e);return Pn(r,t.length)},u:function(e,t){const r=e.getFullYear();return Pn(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return Pn(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return Pn(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return pf.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return Pn(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const o=NY(e,n);return t==="wo"?r.ordinalNumber(o,{unit:"week"}):Pn(o,t.length)},I:function(e,t,r){const n=OY(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):Pn(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):pf.d(e,t)},D:function(e,t,r){const n=wSe(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):Pn(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const o=e.getDay(),a=(o-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return Pn(a,2);case"eo":return r.ordinalNumber(a,{unit:"day"});case"eee":return r.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(o,{width:"short",context:"formatting"});case"eeee":default:return r.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const o=e.getDay(),a=(o-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return Pn(a,t.length);case"co":return r.ordinalNumber(a,{unit:"day"});case"ccc":return r.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(o,{width:"narrow",context:"standalone"});case"cccccc":return r.day(o,{width:"short",context:"standalone"});case"cccc":default:return r.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),o=n===0?7:n;switch(t){case"i":return String(o);case"ii":return Pn(o,t.length);case"io":return r.ordinalNumber(o,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let o;switch(n===12?o=Tg.noon:n===0?o=Tg.midnight:o=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let o;switch(n>=17?o=Tg.evening:n>=12?o=Tg.afternoon:n>=4?o=Tg.morning:o=Tg.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return pf.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):pf.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):Pn(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):Pn(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):pf.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):pf.s(e,t)},S:function(e,t){return pf.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return S7(n);case"XXXX":case"XX":return Bp(n);case"XXXXX":case"XXX":default:return Bp(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return S7(n);case"xxxx":case"xx":return Bp(n);case"xxxxx":case"xxx":default:return Bp(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+w7(n,":");case"OOOO":default:return"GMT"+Bp(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+w7(n,":");case"zzzz":default:return"GMT"+Bp(n,":")}},t:function(e,t,r){const n=Math.trunc(e.getTime()/1e3);return Pn(n,t.length)},T:function(e,t,r){const n=e.getTime();return Pn(n,t.length)}};function w7(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=Math.trunc(n/60),a=n%60;return a===0?r+String(o):r+String(o)+t+Pn(a,2)}function S7(e,t){return e%60===0?(e>0?"-":"+")+Pn(Math.abs(e)/60,2):Bp(e,t)}function Bp(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=Pn(Math.trunc(n/60),2),a=Pn(n%60,2);return r+o+t+a}const j7=(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"})}},RY=(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"})}},jSe=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],o=r[2];if(!o)return j7(e,t);let a;switch(n){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",j7(n,t)).replace("{{time}}",RY(o,t))},kSe={p:RY,P:jSe},_Se=/^D+$/,CSe=/^Y+$/,ESe=["D","DD","YY","YYYY"];function ASe(e){return _Se.test(e)}function TSe(e){return CSe.test(e)}function PSe(e,t,r){const n=OSe(e,t,r);if(console.warn(n),ESe.includes(e))throw new RangeError(n)}function OSe(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ISe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,NSe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,RSe=/^'([^]*?)'?$/,LSe=/''/g,FSe=/[a-zA-Z]/;function Fh(e,t,r){var d,f,h,p,y,m,x,b;const n=bb(),o=(r==null?void 0:r.locale)??n.locale??PY,a=(r==null?void 0:r.firstWeekContainsDate)??((f=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??n.firstWeekContainsDate??((p=(h=n.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,s=(r==null?void 0:r.weekStartsOn)??((m=(y=r==null?void 0:r.locale)==null?void 0:y.options)==null?void 0:m.weekStartsOn)??n.weekStartsOn??((b=(x=n.locale)==null?void 0:x.options)==null?void 0:b.weekStartsOn)??0,l=nn(e);if(!Wwe(l))throw new RangeError("Invalid time value");let c=t.match(NSe).map(w=>{const k=w[0];if(k==="p"||k==="P"){const S=kSe[k];return S(w,o.formatLong)}return w}).join("").match(ISe).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const k=w[0];if(k==="'")return{isToken:!1,value:MSe(w)};if(b7[k])return{isToken:!0,value:w};if(k.match(FSe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+k+"`");return{isToken:!1,value:w}});o.localize.preprocessor&&(c=o.localize.preprocessor(l,c));const u={firstWeekContainsDate:a,weekStartsOn:s,locale:o};return c.map(w=>{if(!w.isToken)return w.value;const k=w.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&TSe(k)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&ASe(k))&&PSe(k,t,String(e));const S=b7[k[0]];return S(l,k,o.localize,u)}).join("")}function MSe(e){const t=e.match(RSe);return t?t[1].replace(LSe,"'"):e}function DSe(e){const t=nn(e),r=t.getFullYear(),n=t.getMonth(),o=Js(e,0);return o.setFullYear(r,n+1,0),o.setHours(0,0,0,0),o.getDate()}function zSe(e){return Math.trunc(+nn(e)/1e3)}function BSe(e){const t=nn(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(0,0,0,0),t}function WSe(e,t){return qwe(BSe(e),hs(e),t)+1}function NA(e,t){const r=nn(e),n=nn(t);return r.getTime()>n.getTime()}function LY(e,t){const r=nn(e),n=nn(t);return+r<+n}function vP(e,t){const r=nn(e),n=nn(t);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function qSe(e,t){const r=nn(e),n=nn(t);return r.getFullYear()===n.getFullYear()}function P4(e,t){return Na(e,-t)}function O4(e,t){const r=nn(e),n=r.getFullYear(),o=r.getDate(),a=Js(e,0);a.setFullYear(n,t,15),a.setHours(0,0,0,0);const s=DSe(a);return r.setMonth(t,Math.min(o,s)),r}function k7(e,t){const r=nn(e);return isNaN(+r)?Js(e,NaN):(r.setFullYear(t),r)}var Sr=function(){return Sr=Object.assign||function(t){for(var r,n=1,o=arguments.length;n1&&(c||!u),f=t>1&&(u||!c),h=function(){n&&a(n)},p=function(){o&&a(o)};return i.jsx(wje,{displayMonth:e.displayMonth,hideNext:d,hidePrevious:f,nextMonth:o,previousMonth:n,onPreviousClick:h,onNextClick:p})}function Sje(e){var t,r=Qn(),n=r.classNames,o=r.disableNavigation,a=r.styles,s=r.captionLayout,l=r.components,c=(t=l==null?void 0:l.CaptionLabel)!==null&&t!==void 0?t:DY,u;return o?u=i.jsx(c,{id:e.id,displayMonth:e.displayMonth}):s==="dropdown"?u=i.jsx(_7,{displayMonth:e.displayMonth,id:e.id}):s==="dropdown-buttons"?u=i.jsxs(i.Fragment,{children:[i.jsx(_7,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),i.jsx(C7,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):u=i.jsxs(i.Fragment,{children:[i.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),i.jsx(C7,{displayMonth:e.displayMonth,id:e.id})]}),i.jsx("div",{className:n.caption,style:a.caption,children:u})}function jje(e){var t=Qn(),r=t.footer,n=t.styles,o=t.classNames.tfoot;return r?i.jsx("tfoot",{className:o,style:n.tfoot,children:i.jsx("tr",{children:i.jsx("td",{colSpan:8,children:r})})}):i.jsx(i.Fragment,{})}function kje(e,t,r){for(var n=r?xh(new Date):tu(new Date,{locale:e,weekStartsOn:t}),o=[],a=0;a<7;a++){var s=Na(n,a);o.push(s)}return o}function _je(){var e=Qn(),t=e.classNames,r=e.styles,n=e.showWeekNumber,o=e.locale,a=e.weekStartsOn,s=e.ISOWeek,l=e.formatters.formatWeekdayName,c=e.labels.labelWeekday,u=kje(o,a,s);return i.jsxs("tr",{style:r.head_row,className:t.head_row,children:[n&&i.jsx("td",{style:r.head_cell,className:t.head_cell}),u.map(function(d,f){return i.jsx("th",{scope:"col",className:t.head_cell,style:r.head_cell,"aria-label":c(d,{locale:o}),children:l(d,{locale:o})},f)})]})}function Cje(){var e,t=Qn(),r=t.classNames,n=t.styles,o=t.components,a=(e=o==null?void 0:o.HeadRow)!==null&&e!==void 0?e:_je;return i.jsx("thead",{style:n.head,className:r.head,children:i.jsx(a,{})})}function Eje(e){var t=Qn(),r=t.locale,n=t.formatters.formatDay;return i.jsx(i.Fragment,{children:n(e.date,{locale:r})})}var yP=j.createContext(void 0);function Aje(e){if(!wb(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return i.jsx(yP.Provider,{value:t,children:e.children})}return i.jsx(Tje,{initialProps:e.initialProps,children:e.children})}function Tje(e){var t=e.initialProps,r=e.children,n=t.selected,o=t.min,a=t.max,s=function(u,d,f){var h,p;(h=t.onDayClick)===null||h===void 0||h.call(t,u,d,f);var y=!!(d.selected&&o&&(n==null?void 0:n.length)===o);if(!y){var m=!!(!d.selected&&a&&(n==null?void 0:n.length)===a);if(!m){var x=n?FY([],n):[];if(d.selected){var b=x.findIndex(function(w){return us(u,w)});x.splice(b,1)}else x.push(u);(p=t.onSelect)===null||p===void 0||p.call(t,x,u,d,f)}}},l={disabled:[]};n&&l.disabled.push(function(u){var d=a&&n.length>a-1,f=n.some(function(h){return us(h,u)});return!!(d&&!f)});var c={selected:n,onDayClick:s,modifiers:l};return i.jsx(yP.Provider,{value:c,children:r})}function xP(){var e=j.useContext(yP);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function Pje(e,t){var r=t||{},n=r.from,o=r.to;return n&&o?us(o,e)&&us(n,e)?void 0:us(o,e)?{from:o,to:void 0}:us(n,e)?void 0:NA(n,e)?{from:e,to:o}:{from:n,to:e}:o?NA(e,o)?{from:o,to:e}:{from:e,to:o}:n?LY(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var bP=j.createContext(void 0);function Oje(e){if(!Sb(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return i.jsx(bP.Provider,{value:t,children:e.children})}return i.jsx(Ije,{initialProps:e.initialProps,children:e.children})}function Ije(e){var t=e.initialProps,r=e.children,n=t.selected,o=n||{},a=o.from,s=o.to,l=t.min,c=t.max,u=function(p,y,m){var x,b;(x=t.onDayClick)===null||x===void 0||x.call(t,p,y,m);var w=Pje(p,n);(b=t.onSelect)===null||b===void 0||b.call(t,w,p,y,m)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(d.range_start=[a],s?(d.range_end=[s],us(a,s)||(d.range_middle=[{after:a,before:s}])):d.range_end=[a]):s&&(d.range_start=[s],d.range_end=[s]),l&&(a&&!s&&d.disabled.push({after:P4(a,l-1),before:Na(a,l-1)}),a&&s&&d.disabled.push({after:a,before:Na(a,l-1)}),!a&&s&&d.disabled.push({after:P4(s,l-1),before:Na(s,l-1)})),c){if(a&&!s&&(d.disabled.push({before:Na(a,-c+1)}),d.disabled.push({after:Na(a,c-1)})),a&&s){var f=Yc(s,a)+1,h=c-f;d.disabled.push({before:P4(a,h)}),d.disabled.push({after:Na(s,h)})}!a&&s&&(d.disabled.push({before:Na(s,-c+1)}),d.disabled.push({after:Na(s,c-1)}))}return i.jsx(bP.Provider,{value:{selected:n,onDayClick:u,modifiers:d},children:r})}function wP(){var e=j.useContext(bP);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function y0(e){return Array.isArray(e)?FY([],e):e!==void 0?[e]:[]}function Nje(e){var t={};return Object.entries(e).forEach(function(r){var n=r[0],o=r[1];t[n]=y0(o)}),t}var uc;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(uc||(uc={}));var Rje=uc.Selected,$u=uc.Disabled,Lje=uc.Hidden,Fje=uc.Today,I4=uc.RangeEnd,N4=uc.RangeMiddle,R4=uc.RangeStart,Mje=uc.Outside;function Dje(e,t,r){var n,o=(n={},n[Rje]=y0(e.selected),n[$u]=y0(e.disabled),n[Lje]=y0(e.hidden),n[Fje]=[e.today],n[I4]=[],n[N4]=[],n[R4]=[],n[Mje]=[],n);return e.fromDate&&o[$u].push({before:e.fromDate}),e.toDate&&o[$u].push({after:e.toDate}),wb(e)?o[$u]=o[$u].concat(t.modifiers[$u]):Sb(e)&&(o[$u]=o[$u].concat(r.modifiers[$u]),o[R4]=r.modifiers[R4],o[N4]=r.modifiers[N4],o[I4]=r.modifiers[I4]),o}var WY=j.createContext(void 0);function zje(e){var t=Qn(),r=xP(),n=wP(),o=Dje(t,r,n),a=Nje(t.modifiers),s=Sr(Sr({},o),a);return i.jsx(WY.Provider,{value:s,children:e.children})}function qY(){var e=j.useContext(WY);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function Bje(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Wje(e){return!!(e&&typeof e=="object"&&"from"in e)}function qje(e){return!!(e&&typeof e=="object"&&"after"in e)}function $je(e){return!!(e&&typeof e=="object"&&"before"in e)}function Uje(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Hje(e,t){var r,n=t.from,o=t.to;if(n&&o){var a=Yc(o,n)<0;a&&(r=[o,n],n=r[0],o=r[1]);var s=Yc(e,n)>=0&&Yc(o,e)>=0;return s}return o?us(o,e):n?us(n,e):!1}function Vje(e){return hP(e)}function Yje(e){return Array.isArray(e)&&e.every(hP)}function Gje(e,t){return t.some(function(r){if(typeof r=="boolean")return r;if(Vje(r))return us(e,r);if(Yje(r))return r.includes(e);if(Wje(r))return Hje(e,r);if(Uje(r))return r.dayOfWeek.includes(e.getDay());if(Bje(r)){var n=Yc(r.before,e),o=Yc(r.after,e),a=n>0,s=o<0,l=NA(r.before,r.after);return l?s&&a:a||s}return qje(r)?Yc(e,r.after)>0:$je(r)?Yc(r.before,e)>0:typeof r=="function"?r(e):!1})}function SP(e,t,r){var n=Object.keys(t).reduce(function(a,s){var l=t[s];return Gje(e,l)&&a.push(s),a},[]),o={};return n.forEach(function(a){return o[a]=!0}),r&&!vP(e,r)&&(o.outside=!0),o}function Kje(e,t){for(var r=hs(e[0]),n=gP(e[e.length-1]),o,a,s=r;s<=n;){var l=SP(s,t),c=!l.disabled&&!l.hidden;if(!c){s=Na(s,1);continue}if(l.selected)return s;l.today&&!a&&(a=s),o||(o=s),s=Na(s,1)}return a||o}var Qje=365;function $Y(e,t){var r=t.moveBy,n=t.direction,o=t.context,a=t.modifiers,s=t.retry,l=s===void 0?{count:0,lastFocused:e}:s,c=o.weekStartsOn,u=o.fromDate,d=o.toDate,f=o.locale,h={day:Na,week:IA,month:cc,year:Dwe,startOfWeek:function(x){return o.ISOWeek?xh(x):tu(x,{locale:f,weekStartsOn:c})},endOfWeek:function(x){return o.ISOWeek?TY(x):mP(x,{locale:f,weekStartsOn:c})}},p=h[r](e,n==="after"?1:-1);n==="before"&&u?p=zwe([u,p]):n==="after"&&d&&(p=Bwe([d,p]));var y=!0;if(a){var m=SP(p,a);y=!m.disabled&&!m.hidden}return y?p:l.count>Qje?l.lastFocused:$Y(p,{moveBy:r,direction:n,context:o,modifiers:a,retry:Sr(Sr({},l),{count:l.count+1})})}var UY=j.createContext(void 0);function Xje(e){var t=jb(),r=qY(),n=j.useState(),o=n[0],a=n[1],s=j.useState(),l=s[0],c=s[1],u=Kje(t.displayMonths,r),d=o??(l&&t.isDateDisplayed(l))?l:u,f=function(){c(o),a(void 0)},h=function(x){a(x)},p=Qn(),y=function(x,b){if(o){var w=$Y(o,{moveBy:x,direction:b,context:p,modifiers:r});us(o,w)||(t.goToDate(w,o),h(w))}},m={focusedDay:o,focusTarget:d,blur:f,focus:h,focusDayAfter:function(){return y("day","after")},focusDayBefore:function(){return y("day","before")},focusWeekAfter:function(){return y("week","after")},focusWeekBefore:function(){return y("week","before")},focusMonthBefore:function(){return y("month","before")},focusMonthAfter:function(){return y("month","after")},focusYearBefore:function(){return y("year","before")},focusYearAfter:function(){return y("year","after")},focusStartOfWeek:function(){return y("startOfWeek","before")},focusEndOfWeek:function(){return y("endOfWeek","after")}};return i.jsx(UY.Provider,{value:m,children:e.children})}function jP(){var e=j.useContext(UY);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function Zje(e,t){var r=qY(),n=SP(e,r,t);return n}var kP=j.createContext(void 0);function Jje(e){if(!wS(e.initialProps)){var t={selected:void 0};return i.jsx(kP.Provider,{value:t,children:e.children})}return i.jsx(e5e,{initialProps:e.initialProps,children:e.children})}function e5e(e){var t=e.initialProps,r=e.children,n=function(a,s,l){var c,u,d;if((c=t.onDayClick)===null||c===void 0||c.call(t,a,s,l),s.selected&&!t.required){(u=t.onSelect)===null||u===void 0||u.call(t,void 0,a,s,l);return}(d=t.onSelect)===null||d===void 0||d.call(t,a,a,s,l)},o={selected:t.selected,onDayClick:n};return i.jsx(kP.Provider,{value:o,children:r})}function HY(){var e=j.useContext(kP);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function t5e(e,t){var r=Qn(),n=HY(),o=xP(),a=wP(),s=jP(),l=s.focusDayAfter,c=s.focusDayBefore,u=s.focusWeekAfter,d=s.focusWeekBefore,f=s.blur,h=s.focus,p=s.focusMonthBefore,y=s.focusMonthAfter,m=s.focusYearBefore,x=s.focusYearAfter,b=s.focusStartOfWeek,w=s.focusEndOfWeek,k=function(Q){var U,ee,H,B;wS(r)?(U=n.onDayClick)===null||U===void 0||U.call(n,e,t,Q):wb(r)?(ee=o.onDayClick)===null||ee===void 0||ee.call(o,e,t,Q):Sb(r)?(H=a.onDayClick)===null||H===void 0||H.call(a,e,t,Q):(B=r.onDayClick)===null||B===void 0||B.call(r,e,t,Q)},S=function(Q){var U;h(e),(U=r.onDayFocus)===null||U===void 0||U.call(r,e,t,Q)},_=function(Q){var U;f(),(U=r.onDayBlur)===null||U===void 0||U.call(r,e,t,Q)},P=function(Q){var U;(U=r.onDayMouseEnter)===null||U===void 0||U.call(r,e,t,Q)},O=function(Q){var U;(U=r.onDayMouseLeave)===null||U===void 0||U.call(r,e,t,Q)},T=function(Q){var U;(U=r.onDayPointerEnter)===null||U===void 0||U.call(r,e,t,Q)},R=function(Q){var U;(U=r.onDayPointerLeave)===null||U===void 0||U.call(r,e,t,Q)},I=function(Q){var U;(U=r.onDayTouchCancel)===null||U===void 0||U.call(r,e,t,Q)},E=function(Q){var U;(U=r.onDayTouchEnd)===null||U===void 0||U.call(r,e,t,Q)},A=function(Q){var U;(U=r.onDayTouchMove)===null||U===void 0||U.call(r,e,t,Q)},F=function(Q){var U;(U=r.onDayTouchStart)===null||U===void 0||U.call(r,e,t,Q)},L=function(Q){var U;(U=r.onDayKeyUp)===null||U===void 0||U.call(r,e,t,Q)},z=function(Q){var U;switch(Q.key){case"ArrowLeft":Q.preventDefault(),Q.stopPropagation(),r.dir==="rtl"?l():c();break;case"ArrowRight":Q.preventDefault(),Q.stopPropagation(),r.dir==="rtl"?c():l();break;case"ArrowDown":Q.preventDefault(),Q.stopPropagation(),u();break;case"ArrowUp":Q.preventDefault(),Q.stopPropagation(),d();break;case"PageUp":Q.preventDefault(),Q.stopPropagation(),Q.shiftKey?m():p();break;case"PageDown":Q.preventDefault(),Q.stopPropagation(),Q.shiftKey?x():y();break;case"Home":Q.preventDefault(),Q.stopPropagation(),b();break;case"End":Q.preventDefault(),Q.stopPropagation(),w();break}(U=r.onDayKeyDown)===null||U===void 0||U.call(r,e,t,Q)},V={onClick:k,onFocus:S,onBlur:_,onKeyDown:z,onKeyUp:L,onMouseEnter:P,onMouseLeave:O,onPointerEnter:T,onPointerLeave:R,onTouchCancel:I,onTouchEnd:E,onTouchMove:A,onTouchStart:F};return V}function r5e(){var e=Qn(),t=HY(),r=xP(),n=wP(),o=wS(e)?t.selected:wb(e)?r.selected:Sb(e)?n.selected:void 0;return o}function n5e(e){return Object.values(uc).includes(e)}function i5e(e,t){var r=[e.classNames.day];return Object.keys(t).forEach(function(n){var o=e.modifiersClassNames[n];if(o)r.push(o);else if(n5e(n)){var a=e.classNames["day_".concat(n)];a&&r.push(a)}}),r}function o5e(e,t){var r=Sr({},e.styles.day);return Object.keys(t).forEach(function(n){var o;r=Sr(Sr({},r),(o=e.modifiersStyles)===null||o===void 0?void 0:o[n])}),r}function a5e(e,t,r){var n,o,a,s=Qn(),l=jP(),c=Zje(e,t),u=t5e(e,c),d=r5e(),f=!!(s.onDayClick||s.mode!=="default");j.useEffect(function(){var P;c.outside||l.focusedDay&&f&&us(l.focusedDay,e)&&((P=r.current)===null||P===void 0||P.focus())},[l.focusedDay,e,r,f,c.outside]);var h=i5e(s,c).join(" "),p=o5e(s,c),y=!!(c.outside&&!s.showOutsideDays||c.hidden),m=(a=(o=s.components)===null||o===void 0?void 0:o.DayContent)!==null&&a!==void 0?a:Eje,x=i.jsx(m,{date:e,displayMonth:t,activeModifiers:c}),b={style:p,className:h,children:x,role:"gridcell"},w=l.focusTarget&&us(l.focusTarget,e)&&!c.outside,k=l.focusedDay&&us(l.focusedDay,e),S=Sr(Sr(Sr({},b),(n={disabled:c.disabled,role:"gridcell"},n["aria-selected"]=c.selected,n.tabIndex=k||w?0:-1,n)),u),_={isButton:f,isHidden:y,activeModifiers:c,selectedDays:d,buttonProps:S,divProps:b};return _}function s5e(e){var t=j.useRef(null),r=a5e(e.date,e.displayMonth,t);return r.isHidden?i.jsx("div",{role:"gridcell"}):r.isButton?i.jsx(H2,Sr({name:"day",ref:t},r.buttonProps)):i.jsx("div",Sr({},r.divProps))}function l5e(e){var t=e.number,r=e.dates,n=Qn(),o=n.onWeekNumberClick,a=n.styles,s=n.classNames,l=n.locale,c=n.labels.labelWeekNumber,u=n.formatters.formatWeekNumber,d=u(Number(t),{locale:l});if(!o)return i.jsx("span",{className:s.weeknumber,style:a.weeknumber,children:d});var f=c(Number(t),{locale:l}),h=function(p){o(t,r,p)};return i.jsx(H2,{name:"week-number","aria-label":f,className:s.weeknumber,style:a.weeknumber,onClick:h,children:d})}function c5e(e){var t,r,n=Qn(),o=n.styles,a=n.classNames,s=n.showWeekNumber,l=n.components,c=(t=l==null?void 0:l.Day)!==null&&t!==void 0?t:s5e,u=(r=l==null?void 0:l.WeekNumber)!==null&&r!==void 0?r:l5e,d;return s&&(d=i.jsx("td",{className:a.cell,style:o.cell,children:i.jsx(u,{number:e.weekNumber,dates:e.dates})})),i.jsxs("tr",{className:a.row,style:o.row,children:[d,e.dates.map(function(f){return i.jsx("td",{className:a.cell,style:o.cell,role:"presentation",children:i.jsx(c,{displayMonth:e.displayMonth,date:f})},zSe(f))})]})}function E7(e,t,r){for(var n=r!=null&&r.ISOWeek?TY(t):mP(t,r),o=r!=null&&r.ISOWeek?xh(e):tu(e,r),a=Yc(n,o),s=[],l=0;l<=a;l++)s.push(Na(o,l));var c=s.reduce(function(u,d){var f=r!=null&&r.ISOWeek?OY(d):NY(d,r),h=u.find(function(p){return p.weekNumber===f});return h?(h.dates.push(d),u):(u.push({weekNumber:f,dates:[d]}),u)},[]);return c}function u5e(e,t){var r=E7(hs(e),gP(e),t);if(t!=null&&t.useFixedWeeks){var n=WSe(e,t);if(n<6){var o=r[r.length-1],a=o.dates[o.dates.length-1],s=IA(a,6-n),l=E7(IA(a,1),s,t);r.push.apply(r,l)}}return r}function d5e(e){var t,r,n,o=Qn(),a=o.locale,s=o.classNames,l=o.styles,c=o.hideHead,u=o.fixedWeeks,d=o.components,f=o.weekStartsOn,h=o.firstWeekContainsDate,p=o.ISOWeek,y=u5e(e.displayMonth,{useFixedWeeks:!!u,ISOWeek:p,locale:a,weekStartsOn:f,firstWeekContainsDate:h}),m=(t=d==null?void 0:d.Head)!==null&&t!==void 0?t:Cje,x=(r=d==null?void 0:d.Row)!==null&&r!==void 0?r:c5e,b=(n=d==null?void 0:d.Footer)!==null&&n!==void 0?n:jje;return i.jsxs("table",{id:e.id,className:s.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&i.jsx(m,{}),i.jsx("tbody",{className:s.tbody,style:l.tbody,children:y.map(function(w){return i.jsx(x,{displayMonth:e.displayMonth,dates:w.dates,weekNumber:w.weekNumber},w.weekNumber)})}),i.jsx(b,{displayMonth:e.displayMonth})]})}function f5e(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var p5e=f5e()?j.useLayoutEffect:j.useEffect,L4=!1,h5e=0;function A7(){return"react-day-picker-".concat(++h5e)}function g5e(e){var t,r=e??(L4?A7():null),n=j.useState(r),o=n[0],a=n[1];return p5e(function(){o===null&&a(A7())},[]),j.useEffect(function(){L4===!1&&(L4=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function m5e(e){var t,r,n=Qn(),o=n.dir,a=n.classNames,s=n.styles,l=n.components,c=jb().displayMonths,u=g5e(n.id?"".concat(n.id,"-").concat(e.displayIndex):void 0),d=n.id?"".concat(n.id,"-grid-").concat(e.displayIndex):void 0,f=[a.month],h=s.month,p=e.displayIndex===0,y=e.displayIndex===c.length-1,m=!p&&!y;o==="rtl"&&(t=[p,y],y=t[0],p=t[1]),p&&(f.push(a.caption_start),h=Sr(Sr({},h),s.caption_start)),y&&(f.push(a.caption_end),h=Sr(Sr({},h),s.caption_end)),m&&(f.push(a.caption_between),h=Sr(Sr({},h),s.caption_between));var x=(r=l==null?void 0:l.Caption)!==null&&r!==void 0?r:Sje;return i.jsxs("div",{className:f.join(" "),style:h,children:[i.jsx(x,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),i.jsx(d5e,{id:d,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function v5e(e){var t=Qn(),r=t.classNames,n=t.styles;return i.jsx("div",{className:r.months,style:n.months,children:e.children})}function y5e(e){var t,r,n=e.initialProps,o=Qn(),a=jP(),s=jb(),l=j.useState(!1),c=l[0],u=l[1];j.useEffect(function(){o.initialFocus&&a.focusTarget&&(c||(a.focus(a.focusTarget),u(!0)))},[o.initialFocus,c,a.focus,a.focusTarget,a]);var d=[o.classNames.root,o.className];o.numberOfMonths>1&&d.push(o.classNames.multiple_months),o.showWeekNumber&&d.push(o.classNames.with_weeknumber);var f=Sr(Sr({},o.styles.root),o.style),h=Object.keys(n).filter(function(y){return y.startsWith("data-")}).reduce(function(y,m){var x;return Sr(Sr({},y),(x={},x[m]=n[m],x))},{}),p=(r=(t=n.components)===null||t===void 0?void 0:t.Months)!==null&&r!==void 0?r:v5e;return i.jsx("div",Sr({className:d.join(" "),style:f,dir:o.dir,id:o.id,nonce:n.nonce,title:n.title,lang:n.lang},h,{children:i.jsx(p,{children:s.displayMonths.map(function(y,m){return i.jsx(m5e,{displayIndex:m,displayMonth:y},m)})})}))}function x5e(e){var t=e.children,r=$Se(e,["children"]);return i.jsx(lje,{initialProps:r,children:i.jsx(yje,{children:i.jsx(Jje,{initialProps:r,children:i.jsx(Aje,{initialProps:r,children:i.jsx(Oje,{initialProps:r,children:i.jsx(zje,{children:i.jsx(Xje,{children:t})})})})})})})}function b5e(e){return i.jsx(x5e,Sr({},e,{children:i.jsx(y5e,{initialProps:e})}))}const T7=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,P7=Lr,w5e=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return P7(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:o,defaultVariants:a}=t,s=Object.keys(o).map(u=>{const d=r==null?void 0:r[u],f=a==null?void 0:a[u];if(d===null)return null;const h=T7(d)||T7(f);return o[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(y=>{let[m,x]=y;return Array.isArray(x)?x.includes({...a,...l}[m]):{...a,...l}[m]===x})?[...u,f,h]:u},[]);return P7(e,s,c,r==null?void 0:r.class,r==null?void 0:r.className)},O7=w5e("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9 rounded-md"}},defaultVariants:{variant:"default",size:"default"}});function S5e({className:e,classNames:t,showOutsideDays:r=!0,...n}){return i.jsx(b5e,{showOutsideDays:r,className:Xo("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:Xo(O7({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:Xo("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",n.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:Xo(O7({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({className:o,...a})=>i.jsx(Nf,{className:Xo("size-4",o),...a}),IconRight:({className:o,...a})=>i.jsx(va,{className:Xo("size-4",o),...a})},...n})}const j5e=["top","right","bottom","left"],Mf=Math.min,qs=Math.max,V2=Math.round,X1=Math.floor,Zc=e=>({x:e,y:e}),k5e={left:"right",right:"left",bottom:"top",top:"bottom"};function RA(e,t,r){return qs(e,Mf(t,r))}function hd(e,t){return typeof e=="function"?e(t):e}function gd(e){return e.split("-")[0]}function jv(e){return e.split("-")[1]}function _P(e){return e==="x"?"y":"x"}function CP(e){return e==="y"?"height":"width"}function Gc(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function EP(e){return _P(Gc(e))}function _5e(e,t,r){r===void 0&&(r=!1);const n=jv(e),o=EP(e),a=CP(o);let s=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(s=Y2(s)),[s,Y2(s)]}function C5e(e){const t=Y2(e);return[LA(e),t,LA(t)]}function LA(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const I7=["left","right"],N7=["right","left"],E5e=["top","bottom"],A5e=["bottom","top"];function T5e(e,t,r){switch(e){case"top":case"bottom":return r?t?N7:I7:t?I7:N7;case"left":case"right":return t?E5e:A5e;default:return[]}}function P5e(e,t,r,n){const o=jv(e);let a=T5e(gd(e),r==="start",n);return o&&(a=a.map(s=>s+"-"+o),t&&(a=a.concat(a.map(LA)))),a}function Y2(e){const t=gd(e);return k5e[t]+e.slice(t.length)}function O5e(e){return{top:0,right:0,bottom:0,left:0,...e}}function VY(e){return typeof e!="number"?O5e(e):{top:e,right:e,bottom:e,left:e}}function G2(e){const{x:t,y:r,width:n,height:o}=e;return{width:n,height:o,top:r,left:t,right:t+n,bottom:r+o,x:t,y:r}}function R7(e,t,r){let{reference:n,floating:o}=e;const a=Gc(t),s=EP(t),l=CP(s),c=gd(t),u=a==="y",d=n.x+n.width/2-o.width/2,f=n.y+n.height/2-o.height/2,h=n[l]/2-o[l]/2;let p;switch(c){case"top":p={x:d,y:n.y-o.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:f};break;case"left":p={x:n.x-o.width,y:f};break;default:p={x:n.x,y:n.y}}switch(jv(t)){case"start":p[s]-=h*(r&&u?-1:1);break;case"end":p[s]+=h*(r&&u?-1:1);break}return p}async function I5e(e,t){var r;t===void 0&&(t={});const{x:n,y:o,platform:a,rects:s,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=hd(t,e),y=VY(p),x=l[h?f==="floating"?"reference":"floating":f],b=G2(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(x)))==null||r?x:x.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),w=f==="floating"?{x:n,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),S=await(a.isElement==null?void 0:a.isElement(k))?await(a.getScale==null?void 0:a.getScale(k))||{x:1,y:1}:{x:1,y:1},_=G2(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:k,strategy:c}):w);return{top:(b.top-_.top+y.top)/S.y,bottom:(_.bottom-b.bottom+y.bottom)/S.y,left:(b.left-_.left+y.left)/S.x,right:(_.right-b.right+y.right)/S.x}}const N5e=50,R5e=async(e,t,r)=>{const{placement:n="bottom",strategy:o="absolute",middleware:a=[],platform:s}=r,l=s.detectOverflow?s:{...s,detectOverflow:I5e},c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=R7(u,n,c),h=n,p=0;const y={};for(let m=0;m({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:o,rects:a,platform:s,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=hd(e,t)||{};if(u==null)return{};const f=VY(d),h={x:r,y:n},p=EP(o),y=CP(p),m=await s.getDimensions(u),x=p==="y",b=x?"top":"left",w=x?"bottom":"right",k=x?"clientHeight":"clientWidth",S=a.reference[y]+a.reference[p]-h[p]-a.floating[y],_=h[p]-a.reference[p],P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let O=P?P[k]:0;(!O||!await(s.isElement==null?void 0:s.isElement(P)))&&(O=l.floating[k]||a.floating[y]);const T=S/2-_/2,R=O/2-m[y]/2-1,I=Mf(f[b],R),E=Mf(f[w],R),A=I,F=O-m[y]-E,L=O/2-m[y]/2+T,z=RA(A,L,F),V=!c.arrow&&jv(o)!=null&&L!==z&&a.reference[y]/2-(LL<=0)){var E,A;const L=(((E=a.flip)==null?void 0:E.index)||0)+1,z=O[L];if(z&&(!(f==="alignment"?w!==Gc(z):!1)||I.every(U=>Gc(U.placement)===w?U.overflows[0]>0:!0)))return{data:{index:L,overflows:I},reset:{placement:z}};let V=(A=I.filter(Q=>Q.overflows[0]<=0).sort((Q,U)=>Q.overflows[1]-U.overflows[1])[0])==null?void 0:A.placement;if(!V)switch(p){case"bestFit":{var F;const Q=(F=I.filter(U=>{if(P){const ee=Gc(U.placement);return ee===w||ee==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(ee=>ee>0).reduce((ee,H)=>ee+H,0)]).sort((U,ee)=>U[1]-ee[1])[0])==null?void 0:F[0];Q&&(V=Q);break}case"initialPlacement":V=l;break}if(o!==V)return{reset:{placement:V}}}return{}}}};function L7(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function F7(e){return j5e.some(t=>e[t]>=0)}const M5e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:o="referenceHidden",...a}=hd(e,t);switch(o){case"referenceHidden":{const s=await n.detectOverflow(t,{...a,elementContext:"reference"}),l=L7(s,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:F7(l)}}}case"escaped":{const s=await n.detectOverflow(t,{...a,altBoundary:!0}),l=L7(s,r.floating);return{data:{escapedOffsets:l,escaped:F7(l)}}}default:return{}}}}},YY=new Set(["left","top"]);async function D5e(e,t){const{placement:r,platform:n,elements:o}=e,a=await(n.isRTL==null?void 0:n.isRTL(o.floating)),s=gd(r),l=jv(r),c=Gc(r)==="y",u=YY.has(s)?-1:1,d=a&&c?-1:1,f=hd(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(p=l==="end"?y*-1:y),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const z5e=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:o,y:a,placement:s,middlewareData:l}=t,c=await D5e(t,e);return s===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:o+c.x,y:a+c.y,data:{...c,placement:s}}}}},B5e=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:o,platform:a}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:w,y:k}=b;return{x:w,y:k}}},...u}=hd(e,t),d={x:r,y:n},f=await a.detectOverflow(t,u),h=Gc(gd(o)),p=_P(h);let y=d[p],m=d[h];if(s){const b=p==="y"?"top":"left",w=p==="y"?"bottom":"right",k=y+f[b],S=y-f[w];y=RA(k,y,S)}if(l){const b=h==="y"?"top":"left",w=h==="y"?"bottom":"right",k=m+f[b],S=m-f[w];m=RA(k,m,S)}const x=c.fn({...t,[p]:y,[h]:m});return{...x,data:{x:x.x-r,y:x.y-n,enabled:{[p]:s,[h]:l}}}}}},W5e=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:o,rects:a,middlewareData:s}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=hd(e,t),d={x:r,y:n},f=Gc(o),h=_P(f);let p=d[h],y=d[f];const m=hd(l,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const k=h==="y"?"height":"width",S=a.reference[h]-a.floating[k]+x.mainAxis,_=a.reference[h]+a.reference[k]-x.mainAxis;p_&&(p=_)}if(u){var b,w;const k=h==="y"?"width":"height",S=YY.has(gd(o)),_=a.reference[f]-a.floating[k]+(S&&((b=s.offset)==null?void 0:b[f])||0)+(S?0:x.crossAxis),P=a.reference[f]+a.reference[k]+(S?0:((w=s.offset)==null?void 0:w[f])||0)-(S?x.crossAxis:0);y<_?y=_:y>P&&(y=P)}return{[h]:p,[f]:y}}}},q5e=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:o,rects:a,platform:s,elements:l}=t,{apply:c=()=>{},...u}=hd(e,t),d=await s.detectOverflow(t,u),f=gd(o),h=jv(o),p=Gc(o)==="y",{width:y,height:m}=a.floating;let x,b;f==="top"||f==="bottom"?(x=f,b=h===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,x=h==="end"?"top":"bottom");const w=m-d.top-d.bottom,k=y-d.left-d.right,S=Mf(m-d[x],w),_=Mf(y-d[b],k),P=!t.middlewareData.shift;let O=S,T=_;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(T=k),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(O=w),P&&!h){const I=qs(d.left,0),E=qs(d.right,0),A=qs(d.top,0),F=qs(d.bottom,0);p?T=y-2*(I!==0||E!==0?I+E:qs(d.left,d.right)):O=m-2*(A!==0||F!==0?A+F:qs(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:O});const R=await s.getDimensions(l.floating);return y!==R.width||m!==R.height?{reset:{rects:!0}}:{}}}};function SS(){return typeof window<"u"}function kv(e){return GY(e)?(e.nodeName||"").toLowerCase():"#document"}function Qs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function lu(e){var t;return(t=(GY(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function GY(e){return SS()?e instanceof Node||e instanceof Qs(e).Node:!1}function dc(e){return SS()?e instanceof Element||e instanceof Qs(e).Element:!1}function _d(e){return SS()?e instanceof HTMLElement||e instanceof Qs(e).HTMLElement:!1}function M7(e){return!SS()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qs(e).ShadowRoot}function kb(e){const{overflow:t,overflowX:r,overflowY:n,display:o}=fc(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&o!=="inline"&&o!=="contents"}function $5e(e){return/^(table|td|th)$/.test(kv(e))}function jS(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const U5e=/transform|translate|scale|rotate|perspective|filter/,H5e=/paint|layout|strict|content/,Pp=e=>!!e&&e!=="none";let F4;function AP(e){const t=dc(e)?fc(e):e;return Pp(t.transform)||Pp(t.translate)||Pp(t.scale)||Pp(t.rotate)||Pp(t.perspective)||!TP()&&(Pp(t.backdropFilter)||Pp(t.filter))||U5e.test(t.willChange||"")||H5e.test(t.contain||"")}function V5e(e){let t=Df(e);for(;_d(t)&&!Gm(t);){if(AP(t))return t;if(jS(t))return null;t=Df(t)}return null}function TP(){return F4==null&&(F4=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),F4}function Gm(e){return/^(html|body|#document)$/.test(kv(e))}function fc(e){return Qs(e).getComputedStyle(e)}function kS(e){return dc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Df(e){if(kv(e)==="html")return e;const t=e.assignedSlot||e.parentNode||M7(e)&&e.host||lu(e);return M7(t)?t.host:t}function KY(e){const t=Df(e);return Gm(t)?e.ownerDocument?e.ownerDocument.body:e.body:_d(t)&&kb(t)?t:KY(t)}function $x(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=KY(e),a=o===((n=e.ownerDocument)==null?void 0:n.body),s=Qs(o);if(a){const l=FA(s);return t.concat(s,s.visualViewport||[],kb(o)?o:[],l&&r?$x(l):[])}else return t.concat(o,$x(o,[],r))}function FA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function QY(e){const t=fc(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=_d(e),a=o?e.offsetWidth:r,s=o?e.offsetHeight:n,l=V2(r)!==a||V2(n)!==s;return l&&(r=a,n=s),{width:r,height:n,$:l}}function PP(e){return dc(e)?e:e.contextElement}function im(e){const t=PP(e);if(!_d(t))return Zc(1);const r=t.getBoundingClientRect(),{width:n,height:o,$:a}=QY(t);let s=(a?V2(r.width):r.width)/n,l=(a?V2(r.height):r.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const Y5e=Zc(0);function XY(e){const t=Qs(e);return!TP()||!t.visualViewport?Y5e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function G5e(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Qs(e)?!1:t}function bh(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),a=PP(e);let s=Zc(1);t&&(n?dc(n)&&(s=im(n)):s=im(e));const l=G5e(a,r,n)?XY(a):Zc(0);let c=(o.left+l.x)/s.x,u=(o.top+l.y)/s.y,d=o.width/s.x,f=o.height/s.y;if(a){const h=Qs(a),p=n&&dc(n)?Qs(n):n;let y=h,m=FA(y);for(;m&&n&&p!==y;){const x=im(m),b=m.getBoundingClientRect(),w=fc(m),k=b.left+(m.clientLeft+parseFloat(w.paddingLeft))*x.x,S=b.top+(m.clientTop+parseFloat(w.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,f*=x.y,c+=k,u+=S,y=Qs(m),m=FA(y)}}return G2({width:d,height:f,x:c,y:u})}function _S(e,t){const r=kS(e).scrollLeft;return t?t.left+r:bh(lu(e)).left+r}function ZY(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-_S(e,r),o=r.top+t.scrollTop;return{x:n,y:o}}function K5e(e){let{elements:t,rect:r,offsetParent:n,strategy:o}=e;const a=o==="fixed",s=lu(n),l=t?jS(t.floating):!1;if(n===s||l&&a)return r;let c={scrollLeft:0,scrollTop:0},u=Zc(1);const d=Zc(0),f=_d(n);if((f||!f&&!a)&&((kv(n)!=="body"||kb(s))&&(c=kS(n)),f)){const p=bh(n);u=im(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}const h=s&&!f&&!a?ZY(s,c):Zc(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+h.x,y:r.y*u.y-c.scrollTop*u.y+d.y+h.y}}function Q5e(e){return Array.from(e.getClientRects())}function X5e(e){const t=lu(e),r=kS(e),n=e.ownerDocument.body,o=qs(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),a=qs(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+_S(e);const l=-r.scrollTop;return fc(n).direction==="rtl"&&(s+=qs(t.clientWidth,n.clientWidth)-o),{width:o,height:a,x:s,y:l}}const D7=25;function Z5e(e,t){const r=Qs(e),n=lu(e),o=r.visualViewport;let a=n.clientWidth,s=n.clientHeight,l=0,c=0;if(o){a=o.width,s=o.height;const d=TP();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=_S(n);if(u<=0){const d=n.ownerDocument,f=d.body,h=getComputedStyle(f),p=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,y=Math.abs(n.clientWidth-f.clientWidth-p);y<=D7&&(a-=y)}else u<=D7&&(a+=u);return{width:a,height:s,x:l,y:c}}function J5e(e,t){const r=bh(e,!0,t==="fixed"),n=r.top+e.clientTop,o=r.left+e.clientLeft,a=_d(e)?im(e):Zc(1),s=e.clientWidth*a.x,l=e.clientHeight*a.y,c=o*a.x,u=n*a.y;return{width:s,height:l,x:c,y:u}}function z7(e,t,r){let n;if(t==="viewport")n=Z5e(e,r);else if(t==="document")n=X5e(lu(e));else if(dc(t))n=J5e(t,r);else{const o=XY(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return G2(n)}function JY(e,t){const r=Df(e);return r===t||!dc(r)||Gm(r)?!1:fc(r).position==="fixed"||JY(r,t)}function eke(e,t){const r=t.get(e);if(r)return r;let n=$x(e,[],!1).filter(l=>dc(l)&&kv(l)!=="body"),o=null;const a=fc(e).position==="fixed";let s=a?Df(e):e;for(;dc(s)&&!Gm(s);){const l=fc(s),c=AP(s);!c&&l.position==="fixed"&&(o=null),(a?!c&&!o:!c&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||kb(s)&&!c&&JY(e,s))?n=n.filter(d=>d!==s):o=l,s=Df(s)}return t.set(e,n),n}function tke(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e;const s=[...r==="clippingAncestors"?jS(t)?[]:eke(t,this._c):[].concat(r),n],l=z7(t,s[0],o);let c=l.top,u=l.right,d=l.bottom,f=l.left;for(let h=1;h{s(!1,1e-7)},1e3)}O===1&&!tG(u,e.getBoundingClientRect())&&s(),S=!1}try{r=new IntersectionObserver(_,{...k,root:o.ownerDocument})}catch{r=new IntersectionObserver(_,k)}r.observe(e)}return s(!0),a}function lke(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=PP(e),d=o||a?[...u?$x(u):[],...t?$x(t):[]]:[];d.forEach(b=>{o&&b.addEventListener("scroll",r,{passive:!0}),a&&b.addEventListener("resize",r)});const f=u&&l?ske(u,r):null;let h=-1,p=null;s&&(p=new ResizeObserver(b=>{let[w]=b;w&&w.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(t)})),r()}),u&&!c&&p.observe(u),t&&p.observe(t));let y,m=c?bh(e):null;c&&x();function x(){const b=bh(e);m&&!tG(m,b)&&r(),m=b,y=requestAnimationFrame(x)}return r(),()=>{var b;d.forEach(w=>{o&&w.removeEventListener("scroll",r),a&&w.removeEventListener("resize",r)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(y)}}const cke=z5e,uke=B5e,dke=F5e,fke=q5e,pke=M5e,W7=L5e,hke=W5e,gke=(e,t,r)=>{const n=new Map,o={platform:ake,...r},a={...o.platform,_c:n};return R5e(e,t,{...o,platform:a})};var mke=typeof document<"u",vke=function(){},x0=mke?j.useLayoutEffect:vke;function K2(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!K2(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=r;n--!==0;){const a=o[n];if(!(a==="_owner"&&e.$$typeof)&&!K2(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function rG(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function q7(e,t){const r=rG(e);return Math.round(t*r)/r}function D4(e){const t=j.useRef(e);return x0(()=>{t.current=e}),t}function yke(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:a,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=j.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=j.useState(n);K2(h,n)||p(n);const[y,m]=j.useState(null),[x,b]=j.useState(null),w=j.useCallback(U=>{U!==P.current&&(P.current=U,m(U))},[]),k=j.useCallback(U=>{U!==O.current&&(O.current=U,b(U))},[]),S=a||y,_=s||x,P=j.useRef(null),O=j.useRef(null),T=j.useRef(d),R=c!=null,I=D4(c),E=D4(o),A=D4(u),F=j.useCallback(()=>{if(!P.current||!O.current)return;const U={placement:t,strategy:r,middleware:h};E.current&&(U.platform=E.current),gke(P.current,O.current,U).then(ee=>{const H={...ee,isPositioned:A.current!==!1};L.current&&!K2(T.current,H)&&(T.current=H,k6.flushSync(()=>{f(H)}))})},[h,t,r,E,A]);x0(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(U=>({...U,isPositioned:!1})))},[u]);const L=j.useRef(!1);x0(()=>(L.current=!0,()=>{L.current=!1}),[]),x0(()=>{if(S&&(P.current=S),_&&(O.current=_),S&&_){if(I.current)return I.current(S,_,F);F()}},[S,_,F,I,R]);const z=j.useMemo(()=>({reference:P,floating:O,setReference:w,setFloating:k}),[w,k]),V=j.useMemo(()=>({reference:S,floating:_}),[S,_]),Q=j.useMemo(()=>{const U={position:r,left:0,top:0};if(!V.floating)return U;const ee=q7(V.floating,d.x),H=q7(V.floating,d.y);return l?{...U,transform:"translate("+ee+"px, "+H+"px)",...rG(V.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:ee,top:H}},[r,l,V.floating,d.x,d.y]);return j.useMemo(()=>({...d,update:F,refs:z,elements:V,floatingStyles:Q}),[d,F,z,V,Q])}const xke=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:o}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?W7({element:n.current,padding:o}).fn(r):{}:n?W7({element:n,padding:o}).fn(r):{}}}},bke=(e,t)=>{const r=cke(e);return{name:r.name,fn:r.fn,options:[e,t]}},wke=(e,t)=>{const r=uke(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ske=(e,t)=>({fn:hke(e).fn,options:[e,t]}),jke=(e,t)=>{const r=dke(e);return{name:r.name,fn:r.fn,options:[e,t]}},kke=(e,t)=>{const r=fke(e);return{name:r.name,fn:r.fn,options:[e,t]}},_ke=(e,t)=>{const r=pke(e);return{name:r.name,fn:r.fn,options:[e,t]}},Cke=(e,t)=>{const r=xke(e);return{name:r.name,fn:r.fn,options:[e,t]}};var Eke="Arrow",nG=j.forwardRef((e,t)=>{const{children:r,width:n=10,height:o=5,...a}=e;return i.jsx(ya.svg,{...a,ref:t,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});nG.displayName=Eke;var Ake=nG;function iG(e){const[t,r]=j.useState(void 0);return uh(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let s,l;if("borderBoxSize"in a){const c=a.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,l=u.blockSize}else s=e.offsetWidth,l=e.offsetHeight;r({width:s,height:l})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var OP="Popper",[oG,aG]=Rw(OP),[Tke,sG]=oG(OP),lG=e=>{const{__scopePopper:t,children:r}=e,[n,o]=j.useState(null);return i.jsx(Tke,{scope:t,anchor:n,onAnchorChange:o,children:r})};lG.displayName=OP;var cG="PopperAnchor",uG=j.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...o}=e,a=sG(cG,r),s=j.useRef(null),l=Nl(t,s);return j.useEffect(()=>{a.onAnchorChange((n==null?void 0:n.current)||s.current)}),n?null:i.jsx(ya.div,{...o,ref:l})});uG.displayName=cG;var IP="PopperContent",[Pke,Oke]=oG(IP),dG=j.forwardRef((e,t)=>{var G,re,J,ae,le,me;const{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:a="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:y,...m}=e,x=sG(IP,r),[b,w]=j.useState(null),k=Nl(t,Oe=>w(Oe)),[S,_]=j.useState(null),P=iG(S),O=(P==null?void 0:P.width)??0,T=(P==null?void 0:P.height)??0,R=n+(a!=="center"?"-"+a:""),I=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},E=Array.isArray(u)?u:[u],A=E.length>0,F={padding:I,boundary:E.filter(Nke),altBoundary:A},{refs:L,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:U}=yke({strategy:"fixed",placement:R,whileElementsMounted:(...Oe)=>lke(...Oe,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[bke({mainAxis:o+T,alignmentAxis:s}),c&&wke({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Ske():void 0,...F}),c&&jke({...F}),kke({...F,apply:({elements:Oe,rects:we,availableWidth:ie,availableHeight:Me})=>{const{width:ke,height:se}=we.reference,fe=Oe.floating.style;fe.setProperty("--radix-popper-available-width",`${ie}px`),fe.setProperty("--radix-popper-available-height",`${Me}px`),fe.setProperty("--radix-popper-anchor-width",`${ke}px`),fe.setProperty("--radix-popper-anchor-height",`${se}px`)}}),S&&Cke({element:S,padding:l}),Rke({arrowWidth:O,arrowHeight:T}),h&&_ke({strategy:"referenceHidden",...F})]}),[ee,H]=hG(V),B=Lf(y);uh(()=>{Q&&(B==null||B())},[Q,B]);const M=(G=U.arrow)==null?void 0:G.x,$=(re=U.arrow)==null?void 0:re.y,q=((J=U.arrow)==null?void 0:J.centerOffset)!==0,[Y,K]=j.useState();return uh(()=>{b&&K(window.getComputedStyle(b).zIndex)},[b]),i.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[(ae=U.transformOrigin)==null?void 0:ae.x,(le=U.transformOrigin)==null?void 0:le.y].join(" "),...((me=U.hide)==null?void 0:me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(Pke,{scope:r,placedSide:ee,onArrowChange:_,arrowX:M,arrowY:$,shouldHideArrow:q,children:i.jsx(ya.div,{"data-side":ee,"data-align":H,...m,ref:k,style:{...m.style,animation:Q?void 0:"none"}})})})});dG.displayName=IP;var fG="PopperArrow",Ike={top:"bottom",right:"left",bottom:"top",left:"right"},pG=j.forwardRef(function(t,r){const{__scopePopper:n,...o}=t,a=Oke(fG,n),s=Ike[a.placedSide];return i.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:i.jsx(Ake,{...o,ref:r,style:{...o.style,display:"block"}})})});pG.displayName=fG;function Nke(e){return e!==null}var Rke=e=>({name:"transformOrigin",options:e,fn(t){var x,b,w;const{placement:r,rects:n,middlewareData:o}=t,s=((x=o.arrow)==null?void 0:x.centerOffset)!==0,l=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[u,d]=hG(r),f={start:"0%",center:"50%",end:"100%"}[d],h=(((b=o.arrow)==null?void 0:b.x)??0)+l/2,p=(((w=o.arrow)==null?void 0:w.y)??0)+c/2;let y="",m="";return u==="bottom"?(y=s?f:`${h}px`,m=`${-c}px`):u==="top"?(y=s?f:`${h}px`,m=`${n.floating.height+c}px`):u==="right"?(y=`${-c}px`,m=s?f:`${p}px`):u==="left"&&(y=`${n.floating.width+c}px`,m=s?f:`${p}px`),{data:{x:y,y:m}}}});function hG(e){const[t,r="center"]=e.split("-");return[t,r]}var Lke=lG,gG=uG,Fke=dG,Mke=pG,NP="Popover",[mG]=Rw(NP,[aG]),_b=aG(),[Dke,Kf]=mG(NP),vG=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:o,onOpenChange:a,modal:s=!1}=e,l=_b(t),c=j.useRef(null),[u,d]=j.useState(!1),[f=!1,h]=W6({prop:n,defaultProp:o,onChange:a});return i.jsx(Lke,{...l,children:i.jsx(Dke,{scope:t,contentId:h0(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:j.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:u,onCustomAnchorAdd:j.useCallback(()=>d(!0),[]),onCustomAnchorRemove:j.useCallback(()=>d(!1),[]),modal:s,children:r})})};vG.displayName=NP;var yG="PopoverAnchor",zke=j.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=Kf(yG,r),a=_b(r),{onCustomAnchorAdd:s,onCustomAnchorRemove:l}=o;return j.useEffect(()=>(s(),()=>l()),[s,l]),i.jsx(gG,{...a,...n,ref:t})});zke.displayName=yG;var xG="PopoverTrigger",bG=j.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=Kf(xG,r),a=_b(r),s=Nl(t,o.triggerRef),l=i.jsx(ya.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":_G(o.open),...n,ref:s,onClick:ps(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:i.jsx(gG,{asChild:!0,...a,children:l})});bG.displayName=xG;var RP="PopoverPortal",[Bke,Wke]=mG(RP,{forceMount:void 0}),wG=e=>{const{__scopePopover:t,forceMount:r,children:n,container:o}=e,a=Kf(RP,t);return i.jsx(Bke,{scope:t,forceMount:r,children:i.jsx(cv,{present:r||a.open,children:i.jsx(U6,{asChild:!0,container:o,children:n})})})};wG.displayName=RP;var Km="PopoverContent",SG=j.forwardRef((e,t)=>{const r=Wke(Km,e.__scopePopover),{forceMount:n=r.forceMount,...o}=e,a=Kf(Km,e.__scopePopover);return i.jsx(cv,{present:n||a.open,children:a.modal?i.jsx(qke,{...o,ref:t}):i.jsx($ke,{...o,ref:t})})});SG.displayName=Km;var qke=j.forwardRef((e,t)=>{const r=Kf(Km,e.__scopePopover),n=j.useRef(null),o=Nl(t,n),a=j.useRef(!1);return j.useEffect(()=>{const s=n.current;if(s)return Vq(s)},[]),i.jsx(H6,{as:Lw,allowPinchZoom:!0,children:i.jsx(jG,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ps(e.onCloseAutoFocus,s=>{var l;s.preventDefault(),a.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ps(e.onPointerDownOutside,s=>{const l=s.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:ps(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),$ke=j.forwardRef((e,t)=>{const r=Kf(Km,e.__scopePopover),n=j.useRef(!1),o=j.useRef(!1);return i.jsx(jG,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var s,l;(s=e.onCloseAutoFocus)==null||s.call(e,a),a.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),a.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:a=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=a.target;((u=r.triggerRef.current)==null?void 0:u.contains(s))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),jG=j.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=e,h=Kf(Km,r),p=_b(r);return Mq(),i.jsx($6,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:a,children:i.jsx(q6,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:i.jsx(Fke,{"data-state":_G(h.open),role:"dialog",id:h.contentId,...p,...f,ref:t,style:{...f.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)"}})})})}),kG="PopoverClose",Uke=j.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=Kf(kG,r);return i.jsx(ya.button,{type:"button",...n,ref:t,onClick:ps(e.onClick,()=>o.onOpenChange(!1))})});Uke.displayName=kG;var Hke="PopoverArrow",Vke=j.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=_b(r);return i.jsx(Mke,{...o,...n,ref:t})});Vke.displayName=Hke;function _G(e){return e?"open":"closed"}var Yke=vG,Gke=bG,Kke=wG,Qke=SG;function Xke({...e}){return i.jsx(Yke,{"data-slot":"popover",...e})}function Zke({...e}){return i.jsx(Gke,{"data-slot":"popover-trigger",...e})}function Jke({className:e,align:t="center",sideOffset:r=4,...n}){return i.jsx(Kke,{children:i.jsx(Qke,{"data-slot":"popover-content",align:t,sideOffset:r,className:Xo("bg-popover text-popover-foreground 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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...n})})}const $7="eventbuzz_setup_checklist_dismissed",e_e=["organisation","event","session","team","notifications"];function t_e(e){return e?[e.description,e.email,e.phone,e.website,e.address,e.logo,e.timezone,e.dateFormat,e.language].some(r=>r!=null&&String(r).trim()!==""):!1}function r_e(e,t){return e.some(r=>String(r._id)!==String(t))}function n_e(e){return e_e.every(t=>e[t]===!0)}function i_e(e){const t=String(e||"conference").toLowerCase().replace(/[\s_-]+/g,"");return{conference:"Conference",workshop:"Workshop",summit:"Summit",cme:"CME",webinar:"Webinar"}[t]||"Conference"}function o_e(e){const t=String(e||"draft").toLowerCase();return{live:"Live",upcoming:"Upcoming",completed:"Completed",draft:"Draft"}[t]||"Draft"}function Q2(e){return(typeof e=="string"?new Date(e):e).toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"})}function a_e(e,t){var c,u,d;const r=o_e(e.status),n=i_e(e.type),o=(e.locationType||"physical").toLowerCase(),a=o==="virtual"?"Virtual":o==="hybrid"?"Hybrid":"Physical",s=typeof e.startDate=="string"?e.startDate:new Date(e.startDate).toISOString(),l=typeof e.endDate=="string"?e.endDate:new Date(e.endDate).toISOString();return{id:e._id,name:e.name,subtitle:e.subtitle,categoryId:t,type:n,status:r,startDate:s,endDate:l,location:e.location||"",locationType:a,participants:0,sessions:0,totalRevenue:(c=e.metadata)==null?void 0:c.totalRevenue,rating:(u=e.metadata)==null?void 0:u.rating,ratingCount:(d=e.metadata)==null?void 0:d.ratingCount}}function s_e(e){return[{id:"all",name:"All Events",description:"",accent:"var(--chart-1)",events:e.map(n=>a_e(n,"all"))}]}const LP={Live:{bg:"#dcfce7",color:"#15803d",label:"Live"},Upcoming:{bg:"#dbeafe",color:"#1d4ed8",label:"Upcoming"},Completed:{bg:"#f1f5f9",color:"#475569",label:"Completed"},Draft:{bg:"#ffedd5",color:"#c2410c",label:"Draft"}},l_e={Conference:{bg:"#ede9fe",color:"#5b21b6"},Workshop:{bg:"#ffedd5",color:"#c2410c"},Summit:{bg:"#fce7f3",color:"#be185d"},CME:{bg:"#ccfbf1",color:"#0d9488"},Webinar:{bg:"#e0e7ff",color:"#3730a3"}},c_e={bg:"#f1f5f9",color:"#475569"},FP={bg:"#f1f5f9",color:"#475569",label:"Unknown"},MP={Physical:i.jsx(nb,{size:11}),Virtual:i.jsx(ud,{size:11}),Hybrid:i.jsx(B6,{size:11})};function DP({status:e}){const t=LP[e]??FP;return i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"999px",background:t.bg,color:t.color,fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:[e==="Live"&&i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"#16a34a",display:"block",animation:"pulse 1.5s infinite"}}),t.label]})}function zP({type:e}){const t=l_e[e]??c_e;return i.jsx("span",{style:{display:"inline-flex",padding:"2px 7px",borderRadius:"3px",background:t.bg,color:t.color,fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:e})}function CG({name:e,accent:t}){return i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 0px",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:t,whiteSpace:"nowrap"},children:[i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:t,display:"block",flexShrink:0}}),e]})}function U7({icon:e,value:t,label:r}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("span",{style:{color:"var(--muted)",display:"flex"},children:e}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",fontWeight:"var(--font-weight-medium)"},children:t}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:r})]})}function u_e({items:e}){const[t,r]=j.useState(!1),n=j.useRef(null);return j.useEffect(()=>{const o=a=>{n.current&&!n.current.contains(a.target)&&r(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[]),i.jsxs("div",{ref:n,style:{position:"relative"},children:[i.jsx("button",{onClick:o=>{o.stopPropagation(),r(a=>!a)},style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"1px solid transparent",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:o=>{o.currentTarget.style.background="var(--secondary)",o.currentTarget.style.borderColor="var(--border)"},onMouseLeave:o=>{t||(o.currentTarget.style.background="transparent",o.currentTarget.style.borderColor="transparent")},children:i.jsx(Tee,{size:14})}),t&&i.jsx("div",{style:{position:"absolute",right:0,top:"calc(100% + 4px)",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",boxShadow:"var(--shadow-md)",zIndex:50,minWidth:"160px",overflow:"hidden"},children:e.map((o,a)=>i.jsxs("button",{onClick:()=>{o.onClick(),r(!1)},style:{width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:"none",border:"none",cursor:"pointer",textAlign:"left",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:o.danger?"var(--destructive)":"var(--card-foreground)",borderBottom:a{s.currentTarget.style.background=o.danger?"#fef2f2":"var(--secondary)"},onMouseLeave:s=>{s.currentTarget.style.background="none"},children:[o.icon," ",o.label]},a))})]})}function EG(e){return e>=1e5?`₹${(e/1e5).toFixed(2)}L`:e>=1e3?`₹${(e/1e3).toFixed(1)}K`:`₹${e}`}function d_e({rating:e,count:t}){const r=Math.floor(e),n=e%1>=.4;return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Rating (",t,")"]}),i.jsx("div",{style:{display:"flex",gap:"1px"},children:[1,2,3,4,5].map(o=>i.jsx(Rf,{size:11,style:{color:o<=r||o===r+1&&n?"#f59e0b":"var(--border)",fill:o<=r||o===r+1&&n?"#f59e0b":"none"}},o))}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",fontWeight:"var(--font-weight-medium)"},children:e.toFixed(1)})]})}function f_e({event:e,accent:t,categoryName:r,onOpen:n}){const[o,a]=j.useState(!1),[s,l]=j.useState("attendance");LP[e.status];const c=(e.status==="Live"||e.status==="Completed")&&e.registeredAttendees!==void 0;return i.jsxs("div",{onClick:n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{background:"var(--card)",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:o?t:"var(--border)",borderRightColor:o?t:"var(--border)",borderBottomColor:o?t:"var(--border)",borderLeftColor:o?t:"var(--border)",borderRadius:"var(--radius-card)",display:"flex",flexDirection:"column",overflow:"hidden",transition:"box-shadow 0.15s, border-color 0.15s, transform 0.15s",boxShadow:o?"var(--elevation-sm)":"none",transform:o?"translateY(-2px)":"translateY(0)",position:"relative",cursor:"pointer"},children:[i.jsxs("div",{style:{padding:"16px 16px 12px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"8px",marginBottom:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"},children:[i.jsx(DP,{status:e.status}),i.jsx(zP,{type:e.type}),i.jsx(CG,{name:r,accent:t})]}),c&&i.jsx("div",{style:{display:"flex",alignItems:"center",flexShrink:0,background:"var(--secondary)",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderRadius:"999px",padding:"2px"},children:["attendance","sales"].map(u=>i.jsx("button",{onClick:d=>{d.stopPropagation(),l(u)},style:{padding:"2px 8px",borderRadius:"999px",border:"none",cursor:"pointer",background:s===u?"var(--primary)":"transparent",color:s===u?"var(--primary-foreground)":"var(--muted)",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:s===u?"var(--font-weight-medium)":"var(--font-weight-normal)",transition:"background 0.15s, color 0.15s"},children:u==="attendance"?"Attendance":"Sales"},u))})]}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.35",marginBottom:"4px"},children:e.name}),e.subtitle&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",lineHeight:"1.4",marginBottom:"8px"},children:e.subtitle}),i.jsxs("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",marginBottom:c?"12px":"0"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx(Wi,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[Q2(e.startDate),e.endDate!==e.startDate?` – ${Q2(e.endDate)}`:""]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("span",{style:{color:"var(--muted)",display:"flex",flexShrink:0},children:MP[e.locationType]}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.location})]})]}),c&&i.jsxs("div",{style:{borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[s==="attendance"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",background:"var(--secondary)",borderBottomStyle:"solid",borderBottomWidth:"1px",borderBottomColor:"var(--border)"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Registered Attendees"}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:e.registeredAttendees})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr"},children:[i.jsxs("div",{style:{padding:"8px 6px",textAlign:"center",borderRightStyle:"solid",borderRightWidth:"1px",borderRightColor:"var(--border)",background:"var(--success-bg)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--success-fg)",lineHeight:"1.2",fontSize:"var(--text-base)"},children:e.attended}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--success-fg-label)",marginTop:"2px"},children:"Attended"})]}),i.jsxs("div",{style:{padding:"8px 6px",textAlign:"center",borderRightStyle:"solid",borderRightWidth:"1px",borderRightColor:"var(--border)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",lineHeight:"1.2",fontSize:"var(--text-base)"},children:e.notAttended}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px"},children:"Absent"})]}),i.jsxs("div",{style:{padding:"8px 6px",textAlign:"center"},children:[i.jsxs("p",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",lineHeight:"1.2",fontSize:"var(--text-base)",color:e.attendancePct!==void 0?e.attendancePct>=75?"#15803d":e.attendancePct>=50?"#d97706":"var(--destructive)":"var(--card-foreground)"},children:[e.attendancePct,"%"]}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px"},children:"% Rate"})]})]})]}):i.jsx(i.Fragment,{children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 10px",background:e.totalRevenue&&e.totalRevenue>0?"rgba(11, 77, 209, 0.04)":"var(--secondary)"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"var(--radius-button)",background:e.totalRevenue&&e.totalRevenue>0?"rgba(11, 77, 209, 0.1)":"var(--border)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx(D6,{size:13,style:{color:e.totalRevenue&&e.totalRevenue>0?"var(--primary)":"var(--muted)"}})}),i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:e.totalRevenue&&e.totalRevenue>0?"var(--primary)":"var(--muted)",lineHeight:"1.1",fontSize:"var(--text-base)"},children:e.totalRevenue&&e.totalRevenue>0?EG(e.totalRevenue):"Free event"}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px"},children:e.totalRevenue&&e.totalRevenue>0?"Total Revenue Earned":"No paid tickets"})]})]})}),e.rating!==void 0&&e.ratingCount!==void 0&&i.jsx("div",{style:{padding:"6px 10px",borderTopStyle:"solid",borderTopWidth:"1px",borderTopColor:"var(--border)",background:"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(d_e,{rating:e.rating,count:e.ratingCount})})]})]}),i.jsxs("div",{style:{padding:"10px 16px",borderTopWidth:"1px",borderTopStyle:"solid",borderTopColor:"var(--border)",background:"var(--secondary)",display:"flex",alignItems:"center",gap:"12px",marginTop:"auto"},children:[i.jsx(U7,{icon:i.jsx(vi,{size:11}),value:e.participants>0?e.participants:"—",label:e.participants===1?"participant":"participants"}),i.jsx(U7,{icon:i.jsx(Wi,{size:11}),value:e.sessions>0?e.sessions:"—",label:"sessions"})]})]})}function p_e({event:e,categoryName:t,accent:r,onOpen:n}){const[o,a]=j.useState(!1),[s,l]=j.useState(!1),c=(e.status==="Live"||e.status==="Completed")&&e.registeredAttendees!==void 0;LP[e.status];const u=o?"var(--secondary)":e.isCurrent?"var(--accent)":"transparent";return i.jsxs(i.Fragment,{children:[i.jsxs("tr",{onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{background:u,transition:"background 0.12s",borderBottomStyle:"solid",borderBottomWidth:"1px",borderBottomColor:s?"transparent":"var(--border)"},children:[i.jsx("td",{style:{padding:"11px 8px 11px 12px",width:"32px"},children:c?i.jsx("button",{onClick:()=>l(d=>!d),title:s?"Collapse attendance & sales details":"Expand attendance & sales details","aria-expanded":s,"aria-label":s?"Collapse details":"Expand details",style:{width:"22px",height:"22px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",cursor:"pointer",background:s?"var(--primary)":"var(--secondary)",borderStyle:"solid",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:s?"var(--primary)":"var(--border)",borderRightColor:s?"var(--primary)":"var(--border)",borderBottomColor:s?"var(--primary)":"var(--border)",borderLeftColor:s?"var(--primary)":"var(--border)",color:s?"var(--primary-foreground)":"var(--muted)",transition:"background 0.15s, color 0.15s, border-top-color 0.15s, border-right-color 0.15s, border-bottom-color 0.15s, border-left-color 0.15s",flexShrink:0},children:s?i.jsx($f,{size:12}):i.jsx(po,{size:12})}):i.jsx("span",{style:{width:"22px",height:"22px",display:"block"}})}),i.jsx("td",{style:{padding:"11px 16px 11px 4px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.isCurrent&&i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--primary)",display:"block",flexShrink:0}}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.3"},children:e.name}),e.subtitle&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"1px"},children:e.subtitle})]})]})}),i.jsx("td",{style:{padding:"11px 12px",whiteSpace:"nowrap"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"},children:[i.jsx(zP,{type:e.type}),i.jsx(CG,{name:t,accent:r})]})}),i.jsx("td",{style:{padding:"11px 12px",whiteSpace:"nowrap"},children:i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[Q2(e.startDate),e.endDate!==e.startDate?` – ${Q2(e.endDate)}`:""]})}),i.jsx("td",{style:{padding:"11px 12px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx("span",{style:{color:"var(--muted)",display:"flex"},children:MP[e.locationType]}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.location})]})}),i.jsx("td",{style:{padding:"11px 12px",whiteSpace:"nowrap"},children:i.jsx(DP,{status:e.status})}),i.jsx("td",{style:{padding:"11px 12px",textAlign:"right"},children:i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:e.participants>0?e.participants.toLocaleString():"—"})}),i.jsx("td",{style:{padding:"11px 12px",textAlign:"right"},children:i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.sessions>0?e.sessions:"—"})}),i.jsx("td",{style:{padding:"11px 16px 11px 8px",whiteSpace:"nowrap"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",opacity:o?1:0,transition:"opacity 0.15s"},children:[i.jsxs("button",{onClick:n,style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:d=>{d.currentTarget.style.borderColor="var(--primary)",d.currentTarget.style.color="var(--primary)"},onMouseLeave:d=>{d.currentTarget.style.borderColor="var(--border)",d.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(av,{size:11})," Open"]}),i.jsx(u_e,{items:[{label:"Duplicate",icon:i.jsx(iu,{size:13}),onClick:()=>{}},{label:"Edit",icon:i.jsx(Ii,{size:13}),onClick:()=>{}},{label:"Delete",icon:i.jsx(gn,{size:13}),danger:!0,onClick:()=>{window.confirm("Delete this event? This cannot be undone.")}}]})]})})]}),c&&s&&i.jsx("tr",{style:{borderBottomStyle:"solid",borderBottomWidth:"1px",borderBottomColor:"var(--border)",background:"var(--card)"},children:i.jsx("td",{colSpan:9,style:{padding:"0 16px 14px 48px",background:"var(--accent)"},children:(()=>{const d=e.attendancePct??0,f=d>=75?"#15803d":d>=50?"#d97706":"var(--destructive)",h=e.totalRevenue!==void 0&&e.totalRevenue>0,p=e.rating!==void 0&&e.ratingCount!==void 0;return i.jsxs("div",{style:{display:"flex",alignItems:"center",background:"var(--secondary)",borderTopWidth:"1px",borderTopStyle:"solid",borderTopColor:"var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 12px",flexShrink:0},children:[i.jsx(vi,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",whiteSpace:"nowrap"},children:[i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:e.registeredAttendees})," ","reg."]})]}),i.jsx("div",{style:{width:"1px",height:"28px",background:"var(--border)",flexShrink:0}}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"7px 12px",flex:"1 1 0",minWidth:0},children:[i.jsx("div",{style:{flex:"1 1 60px",minWidth:"40px",maxWidth:"100px",height:"5px",borderRadius:"999px",background:"var(--border)",overflow:"hidden",flexShrink:0},children:i.jsx("div",{style:{height:"100%",borderRadius:"999px",width:`${d}%`,background:f,transition:"width 0.4s ease"}})}),i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:f,whiteSpace:"nowrap",flexShrink:0},children:[d,"%"]}),i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"#15803d",whiteSpace:"nowrap",flexShrink:0},children:[i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"#16a34a",display:"inline-block",flexShrink:0}}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)"},children:e.attended})," ","attended"]}),i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",whiteSpace:"nowrap",flexShrink:0},children:[i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"var(--muted-foreground)",display:"inline-block",flexShrink:0}}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:e.notAttended})," ","absent"]})]}),h&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{width:"1px",height:"28px",background:"var(--border)",flexShrink:0}}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 12px",flexShrink:0},children:[i.jsx(D6,{size:11,style:{color:"var(--primary)",flexShrink:0}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",whiteSpace:"nowrap"},children:[i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--primary)"},children:EG(e.totalRevenue)})," ","revenue"]})]})]}),p&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{width:"1px",height:"28px",background:"var(--border)",flexShrink:0}}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"7px 12px",flexShrink:0},children:[i.jsx(Rf,{size:11,style:{color:"#f59e0b",fill:"#f59e0b",flexShrink:0}}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",whiteSpace:"nowrap"},children:e.rating.toFixed(1)}),i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",whiteSpace:"nowrap"},children:["(",e.ratingCount,")"]})]})]})]})})()})})]})}function h_e({categories:e}){const t=qi(),r=t==="mobile",n=t==="tablet",o=e.flatMap(x=>x.events),a=o.length,s=o.filter(x=>x.status==="Live").length,l=o.filter(x=>x.status==="Upcoming").length,c=o.filter(x=>x.status==="Completed").length,u=o.reduce((x,b)=>x+b.participants,0),d=[{label:"Total Events",value:a,icon:i.jsx(lh,{size:14}),accent:"var(--chart-1)",sub:`${e.length} categor${e.length===1?"y":"ies"}`},{label:"Live Now",value:s,icon:i.jsx(Eq,{size:14}),accent:"#16a34a",sub:"Active right now",pulse:!0},{label:"Upcoming",value:l,icon:i.jsx(ob,{size:14}),accent:"var(--chart-3)",sub:"Scheduled events"},{label:"Completed",value:c,icon:i.jsx(iv,{size:14}),accent:"var(--muted)",sub:"Past events"},{label:"Total Participants",value:u.toLocaleString(),icon:i.jsx(vi,{size:14}),accent:"var(--chart-2)",sub:"Across all events"},{label:"Total Revenue",value:"₹14.2L",icon:i.jsx(D6,{size:14}),accent:"var(--chart-5)",sub:"Till date"}],f=r?"repeat(2, 1fr)":n?"repeat(3, 1fr)":"repeat(6, 1fr)",h=r?"10px 12px":"14px 16px",p=r?28:32,y=r?13:14,m=r?"8px":"12px";return i.jsx("div",{style:{display:"grid",gridTemplateColumns:f,gap:r?"8px":"12px"},children:d.map(x=>i.jsxs("div",{style:{background:"var(--card)",borderStyle:"solid",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"3px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:x.accent,borderRadius:"var(--radius-card)",padding:h,display:"flex",flexDirection:r?"column":"row",alignItems:r?"flex-start":"center",gap:m},children:[i.jsxs("div",{style:{width:`${p}px`,height:`${p}px`,borderRadius:"var(--radius-button)",background:x.accent+"15",display:"flex",alignItems:"center",justifyContent:"center",color:x.accent,flexShrink:0,position:"relative"},children:[ze.cloneElement(x.icon,{size:y}),x.pulse&&i.jsx("span",{style:{position:"absolute",top:"3px",right:"3px",width:"6px",height:"6px",borderRadius:"50%",background:"#16a34a",border:"2px solid var(--card)"}})]}),i.jsxs("div",{style:{minWidth:0},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:r?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.value}),i.jsx("p",{style:{fontSize:r?"10px":"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.label}),!r&&i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:x.pulse?"#16a34a":"var(--muted)",marginTop:"3px"},children:x.sub})]})]},x.label))})}function g_e({categories:e,onOpenEvent:t}){const r=new Date,[n,o]=j.useState(new Date(r.getFullYear(),r.getMonth(),1)),[a,s]=j.useState(null);function l(w){return`${w.getFullYear()}-${String(w.getMonth()+1).padStart(2,"0")}-${String(w.getDate()).padStart(2,"0")}`}const c=l(r),u=j.useMemo(()=>{const w=new Map;return e.forEach(k=>{k.events.forEach(S=>{const _=new Date(S.startDate),P=new Date(S.endDate),O=new Date(_);let T=0;for(;O<=P&&T<60;){const R=l(O);w.has(R)||w.set(R,[]),w.get(R).push({event:S,category:k}),O.setDate(O.getDate()+1),T++}})}),w},[e]),d=n.getFullYear(),f=n.getMonth(),h=new Date(d,f,1).getDay(),p=new Date(d,f+1,0).getDate(),y=[...Array(h).fill(null),...Array.from({length:p},(w,k)=>k+1)];for(;y.length%7!==0;)y.push(null);const m=["January","February","March","April","May","June","July","August","September","October","November","December"],x=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],b=a?e.find(w=>w.id===a.categoryId):null;return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--border)",background:"var(--secondary)"},children:[i.jsx("button",{onClick:()=>o(new Date(d,f-1,1)),style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--card)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderStyle:"solid",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(Nf,{size:13})}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[i.jsxs("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:[m[f]," ",d]}),i.jsx("button",{onClick:()=>o(new Date(r.getFullYear(),r.getMonth(),1)),style:{padding:"3px 10px",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderStyle:"solid",borderRadius:"var(--radius-button)",background:"var(--card)",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Today"})]}),i.jsx("button",{onClick:()=>o(new Date(d,f+1,1)),style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--card)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderStyle:"solid",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(va,{size:13})})]}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",borderBottom:"1px solid var(--border)"},children:x.map(w=>i.jsx("div",{style:{padding:"7px 0",textAlign:"center",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",letterSpacing:"0.04em",textTransform:"uppercase"},children:w},w))}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)"},children:y.map((w,k)=>{const S=k%7,_=k>=y.length-7;if(w===null)return i.jsx("div",{style:{minHeight:"90px",background:"var(--secondary)",borderRightWidth:S<6?"1px":"0",borderRightStyle:"solid",borderRightColor:"var(--border)",borderBottomWidth:_?"0":"1px",borderBottomStyle:"solid",borderBottomColor:"var(--border)"}},`pad-${k}`);const P=l(new Date(d,f,w)),O=u.get(P)||[],T=P===c,R=S===0||S===6;return i.jsxs("div",{style:{minHeight:"90px",padding:"5px",background:R?"var(--secondary)":"var(--card)",borderRightWidth:S<6?"1px":"0",borderRightStyle:"solid",borderRightColor:"var(--border)",borderBottomWidth:_?"0":"1px",borderBottomStyle:"solid",borderBottomColor:"var(--border)"},children:[i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"3px"},children:i.jsx("span",{style:{width:"22px",height:"22px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",background:T?"var(--primary)":"transparent",color:T?"var(--primary-foreground)":R?"var(--muted)":"var(--foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:T?"var(--font-weight-medium)":"var(--font-weight-normal)"},children:w})}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[O.slice(0,3).map(({event:I,category:E})=>i.jsx("button",{title:I.name,onClick:()=>s(A=>(A==null?void 0:A.id)===I.id?null:I),style:{display:"block",width:"100%",textAlign:"left",padding:"2px 5px",borderRadius:"3px",background:(a==null?void 0:a.id)===I.id?E.accent+"30":E.accent+"18",borderLeftWidth:"2px",borderLeftStyle:"solid",borderLeftColor:E.accent,borderTopWidth:"0",borderRightWidth:"0",borderBottomWidth:"0",outlineWidth:(a==null?void 0:a.id)===I.id?"1px":"0",outlineStyle:"solid",outlineColor:E.accent,cursor:"pointer",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:I.name},I.id)),O.length>3&&i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",paddingLeft:"4px"},children:["+",O.length-3," more"]})]})]},P)})})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px",flexWrap:"wrap",padding:"0 2px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)"},children:"Categories:"}),e.map(w=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx("span",{style:{width:"10px",height:"10px",borderRadius:"2px",background:w.accent,flexShrink:0}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:w.name})]},w.id))]}),a&&b&&i.jsxs("div",{style:{background:"var(--card)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"4px",borderStyle:"solid",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:b.accent,borderRadius:"var(--radius-card)",padding:"16px 20px",display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"16px"},children:[i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px",flexWrap:"wrap"},children:[i.jsx(DP,{status:a.status}),i.jsx(zP,{type:a.type}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:b.name})]}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"4px"},children:a.name}),a.subtitle&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"10px"},children:a.subtitle}),i.jsxs("div",{style:{display:"flex",gap:"16px",flexWrap:"wrap"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx(Wi,{size:11,style:{color:"var(--muted)"}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[a.startDate,a.endDate!==a.startDate?` – ${a.endDate}`:""]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx("span",{style:{color:"var(--muted)",display:"flex"},children:MP[a.locationType]}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:a.location})]}),a.participants>0&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx(vi,{size:11,style:{color:"var(--muted)"}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[a.participants.toLocaleString()," participants"]})]})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsxs("button",{onClick:()=>t(a),style:{display:"flex",alignItems:"center",gap:"4px",padding:"6px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:["Open ",i.jsx(O6,{size:11})]}),i.jsx("button",{onClick:()=>s(null),style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--secondary)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderStyle:"solid",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(er,{size:13})})]})]})]})}function m_e({msg:e,onDone:t}){return j.useEffect(()=>{const r=setTimeout(t,3e3);return()=>clearTimeout(r)},[]),i.jsxs("div",{style:{position:"fixed",bottom:"24px",left:"50%",transform:"translateX(-50%)",background:"var(--foreground)",color:"var(--background)",padding:"10px 20px",borderRadius:"var(--radius-button)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",boxShadow:"var(--shadow-xl)",zIndex:200,display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx(av,{size:13})," ",e]})}function v_e({onNavigateToEvent:e}){const{user:t}=Ur(),r=zn(t),{setActiveNav:n,setSelectedEventId:o,setSettingsInitialSection:a,setOpenAgendaSessionPanelOnce:s}=eo(),{theme:l}=lq(),[c,u]=j.useState("card"),[d,f]=j.useState(""),[h,p]=j.useState("All"),[y,m]=j.useState("All"),[x,b]=j.useState("All"),[w,k]=j.useState(!1),[S,_]=j.useState(null),[P,O]=j.useState(void 0),[T,R]=j.useState(!1),[I,E]=j.useState(!1),[A,F]=j.useState([]),[L,z]=j.useState(!0),[V,Q]=j.useState(null),[U,ee]=j.useState(()=>{try{return localStorage.getItem($7)==="1"}catch{return!1}}),[H,B]=j.useState(null),[M,$]=j.useState([]),[q,Y]=j.useState(!1),[K,G]=j.useState(0),re=j.useMemo(()=>s_e(A),[A]),J=(t==null?void 0:t.role)==="super_admin"||(t==null?void 0:t.role)==="admin",ae=j.useMemo(()=>({organisation:t_e(H),event:A.length>=1,session:K>=1,team:J?q?!1:r_e(M,(t==null?void 0:t._id)??""):!1,notifications:!!(t!=null&&t.notificationPreferencesSavedAt)}),[H,A.length,K,J,q,M,t==null?void 0:t._id,t==null?void 0:t.notificationPreferencesSavedAt]);j.useEffect(()=>{var Ie;if(!r||L||V)return;let se=!1;const fe=(Ie=A[0])==null?void 0:Ie._id;return(async()=>{var Ge,Ot,nt;const ce=ls.get().catch(()=>null),je=J?nx.list():Promise.resolve(null),qe=fe?Da.list(fe):Promise.resolve(null),[Ne,Je,vt]=await Promise.all([ce,je,qe]);se||(B(Ne),J&&Je?Je.error?($([]),Y(!0)):($(((Ge=Je.data)==null?void 0:Ge.users)??[]),Y(!1)):($([]),Y(!1)),G(fe&&vt?vt.error?0:((nt=(Ot=vt.data)==null?void 0:Ot.sessions)==null?void 0:nt.length)??0:0))})(),()=>{se=!0}},[r,L,V,J,A]);const le=j.useCallback(()=>{if(z(!0),Q(null),!r){F([]),Q((t==null?void 0:t.role)==="super_admin"?"Assign an organisation to your account to load events for that tenant.":"Your profile has no organisation."),z(!1);return}zr.list({organization:r}).then(se=>{var fe;((fe=se.data)==null?void 0:fe.events)!=null?F(se.data.events):Q(se.error||"Failed to load events")}).catch(()=>Q("Failed to load events")).finally(()=>z(!1))},[r,t==null?void 0:t.role]);j.useEffect(()=>{le()},[le]);const me=j.useMemo(()=>re.flatMap(se=>se.events.map(fe=>({ev:fe,cat:se}))),[re]),Oe=j.useMemo(()=>me.filter(({ev:se,cat:fe})=>{const Ie=d.toLowerCase(),ce=!Ie||se.name.toLowerCase().includes(Ie)||se.location.toLowerCase().includes(Ie)||(se.subtitle||"").toLowerCase().includes(Ie)||fe.name.toLowerCase().includes(Ie),je=h==="All"||se.status===h,qe=y==="All"||se.type===y,Ne=x==="All"||fe.id===x;return ce&&je&&qe&&Ne}),[me,d,h,y,x]),we=Oe.length,ie=h!=="All"||y!=="All"||x!=="All"||!!d,Me=!L&&A.length>0,ke=se=>{e?e(se.id):_(se.isCurrent?`You are already viewing ${se.name}`:`Switching to ${se.name}…`)};return j.useCallback(()=>{try{localStorage.setItem($7,"1")}catch{}ee(!0)},[]),j.useCallback(se=>{var fe;if(se==="organisation"){a("org"),n("settings");return}if(se==="event"){E(!0);return}if(se==="session"){const Ie=(fe=A[0])==null?void 0:fe._id;Ie?(o(Ie),s(!0),n("dashboard")):E(!0);return}if(se==="team"){n("user-management");return}se==="notifications"&&(a("notifications"),n("settings"))},[A,n,o,a,s]),r&&!L&&!V&&!U&&n_e(ae),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"EventBuzz · Organisation"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2",marginBottom:"4px"},children:"All Events"}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[L?"Loading…":V||`${re.length} categor${re.length===1?"y":"ies"} · ${re.flatMap(se=>se.events).length} events`,(P==null?void 0:P.from)&&i.jsx("span",{style:{marginLeft:"8px",color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:"· filtered by date range"})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs(Xke,{open:T,onOpenChange:R,children:[i.jsx(Zke,{asChild:!0,children:i.jsxs("button",{style:{display:"flex",alignItems:"center",gap:"7px",padding:"7px 12px",borderRadius:"var(--radius-button)",background:P!=null&&P.from?"var(--accent)":"var(--secondary)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopColor:P!=null&&P.from?"var(--primary)":"var(--border)",borderRightColor:P!=null&&P.from?"var(--primary)":"var(--border)",borderBottomColor:P!=null&&P.from?"var(--primary)":"var(--border)",borderLeftColor:P!=null&&P.from?"var(--primary)":"var(--border)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",color:P!=null&&P.from?"var(--primary)":"var(--muted)",transition:"border-top-color 0.15s, border-right-color 0.15s, border-bottom-color 0.15s, border-left-color 0.15s, background 0.15s",whiteSpace:"nowrap"},onMouseEnter:se=>{P!=null&&P.from||(se.currentTarget.style.borderTopColor="var(--ring)",se.currentTarget.style.borderRightColor="var(--ring)",se.currentTarget.style.borderBottomColor="var(--ring)",se.currentTarget.style.borderLeftColor="var(--ring)",se.currentTarget.style.color="var(--foreground)")},onMouseLeave:se=>{P!=null&&P.from||(se.currentTarget.style.borderTopColor="var(--border)",se.currentTarget.style.borderRightColor="var(--border)",se.currentTarget.style.borderBottomColor="var(--border)",se.currentTarget.style.borderLeftColor="var(--border)",se.currentTarget.style.color="var(--muted)")},children:[i.jsx(Wi,{size:13,style:{flexShrink:0}}),P!=null&&P.from?i.jsxs("span",{children:[P.from.toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"}),P.to&&P.to.getTime()!==P.from.getTime()?` – ${P.to.toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"})}`:""]}):i.jsx("span",{children:"Select date range"}),P!=null&&P.from?i.jsx("span",{onClick:se=>{se.stopPropagation(),O(void 0)},style:{display:"flex",alignItems:"center",justifyContent:"center",marginLeft:"2px",cursor:"pointer",color:"var(--muted)"},onMouseEnter:se=>{se.currentTarget.style.color="var(--destructive)"},onMouseLeave:se=>{se.currentTarget.style.color="var(--muted)"},children:i.jsx(er,{size:11})}):i.jsx(po,{size:11,style:{flexShrink:0}})]})}),i.jsxs(Jke,{align:"end",sideOffset:6,style:{padding:0,background:"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",borderRadius:"var(--radius-card)",boxShadow:"var(--elevation-sm)",overflow:"hidden",width:"auto"},children:[i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",padding:"10px 12px 8px",borderBottom:"1px solid var(--border)"},children:[{label:"Last 30 days",days:30},{label:"Last 90 days",days:90},{label:"This year",days:365}].map(se=>{var je,qe;const fe=new Date,Ie=new Date;Ie.setDate(Ie.getDate()-se.days);const ce=((je=P==null?void 0:P.from)==null?void 0:je.toDateString())===Ie.toDateString()&&((qe=P==null?void 0:P.to)==null?void 0:qe.toDateString())===fe.toDateString();return i.jsx("button",{onClick:()=>{O({from:Ie,to:fe}),R(!1)},style:{padding:"3px 10px",borderRadius:"999px",background:ce?"var(--primary)":"var(--secondary)",borderWidth:"1px",borderStyle:"solid",borderColor:ce?"var(--primary)":"var(--border)",color:ce?"var(--primary-foreground)":"var(--card-foreground)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",transition:"all 0.12s"},onMouseEnter:Ne=>{ce||(Ne.currentTarget.style.borderColor="var(--primary)",Ne.currentTarget.style.color="var(--primary)")},onMouseLeave:Ne=>{ce||(Ne.currentTarget.style.borderColor="var(--border)",Ne.currentTarget.style.color="var(--card-foreground)")},children:se.label},se.label)})}),i.jsx(S5e,{mode:"range",selected:P,onSelect:O,numberOfMonths:2,defaultMonth:(()=>{const se=new Date;return se.setMonth(se.getMonth()-1),se})(),style:{padding:"8px 12px 12px",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)"}}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:"8px",padding:"8px 12px 10px",borderTop:"1px solid var(--border)"},children:[i.jsx("button",{onClick:()=>{O(void 0),R(!1)},style:{padding:"5px 14px",borderRadius:"var(--radius-button)",background:"transparent",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",color:"var(--card-foreground)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},onMouseEnter:se=>{se.currentTarget.style.borderColor="var(--ring)"},onMouseLeave:se=>{se.currentTarget.style.borderColor="var(--border)"},children:"Clear"}),i.jsx("button",{onClick:()=>R(!1),style:{padding:"5px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"Apply"})]})]})]}),i.jsxs("button",{onClick:()=>E(!0),style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:14})," Create Event"]})]})]}),L&&i.jsx(fh,{message:"Loading events…"}),!L&&V&&i.jsxs("div",{style:{padding:"32px 24px",textAlign:"center",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",background:"var(--card)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginBottom:"12px"},children:V}),i.jsx("button",{type:"button",onClick:()=>le(),style:{padding:"8px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"Retry"})]}),!L&&!V&&!Me&&i.jsxs("div",{style:{textAlign:"center",padding:"48px 24px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)",background:"var(--secondary)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"8px"},children:"No events yet"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"16px",maxWidth:"360px",marginLeft:"auto",marginRight:"auto"},children:"Create an event to see it listed here with stats, filters, and calendar view."}),i.jsxs("button",{type:"button",onClick:()=>E(!0),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:16})," Create your first event"]})]}),!L&&!V&&Me&&i.jsxs(ze.Fragment,{children:[i.jsx(h_e,{categories:re}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)",textTransform:"uppercase",letterSpacing:"0.06em",whiteSpace:"nowrap"},children:"Events"}),i.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}})]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px",padding:"0 10px",height:"34px",flex:"1 1 180px",background:"var(--card)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopColor:w?"var(--ring)":"var(--border)",borderRightColor:w?"var(--ring)":"var(--border)",borderBottomColor:w?"var(--ring)":"var(--border)",borderLeftColor:w?"var(--ring)":"var(--border)",borderRadius:"var(--radius-button)",transition:"border-top-color 0.15s, border-right-color 0.15s, border-bottom-color 0.15s, border-left-color 0.15s"},children:[i.jsx(Pi,{size:13,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:d,onChange:se=>f(se.target.value),placeholder:"Search events…",onFocus:()=>k(!0),onBlur:()=>k(!1),style:{background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",width:"100%"}}),d&&i.jsx("button",{onClick:()=>f(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:0,display:"flex"},children:i.jsx(er,{size:12})})]}),i.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",flexShrink:0},children:[i.jsxs("select",{value:h,onChange:se=>p(se.target.value),style:{height:"34px",paddingLeft:"10px",paddingRight:"28px",appearance:"none",WebkitAppearance:"none",background:h!=="All"?"var(--accent)":"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:h!=="All"?"var(--primary)":"var(--border)",borderRadius:"var(--radius-button)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:h!=="All"?"var(--primary)":"var(--card-foreground)",cursor:"pointer",outline:"none",minWidth:"100px"},children:[i.jsx("option",{value:"All",children:"Status"}),["Live","Upcoming","Completed","Draft"].map(se=>i.jsx("option",{value:se,children:se},se))]}),i.jsx(po,{size:12,style:{position:"absolute",right:"8px",pointerEvents:"none",color:h!=="All"?"var(--primary)":"var(--muted)"}})]}),i.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",flexShrink:0},children:[i.jsxs("select",{value:y,onChange:se=>m(se.target.value),style:{height:"34px",paddingLeft:"10px",paddingRight:"28px",appearance:"none",WebkitAppearance:"none",background:y!=="All"?"var(--accent)":"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:y!=="All"?"var(--primary)":"var(--border)",borderRadius:"var(--radius-button)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:y!=="All"?"var(--primary)":"var(--card-foreground)",cursor:"pointer",outline:"none",minWidth:"110px"},children:[i.jsx("option",{value:"All",children:"Type"}),["Conference","Workshop","Summit","CME","Webinar"].map(se=>i.jsx("option",{value:se,children:se},se))]}),i.jsx(po,{size:12,style:{position:"absolute",right:"8px",pointerEvents:"none",color:y!=="All"?"var(--primary)":"var(--muted)"}})]}),(()=>{const se=x!=="All"?re.find(fe=>fe.id===x):null;return i.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",flexShrink:0},children:[se&&i.jsx("span",{style:{position:"absolute",left:"10px",width:"7px",height:"7px",borderRadius:"50%",background:se.accent,flexShrink:0,zIndex:1,pointerEvents:"none"}}),i.jsxs("select",{value:x,onChange:fe=>b(fe.target.value),style:{height:"34px",paddingLeft:se?"24px":"10px",paddingRight:"28px",appearance:"none",WebkitAppearance:"none",background:se?se.accent+"18":"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:se?se.accent:"var(--border)",borderRadius:"var(--radius-button)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:se?se.accent:"var(--card-foreground)",cursor:"pointer",outline:"none",minWidth:"120px"},children:[i.jsx("option",{value:"All",children:"Category"}),re.map(fe=>i.jsx("option",{value:fe.id,children:fe.name},fe.id))]}),i.jsx(po,{size:12,style:{position:"absolute",right:"8px",pointerEvents:"none",color:se?se.accent:"var(--muted)"}})]})})(),ie&&i.jsxs("button",{onClick:()=>{f(""),p("All"),m("All"),b("All")},style:{display:"flex",alignItems:"center",gap:"4px",padding:"0 10px",height:"34px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",flexShrink:0},children:[i.jsx(er,{size:11})," Clear"]}),i.jsx("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"6px"},children:i.jsx("div",{style:{display:"flex",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden",background:"var(--card)"},children:["card","list","calendar"].map(se=>i.jsxs("button",{onClick:()=>u(se),style:{display:"flex",alignItems:"center",gap:"4px",padding:"5px 10px",background:c===se?"var(--primary)":"transparent",color:c===se?"#fff":"var(--muted)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",borderLeft:se!=="card"?"1px solid var(--border)":"none"},children:[se==="card"?i.jsx(ab,{size:13}):se==="list"?i.jsx(sb,{size:13}):i.jsx(Wi,{size:13}),se==="card"?"Cards":se==="list"?"List":"Calendar"]},se))})})]})}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Showing ",i.jsx("strong",{style:{color:"var(--foreground)",fontFamily:"var(--font-inter)"},children:we})," event",we!==1?"s":"",ie&&i.jsx("span",{style:{color:"var(--primary)",marginLeft:"6px"},children:"· filtered"})]}),c==="calendar"?i.jsx(g_e,{categories:re,onOpenEvent:ke}):Oe.length===0?i.jsxs("div",{style:{textAlign:"center",padding:"60px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(Pi,{size:28,style:{color:"var(--border)",margin:"0 auto 12px"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"No events match your filters"}),i.jsxs("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"16px"},children:[d?`No results for "${d}". `:"","Try adjusting your status, type, or category filters."]}),i.jsxs("button",{onClick:()=>{f(""),p("All"),m("All"),b("All")},style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"6px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(er,{size:12})," Clear all filters"]})]}):c==="card"?i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(288px, 1fr))",gap:"14px"},children:Oe.map(({ev:se,cat:fe})=>i.jsx(f_e,{event:se,accent:fe.accent,categoryName:fe.name,onOpen:()=>ke(se)},se.id))}):i.jsx("div",{style:{background:"var(--card)",borderStyle:"solid",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsx("tr",{style:{background:"var(--secondary)",borderBottomStyle:"solid",borderBottomWidth:"1px",borderBottomColor:"var(--border)"},children:["","Event","Type / Category","Dates","Location","Status","Participants","Sessions",""].map((se,fe)=>i.jsx("th",{style:{padding:fe===0?"8px 8px 8px 12px":"8px 12px",textAlign:se==="Participants"||se==="Sessions"?"right":"left",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",letterSpacing:"0.04em",textTransform:"uppercase",whiteSpace:"nowrap"},children:se},fe))})}),i.jsx("tbody",{children:Oe.map(({ev:se,cat:fe})=>i.jsx(p_e,{event:se,categoryName:fe.name,accent:fe.accent,onOpen:()=>ke(se)},se.id))})]})})}),i.jsx("div",{style:{paddingTop:"16px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})})]}),S&&i.jsx(m_e,{msg:S,onDone:()=>_(null)}),I&&i.jsx(CY,{organizationId:r,onClose:()=>{E(!1),le()},onCreated:se=>{e==null||e(se)}})]})}function y_e(e){return e==="quiz"?"Quiz":e==="poll"?"Poll":"Q&A Session"}function x_e(e){const t=(e||"draft").toLowerCase();return t==="live"?"Active":t==="upcoming"?"Scheduled":t==="completed"?"Completed":"Draft"}function b_e(e){if(!e)return"—";try{return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return"—"}}const Op={width:"100%",boxSizing:"border-box",padding:"10px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"};async function H7(e,t,r,n,o){var y,m,x;const a=$0(n),s=$0(o);if(!a||!s)return{ok:!1,error:"Invalid start or end date/time."};const l=new Date(a);let c=new Date(s);c<=l&&(c=new Date(l.getTime()+3600*1e3));const u=await zr.create({name:t.trim(),type:"webinar",recordKind:"activity",activitySubtype:r,status:"draft",startDate:l.toISOString(),endDate:c.toISOString(),locationType:"virtual",organization:e});if(u.error||!((y=u.data)!=null&&y._id))return{ok:!1,error:u.error||"Could not create activity."};const d=u.data._id,p=(x=(((m=(await Da.list(d)).data)==null?void 0:m.sessions)??[])[0])==null?void 0:x._id;return p?{ok:!0,eventId:d,sessionId:p}:{ok:!1,error:"Activity created but no session was found."}}function w_e(e){var r,n;const t=e.activityStats;return{id:e._id,name:e.name,type:y_e(e.activitySubtype),status:x_e(e.status),createdDate:b_e(e.createdAt),subtitle:(r=e.description)!=null&&r.trim()?e.description.trim().slice(0,120):((n=e.subtitle)==null?void 0:n.trim())||void 0,participants:(t==null?void 0:t.participantCount)??0,questions:(t==null?void 0:t.questionCount)??0,responses:(t==null?void 0:t.responseCount)??0,subtype:e.activitySubtype||"qna",raw:e}}const AG={"Q&A Session":{bg:"#E8EFFC",fg:"#0B4DD1",icon:i.jsx(Zs,{size:14})},Quiz:{bg:"#FEF3C7",fg:"#D97706",icon:i.jsx(ib,{size:14})},Poll:{bg:"#ECFDF5",fg:"#059669",icon:i.jsx(N6,{size:14})}},TG={Active:{bg:"#dcfce7",color:"#15803d"},Scheduled:{bg:"#dbeafe",color:"#1d4ed8"},Completed:{bg:"#f1f5f9",color:"#475569"},Draft:{bg:"#ffedd5",color:"#c2410c"}};function S_e(e,t){var r,n;return{question:e.text,imageUrl:(r=e.imageUrl)!=null&&r.trim()?e.imageUrl.trim():null,type:e.type==="Single Choice"||e.type==="True / False"?"single":e.type==="Multiple Choice"?"multiple":"text",options:(n=e.options)==null?void 0:n.map(o=>{var a;return{text:o.text,isCorrect:o.isCorrect,imageUrl:(a=o.imageUrl)!=null&&a.trim()?o.imageUrl.trim():null}}),required:!0,...t==="quiz"?{points:1}:{}}}function V7({title:e,subtitle:t,onClose:r,children:n,footer:o}){return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:r,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200},role:"presentation"}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(720px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)",animation:"activityPanelIn 0.25s ease"},children:[i.jsx("style",{children:"@keyframes activityPanelIn { from { transform: translateX(100%); } to { transform: translateX(0); } }"}),i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("h2",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:e}),t?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"6px 0 0",lineHeight:1.45},children:t}):null]}),i.jsx("button",{type:"button",onClick:r,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:4},children:i.jsx(er,{size:20})})]}),i.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:n}),o?i.jsx("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",flexShrink:0},children:o}):null]})]})}function j_e({onNavigateToActivity:e}){const{user:t}=Ur(),r=zn(t),[n,o]=j.useState("card"),[a,s]=j.useState(""),[l,c]=j.useState("all"),[u,d]=j.useState("all"),[f,h]=j.useState(!1),[p,y]=j.useState([]),[m,x]=j.useState(!0),[b,w]=j.useState(null),[k,S]=j.useState(!1),[_,P]=j.useState(!1),[O,T]=j.useState("shell"),[R,I]=j.useState("poll"),[E,A]=j.useState(""),[F,L]=j.useState(""),[z,V]=j.useState(""),[Q,U]=j.useState(!1),[ee,H]=j.useState(null),[B,M]=j.useState(null),[$,q]=j.useState(null),[Y,K]=j.useState(!1),[G,re]=j.useState(null),[J,ae]=j.useState(null),le=qi(),me=le==="mobile",Oe=le==="mobile"?"1fr":"repeat(4, minmax(0, 1fr))",we=j.useCallback(async()=>{var Je;if(!r){y([]),x(!1);return}x(!0),w(null);const Ne=await zr.list({organization:r,recordKind:"activity",enrich:!0,limit:200});if(x(!1),Ne.error||!((Je=Ne.data)!=null&&Je.events)){w(Ne.error||"Could not load activities."),y([]);return}y(Ne.data.events.map(w_e))},[r]);j.useEffect(()=>{we()},[we]);const ie=()=>{const{start:Ne,end:Je}=WI();A(""),L(Ne),V(Je),re(null),S(!0)},Me=()=>{const{start:Ne,end:Je}=WI();A(""),L(Ne),V(Je),I("poll"),H(null),T("shell"),M(null),q(null),P(!0)},ke=()=>{P(!1),T("shell"),M(null),q(null),H(null),ae(null)},se=j.useMemo(()=>{if(O!=="form")return;const Ne=nT();return Ne.title=E.trim(),Ne.status="Draft",Ne.displayMode="always_sched",Ne.scheduledStart=F,Ne.scheduledEnd=z,{form:Ne,questions:[]}},[O,E,F,z]),fe=()=>{(async()=>{if(!r)return;re(null);const Ne=E.trim();if(Ne.length<3){re("Name must be at least 3 characters.");return}K(!0);const Je=await H7(r,Ne,"qna",F,z);if(K(!1),!Je.ok){re(Je.error);return}S(!1),we(),e==null||e(Je.eventId)})()},Ie=()=>{(async()=>{if(!r)return;H(null);const Ne=E.trim();if(Ne.length<3){H("Name must be at least 3 characters.");return}U(!0);const Je=await H7(r,Ne,R,F,z);if(U(!1),!Je.ok){H(Je.error);return}M(Je.eventId),q(Je.sessionId),ae(null),T("form")})()},ce=Ne=>{(async()=>{if(!B||!$)return;const Je=R;ae(null);const vt={session:$,title:Ne.form.title,type:Je,description:Ne.form.description||void 0,questions:Ne.questions.map(Ot=>S_e(Ot,Je)),settings:iT(Ne.form,Je)},Ge=await Oa.create(B,vt);if(Ge.error){ae(Ge.error);return}ke(),we(),e==null||e(B)})()},je=j.useMemo(()=>p.filter(Ne=>{var Ot;const Je=a===""||Ne.name.toLowerCase().includes(a.toLowerCase())||(((Ot=Ne.subtitle)==null?void 0:Ot.toLowerCase().includes(a.toLowerCase()))??!1),vt=l==="all"||Ne.type===l,Ge=u==="all"||Ne.status===u;return Je&&vt&&Ge}),[p,a,l,u]),qe=j.useMemo(()=>{const Ne=p;return{count:Ne.length,active:Ne.filter(Je=>Je.status==="Active").length,participants:Ne.reduce((Je,vt)=>Je+vt.participants,0),responses:Ne.reduce((Je,vt)=>Je+vt.responses,0)}},[p]);return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:me?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 6px"},children:"Activities"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:"Manage Q&A sessions, quizzes, and polls (standalone activity events)"})]}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[i.jsxs("button",{type:"button",onClick:()=>r&&ie(),disabled:!r,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 16px",borderRadius:"var(--radius-button)",background:r?"var(--primary)":"var(--muted)",color:"var(--primary-foreground)",border:"none",cursor:r?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:r?1:.7},children:[i.jsx(Zs,{size:14})," Create Q&A Session"]}),i.jsxs("button",{type:"button",onClick:()=>r&&Me(),disabled:!r,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 16px",borderRadius:"var(--radius-button)",background:r?"var(--card)":"var(--muted)",color:r?"var(--foreground)":"var(--muted-foreground)",border:"1px solid var(--border)",cursor:r?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(N6,{size:14})," Create Quiz/Poll"]})]})]}),!r&&i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:"Set up an organization in your portfolio to view and create activities."}),b&&i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:0},children:b}),m&&r?i.jsx(fh,{message:"Loading activities…"}):null,!m&&r?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"grid",gridTemplateColumns:me?"1fr 1fr":"repeat(4, 1fr)",gap:"12px"},children:[i.jsx(Z1,{label:"Total Activities",value:String(qe.count)}),i.jsx(Z1,{label:"Active",value:String(qe.active),color:"#15803d"}),i.jsx(Z1,{label:"Total Participants",value:String(qe.participants)}),i.jsx(Z1,{label:"Total Responses",value:String(qe.responses)})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px",padding:"0 10px",height:"34px",flex:me?"1 1 100%":"1 1 180px",background:"var(--card)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopColor:f?"var(--ring)":"var(--border)",borderRightColor:f?"var(--ring)":"var(--border)",borderBottomColor:f?"var(--ring)":"var(--border)",borderLeftColor:f?"var(--ring)":"var(--border)",borderRadius:"var(--radius-button)",transition:"border-top-color 0.15s, border-right-color 0.15s, border-bottom-color 0.15s, border-left-color 0.15s"},children:[i.jsx(Pi,{size:13,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:a,onChange:Ne=>s(Ne.target.value),placeholder:"Search activities…",onFocus:()=>h(!0),onBlur:()=>h(!1),style:{background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",width:"100%"}}),a?i.jsx("button",{type:"button",onClick:()=>s(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:0,display:"flex"},children:i.jsx(er,{size:12})}):null]}),i.jsxs("select",{value:l,onChange:Ne=>c(Ne.target.value),style:{padding:"0 32px 0 10px",height:"34px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",cursor:"pointer",outline:"none"},children:[i.jsx("option",{value:"all",children:"All Types"}),i.jsx("option",{value:"Q&A Session",children:"Q&A Session"}),i.jsx("option",{value:"Quiz",children:"Quiz"}),i.jsx("option",{value:"Poll",children:"Poll"})]}),i.jsxs("select",{value:u,onChange:Ne=>d(Ne.target.value),style:{padding:"0 32px 0 10px",height:"34px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",cursor:"pointer",outline:"none"},children:[i.jsx("option",{value:"all",children:"All Status"}),i.jsx("option",{value:"Active",children:"Active"}),i.jsx("option",{value:"Scheduled",children:"Scheduled"}),i.jsx("option",{value:"Completed",children:"Completed"}),i.jsx("option",{value:"Draft",children:"Draft"})]}),i.jsx("div",{style:{flex:1}}),i.jsx("div",{style:{display:"flex",gap:"4px",borderRadius:"var(--radius-button)",background:"var(--secondary)",padding:"3px"},children:[{mode:"card",icon:i.jsx(ab,{size:14}),label:"Cards"},{mode:"list",icon:i.jsx(sb,{size:14}),label:"List"},{mode:"calendar",icon:i.jsx(Wi,{size:14}),label:"Calendar"}].map(Ne=>i.jsx("button",{type:"button",onClick:()=>o(Ne.mode),title:Ne.label,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"28px",borderRadius:"var(--radius-button)",background:n===Ne.mode?"var(--card)":"transparent",color:n===Ne.mode?"var(--primary)":"var(--muted)",border:"none",cursor:"pointer",transition:"all 0.15s"},children:Ne.icon},Ne.mode))})]}),i.jsxs("div",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Showing ",je.length," ",je.length===1?"activity":"activities"]}),n==="card"&&i.jsx("div",{style:{display:"grid",gridTemplateColumns:Oe,gap:"16px"},children:je.map(Ne=>i.jsx(k_e,{activity:Ne,onClick:()=>e==null?void 0:e(Ne.id)},Ne.id))}),n==="list"&&i.jsx("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",overflow:"hidden"},children:je.map((Ne,Je)=>i.jsx(__e,{activity:Ne,isLast:Je===je.length-1,onClick:()=>e==null?void 0:e(Ne.id)},Ne.id))}),n==="calendar"&&i.jsxs("div",{style:{padding:"60px 20px",textAlign:"center",background:"var(--card)",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)"},children:[i.jsx(Wi,{size:32,style:{color:"var(--muted)",margin:"0 auto 16px",display:"block"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Calendar view coming soon"})]}),je.length===0&&!m?i.jsxs("div",{style:{padding:"60px 20px",textAlign:"center",background:"var(--card)",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)"},children:[i.jsx(Pi,{size:32,style:{color:"var(--muted)",margin:"0 auto 16px",display:"block"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:p.length===0?"No activities yet. Create one to get started.":"No activities match your filters."})]}):null]}):null,k&&r?i.jsx(V7,{title:"Create Q&A Session",subtitle:"Name is used for the event and the session. Track: Default.",onClose:()=>{S(!1),re(null)},footer:i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"},children:[i.jsx("button",{type:"button",onClick:()=>{S(!1),re(null)},disabled:Y,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:Y?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:fe,disabled:Y,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:Y?"var(--muted)":"var(--primary)",color:"var(--primary-foreground)",cursor:Y?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:Y?"Creating…":"Create"})]}),children:i.jsxs("div",{style:{padding:"20px",overflowY:"auto"},children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"Name of activity"}),i.jsx("input",{value:E,onChange:Ne=>A(Ne.target.value),disabled:Y,placeholder:"e.g. Keynote Q&A",style:{...Op,marginBottom:"16px"}}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:me?"1fr":"1fr 1fr",gap:"16px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"Start"}),i.jsx(jf,{value:F,onChange:L,style:Op,disabled:Y})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"End"}),i.jsx(jf,{value:z,onChange:V,style:Op,disabled:Y})]})]}),G?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",marginTop:"14px",marginBottom:0},children:G}):null]})}):null,_&&r?i.jsx(V7,{title:O==="shell"?"Create Quiz / Poll":R==="quiz"?"New quiz":"New poll",subtitle:O==="shell"?"Step 1: name and schedule (event & session; track: Default). Step 2: same form as Quiz & Polls in the event dashboard.":void 0,onClose:ke,footer:O==="shell"?i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"},children:[i.jsx("button",{type:"button",onClick:ke,disabled:Q,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:Q?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:Ie,disabled:Q,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:Q?"var(--muted)":"var(--primary)",color:"var(--primary-foreground)",cursor:Q?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:Q?"Creating…":"Continue to form"})]}):void 0,children:O==="shell"?i.jsxs("div",{style:{padding:"20px",overflowY:"auto"},children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"Name of activity"}),i.jsx("input",{value:E,onChange:Ne=>A(Ne.target.value),disabled:Q,placeholder:"e.g. Audience pulse check",style:{...Op,marginBottom:"16px"}}),i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"Type"}),i.jsxs("select",{value:R,onChange:Ne=>I(Ne.target.value),disabled:Q,style:{...Op,marginBottom:"16px",cursor:Q?"not-allowed":"pointer"},children:[i.jsx("option",{value:"poll",children:"Poll"}),i.jsx("option",{value:"quiz",children:"Quiz"})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:me?"1fr":"1fr 1fr",gap:"16px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"Start"}),i.jsx(jf,{value:F,onChange:L,style:Op,disabled:Q})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"End"}),i.jsx(jf,{value:z,onChange:V,style:Op,disabled:Q})]})]}),ee?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",marginTop:"14px",marginBottom:0},children:ee}):null]}):B&&se?i.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:[J?i.jsx("div",{style:{padding:"10px 20px",borderBottom:"1px solid var(--border)",background:"var(--secondary)",color:"var(--destructive)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:J}):null,i.jsx(ax,{variant:"panel",kind:R,eventId:B,initial:se,onClose:ke,onSave:ce},`${B}-${R}`)]}):null}):null]})}function Z1({label:e,value:t,color:r}){return i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",padding:"16px 20px"},children:[i.jsx("div",{style:{fontSize:"var(--text-2xl)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:r||"var(--foreground)",marginBottom:"4px"},children:t}),i.jsx("div",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.5px"},children:e})]})}function k_e({activity:e,onClick:t}){const r=AG[e.type],n=TG[e.status];return i.jsxs("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t())},style:{background:"var(--card)",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",padding:"20px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s"},onMouseEnter:o=>{o.currentTarget.style.borderColor="var(--primary)",o.currentTarget.style.boxShadow="0 4px 12px rgba(11,77,209,0.1)"},onMouseLeave:o=>{o.currentTarget.style.borderColor="var(--border)",o.currentTarget.style.boxShadow="none"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:"12px"},children:[i.jsx("h3",{style:{fontSize:"var(--text-base)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,flex:1},children:e.name}),i.jsx("span",{style:{padding:"3px 10px",borderRadius:"999px",background:n.bg,color:n.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0,textTransform:"uppercase",letterSpacing:"0.3px"},children:e.status})]}),i.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:r.bg,marginBottom:"16px"},children:[r.icon,i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:r.fg},children:e.type})]}),e.subtitle?i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 16px",lineHeight:1.4},children:e.subtitle}):null,i.jsxs("div",{style:{display:"flex",gap:"16px",paddingTop:"12px",borderTop:"1px solid var(--border)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx(vi,{size:14,style:{color:"var(--muted)"}}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.participants})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx(ib,{size:14,style:{color:"var(--muted)"}}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.questions})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx(iv,{size:14,style:{color:"var(--muted)"}}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.responses})]})]})]})}function __e({activity:e,isLast:t,onClick:r}){const n=AG[e.type],o=TG[e.status];return i.jsxs("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),r())},style:{display:"flex",alignItems:"center",gap:"16px",padding:"16px 20px",borderBottom:t?"none":"1px solid var(--border)",cursor:"pointer",transition:"background 0.15s"},onMouseEnter:a=>{a.currentTarget.style.background="var(--secondary)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[i.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"var(--radius-button)",background:n.bg,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:n.fg},children:n.icon}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("h4",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 3px"},children:e.name}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:e.createdDate})]}),i.jsx("div",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",minWidth:"100px"},children:e.type}),i.jsx("div",{style:{display:"flex",gap:"12px",minWidth:"120px"},children:i.jsxs("div",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[e.participants," participants"]})}),i.jsx("span",{style:{padding:"3px 10px",borderRadius:"999px",background:o.bg,color:o.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0,textTransform:"uppercase"},children:e.status})]})}const C_e=()=>{};var Y7={};/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const PG={NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"};/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const Wt=function(e,t){if(!e)throw _v(t)},_v=function(e){return new Error("Firebase Database ("+PG.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)};/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const OG=function(e){const t=[];let r=0;for(let n=0;n>6|192,t[r++]=o&63|128):(o&64512)===55296&&n+1>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128)}return t},E_e=function(e){const t=[];let r=0,n=0;for(;r191&&o<224){const a=e[r++];t[n++]=String.fromCharCode((o&31)<<6|a&63)}else if(o>239&&o<365){const a=e[r++],s=e[r++],l=e[r++],c=((o&7)<<18|(a&63)<<12|(s&63)<<6|l&63)-65536;t[n++]=String.fromCharCode(55296+(c>>10)),t[n++]=String.fromCharCode(56320+(c&1023))}else{const a=e[r++],s=e[r++];t[n++]=String.fromCharCode((o&15)<<12|(a&63)<<6|s&63)}}return t.join("")},BP={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let o=0;o>2,f=(a&3)<<4|l>>4;let h=(l&15)<<2|u>>6,p=u&63;c||(p=64,s||(h=64)),n.push(r[d],r[f],r[h],r[p])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(OG(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):E_e(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let o=0;o>4;if(n.push(h),u!==64){const p=l<<4&240|u>>2;if(n.push(p),f!==64){const y=u<<6&192|f;n.push(y)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class A_e extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const IG=function(e){const t=OG(e);return BP.encodeByteArray(t,!0)},X2=function(e){return IG(e).replace(/\./g,"")},MA=function(e){try{return BP.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function T_e(e){return NG(void 0,e)}function NG(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:const r=t;return new Date(r.getTime());case Object:e===void 0&&(e={});break;case Array:e=[];break;default:return t}for(const r in t)!t.hasOwnProperty(r)||!P_e(r)||(e[r]=NG(e[r],t[r]));return e}function P_e(e){return e!=="__proto__"}/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function O_e(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const I_e=()=>O_e().__FIREBASE_DEFAULTS__,N_e=()=>{if(typeof process>"u"||typeof Y7>"u")return;const e=Y7.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},R_e=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&MA(e[1]);return t&&JSON.parse(t)},RG=()=>{try{return C_e()||I_e()||N_e()||R_e()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},L_e=e=>{var t,r;return(r=(t=RG())===null||t===void 0?void 0:t.emulatorHosts)===null||r===void 0?void 0:r[e]},F_e=e=>{const t=L_e(e);if(!t)return;const r=t.lastIndexOf(":");if(r<=0||r+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const n=parseInt(t.substring(r+1),10);return t[0]==="["?[t.substring(1,r-1),n]:[t.substring(0,r),n]},LG=()=>{var e;return(e=RG())===null||e===void 0?void 0:e.config};/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class WP{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,r)=>{this.resolve=t,this.reject=r})}wrapCallback(t){return(r,n)=>{r?this.reject(r):this.resolve(n),typeof t=="function"&&(this.promise.catch(()=>{}),t.length===1?t(r):t(r,n))}}}/** - * @license - * Copyright 2025 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function qP(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function M_e(e){return(await fetch(e,{credentials:"include"})).ok}/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function D_e(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const r={alg:"none",type:"JWT"},n=t||"demo-project",o=e.iat||0,a=e.sub||e.user_id;if(!a)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:o,exp:o+3600,auth_time:o,sub:a,user_id:a,firebase:{sign_in_provider:"custom",identities:{}}},e);return[X2(JSON.stringify(r)),X2(JSON.stringify(s)),""].join(".")}const Yy={};function z_e(){const e={prod:[],emulator:[]};for(const t of Object.keys(Yy))Yy[t]?e.emulator.push(t):e.prod.push(t);return e}function B_e(e){let t=document.getElementById(e),r=!1;return t||(t=document.createElement("div"),t.setAttribute("id",e),r=!0),{created:r,element:t}}let G7=!1;function W_e(e,t){if(typeof window>"u"||typeof document>"u"||!qP(window.location.host)||Yy[e]===t||Yy[e]||G7)return;Yy[e]=t;function r(h){return`__firebase__banner__${h}`}const n="__firebase__banner",a=z_e().prod.length>0;function s(){const h=document.getElementById(n);h&&h.remove()}function l(h){h.style.display="flex",h.style.background="#7faaf0",h.style.position="fixed",h.style.bottom="5px",h.style.left="5px",h.style.padding=".5em",h.style.borderRadius="5px",h.style.alignItems="center"}function c(h,p){h.setAttribute("width","24"),h.setAttribute("id",p),h.setAttribute("height","24"),h.setAttribute("viewBox","0 0 24 24"),h.setAttribute("fill","none"),h.style.marginLeft="-6px"}function u(){const h=document.createElement("span");return h.style.cursor="pointer",h.style.marginLeft="16px",h.style.fontSize="24px",h.innerHTML=" ×",h.onclick=()=>{G7=!0,s()},h}function d(h,p){h.setAttribute("id",p),h.innerText="Learn more",h.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",h.setAttribute("target","__blank"),h.style.paddingLeft="5px",h.style.textDecoration="underline"}function f(){const h=B_e(n),p=r("text"),y=document.getElementById(p)||document.createElement("span"),m=r("learnmore"),x=document.getElementById(m)||document.createElement("a"),b=r("preprendIcon"),w=document.getElementById(b)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(h.created){const k=h.element;l(k),d(x,m);const S=u();c(w,b),k.append(w,y,x,S),document.body.appendChild(k)}a?(y.innerText="Preview backend disconnected.",w.innerHTML=` - - - - - - -`):(w.innerHTML=` - - - - - - -`,y.innerText="Preview backend running in this workspace."),y.setAttribute("id",p)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",f):f()}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function q_e(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function FG(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(q_e())}function $_e(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function U_e(){return PG.NODE_ADMIN===!0}function H_e(){try{return typeof indexedDB=="object"}catch{return!1}}function V_e(){return new Promise((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",o=self.indexedDB.open(n);o.onsuccess=()=>{o.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},o.onupgradeneeded=()=>{r=!1},o.onerror=()=>{var a;t(((a=o.error)===null||a===void 0?void 0:a.message)||"")}}catch(r){t(r)}})}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const Y_e="FirebaseError";class Cb extends Error{constructor(t,r,n){super(r),this.code=t,this.customData=n,this.name=Y_e,Object.setPrototypeOf(this,Cb.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,MG.prototype.create)}}class MG{constructor(t,r,n){this.service=t,this.serviceName=r,this.errors=n}create(t,...r){const n=r[0]||{},o=`${this.service}/${t}`,a=this.errors[t],s=a?G_e(a,n):"Error",l=`${this.serviceName}: ${s} (${o}).`;return new Cb(o,l,n)}}function G_e(e,t){return e.replace(K_e,(r,n)=>{const o=t[n];return o!=null?String(o):`<${n}?>`})}const K_e=/\{\$([^}]+)}/g;/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function Ux(e){return JSON.parse(e)}function Mo(e){return JSON.stringify(e)}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const DG=function(e){let t={},r={},n={},o="";try{const a=e.split(".");t=Ux(MA(a[0])||""),r=Ux(MA(a[1])||""),o=a[2],n=r.d||{},delete r.d}catch{}return{header:t,claims:r,data:n,signature:o}},Q_e=function(e){const t=DG(e),r=t.claims;return!!r&&typeof r=="object"&&r.hasOwnProperty("iat")},X_e=function(e){const t=DG(e).claims;return typeof t=="object"&&t.admin===!0};/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function Cd(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Qm(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]}function K7(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function Z2(e,t,r){const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=t.call(r,e[o],o,e));return n}function J2(e,t){if(e===t)return!0;const r=Object.keys(e),n=Object.keys(t);for(const o of r){if(!n.includes(o))return!1;const a=e[o],s=t[o];if(Q7(a)&&Q7(s)){if(!J2(a,s))return!1}else if(a!==s)return!1}for(const o of n)if(!r.includes(o))return!1;return!0}function Q7(e){return e!==null&&typeof e=="object"}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function Z_e(e){const t=[];for(const[r,n]of Object.entries(e))Array.isArray(n)?n.forEach(o=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(o))}):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class J_e{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let t=1;t>>31)&4294967295}let o=this.chain_[0],a=this.chain_[1],s=this.chain_[2],l=this.chain_[3],c=this.chain_[4],u,d;for(let f=0;f<80;f++){f<40?f<20?(u=l^a&(s^l),d=1518500249):(u=a^s^l,d=1859775393):f<60?(u=a&s|l&(a|s),d=2400959708):(u=a^s^l,d=3395469782);const h=(o<<5|o>>>27)+u+c+d+n[f]&4294967295;c=l,l=s,s=(a<<30|a>>>2)&4294967295,a=o,o=h}this.chain_[0]=this.chain_[0]+o&4294967295,this.chain_[1]=this.chain_[1]+a&4294967295,this.chain_[2]=this.chain_[2]+s&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+c&4294967295}update(t,r){if(t==null)return;r===void 0&&(r=t.length);const n=r-this.blockSize;let o=0;const a=this.buf_;let s=this.inbuf_;for(;o=56;o--)this.buf_[o]=r&255,r/=256;this.compress_(this.buf_);let n=0;for(let o=0;o<5;o++)for(let a=24;a>=0;a-=8)t[n]=this.chain_[o]>>a&255,++n;return t}}function zG(e,t){return`${e} failed: ${t} argument `}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const eCe=function(e){const t=[];let r=0;for(let n=0;n=55296&&o<=56319){const a=o-55296;n++,Wt(n>6|192,t[r++]=o&63|128):o<65536?(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128)}return t},CS=function(e){let t=0;for(let r=0;r=55296&&n<=56319?(t+=4,r++):t+=3}return t};/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function ES(e){return e&&e._delegate?e._delegate:e}class Hx{constructor(t,r,n){this.name=t,this.instanceFactory=r,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const Wp="[DEFAULT]";/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class tCe{constructor(t,r){this.name=t,this.container=r,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const r=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(r)){const n=new WP;if(this.instancesDeferred.set(r,n),this.isInitialized(r)||this.shouldAutoInitialize())try{const o=this.getOrInitializeService({instanceIdentifier:r});o&&n.resolve(o)}catch{}}return this.instancesDeferred.get(r).promise}getImmediate(t){var r;const n=this.normalizeInstanceIdentifier(t==null?void 0:t.identifier),o=(r=t==null?void 0:t.optional)!==null&&r!==void 0?r:!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(a){if(o)return null;throw a}else{if(o)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,!!this.shouldAutoInitialize()){if(nCe(t))try{this.getOrInitializeService({instanceIdentifier:Wp})}catch{}for(const[r,n]of this.instancesDeferred.entries()){const o=this.normalizeInstanceIdentifier(r);try{const a=this.getOrInitializeService({instanceIdentifier:o});n.resolve(a)}catch{}}}}clearInstance(t=Wp){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(r=>"INTERNAL"in r).map(r=>r.INTERNAL.delete()),...t.filter(r=>"_delete"in r).map(r=>r._delete())])}isComponentSet(){return this.component!=null}isInitialized(t=Wp){return this.instances.has(t)}getOptions(t=Wp){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:r={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const o=this.getOrInitializeService({instanceIdentifier:n,options:r});for(const[a,s]of this.instancesDeferred.entries()){const l=this.normalizeInstanceIdentifier(a);n===l&&s.resolve(o)}return o}onInit(t,r){var n;const o=this.normalizeInstanceIdentifier(r),a=(n=this.onInitCallbacks.get(o))!==null&&n!==void 0?n:new Set;a.add(t),this.onInitCallbacks.set(o,a);const s=this.instances.get(o);return s&&t(s,o),()=>{a.delete(t)}}invokeOnInitCallbacks(t,r){const n=this.onInitCallbacks.get(r);if(n)for(const o of n)try{o(t,r)}catch{}}getOrInitializeService({instanceIdentifier:t,options:r={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:rCe(t),options:r}),this.instances.set(t,n),this.instancesOptions.set(t,r),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch{}return n||null}normalizeInstanceIdentifier(t=Wp){return this.component?this.component.multipleInstances?t:Wp:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function rCe(e){return e===Wp?void 0:e}function nCe(e){return e.instantiationMode==="EAGER"}/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class iCe{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const r=this.getProvider(t.name);if(r.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);r.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const r=new tCe(t,this);return this.providers.set(t,r),r}getProviders(){return Array.from(this.providers.values())}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */var Yn;(function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"})(Yn||(Yn={}));const oCe={debug:Yn.DEBUG,verbose:Yn.VERBOSE,info:Yn.INFO,warn:Yn.WARN,error:Yn.ERROR,silent:Yn.SILENT},aCe=Yn.INFO,sCe={[Yn.DEBUG]:"log",[Yn.VERBOSE]:"log",[Yn.INFO]:"info",[Yn.WARN]:"warn",[Yn.ERROR]:"error"},lCe=(e,t,...r)=>{if(tt.some(r=>e instanceof r);let X7,Z7;function uCe(){return X7||(X7=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function dCe(){return Z7||(Z7=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const WG=new WeakMap,DA=new WeakMap,qG=new WeakMap,z4=new WeakMap,$P=new WeakMap;function fCe(e){const t=new Promise((r,n)=>{const o=()=>{e.removeEventListener("success",a),e.removeEventListener("error",s)},a=()=>{r(Pf(e.result)),o()},s=()=>{n(e.error),o()};e.addEventListener("success",a),e.addEventListener("error",s)});return t.then(r=>{r instanceof IDBCursor&&WG.set(r,e)}).catch(()=>{}),$P.set(t,e),t}function pCe(e){if(DA.has(e))return;const t=new Promise((r,n)=>{const o=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",s),e.removeEventListener("abort",s)},a=()=>{r(),o()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",a),e.addEventListener("error",s),e.addEventListener("abort",s)});DA.set(e,t)}let zA={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return DA.get(e);if(t==="objectStoreNames")return e.objectStoreNames||qG.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Pf(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function hCe(e){zA=e(zA)}function gCe(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...r){const n=e.call(B4(this),t,...r);return qG.set(n,t.sort?t.sort():[t]),Pf(n)}:dCe().includes(e)?function(...t){return e.apply(B4(this),t),Pf(WG.get(this))}:function(...t){return Pf(e.apply(B4(this),t))}}function mCe(e){return typeof e=="function"?gCe(e):(e instanceof IDBTransaction&&pCe(e),cCe(e,uCe())?new Proxy(e,zA):e)}function Pf(e){if(e instanceof IDBRequest)return fCe(e);if(z4.has(e))return z4.get(e);const t=mCe(e);return t!==e&&(z4.set(e,t),$P.set(t,e)),t}const B4=e=>$P.get(e);function vCe(e,t,{blocked:r,upgrade:n,blocking:o,terminated:a}={}){const s=indexedDB.open(e,t),l=Pf(s);return n&&s.addEventListener("upgradeneeded",c=>{n(Pf(s.result),c.oldVersion,c.newVersion,Pf(s.transaction),c)}),r&&s.addEventListener("blocked",c=>r(c.oldVersion,c.newVersion,c)),l.then(c=>{a&&c.addEventListener("close",()=>a()),o&&c.addEventListener("versionchange",u=>o(u.oldVersion,u.newVersion,u))}).catch(()=>{}),l}const yCe=["get","getKey","getAll","getAllKeys","count"],xCe=["put","add","delete","clear"],W4=new Map;function J7(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(W4.get(t))return W4.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,o=xCe.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(o||yCe.includes(r)))return;const a=async function(s,...l){const c=this.transaction(s,o?"readwrite":"readonly");let u=c.store;return n&&(u=u.index(l.shift())),(await Promise.all([u[r](...l),o&&c.done]))[0]};return W4.set(t,a),a}hCe(e=>({...e,get:(t,r,n)=>J7(t,r)||e.get(t,r,n),has:(t,r)=>!!J7(t,r)||e.has(t,r)}));/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class bCe{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(r=>{if(wCe(r)){const n=r.getImmediate();return`${n.library}/${n.version}`}else return null}).filter(r=>r).join(" ")}}function wCe(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const BA="@firebase/app",eB="0.13.2";/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const md=new BG("@firebase/app"),SCe="@firebase/app-compat",jCe="@firebase/analytics-compat",kCe="@firebase/analytics",_Ce="@firebase/app-check-compat",CCe="@firebase/app-check",ECe="@firebase/auth",ACe="@firebase/auth-compat",TCe="@firebase/database",PCe="@firebase/data-connect",OCe="@firebase/database-compat",ICe="@firebase/functions",NCe="@firebase/functions-compat",RCe="@firebase/installations",LCe="@firebase/installations-compat",FCe="@firebase/messaging",MCe="@firebase/messaging-compat",DCe="@firebase/performance",zCe="@firebase/performance-compat",BCe="@firebase/remote-config",WCe="@firebase/remote-config-compat",qCe="@firebase/storage",$Ce="@firebase/storage-compat",UCe="@firebase/firestore",HCe="@firebase/ai",VCe="@firebase/firestore-compat",YCe="firebase",GCe="11.10.0";/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const WA="[DEFAULT]",KCe={[BA]:"fire-core",[SCe]:"fire-core-compat",[kCe]:"fire-analytics",[jCe]:"fire-analytics-compat",[CCe]:"fire-app-check",[_Ce]:"fire-app-check-compat",[ECe]:"fire-auth",[ACe]:"fire-auth-compat",[TCe]:"fire-rtdb",[PCe]:"fire-data-connect",[OCe]:"fire-rtdb-compat",[ICe]:"fire-fn",[NCe]:"fire-fn-compat",[RCe]:"fire-iid",[LCe]:"fire-iid-compat",[FCe]:"fire-fcm",[MCe]:"fire-fcm-compat",[DCe]:"fire-perf",[zCe]:"fire-perf-compat",[BCe]:"fire-rc",[WCe]:"fire-rc-compat",[qCe]:"fire-gcs",[$Ce]:"fire-gcs-compat",[UCe]:"fire-fst",[VCe]:"fire-fst-compat",[HCe]:"fire-vertex","fire-js":"fire-js",[YCe]:"fire-js-all"};/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const Vx=new Map,QCe=new Map,qA=new Map;function tB(e,t){try{e.container.addComponent(t)}catch(r){md.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function ew(e){const t=e.name;if(qA.has(t))return md.debug(`There were multiple attempts to register component ${t}.`),!1;qA.set(t,e);for(const r of Vx.values())tB(r,e);for(const r of QCe.values())tB(r,e);return!0}function XCe(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}function ZCe(e){return e==null?!1:e.settings!==void 0}/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const JCe={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Of=new MG("app","Firebase",JCe);/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class e4e{constructor(t,r,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},r),this._name=r.name,this._automaticDataCollectionEnabled=r.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new Hx("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Of.create("app-deleted",{appName:this._name})}}/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const t4e=GCe;function $G(e,t={}){let r=e;typeof t!="object"&&(t={name:t});const n=Object.assign({name:WA,automaticDataCollectionEnabled:!0},t),o=n.name;if(typeof o!="string"||!o)throw Of.create("bad-app-name",{appName:String(o)});if(r||(r=LG()),!r)throw Of.create("no-options");const a=Vx.get(o);if(a){if(J2(r,a.options)&&J2(n,a.config))return a;throw Of.create("duplicate-app",{appName:o})}const s=new iCe(o);for(const c of qA.values())s.addComponent(c);const l=new e4e(r,n,s);return Vx.set(o,l),l}function r4e(e=WA){const t=Vx.get(e);if(!t&&e===WA&&LG())return $G();if(!t)throw Of.create("no-app",{appName:e});return t}function rB(){return Array.from(Vx.values())}function om(e,t,r){var n;let o=(n=KCe[e])!==null&&n!==void 0?n:e;r&&(o+=`-${r}`);const a=o.match(/\s|\//),s=t.match(/\s|\//);if(a||s){const l=[`Unable to register library "${o}" with version "${t}":`];a&&l.push(`library name "${o}" contains illegal characters (whitespace or "/")`),a&&s&&l.push("and"),s&&l.push(`version name "${t}" contains illegal characters (whitespace or "/")`),md.warn(l.join(" "));return}ew(new Hx(`${o}-version`,()=>({library:o,version:t}),"VERSION"))}/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const n4e="firebase-heartbeat-database",i4e=1,Yx="firebase-heartbeat-store";let q4=null;function UG(){return q4||(q4=vCe(n4e,i4e,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(Yx)}catch(r){console.warn(r)}}}}).catch(e=>{throw Of.create("idb-open",{originalErrorMessage:e.message})})),q4}async function o4e(e){try{const r=(await UG()).transaction(Yx),n=await r.objectStore(Yx).get(HG(e));return await r.done,n}catch(t){if(t instanceof Cb)md.warn(t.message);else{const r=Of.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});md.warn(r.message)}}}async function nB(e,t){try{const n=(await UG()).transaction(Yx,"readwrite");await n.objectStore(Yx).put(t,HG(e)),await n.done}catch(r){if(r instanceof Cb)md.warn(r.message);else{const n=Of.create("idb-set",{originalErrorMessage:r==null?void 0:r.message});md.warn(n.message)}}}function HG(e){return`${e.name}!${e.options.appId}`}/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const a4e=1024,s4e=30;class l4e{constructor(t){this.container=t,this._heartbeatsCache=null;const r=this.container.getProvider("app").getImmediate();this._storage=new u4e(r),this._heartbeatsCachePromise=this._storage.read().then(n=>(this._heartbeatsCache=n,n))}async triggerHeartbeat(){var t,r;try{const o=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),a=iB();if(((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((r=this._heartbeatsCache)===null||r===void 0?void 0:r.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===a||this._heartbeatsCache.heartbeats.some(s=>s.date===a))return;if(this._heartbeatsCache.heartbeats.push({date:a,agent:o}),this._heartbeatsCache.heartbeats.length>s4e){const s=d4e(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(s,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(n){md.warn(n)}}async getHeartbeatsHeader(){var t;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const r=iB(),{heartbeatsToSend:n,unsentEntries:o}=c4e(this._heartbeatsCache.heartbeats),a=X2(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=r,o.length>0?(this._heartbeatsCache.heartbeats=o,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),a}catch(r){return md.warn(r),""}}}function iB(){return new Date().toISOString().substring(0,10)}function c4e(e,t=a4e){const r=[];let n=e.slice();for(const o of e){const a=r.find(s=>s.agent===o.agent);if(a){if(a.dates.push(o.date),oB(r)>t){a.dates.pop();break}}else if(r.push({agent:o.agent,dates:[o.date]}),oB(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}class u4e{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return H_e()?V_e().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const r=await o4e(this.app);return r!=null&&r.heartbeats?r:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(t){var r;if(await this._canUseIndexedDBPromise){const o=await this.read();return nB(this.app,{lastSentHeartbeatDate:(r=t.lastSentHeartbeatDate)!==null&&r!==void 0?r:o.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){var r;if(await this._canUseIndexedDBPromise){const o=await this.read();return nB(this.app,{lastSentHeartbeatDate:(r=t.lastSentHeartbeatDate)!==null&&r!==void 0?r:o.lastSentHeartbeatDate,heartbeats:[...o.heartbeats,...t.heartbeats]})}else return}}function oB(e){return X2(JSON.stringify({version:2,heartbeats:e})).length}function d4e(e){if(e.length===0)return-1;let t=0,r=e[0].date;for(let n=1;nnew bCe(t),"PRIVATE")),ew(new Hx("heartbeat",t=>new l4e(t),"PRIVATE")),om(BA,eB,e),om(BA,eB,"esm2017"),om("fire-js","")}f4e("");var aB={};const sB="@firebase/database",lB="1.0.20";/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */let VG="";function p4e(e){VG=e}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class h4e{constructor(t){this.domStorage_=t,this.prefix_="firebase:"}set(t,r){r==null?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),Mo(r))}get(t){const r=this.domStorage_.getItem(this.prefixedName_(t));return r==null?null:Ux(r)}remove(t){this.domStorage_.removeItem(this.prefixedName_(t))}prefixedName_(t){return this.prefix_+t}toString(){return this.domStorage_.toString()}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class g4e{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(t,r){r==null?delete this.cache_[t]:this.cache_[t]=r}get(t){return Cd(this.cache_,t)?this.cache_[t]:null}remove(t){delete this.cache_[t]}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const YG=function(e){try{if(typeof window<"u"&&typeof window[e]<"u"){const t=window[e];return t.setItem("firebase:sentinel","cache"),t.removeItem("firebase:sentinel"),new h4e(t)}}catch{}return new g4e},Jp=YG("localStorage"),m4e=YG("sessionStorage");/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const am=new BG("@firebase/database"),v4e=(function(){let e=1;return function(){return e++}})(),GG=function(e){const t=eCe(e),r=new J_e;r.update(t);const n=r.digest();return BP.encodeByteArray(n)},Eb=function(...e){let t="";for(let r=0;r{document.readyState==="complete"&&r()}),window.attachEvent("onload",r))}},Xm="[MIN_NAME]",wh="[MAX_NAME]",Cv=function(e,t){if(e===t)return 0;if(e===Xm||t===wh)return-1;if(t===Xm||e===wh)return 1;{const r=uB(e),n=uB(t);return r!==null?n!==null?r-n===0?e.length-t.length:r-n:-1:n!==null?1:er?n.push(e.substring(o,r)):n.push(e.substring(o,o+t));return n};function gs(e,t){for(const r in e)e.hasOwnProperty(r)&&t(r,e[r])}const XG=function(e){Wt(!KG(e),"Invalid JSON number");const t=11,r=52,n=(1<=Math.pow(2,1-n)?(l=Math.min(Math.floor(Math.log(e)/Math.LN2),n),a=l+n,s=Math.round(e*Math.pow(2,r-l)-Math.pow(2,r))):(a=0,s=Math.round(e/Math.pow(2,1-n-r))));const u=[];for(c=r;c;c-=1)u.push(s%2?1:0),s=Math.floor(s/2);for(c=t;c;c-=1)u.push(a%2?1:0),a=Math.floor(a/2);u.push(o?1:0),u.reverse();const d=u.join("");let f="";for(c=0;c<64;c+=8){let h=parseInt(d.substr(c,8),2).toString(16);h.length===1&&(h="0"+h),f=f+h}return f.toLowerCase()},S4e=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},j4e=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function k4e(e,t){let r="Unknown Error";e==="too_big"?r="The data requested exceeds the maximum size that can be accessed with a single request.":e==="permission_denied"?r="Client doesn't have permission to access the desired data.":e==="unavailable"&&(r="The service is unavailable");const n=new Error(e+" at "+t._path.toString()+": "+r);return n.code=e.toUpperCase(),n}const _4e=new RegExp("^-?(0*)\\d{1,10}$"),C4e=-2147483648,E4e=2147483647,uB=function(e){if(_4e.test(e)){const t=Number(e);if(t>=C4e&&t<=E4e)return t}return null},Tb=function(e){try{e()}catch(t){setTimeout(()=>{const r=t.stack||"";throw Xs("Exception was thrown by user callback.",r),t},Math.floor(0))}},A4e=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},Ky=function(e,t){const r=setTimeout(e,t);return typeof r=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(r):typeof r=="object"&&r.unref&&r.unref(),r};/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class T4e{constructor(t,r){this.appCheckProvider=r,this.appName=t.name,ZCe(t)&&t.settings.appCheckToken&&(this.serverAppAppCheckToken=t.settings.appCheckToken),this.appCheck=r==null?void 0:r.getImmediate({optional:!0}),this.appCheck||r==null||r.get().then(n=>this.appCheck=n)}getToken(t){if(this.serverAppAppCheckToken){if(t)throw new Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(t):new Promise((r,n)=>{setTimeout(()=>{this.appCheck?this.getToken(t).then(r,n):r(null)},0)})}addTokenChangeListener(t){var r;(r=this.appCheckProvider)===null||r===void 0||r.get().then(n=>n.addTokenListener(t))}notifyForInvalidToken(){Xs(`Provided AppCheck credentials for the app named "${this.appName}" are invalid. This usually indicates your app was not initialized correctly.`)}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class P4e{constructor(t,r,n){this.appName_=t,this.firebaseOptions_=r,this.authProvider_=n,this.auth_=null,this.auth_=n.getImmediate({optional:!0}),this.auth_||n.onInit(o=>this.auth_=o)}getToken(t){return this.auth_?this.auth_.getToken(t).catch(r=>r&&r.code==="auth/token-not-initialized"?(ga("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(r)):new Promise((r,n)=>{setTimeout(()=>{this.auth_?this.getToken(t).then(r,n):r(null)},0)})}addTokenChangeListener(t){this.auth_?this.auth_.addAuthTokenListener(t):this.authProvider_.get().then(r=>r.addAuthTokenListener(t))}removeTokenChangeListener(t){this.authProvider_.get().then(r=>r.removeAuthTokenListener(t))}notifyForInvalidToken(){let t='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',Xs(t)}}class b0{constructor(t){this.accessToken=t}getToken(t){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(t){t(this.accessToken)}removeTokenChangeListener(t){}notifyForInvalidToken(){}}b0.OWNER="owner";/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const HP="5",ZG="v",JG="s",eK="r",tK="f",rK=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,nK="ls",iK="p",UA="ac",oK="websocket",aK="long_polling";/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class sK{constructor(t,r,n,o,a=!1,s="",l=!1,c=!1,u=null){this.secure=r,this.namespace=n,this.webSocketOnly=o,this.nodeAdmin=a,this.persistenceKey=s,this.includeNamespaceInQueryParams=l,this.isUsingEmulator=c,this.emulatorOptions=u,this._host=t.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=Jp.get("host:"+t)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&Jp.set("host:"+this._host,this.internalHost))}toString(){let t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t}toURLString(){const t=this.secure?"https://":"http://",r=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${t}${this.host}/${r}`}}function O4e(e){return e.host!==e.internalHost||e.isCustomHost()||e.includeNamespaceInQueryParams}function lK(e,t,r){Wt(typeof t=="string","typeof type must == string"),Wt(typeof r=="object","typeof params must == object");let n;if(t===oK)n=(e.secure?"wss://":"ws://")+e.internalHost+"/.ws?";else if(t===aK)n=(e.secure?"https://":"http://")+e.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+t);O4e(e)&&(r.ns=e.namespace);const o=[];return gs(r,(a,s)=>{o.push(a+"="+s)}),n+o.join("&")}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class I4e{constructor(){this.counters_={}}incrementCounter(t,r=1){Cd(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=r}get(){return T_e(this.counters_)}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const $4={},U4={};function VP(e){const t=e.toString();return $4[t]||($4[t]=new I4e),$4[t]}function N4e(e,t){const r=e.toString();return U4[r]||(U4[r]=t()),U4[r]}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class R4e{constructor(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(t,r){this.closeAfterResponse=t,this.onClose=r,this.closeAfterResponse{this.onMessage_(n[o])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const dB="start",L4e="close",F4e="pLPCommand",M4e="pRTLPCB",cK="id",uK="pw",dK="ser",D4e="cb",z4e="seg",B4e="ts",W4e="d",q4e="dframe",fK=1870,pK=30,$4e=fK-pK,U4e=25e3,H4e=3e4;class Gg{constructor(t,r,n,o,a,s,l){this.connId=t,this.repoInfo=r,this.applicationId=n,this.appCheckToken=o,this.authToken=a,this.transportSessionId=s,this.lastSessionId=l,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=Ab(t),this.stats_=VP(r),this.urlFn=c=>(this.appCheckToken&&(c[UA]=this.appCheckToken),lK(r,aK,c))}open(t,r){this.curSegmentNum=0,this.onDisconnect_=r,this.myPacketOrderer=new R4e(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(H4e)),b4e(()=>{if(this.isClosed_)return;this.scriptTagHolder=new YP((...a)=>{const[s,l,c,u,d]=a;if(this.incrementIncomingBytes_(a),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,s===dB)this.id=l,this.password=c;else if(s===L4e)l?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(l,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+s)},(...a)=>{const[s,l]=a;this.incrementIncomingBytes_(a),this.myPacketOrderer.handleResponse(s,l)},()=>{this.onClosed_()},this.urlFn);const n={};n[dB]="t",n[dK]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(n[D4e]=this.scriptTagHolder.uniqueCallbackIdentifier),n[ZG]=HP,this.transportSessionId&&(n[JG]=this.transportSessionId),this.lastSessionId&&(n[nK]=this.lastSessionId),this.applicationId&&(n[iK]=this.applicationId),this.appCheckToken&&(n[UA]=this.appCheckToken),typeof location<"u"&&location.hostname&&rK.test(location.hostname)&&(n[eK]=tK);const o=this.urlFn(n);this.log_("Connecting via long-poll to "+o),this.scriptTagHolder.addTag(o,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){Gg.forceAllow_=!0}static forceDisallow(){Gg.forceDisallow_=!0}static isAvailable(){return Gg.forceAllow_?!0:!Gg.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!S4e()&&!j4e()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(t){const r=Mo(t);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);const n=IG(r),o=QG(n,$4e);for(let a=0;adocument.domain="'+document.domain+'";<\/script>');const s=""+a+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(s),this.myIFrame.doc.close()}catch(l){ga("frame writing exception"),l.stack&&ga(l.stack),ga(l)}}}static createIFrame_(){const t=document.createElement("iframe");if(t.style.display="none",document.body){document.body.appendChild(t);try{t.contentWindow.document||ga("No IE domain setting required")}catch{const n=document.domain;t.src="javascript:void((function(){document.open();document.domain='"+n+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));const t=this.onDisconnect;t&&(this.onDisconnect=null,t())}startLongPoll(t,r){for(this.myID=t,this.myPW=r,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const t={};t[cK]=this.myID,t[uK]=this.myPW,t[dK]=this.currentSerial;let r=this.urlFn(t),n="",o=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+pK+n.length<=fK;){const s=this.pendingSegs.shift();n=n+"&"+z4e+o+"="+s.seg+"&"+B4e+o+"="+s.ts+"&"+W4e+o+"="+s.d,o++}return r=r+n,this.addLongPollTag_(r,this.currentSerial),!0}else return!1}enqueueSegment(t,r,n){this.pendingSegs.push({seg:t,ts:r,d:n}),this.alive&&this.newRequest_()}addLongPollTag_(t,r){this.outstandingRequests.add(r);const n=()=>{this.outstandingRequests.delete(r),this.newRequest_()},o=setTimeout(n,Math.floor(U4e)),a=()=>{clearTimeout(o),n()};this.addTag(t,a)}addTag(t,r){setTimeout(()=>{try{if(!this.sendNewPolls)return;const n=this.myIFrame.doc.createElement("script");n.type="text/javascript",n.async=!0,n.src=t,n.onload=n.onreadystatechange=function(){const o=n.readyState;(!o||o==="loaded"||o==="complete")&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),r())},n.onerror=()=>{ga("Long-poll script failed to load: "+t),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(n)}catch{}},Math.floor(1))}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const V4e=16384,Y4e=45e3;let tw=null;typeof MozWebSocket<"u"?tw=MozWebSocket:typeof WebSocket<"u"&&(tw=WebSocket);class rc{constructor(t,r,n,o,a,s,l){this.connId=t,this.applicationId=n,this.appCheckToken=o,this.authToken=a,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=Ab(this.connId),this.stats_=VP(r),this.connURL=rc.connectionURL_(r,s,l,o,n),this.nodeAdmin=r.nodeAdmin}static connectionURL_(t,r,n,o,a){const s={};return s[ZG]=HP,typeof location<"u"&&location.hostname&&rK.test(location.hostname)&&(s[eK]=tK),r&&(s[JG]=r),n&&(s[nK]=n),o&&(s[UA]=o),a&&(s[iK]=a),lK(t,oK,s)}open(t,r){this.onDisconnect=r,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,Jp.set("previous_websocket_failure",!0);try{let n;U_e(),this.mySock=new tw(this.connURL,[],n)}catch(n){this.log_("Error instantiating WebSocket.");const o=n.message||n.data;o&&this.log_(o),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=n=>{this.handleIncomingFrame(n)},this.mySock.onerror=n=>{this.log_("WebSocket error. Closing connection.");const o=n.message||n.data;o&&this.log_(o),this.onClosed_()}}start(){}static forceDisallow(){rc.forceDisallow_=!0}static isAvailable(){let t=!1;if(typeof navigator<"u"&&navigator.userAgent){const r=/Android ([0-9]{0,}\.[0-9]{0,})/,n=navigator.userAgent.match(r);n&&n.length>1&&parseFloat(n[1])<4.4&&(t=!0)}return!t&&tw!==null&&!rc.forceDisallow_}static previouslyFailed(){return Jp.isInMemoryStorage||Jp.get("previous_websocket_failure")===!0}markConnectionHealthy(){Jp.remove("previous_websocket_failure")}appendFrame_(t){if(this.frames.push(t),this.frames.length===this.totalFrames){const r=this.frames.join("");this.frames=null;const n=Ux(r);this.onMessage(n)}}handleNewFrameCount_(t){this.totalFrames=t,this.frames=[]}extractFrameCount_(t){if(Wt(this.frames===null,"We already have a frame buffer"),t.length<=6){const r=Number(t);if(!isNaN(r))return this.handleNewFrameCount_(r),null}return this.handleNewFrameCount_(1),t}handleIncomingFrame(t){if(this.mySock===null)return;const r=t.data;if(this.bytesReceived+=r.length,this.stats_.incrementCounter("bytes_received",r.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(r);else{const n=this.extractFrameCount_(r);n!==null&&this.appendFrame_(n)}}send(t){this.resetKeepAlive();const r=Mo(t);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);const n=QG(r,V4e);n.length>1&&this.sendString_(String(n.length));for(let o=0;o{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(Y4e))}sendString_(t){try{this.mySock.send(t)}catch(r){this.log_("Exception thrown from WebSocket.send():",r.message||r.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}rc.responsesRequiredToBeHealthy=2;rc.healthyTimeout=3e4;/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class Gx{static get ALL_TRANSPORTS(){return[Gg,rc]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(t){this.initTransports_(t)}initTransports_(t){const r=rc&&rc.isAvailable();let n=r&&!rc.previouslyFailed();if(t.webSocketOnly&&(r||Xs("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),n=!0),n)this.transports_=[rc];else{const o=this.transports_=[];for(const a of Gx.ALL_TRANSPORTS)a&&a.isAvailable()&&o.push(a);Gx.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}Gx.globalTransportInitialized_=!1;/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const G4e=6e4,K4e=5e3,Q4e=10*1024,X4e=100*1024,H4="t",fB="d",Z4e="s",pB="r",J4e="e",hB="o",gB="a",mB="n",vB="p",e3e="h";class t3e{constructor(t,r,n,o,a,s,l,c,u,d){this.id=t,this.repoInfo_=r,this.applicationId_=n,this.appCheckToken_=o,this.authToken_=a,this.onMessage_=s,this.onReady_=l,this.onDisconnect_=c,this.onKill_=u,this.lastSessionId=d,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=Ab("c:"+this.id+":"),this.transportManager_=new Gx(r),this.log_("Connection created"),this.start_()}start_(){const t=this.transportManager_.initialTransport();this.conn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;const r=this.connReceiver_(this.conn_),n=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(r,n)},Math.floor(0));const o=t.healthyTimeout||0;o>0&&(this.healthyTimeout_=Ky(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>X4e?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>Q4e?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(o)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(t){return r=>{t===this.conn_?this.onConnectionLost_(r):t===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(t){return r=>{this.state_!==2&&(t===this.rx_?this.onPrimaryMessageReceived_(r):t===this.secondaryConn_?this.onSecondaryMessageReceived_(r):this.log_("message on old connection"))}}sendRequest(t){const r={t:"d",d:t};this.sendData_(r)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(t){if(H4 in t){const r=t[H4];r===gB?this.upgradeIfSecondaryHealthy_():r===pB?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):r===hB&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(t){const r=xy("t",t),n=xy("d",t);if(r==="c")this.onSecondaryControl_(n);else if(r==="d")this.pendingDataMessages.push(n);else throw new Error("Unknown protocol layer: "+r)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:vB,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:gB,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:mB,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(t){const r=xy("t",t),n=xy("d",t);r==="c"?this.onControl_(n):r==="d"&&this.onDataMessage_(n)}onDataMessage_(t){this.onPrimaryResponse_(),this.onMessage_(t)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(t){const r=xy(H4,t);if(fB in t){const n=t[fB];if(r===e3e){const o=Object.assign({},n);this.repoInfo_.isUsingEmulator&&(o.h=this.repoInfo_.host),this.onHandshake_(o)}else if(r===mB){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let o=0;o{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(G4e))}onReset_(t){this.log_("Reset packet received. New host: "+t),this.repoInfo_.host=t,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(t,r){this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(r,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):Ky(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(K4e))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:vB,d:{}}}))}onSecondaryConnectionLost_(){const t=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===t||this.rx_===t)&&this.close()}onConnectionLost_(t){this.conn_=null,!t&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(Jp.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(t){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(t)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class hK{put(t,r,n,o){}merge(t,r,n,o){}refreshAuthToken(t){}refreshAppCheckToken(t){}onDisconnectPut(t,r,n){}onDisconnectMerge(t,r,n){}onDisconnectCancel(t,r){}reportStats(t){}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class gK{constructor(t){this.allowedEvents_=t,this.listeners_={},Wt(Array.isArray(t)&&t.length>0,"Requires a non-empty array")}trigger(t,...r){if(Array.isArray(this.listeners_[t])){const n=[...this.listeners_[t]];for(let o=0;or===t),"Unknown event: "+t)}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class rw extends gK{static getInstance(){return new rw}constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!FG()&&(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}getInitialEvent(t){return Wt(t==="online","Unknown event type: "+t),[this.online_]}currentlyOnline(){return this.online_}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const yB=32,xB=768;class Wn{constructor(t,r){if(r===void 0){this.pieces_=t.split("/");let n=0;for(let o=0;o0&&(this.pieces_[n]=this.pieces_[o],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=r}toString(){let t="";for(let r=this.pieceNum_;r=e.pieces_.length?null:e.pieces_[e.pieceNum_]}function zf(e){return e.pieces_.length-e.pieceNum_}function Gn(e){let t=e.pieceNum_;return t=e.pieces_.length)return null;const t=[];for(let r=e.pieceNum_;r0&&r.push(n[o])}return new Wn(r,0)}function Yr(e){return e.pieceNum_>=e.pieces_.length}function ds(e,t){const r=Vr(e),n=Vr(t);if(r===null)return t;if(r===n)return ds(Gn(e),Gn(t));throw new Error("INTERNAL ERROR: innerPath ("+t+") is not within outerPath ("+e+")")}function GP(e,t){if(zf(e)!==zf(t))return!1;for(let r=e.pieceNum_,n=t.pieceNum_;r<=e.pieces_.length;r++,n++)if(e.pieces_[r]!==t.pieces_[n])return!1;return!0}function ic(e,t){let r=e.pieceNum_,n=t.pieceNum_;if(zf(e)>zf(t))return!1;for(;r0&&(e.byteLength_+=1),e.parts_.push(t),e.byteLength_+=CS(t),xK(e)}function o3e(e){const t=e.parts_.pop();e.byteLength_-=CS(t),e.parts_.length>0&&(e.byteLength_-=1)}function xK(e){if(e.byteLength_>xB)throw new Error(e.errorPrefix_+"has a key path longer than "+xB+" bytes ("+e.byteLength_+").");if(e.parts_.length>yB)throw new Error(e.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+yB+") or object contains a cycle "+qp(e))}function qp(e){return e.parts_.length===0?"":"in property '"+e.parts_.join(".")+"'"}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class KP extends gK{static getInstance(){return new KP}constructor(){super(["visible"]);let t,r;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(r="visibilitychange",t="hidden"):typeof document.mozHidden<"u"?(r="mozvisibilitychange",t="mozHidden"):typeof document.msHidden<"u"?(r="msvisibilitychange",t="msHidden"):typeof document.webkitHidden<"u"&&(r="webkitvisibilitychange",t="webkitHidden")),this.visible_=!0,r&&document.addEventListener(r,()=>{const n=!document[t];n!==this.visible_&&(this.visible_=n,this.trigger("visible",n))},!1)}getInitialEvent(t){return Wt(t==="visible","Unknown event type: "+t),[this.visible_]}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const by=1e3,a3e=300*1e3,bB=30*1e3,s3e=1.3,l3e=3e4,c3e="server_kill",wB=3;class cd extends hK{constructor(t,r,n,o,a,s,l,c){if(super(),this.repoInfo_=t,this.applicationId_=r,this.onDataUpdate_=n,this.onConnectStatus_=o,this.onServerInfoUpdate_=a,this.authTokenProvider_=s,this.appCheckTokenProvider_=l,this.authOverride_=c,this.id=cd.nextPersistentConnectionId_++,this.log_=Ab("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=by,this.maxReconnectDelay_=a3e,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,c)throw new Error("Auth override specified in options, but not supported on non Node.js platforms");KP.getInstance().on("visible",this.onVisible_,this),t.host.indexOf("fblocal")===-1&&rw.getInstance().on("online",this.onOnline_,this)}sendRequest(t,r,n){const o=++this.requestNumber_,a={r:o,a:t,b:r};this.log_(Mo(a)),Wt(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(a),n&&(this.requestCBHash_[o]=n)}get(t){this.initConnection_();const r=new WP,o={action:"g",request:{p:t._path.toString(),q:t._queryObject},onComplete:s=>{const l=s.d;s.s==="ok"?r.resolve(l):r.reject(l)}};this.outstandingGets_.push(o),this.outstandingGetCount_++;const a=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(a),r.promise}listen(t,r,n,o){this.initConnection_();const a=t._queryIdentifier,s=t._path.toString();this.log_("Listen called for "+s+" "+a),this.listens.has(s)||this.listens.set(s,new Map),Wt(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"listen() called for non-default but complete query"),Wt(!this.listens.get(s).has(a),"listen() called twice for same path/queryId.");const l={onComplete:o,hashFn:r,query:t,tag:n};this.listens.get(s).set(a,l),this.connected_&&this.sendListen_(l)}sendGet_(t){const r=this.outstandingGets_[t];this.sendRequest("g",r.request,n=>{delete this.outstandingGets_[t],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),r.onComplete&&r.onComplete(n)})}sendListen_(t){const r=t.query,n=r._path.toString(),o=r._queryIdentifier;this.log_("Listen on "+n+" for "+o);const a={p:n},s="q";t.tag&&(a.q=r._queryObject,a.t=t.tag),a.h=t.hashFn(),this.sendRequest(s,a,l=>{const c=l.d,u=l.s;cd.warnOnListenWarnings_(c,r),(this.listens.get(n)&&this.listens.get(n).get(o))===t&&(this.log_("listen response",l),u!=="ok"&&this.removeListen_(n,o),t.onComplete&&t.onComplete(u,c))})}static warnOnListenWarnings_(t,r){if(t&&typeof t=="object"&&Cd(t,"w")){const n=Qm(t,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){const o='".indexOn": "'+r._queryParams.getIndex().toString()+'"',a=r._path.toString();Xs(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${o} at ${a} to your security rules for better performance.`)}}}refreshAuthToken(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(t)}reduceReconnectDelayIfAdminCredential_(t){(t&&t.length===40||X_e(t))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=bB)}refreshAppCheckToken(t){this.appCheckToken_=t,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){const t=this.authToken_,r=Q_e(t)?"auth":"gauth",n={cred:t};this.authOverride_===null?n.noauth=!0:typeof this.authOverride_=="object"&&(n.authvar=this.authOverride_),this.sendRequest(r,n,o=>{const a=o.s,s=o.d||"error";this.authToken_===t&&(a==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(a,s))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},t=>{const r=t.s,n=t.d||"error";r==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(r,n)})}unlisten(t,r){const n=t._path.toString(),o=t._queryIdentifier;this.log_("Unlisten called for "+n+" "+o),Wt(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,o)&&this.connected_&&this.sendUnlisten_(n,o,t._queryObject,r)}sendUnlisten_(t,r,n,o){this.log_("Unlisten on "+t+" for "+r);const a={p:t},s="n";o&&(a.q=n,a.t=o),this.sendRequest(s,a)}onDisconnectPut(t,r,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",t,r,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:r,onComplete:n})}onDisconnectMerge(t,r,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",t,r,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:r,onComplete:n})}onDisconnectCancel(t,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",t,null,r):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:r})}sendOnDisconnect_(t,r,n,o){const a={p:r,d:n};this.log_("onDisconnect "+t,a),this.sendRequest(t,a,s=>{o&&setTimeout(()=>{o(s.s,s.d)},Math.floor(0))})}put(t,r,n,o){this.putInternal("p",t,r,n,o)}merge(t,r,n,o){this.putInternal("m",t,r,n,o)}putInternal(t,r,n,o,a){this.initConnection_();const s={p:r,d:n};a!==void 0&&(s.h=a),this.outstandingPuts_.push({action:t,request:s,onComplete:o}),this.outstandingPutCount_++;const l=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(l):this.log_("Buffering put: "+r)}sendPut_(t){const r=this.outstandingPuts_[t].action,n=this.outstandingPuts_[t].request,o=this.outstandingPuts_[t].onComplete;this.outstandingPuts_[t].queued=this.connected_,this.sendRequest(r,n,a=>{this.log_(r+" response",a),delete this.outstandingPuts_[t],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),o&&o(a.s,a.d)})}reportStats(t){if(this.connected_){const r={c:t};this.log_("reportStats",r),this.sendRequest("s",r,n=>{if(n.s!=="ok"){const a=n.d;this.log_("reportStats","Error sending stats: "+a)}})}}onDataMessage_(t){if("r"in t){this.log_("from server: "+Mo(t));const r=t.r,n=this.requestCBHash_[r];n&&(delete this.requestCBHash_[r],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}}onDataPush_(t,r){this.log_("handleServerMessage",t,r),t==="d"?this.onDataUpdate_(r.p,r.d,!1,r.t):t==="m"?this.onDataUpdate_(r.p,r.d,!0,r.t):t==="c"?this.onListenRevoked_(r.p,r.q):t==="ac"?this.onAuthRevoked_(r.s,r.d):t==="apc"?this.onAppCheckRevoked_(r.s,r.d):t==="sd"?this.onSecurityDebugPacket_(r):$A("Unrecognized action received from server: "+Mo(t)+` -Are you using the latest client?`)}onReady_(t,r){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(t),this.lastSessionId=r,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(t){Wt(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(t))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=by,this.realtime_||this.scheduleConnect_(0)),this.visible_=t}onOnline_(t){t?(this.log_("Browser went online."),this.reconnectDelay_=by,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>l3e&&(this.reconnectDelay_=by),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());const t=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_);let r=Math.max(0,this.reconnectDelay_-t);r=Math.random()*r,this.log_("Trying to reconnect in "+r+"ms"),this.scheduleConnect_(r),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*s3e)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;const t=this.onDataMessage_.bind(this),r=this.onReady_.bind(this),n=this.onRealtimeDisconnect_.bind(this),o=this.id+":"+cd.nextConnectionId_++,a=this.lastSessionId;let s=!1,l=null;const c=function(){l?l.close():(s=!0,n())},u=function(f){Wt(l,"sendRequest call when we're not connected not allowed."),l.sendRequest(f)};this.realtime_={close:c,sendRequest:u};const d=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[f,h]=await Promise.all([this.authTokenProvider_.getToken(d),this.appCheckTokenProvider_.getToken(d)]);s?ga("getToken() completed but was canceled"):(ga("getToken() completed. Creating connection."),this.authToken_=f&&f.accessToken,this.appCheckToken_=h&&h.token,l=new t3e(o,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,t,r,n,p=>{Xs(p+" ("+this.repoInfo_.toString()+")"),this.interrupt(c3e)},a))}catch(f){this.log_("Failed to get token: "+f),s||(this.repoInfo_.nodeAdmin&&Xs(f),c())}}}interrupt(t){ga("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(t){ga("Resuming connection for reason: "+t),delete this.interruptReasons_[t],K7(this.interruptReasons_)&&(this.reconnectDelay_=by,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(t){const r=t-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:r})}cancelSentTransactions_(){for(let t=0;tUP(a)).join("$"):n="default";const o=this.removeListen_(t,n);o&&o.onComplete&&o.onComplete("permission_denied")}removeListen_(t,r){const n=new Wn(t).toString();let o;if(this.listens.has(n)){const a=this.listens.get(n);o=a.get(r),a.delete(r),a.size===0&&this.listens.delete(n)}else o=void 0;return o}onAuthRevoked_(t,r){ga("Auth token revoked: "+t+"/"+r),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(t==="invalid_token"||t==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=wB&&(this.reconnectDelay_=bB,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(t,r){ga("App check token revoked: "+t+"/"+r),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(t==="invalid_token"||t==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=wB&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace(` -`,` -FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of this.listens.values())for(const r of t.values())this.sendListen_(r);for(let t=0;t0}peek(){if(this.nodeStack_.length===0)return null;const t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}}}class Ro{constructor(t,r,n,o,a){this.key=t,this.value=r,this.color=n??Ro.RED,this.left=o??fs.EMPTY_NODE,this.right=a??fs.EMPTY_NODE}copy(t,r,n,o,a){return new Ro(t??this.key,r??this.value,n??this.color,o??this.left,a??this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min_(){return this.left.isEmpty()?this:this.left.min_()}minKey(){return this.min_().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,r,n){let o=this;const a=n(t,o.key);return a<0?o=o.copy(null,null,null,o.left.insert(t,r,n),null):a===0?o=o.copy(null,r,null,null,null):o=o.copy(null,null,null,null,o.right.insert(t,r,n)),o.fixUp_()}removeMin_(){if(this.left.isEmpty())return fs.EMPTY_NODE;let t=this;return!t.left.isRed_()&&!t.left.left.isRed_()&&(t=t.moveRedLeft_()),t=t.copy(null,null,null,t.left.removeMin_(),null),t.fixUp_()}remove(t,r){let n,o;if(n=this,r(t,n.key)<0)!n.left.isEmpty()&&!n.left.isRed_()&&!n.left.left.isRed_()&&(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,r),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),!n.right.isEmpty()&&!n.right.isRed_()&&!n.right.left.isRed_()&&(n=n.moveRedRight_()),r(t,n.key)===0){if(n.right.isEmpty())return fs.EMPTY_NODE;o=n.right.min_(),n=n.copy(o.key,o.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,r))}return n.fixUp_()}isRed_(){return this.color}fixUp_(){let t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t}moveRedLeft_(){let t=this.colorFlip_();return t.right.left.isRed_()&&(t=t.copy(null,null,null,null,t.right.rotateRight_()),t=t.rotateLeft_(),t=t.colorFlip_()),t}moveRedRight_(){let t=this.colorFlip_();return t.left.left.isRed_()&&(t=t.rotateRight_(),t=t.colorFlip_()),t}rotateLeft_(){const t=this.copy(null,null,Ro.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight_(){const t=this.copy(null,null,Ro.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip_(){const t=this.left.copy(null,null,!this.left.color,null,null),r=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,r)}checkMaxDepth_(){const t=this.check_();return Math.pow(2,t)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const t=this.left.check_();if(t!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)}}Ro.RED=!0;Ro.BLACK=!1;class u3e{copy(t,r,n,o,a){return this}insert(t,r,n){return new Ro(t,r,null)}remove(t,r){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}}class fs{constructor(t,r=fs.EMPTY_NODE){this.comparator_=t,this.root_=r}insert(t,r){return new fs(this.comparator_,this.root_.insert(t,r,this.comparator_).copy(null,null,Ro.BLACK,null,null))}remove(t){return new fs(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,Ro.BLACK,null,null))}get(t){let r,n=this.root_;for(;!n.isEmpty();){if(r=this.comparator_(t,n.key),r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null}getPredecessorKey(t){let r,n=this.root_,o=null;for(;!n.isEmpty();)if(r=this.comparator_(t,n.key),r===0){if(n.left.isEmpty())return o?o.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}else r<0?n=n.left:r>0&&(o=n,n=n.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(t){return this.root_.inorderTraversal(t)}reverseTraversal(t){return this.root_.reverseTraversal(t)}getIterator(t){return new e0(this.root_,null,this.comparator_,!1,t)}getIteratorFrom(t,r){return new e0(this.root_,t,this.comparator_,!1,r)}getReverseIteratorFrom(t,r){return new e0(this.root_,t,this.comparator_,!0,r)}getReverseIterator(t){return new e0(this.root_,null,this.comparator_,!0,t)}}fs.EMPTY_NODE=new u3e;/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function d3e(e,t){return Cv(e.name,t.name)}function QP(e,t){return Cv(e,t)}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */let HA;function f3e(e){HA=e}const wK=function(e){return typeof e=="number"?"number:"+XG(e):"string:"+e},SK=function(e){if(e.isLeafNode()){const t=e.val();Wt(typeof t=="string"||typeof t=="number"||typeof t=="object"&&Cd(t,".sv"),"Priority must be a string or number.")}else Wt(e===HA||e.isEmpty(),"priority of unexpected type.");Wt(e===HA||e.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */let SB;class Oo{static set __childrenNodeConstructor(t){SB=t}static get __childrenNodeConstructor(){return SB}constructor(t,r=Oo.__childrenNodeConstructor.EMPTY_NODE){this.value_=t,this.priorityNode_=r,this.lazyHash_=null,Wt(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),SK(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(t){return new Oo(this.value_,t)}getImmediateChild(t){return t===".priority"?this.priorityNode_:Oo.__childrenNodeConstructor.EMPTY_NODE}getChild(t){return Yr(t)?this:Vr(t)===".priority"?this.priorityNode_:Oo.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(t,r){return null}updateImmediateChild(t,r){return t===".priority"?this.updatePriority(r):r.isEmpty()&&t!==".priority"?this:Oo.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,r).updatePriority(this.priorityNode_)}updateChild(t,r){const n=Vr(t);return n===null?r:r.isEmpty()&&n!==".priority"?this:(Wt(n!==".priority"||zf(t)===1,".priority must be the last token in a path"),this.updateImmediateChild(n,Oo.__childrenNodeConstructor.EMPTY_NODE.updateChild(Gn(t),r)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(t,r){return!1}val(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let t="";this.priorityNode_.isEmpty()||(t+="priority:"+wK(this.priorityNode_.val())+":");const r=typeof this.value_;t+=r+":",r==="number"?t+=XG(this.value_):t+=this.value_,this.lazyHash_=GG(t)}return this.lazyHash_}getValue(){return this.value_}compareTo(t){return t===Oo.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof Oo.__childrenNodeConstructor?-1:(Wt(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))}compareToLeafNode_(t){const r=typeof t.value_,n=typeof this.value_,o=Oo.VALUE_TYPE_ORDER.indexOf(r),a=Oo.VALUE_TYPE_ORDER.indexOf(n);return Wt(o>=0,"Unknown leaf type: "+r),Wt(a>=0,"Unknown leaf type: "+n),o===a?n==="object"?0:this.value_parseInt(Math.log(a)/m3e,10),n=a=>parseInt(Array(a+1).join("1"),2);this.count=r(t+1),this.current_=this.count-1;const o=n(this.count);this.bits_=t+1&o}nextBitIsOne(){const t=!(this.bits_&1<{const s=Qm(this.indexSet_,a);if(Wt(s,"Missing index implementation for "+a),o===Pg)if(s.isDefinedOn(t.node)){const l=[],c=r.getIterator(qr.Wrap);let u=c.getNext();for(;u;)u.name!==t.name&&l.push(u),u=c.getNext();return l.push(t),nw(l,s.getCompare())}else return Pg;else{const l=r.get(t.name);let c=o;return l&&(c=c.remove(new qr(t.name,l))),c.insert(t,t.node)}});return new rd(n,this.indexSet_)}removeFromIndexes(t,r){const n=Z2(this.indexes_,o=>{if(o===Pg)return o;{const a=r.get(t.name);return a?o.remove(new qr(t.name,a)):o}});return new rd(n,this.indexSet_)}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */let wy;class kr{static get EMPTY_NODE(){return wy||(wy=new kr(new fs(QP),null,rd.Default))}constructor(t,r,n){this.children_=t,this.priorityNode_=r,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&SK(this.priorityNode_),this.children_.isEmpty()&&Wt(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||wy}updatePriority(t){return this.children_.isEmpty()?this:new kr(this.children_,t,this.indexMap_)}getImmediateChild(t){if(t===".priority")return this.getPriority();{const r=this.children_.get(t);return r===null?wy:r}}getChild(t){const r=Vr(t);return r===null?this:this.getImmediateChild(r).getChild(Gn(t))}hasChild(t){return this.children_.get(t)!==null}updateImmediateChild(t,r){if(Wt(r,"We should always be passing snapshot nodes"),t===".priority")return this.updatePriority(r);{const n=new qr(t,r);let o,a;r.isEmpty()?(o=this.children_.remove(t),a=this.indexMap_.removeFromIndexes(n,this.children_)):(o=this.children_.insert(t,r),a=this.indexMap_.addToIndexes(n,this.children_));const s=o.isEmpty()?wy:this.priorityNode_;return new kr(o,s,a)}}updateChild(t,r){const n=Vr(t);if(n===null)return r;{Wt(Vr(t)!==".priority"||zf(t)===1,".priority must be the last token in a path");const o=this.getImmediateChild(n).updateChild(Gn(t),r);return this.updateImmediateChild(n,o)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(t){if(this.isEmpty())return null;const r={};let n=0,o=0,a=!0;if(this.forEachChild(Ti,(s,l)=>{r[s]=l.val(t),n++,a&&kr.INTEGER_REGEXP_.test(s)?o=Math.max(o,Number(s)):a=!1}),!t&&a&&o<2*n){const s=[];for(const l in r)s[l]=r[l];return s}else return t&&!this.getPriority().isEmpty()&&(r[".priority"]=this.getPriority().val()),r}hash(){if(this.lazyHash_===null){let t="";this.getPriority().isEmpty()||(t+="priority:"+wK(this.getPriority().val())+":"),this.forEachChild(Ti,(r,n)=>{const o=n.hash();o!==""&&(t+=":"+r+":"+o)}),this.lazyHash_=t===""?"":GG(t)}return this.lazyHash_}getPredecessorChildName(t,r,n){const o=this.resolveIndex_(n);if(o){const a=o.getPredecessorKey(new qr(t,r));return a?a.name:null}else return this.children_.getPredecessorKey(t)}getFirstChildName(t){const r=this.resolveIndex_(t);if(r){const n=r.minKey();return n&&n.name}else return this.children_.minKey()}getFirstChild(t){const r=this.getFirstChildName(t);return r?new qr(r,this.children_.get(r)):null}getLastChildName(t){const r=this.resolveIndex_(t);if(r){const n=r.maxKey();return n&&n.name}else return this.children_.maxKey()}getLastChild(t){const r=this.getLastChildName(t);return r?new qr(r,this.children_.get(r)):null}forEachChild(t,r){const n=this.resolveIndex_(t);return n?n.inorderTraversal(o=>r(o.name,o.node)):this.children_.inorderTraversal(r)}getIterator(t){return this.getIteratorFrom(t.minPost(),t)}getIteratorFrom(t,r){const n=this.resolveIndex_(r);if(n)return n.getIteratorFrom(t,o=>o);{const o=this.children_.getIteratorFrom(t.name,qr.Wrap);let a=o.peek();for(;a!=null&&r.compare(a,t)<0;)o.getNext(),a=o.peek();return o}}getReverseIterator(t){return this.getReverseIteratorFrom(t.maxPost(),t)}getReverseIteratorFrom(t,r){const n=this.resolveIndex_(r);if(n)return n.getReverseIteratorFrom(t,o=>o);{const o=this.children_.getReverseIteratorFrom(t.name,qr.Wrap);let a=o.peek();for(;a!=null&&r.compare(a,t)>0;)o.getNext(),a=o.peek();return o}}compareTo(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===Pb?-1:0}withIndex(t){if(t===sm||this.indexMap_.hasIndex(t))return this;{const r=this.indexMap_.addIndex(t,this.children_);return new kr(this.children_,this.priorityNode_,r)}}isIndexed(t){return t===sm||this.indexMap_.hasIndex(t)}equals(t){if(t===this)return!0;if(t.isLeafNode())return!1;{const r=t;if(this.getPriority().equals(r.getPriority()))if(this.children_.count()===r.children_.count()){const n=this.getIterator(Ti),o=r.getIterator(Ti);let a=n.getNext(),s=o.getNext();for(;a&&s;){if(a.name!==s.name||!a.node.equals(s.node))return!1;a=n.getNext(),s=o.getNext()}return a===null&&s===null}else return!1;else return!1}}resolveIndex_(t){return t===sm?null:this.indexMap_.get(t.toString())}}kr.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class y3e extends kr{constructor(){super(new fs(QP),kr.EMPTY_NODE,rd.Default)}compareTo(t){return t===this?0:1}equals(t){return t===this}getPriority(){return this}getImmediateChild(t){return kr.EMPTY_NODE}isEmpty(){return!1}}const Pb=new y3e;Object.defineProperties(qr,{MIN:{value:new qr(Xm,kr.EMPTY_NODE)},MAX:{value:new qr(wh,Pb)}});bK.__EMPTY_NODE=kr.EMPTY_NODE;Oo.__childrenNodeConstructor=kr;f3e(Pb);h3e(Pb);/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const x3e=!0;function ma(e,t=null){if(e===null)return kr.EMPTY_NODE;if(typeof e=="object"&&".priority"in e&&(t=e[".priority"]),Wt(t===null||typeof t=="string"||typeof t=="number"||typeof t=="object"&&".sv"in t,"Invalid priority type found: "+typeof t),typeof e=="object"&&".value"in e&&e[".value"]!==null&&(e=e[".value"]),typeof e!="object"||".sv"in e){const r=e;return new Oo(r,ma(t))}if(!(e instanceof Array)&&x3e){const r=[];let n=!1;if(gs(e,(s,l)=>{if(s.substring(0,1)!=="."){const c=ma(l);c.isEmpty()||(n=n||!c.getPriority().isEmpty(),r.push(new qr(s,c)))}}),r.length===0)return kr.EMPTY_NODE;const a=nw(r,d3e,s=>s.name,QP);if(n){const s=nw(r,Ti.getCompare());return new kr(a,ma(t),new rd({".priority":s},{".priority":Ti}))}else return new kr(a,ma(t),rd.Default)}else{let r=kr.EMPTY_NODE;return gs(e,(n,o)=>{if(Cd(e,n)&&n.substring(0,1)!=="."){const a=ma(o);(a.isLeafNode()||!a.isEmpty())&&(r=r.updateImmediateChild(n,a))}}),r.updatePriority(ma(t))}}p3e(ma);/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class b3e extends AS{constructor(t){super(),this.indexPath_=t,Wt(!Yr(t)&&Vr(t)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(t){return t.getChild(this.indexPath_)}isDefinedOn(t){return!t.getChild(this.indexPath_).isEmpty()}compare(t,r){const n=this.extractChild(t.node),o=this.extractChild(r.node),a=n.compareTo(o);return a===0?Cv(t.name,r.name):a}makePost(t,r){const n=ma(t),o=kr.EMPTY_NODE.updateChild(this.indexPath_,n);return new qr(r,o)}maxPost(){const t=kr.EMPTY_NODE.updateChild(this.indexPath_,Pb);return new qr(wh,t)}toString(){return vK(this.indexPath_,0).join("/")}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class w3e extends AS{compare(t,r){const n=t.node.compareTo(r.node);return n===0?Cv(t.name,r.name):n}isDefinedOn(t){return!0}indexedValueChanged(t,r){return!t.equals(r)}minPost(){return qr.MIN}maxPost(){return qr.MAX}makePost(t,r){const n=ma(t);return new qr(r,n)}toString(){return".value"}}const S3e=new w3e;/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function _K(e){return{type:"value",snapshotNode:e}}function Zm(e,t){return{type:"child_added",snapshotNode:t,childName:e}}function Kx(e,t){return{type:"child_removed",snapshotNode:t,childName:e}}function Qx(e,t,r){return{type:"child_changed",snapshotNode:t,childName:e,oldSnap:r}}function j3e(e,t){return{type:"child_moved",snapshotNode:t,childName:e}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class XP{constructor(t){this.index_=t}updateChild(t,r,n,o,a,s){Wt(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");const l=t.getImmediateChild(r);return l.getChild(o).equals(n.getChild(o))&&l.isEmpty()===n.isEmpty()||(s!=null&&(n.isEmpty()?t.hasChild(r)?s.trackChildChange(Kx(r,l)):Wt(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):l.isEmpty()?s.trackChildChange(Zm(r,n)):s.trackChildChange(Qx(r,n,l))),t.isLeafNode()&&n.isEmpty())?t:t.updateImmediateChild(r,n).withIndex(this.index_)}updateFullNode(t,r,n){return n!=null&&(t.isLeafNode()||t.forEachChild(Ti,(o,a)=>{r.hasChild(o)||n.trackChildChange(Kx(o,a))}),r.isLeafNode()||r.forEachChild(Ti,(o,a)=>{if(t.hasChild(o)){const s=t.getImmediateChild(o);s.equals(a)||n.trackChildChange(Qx(o,a,s))}else n.trackChildChange(Zm(o,a))})),r.withIndex(this.index_)}updatePriority(t,r){return t.isEmpty()?kr.EMPTY_NODE:t.updatePriority(r)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class Xx{constructor(t){this.indexedFilter_=new XP(t.getIndex()),this.index_=t.getIndex(),this.startPost_=Xx.getStartPost_(t),this.endPost_=Xx.getEndPost_(t),this.startIsInclusive_=!t.startAfterSet_,this.endIsInclusive_=!t.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(t){const r=this.startIsInclusive_?this.index_.compare(this.getStartPost(),t)<=0:this.index_.compare(this.getStartPost(),t)<0,n=this.endIsInclusive_?this.index_.compare(t,this.getEndPost())<=0:this.index_.compare(t,this.getEndPost())<0;return r&&n}updateChild(t,r,n,o,a,s){return this.matches(new qr(r,n))||(n=kr.EMPTY_NODE),this.indexedFilter_.updateChild(t,r,n,o,a,s)}updateFullNode(t,r,n){r.isLeafNode()&&(r=kr.EMPTY_NODE);let o=r.withIndex(this.index_);o=o.updatePriority(kr.EMPTY_NODE);const a=this;return r.forEachChild(Ti,(s,l)=>{a.matches(new qr(s,l))||(o=o.updateImmediateChild(s,kr.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(t,o,n)}updatePriority(t,r){return t}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(t){if(t.hasStart()){const r=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),r)}else return t.getIndex().minPost()}static getEndPost_(t){if(t.hasEnd()){const r=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),r)}else return t.getIndex().maxPost()}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class k3e{constructor(t){this.withinDirectionalStart=r=>this.reverse_?this.withinEndPost(r):this.withinStartPost(r),this.withinDirectionalEnd=r=>this.reverse_?this.withinStartPost(r):this.withinEndPost(r),this.withinStartPost=r=>{const n=this.index_.compare(this.rangedFilter_.getStartPost(),r);return this.startIsInclusive_?n<=0:n<0},this.withinEndPost=r=>{const n=this.index_.compare(r,this.rangedFilter_.getEndPost());return this.endIsInclusive_?n<=0:n<0},this.rangedFilter_=new Xx(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft(),this.startIsInclusive_=!t.startAfterSet_,this.endIsInclusive_=!t.endBeforeSet_}updateChild(t,r,n,o,a,s){return this.rangedFilter_.matches(new qr(r,n))||(n=kr.EMPTY_NODE),t.getImmediateChild(r).equals(n)?t:t.numChildren()f(p,h)}else s=this.index_.getCompare();const l=t;Wt(l.numChildren()===this.limit_,"");const c=new qr(r,n),u=this.reverse_?l.getFirstChild(this.index_):l.getLastChild(this.index_),d=this.rangedFilter_.matches(c);if(l.hasChild(r)){const f=l.getImmediateChild(r);let h=o.getChildAfterChild(this.index_,u,this.reverse_);for(;h!=null&&(h.name===r||l.hasChild(h.name));)h=o.getChildAfterChild(this.index_,h,this.reverse_);const p=h==null?1:s(h,c);if(d&&!n.isEmpty()&&p>=0)return a!=null&&a.trackChildChange(Qx(r,n,f)),l.updateImmediateChild(r,n);{a!=null&&a.trackChildChange(Kx(r,f));const m=l.updateImmediateChild(r,kr.EMPTY_NODE);return h!=null&&this.rangedFilter_.matches(h)?(a!=null&&a.trackChildChange(Zm(h.name,h.node)),m.updateImmediateChild(h.name,h.node)):m}}else return n.isEmpty()?t:d&&s(u,c)>=0?(a!=null&&(a.trackChildChange(Kx(u.name,u.node)),a.trackChildChange(Zm(r,n))),l.updateImmediateChild(r,n).updateImmediateChild(u.name,kr.EMPTY_NODE)):t}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class ZP{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=Ti}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return Wt(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return Wt(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Xm}hasEnd(){return this.endSet_}getIndexEndValue(){return Wt(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return Wt(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:wh}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return Wt(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===Ti}copy(){const t=new ZP;return t.limitSet_=this.limitSet_,t.limit_=this.limit_,t.startSet_=this.startSet_,t.startAfterSet_=this.startAfterSet_,t.indexStartValue_=this.indexStartValue_,t.startNameSet_=this.startNameSet_,t.indexStartName_=this.indexStartName_,t.endSet_=this.endSet_,t.endBeforeSet_=this.endBeforeSet_,t.indexEndValue_=this.indexEndValue_,t.endNameSet_=this.endNameSet_,t.indexEndName_=this.indexEndName_,t.index_=this.index_,t.viewFrom_=this.viewFrom_,t}}function _3e(e){return e.loadsAllData()?new XP(e.getIndex()):e.hasLimit()?new k3e(e):new Xx(e)}function jB(e){const t={};if(e.isDefault())return t;let r;if(e.index_===Ti?r="$priority":e.index_===S3e?r="$value":e.index_===sm?r="$key":(Wt(e.index_ instanceof b3e,"Unrecognized index type!"),r=e.index_.toString()),t.orderBy=Mo(r),e.startSet_){const n=e.startAfterSet_?"startAfter":"startAt";t[n]=Mo(e.indexStartValue_),e.startNameSet_&&(t[n]+=","+Mo(e.indexStartName_))}if(e.endSet_){const n=e.endBeforeSet_?"endBefore":"endAt";t[n]=Mo(e.indexEndValue_),e.endNameSet_&&(t[n]+=","+Mo(e.indexEndName_))}return e.limitSet_&&(e.isViewFromLeft()?t.limitToFirst=e.limit_:t.limitToLast=e.limit_),t}function kB(e){const t={};if(e.startSet_&&(t.sp=e.indexStartValue_,e.startNameSet_&&(t.sn=e.indexStartName_),t.sin=!e.startAfterSet_),e.endSet_&&(t.ep=e.indexEndValue_,e.endNameSet_&&(t.en=e.indexEndName_),t.ein=!e.endBeforeSet_),e.limitSet_){t.l=e.limit_;let r=e.viewFrom_;r===""&&(e.isViewFromLeft()?r="l":r="r"),t.vf=r}return e.index_!==Ti&&(t.i=e.index_.toString()),t}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class iw extends hK{reportStats(t){throw new Error("Method not implemented.")}static getListenId_(t,r){return r!==void 0?"tag$"+r:(Wt(t._queryParams.isDefault(),"should have a tag if it's not a default query."),t._path.toString())}constructor(t,r,n,o){super(),this.repoInfo_=t,this.onDataUpdate_=r,this.authTokenProvider_=n,this.appCheckTokenProvider_=o,this.log_=Ab("p:rest:"),this.listens_={}}listen(t,r,n,o){const a=t._path.toString();this.log_("Listen called for "+a+" "+t._queryIdentifier);const s=iw.getListenId_(t,n),l={};this.listens_[s]=l;const c=jB(t._queryParams);this.restRequest_(a+".json",c,(u,d)=>{let f=d;if(u===404&&(f=null,u=null),u===null&&this.onDataUpdate_(a,f,!1,n),Qm(this.listens_,s)===l){let h;u?u===401?h="permission_denied":h="rest_error:"+u:h="ok",o(h,null)}})}unlisten(t,r){const n=iw.getListenId_(t,r);delete this.listens_[n]}get(t){const r=jB(t._queryParams),n=t._path.toString(),o=new WP;return this.restRequest_(n+".json",r,(a,s)=>{let l=s;a===404&&(l=null,a=null),a===null?(this.onDataUpdate_(n,l,!1,null),o.resolve(l)):o.reject(new Error(l))}),o.promise}refreshAuthToken(t){}restRequest_(t,r={},n){return r.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([o,a])=>{o&&o.accessToken&&(r.auth=o.accessToken),a&&a.token&&(r.ac=a.token);const s=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+t+"?ns="+this.repoInfo_.namespace+Z_e(r);this.log_("Sending REST request for "+s);const l=new XMLHttpRequest;l.onreadystatechange=()=>{if(n&&l.readyState===4){this.log_("REST Response for "+s+" received. status:",l.status,"response:",l.responseText);let c=null;if(l.status>=200&&l.status<300){try{c=Ux(l.responseText)}catch{Xs("Failed to parse JSON response for "+s+": "+l.responseText)}n(null,c)}else l.status!==401&&l.status!==404&&Xs("Got unsuccessful REST response for "+s+" Status: "+l.status),n(l.status);n=null}},l.open("GET",s,!0),l.send()})}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class C3e{constructor(){this.rootNode_=kr.EMPTY_NODE}getNode(t){return this.rootNode_.getChild(t)}updateSnapshot(t,r){this.rootNode_=this.rootNode_.updateChild(t,r)}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function ow(){return{value:null,children:new Map}}function CK(e,t,r){if(Yr(t))e.value=r,e.children.clear();else if(e.value!==null)e.value=e.value.updateChild(t,r);else{const n=Vr(t);e.children.has(n)||e.children.set(n,ow());const o=e.children.get(n);t=Gn(t),CK(o,t,r)}}function VA(e,t,r){e.value!==null?r(t,e.value):E3e(e,(n,o)=>{const a=new Wn(t.toString()+"/"+n);VA(o,a,r)})}function E3e(e,t){e.children.forEach((r,n)=>{t(n,r)})}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class A3e{constructor(t){this.collection_=t,this.last_=null}get(){const t=this.collection_.get(),r=Object.assign({},t);return this.last_&&gs(this.last_,(n,o)=>{r[n]=r[n]-o}),this.last_=t,r}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const _B=10*1e3,T3e=30*1e3,P3e=300*1e3;class O3e{constructor(t,r){this.server_=r,this.statsToReport_={},this.statsListener_=new A3e(t);const n=_B+(T3e-_B)*Math.random();Ky(this.reportStats_.bind(this),Math.floor(n))}reportStats_(){const t=this.statsListener_.get(),r={};let n=!1;gs(t,(o,a)=>{a>0&&Cd(this.statsToReport_,o)&&(r[o]=a,n=!0)}),n&&this.server_.reportStats(r),Ky(this.reportStats_.bind(this),Math.floor(Math.random()*2*P3e))}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */var oc;(function(e){e[e.OVERWRITE=0]="OVERWRITE",e[e.MERGE=1]="MERGE",e[e.ACK_USER_WRITE=2]="ACK_USER_WRITE",e[e.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"})(oc||(oc={}));function EK(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function JP(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function e8(e){return{fromUser:!1,fromServer:!0,queryId:e,tagged:!0}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class aw{constructor(t,r,n){this.path=t,this.affectedTree=r,this.revert=n,this.type=oc.ACK_USER_WRITE,this.source=EK()}operationForChild(t){if(Yr(this.path)){if(this.affectedTree.value!=null)return Wt(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{const r=this.affectedTree.subtree(new Wn(t));return new aw(hn(),r,this.revert)}}else return Wt(Vr(this.path)===t,"operationForChild called for unrelated child."),new aw(Gn(this.path),this.affectedTree,this.revert)}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class Zx{constructor(t,r){this.source=t,this.path=r,this.type=oc.LISTEN_COMPLETE}operationForChild(t){return Yr(this.path)?new Zx(this.source,hn()):new Zx(this.source,Gn(this.path))}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class Sh{constructor(t,r,n){this.source=t,this.path=r,this.snap=n,this.type=oc.OVERWRITE}operationForChild(t){return Yr(this.path)?new Sh(this.source,hn(),this.snap.getImmediateChild(t)):new Sh(this.source,Gn(this.path),this.snap)}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class Jx{constructor(t,r,n){this.source=t,this.path=r,this.children=n,this.type=oc.MERGE}operationForChild(t){if(Yr(this.path)){const r=this.children.subtree(new Wn(t));return r.isEmpty()?null:r.value?new Sh(this.source,hn(),r.value):new Jx(this.source,hn(),r)}else return Wt(Vr(this.path)===t,"Can't get a merge for a child not on the path of the operation"),new Jx(this.source,Gn(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class jh{constructor(t,r,n){this.node_=t,this.fullyInitialized_=r,this.filtered_=n}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(t){if(Yr(t))return this.isFullyInitialized()&&!this.filtered_;const r=Vr(t);return this.isCompleteForChild(r)}isCompleteForChild(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)}getNode(){return this.node_}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class I3e{constructor(t){this.query_=t,this.index_=this.query_._queryParams.getIndex()}}function N3e(e,t,r,n){const o=[],a=[];return t.forEach(s=>{s.type==="child_changed"&&e.index_.indexedValueChanged(s.oldSnap,s.snapshotNode)&&a.push(j3e(s.childName,s.snapshotNode))}),Sy(e,o,"child_removed",t,n,r),Sy(e,o,"child_added",t,n,r),Sy(e,o,"child_moved",a,n,r),Sy(e,o,"child_changed",t,n,r),Sy(e,o,"value",t,n,r),o}function Sy(e,t,r,n,o,a){const s=n.filter(l=>l.type===r);s.sort((l,c)=>L3e(e,l,c)),s.forEach(l=>{const c=R3e(e,l,a);o.forEach(u=>{u.respondsTo(l.type)&&t.push(u.createEvent(c,e.query_))})})}function R3e(e,t,r){return t.type==="value"||t.type==="child_removed"||(t.prevName=r.getPredecessorChildName(t.childName,t.snapshotNode,e.index_)),t}function L3e(e,t,r){if(t.childName==null||r.childName==null)throw _v("Should only compare child_ events.");const n=new qr(t.childName,t.snapshotNode),o=new qr(r.childName,r.snapshotNode);return e.index_.compare(n,o)}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function TS(e,t){return{eventCache:e,serverCache:t}}function Qy(e,t,r,n){return TS(new jh(t,r,n),e.serverCache)}function AK(e,t,r,n){return TS(e.eventCache,new jh(t,r,n))}function YA(e){return e.eventCache.isFullyInitialized()?e.eventCache.getNode():null}function kh(e){return e.serverCache.isFullyInitialized()?e.serverCache.getNode():null}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */let Y4;const F3e=()=>(Y4||(Y4=new fs(w4e)),Y4);class ri{static fromObject(t){let r=new ri(null);return gs(t,(n,o)=>{r=r.set(new Wn(n),o)}),r}constructor(t,r=F3e()){this.value=t,this.children=r}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(t,r){if(this.value!=null&&r(this.value))return{path:hn(),value:this.value};if(Yr(t))return null;{const n=Vr(t),o=this.children.get(n);if(o!==null){const a=o.findRootMostMatchingPathAndValue(Gn(t),r);return a!=null?{path:fo(new Wn(n),a.path),value:a.value}:null}else return null}}findRootMostValueAndPath(t){return this.findRootMostMatchingPathAndValue(t,()=>!0)}subtree(t){if(Yr(t))return this;{const r=Vr(t),n=this.children.get(r);return n!==null?n.subtree(Gn(t)):new ri(null)}}set(t,r){if(Yr(t))return new ri(r,this.children);{const n=Vr(t),a=(this.children.get(n)||new ri(null)).set(Gn(t),r),s=this.children.insert(n,a);return new ri(this.value,s)}}remove(t){if(Yr(t))return this.children.isEmpty()?new ri(null):new ri(null,this.children);{const r=Vr(t),n=this.children.get(r);if(n){const o=n.remove(Gn(t));let a;return o.isEmpty()?a=this.children.remove(r):a=this.children.insert(r,o),this.value===null&&a.isEmpty()?new ri(null):new ri(this.value,a)}else return this}}get(t){if(Yr(t))return this.value;{const r=Vr(t),n=this.children.get(r);return n?n.get(Gn(t)):null}}setTree(t,r){if(Yr(t))return r;{const n=Vr(t),a=(this.children.get(n)||new ri(null)).setTree(Gn(t),r);let s;return a.isEmpty()?s=this.children.remove(n):s=this.children.insert(n,a),new ri(this.value,s)}}fold(t){return this.fold_(hn(),t)}fold_(t,r){const n={};return this.children.inorderTraversal((o,a)=>{n[o]=a.fold_(fo(t,o),r)}),r(t,this.value,n)}findOnPath(t,r){return this.findOnPath_(t,hn(),r)}findOnPath_(t,r,n){const o=this.value?n(r,this.value):!1;if(o)return o;if(Yr(t))return null;{const a=Vr(t),s=this.children.get(a);return s?s.findOnPath_(Gn(t),fo(r,a),n):null}}foreachOnPath(t,r){return this.foreachOnPath_(t,hn(),r)}foreachOnPath_(t,r,n){if(Yr(t))return this;{this.value&&n(r,this.value);const o=Vr(t),a=this.children.get(o);return a?a.foreachOnPath_(Gn(t),fo(r,o),n):new ri(null)}}foreach(t){this.foreach_(hn(),t)}foreach_(t,r){this.children.inorderTraversal((n,o)=>{o.foreach_(fo(t,n),r)}),this.value&&r(t,this.value)}foreachChild(t){this.children.inorderTraversal((r,n)=>{n.value&&t(r,n.value)})}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class sc{constructor(t){this.writeTree_=t}static empty(){return new sc(new ri(null))}}function Xy(e,t,r){if(Yr(t))return new sc(new ri(r));{const n=e.writeTree_.findRootMostValueAndPath(t);if(n!=null){const o=n.path;let a=n.value;const s=ds(o,t);return a=a.updateChild(s,r),new sc(e.writeTree_.set(o,a))}else{const o=new ri(r),a=e.writeTree_.setTree(t,o);return new sc(a)}}}function CB(e,t,r){let n=e;return gs(r,(o,a)=>{n=Xy(n,fo(t,o),a)}),n}function EB(e,t){if(Yr(t))return sc.empty();{const r=e.writeTree_.setTree(t,new ri(null));return new sc(r)}}function GA(e,t){return Mh(e,t)!=null}function Mh(e,t){const r=e.writeTree_.findRootMostValueAndPath(t);return r!=null?e.writeTree_.get(r.path).getChild(ds(r.path,t)):null}function AB(e){const t=[],r=e.writeTree_.value;return r!=null?r.isLeafNode()||r.forEachChild(Ti,(n,o)=>{t.push(new qr(n,o))}):e.writeTree_.children.inorderTraversal((n,o)=>{o.value!=null&&t.push(new qr(n,o.value))}),t}function If(e,t){if(Yr(t))return e;{const r=Mh(e,t);return r!=null?new sc(new ri(r)):new sc(e.writeTree_.subtree(t))}}function KA(e){return e.writeTree_.isEmpty()}function Jm(e,t){return TK(hn(),e.writeTree_,t)}function TK(e,t,r){if(t.value!=null)return r.updateChild(e,t.value);{let n=null;return t.children.inorderTraversal((o,a)=>{o===".priority"?(Wt(a.value!==null,"Priority writes must always be leaf nodes"),n=a.value):r=TK(fo(e,o),a,r)}),!r.getChild(e).isEmpty()&&n!==null&&(r=r.updateChild(fo(e,".priority"),n)),r}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function t8(e,t){return NK(t,e)}function M3e(e,t,r,n,o){Wt(n>e.lastWriteId,"Stacking an older write on top of newer ones"),o===void 0&&(o=!0),e.allWrites.push({path:t,snap:r,writeId:n,visible:o}),o&&(e.visibleWrites=Xy(e.visibleWrites,t,r)),e.lastWriteId=n}function D3e(e,t){for(let r=0;rl.writeId===t);Wt(r>=0,"removeWrite called with nonexistent writeId.");const n=e.allWrites[r];e.allWrites.splice(r,1);let o=n.visible,a=!1,s=e.allWrites.length-1;for(;o&&s>=0;){const l=e.allWrites[s];l.visible&&(s>=r&&B3e(l,n.path)?o=!1:ic(n.path,l.path)&&(a=!0)),s--}if(o){if(a)return W3e(e),!0;if(n.snap)e.visibleWrites=EB(e.visibleWrites,n.path);else{const l=n.children;gs(l,c=>{e.visibleWrites=EB(e.visibleWrites,fo(n.path,c))})}return!0}else return!1}function B3e(e,t){if(e.snap)return ic(e.path,t);for(const r in e.children)if(e.children.hasOwnProperty(r)&&ic(fo(e.path,r),t))return!0;return!1}function W3e(e){e.visibleWrites=PK(e.allWrites,q3e,hn()),e.allWrites.length>0?e.lastWriteId=e.allWrites[e.allWrites.length-1].writeId:e.lastWriteId=-1}function q3e(e){return e.visible}function PK(e,t,r){let n=sc.empty();for(let o=0;o{n=n.updateImmediateChild(a,s)}),n;if(r){const a=If(e.visibleWrites,t);return r.forEachChild(Ti,(s,l)=>{const c=Jm(If(a,new Wn(s)),l);n=n.updateImmediateChild(s,c)}),AB(a).forEach(s=>{n=n.updateImmediateChild(s.name,s.node)}),n}else{const a=If(e.visibleWrites,t);return AB(a).forEach(s=>{n=n.updateImmediateChild(s.name,s.node)}),n}}function U3e(e,t,r,n,o){Wt(n||o,"Either existingEventSnap or existingServerSnap must exist");const a=fo(t,r);if(GA(e.visibleWrites,a))return null;{const s=If(e.visibleWrites,a);return KA(s)?o.getChild(r):Jm(s,o.getChild(r))}}function H3e(e,t,r,n){const o=fo(t,r),a=Mh(e.visibleWrites,o);if(a!=null)return a;if(n.isCompleteForChild(r)){const s=If(e.visibleWrites,o);return Jm(s,n.getNode().getImmediateChild(r))}else return null}function V3e(e,t){return Mh(e.visibleWrites,t)}function Y3e(e,t,r,n,o,a,s){let l;const c=If(e.visibleWrites,t),u=Mh(c,hn());if(u!=null)l=u;else if(r!=null)l=Jm(c,r);else return[];if(l=l.withIndex(s),!l.isEmpty()&&!l.isLeafNode()){const d=[],f=s.getCompare(),h=a?l.getReverseIteratorFrom(n,s):l.getIteratorFrom(n,s);let p=h.getNext();for(;p&&d.length0||!e.eventCache.isFullyInitialized()||o&&!n.getNode().equals(a)||!n.getNode().getPriority().equals(a.getPriority()))&&r.push(_K(YA(t)))}}function LK(e,t,r,n,o,a){const s=t.eventCache;if(lw(n,r)!=null)return t;{let l,c;if(Yr(r))if(Wt(t.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),t.serverCache.isFiltered()){const u=kh(t),d=u instanceof kr?u:kr.EMPTY_NODE,f=r8(n,d);l=e.filter.updateFullNode(t.eventCache.getNode(),f,a)}else{const u=sw(n,kh(t));l=e.filter.updateFullNode(t.eventCache.getNode(),u,a)}else{const u=Vr(r);if(u===".priority"){Wt(zf(r)===1,"Can't have a priority with additional path components");const d=s.getNode();c=t.serverCache.getNode();const f=TB(n,r,d,c);f!=null?l=e.filter.updatePriority(d,f):l=s.getNode()}else{const d=Gn(r);let f;if(s.isCompleteForChild(u)){c=t.serverCache.getNode();const h=TB(n,r,s.getNode(),c);h!=null?f=s.getNode().getImmediateChild(u).updateChild(d,h):f=s.getNode().getImmediateChild(u)}else f=n8(n,u,t.serverCache);f!=null?l=e.filter.updateChild(s.getNode(),u,f,d,o,a):l=s.getNode()}}return Qy(t,l,s.isFullyInitialized()||Yr(r),e.filter.filtersNodes())}}function cw(e,t,r,n,o,a,s,l){const c=t.serverCache;let u;const d=s?e.filter:e.filter.getIndexedFilter();if(Yr(r))u=d.updateFullNode(c.getNode(),n,null);else if(d.filtersNodes()&&!c.isFiltered()){const p=c.getNode().updateChild(r,n);u=d.updateFullNode(c.getNode(),p,null)}else{const p=Vr(r);if(!c.isCompleteForPath(r)&&zf(r)>1)return t;const y=Gn(r),x=c.getNode().getImmediateChild(p).updateChild(y,n);p===".priority"?u=d.updatePriority(c.getNode(),x):u=d.updateChild(c.getNode(),p,x,y,RK,null)}const f=AK(t,u,c.isFullyInitialized()||Yr(r),d.filtersNodes()),h=new i8(o,f,a);return LK(e,f,r,o,h,l)}function QA(e,t,r,n,o,a,s){const l=t.eventCache;let c,u;const d=new i8(o,t,a);if(Yr(r))u=e.filter.updateFullNode(t.eventCache.getNode(),n,s),c=Qy(t,u,!0,e.filter.filtersNodes());else{const f=Vr(r);if(f===".priority")u=e.filter.updatePriority(t.eventCache.getNode(),n),c=Qy(t,u,l.isFullyInitialized(),l.isFiltered());else{const h=Gn(r),p=l.getNode().getImmediateChild(f);let y;if(Yr(h))y=n;else{const m=d.getCompleteChild(f);m!=null?mK(h)===".priority"&&m.getChild(yK(h)).isEmpty()?y=m:y=m.updateChild(h,n):y=kr.EMPTY_NODE}if(p.equals(y))c=t;else{const m=e.filter.updateChild(l.getNode(),f,y,h,d,s);c=Qy(t,m,l.isFullyInitialized(),e.filter.filtersNodes())}}}return c}function PB(e,t){return e.eventCache.isCompleteForChild(t)}function rEe(e,t,r,n,o,a,s){let l=t;return n.foreach((c,u)=>{const d=fo(r,c);PB(t,Vr(d))&&(l=QA(e,l,d,u,o,a,s))}),n.foreach((c,u)=>{const d=fo(r,c);PB(t,Vr(d))||(l=QA(e,l,d,u,o,a,s))}),l}function OB(e,t,r){return r.foreach((n,o)=>{t=t.updateChild(n,o)}),t}function XA(e,t,r,n,o,a,s,l){if(t.serverCache.getNode().isEmpty()&&!t.serverCache.isFullyInitialized())return t;let c=t,u;Yr(r)?u=n:u=new ri(null).setTree(r,n);const d=t.serverCache.getNode();return u.children.inorderTraversal((f,h)=>{if(d.hasChild(f)){const p=t.serverCache.getNode().getImmediateChild(f),y=OB(e,p,h);c=cw(e,c,new Wn(f),y,o,a,s,l)}}),u.children.inorderTraversal((f,h)=>{const p=!t.serverCache.isCompleteForChild(f)&&h.value===null;if(!d.hasChild(f)&&!p){const y=t.serverCache.getNode().getImmediateChild(f),m=OB(e,y,h);c=cw(e,c,new Wn(f),m,o,a,s,l)}}),c}function nEe(e,t,r,n,o,a,s){if(lw(o,r)!=null)return t;const l=t.serverCache.isFiltered(),c=t.serverCache;if(n.value!=null){if(Yr(r)&&c.isFullyInitialized()||c.isCompleteForPath(r))return cw(e,t,r,c.getNode().getChild(r),o,a,l,s);if(Yr(r)){let u=new ri(null);return c.getNode().forEachChild(sm,(d,f)=>{u=u.set(new Wn(d),f)}),XA(e,t,r,u,o,a,l,s)}else return t}else{let u=new ri(null);return n.foreach((d,f)=>{const h=fo(r,d);c.isCompleteForPath(h)&&(u=u.set(d,c.getNode().getChild(h)))}),XA(e,t,r,u,o,a,l,s)}}function iEe(e,t,r,n,o){const a=t.serverCache,s=AK(t,a.getNode(),a.isFullyInitialized()||Yr(r),a.isFiltered());return LK(e,s,r,n,RK,o)}function oEe(e,t,r,n,o,a){let s;if(lw(n,r)!=null)return t;{const l=new i8(n,t,o),c=t.eventCache.getNode();let u;if(Yr(r)||Vr(r)===".priority"){let d;if(t.serverCache.isFullyInitialized())d=sw(n,kh(t));else{const f=t.serverCache.getNode();Wt(f instanceof kr,"serverChildren would be complete if leaf node"),d=r8(n,f)}d=d,u=e.filter.updateFullNode(c,d,a)}else{const d=Vr(r);let f=n8(n,d,t.serverCache);f==null&&t.serverCache.isCompleteForChild(d)&&(f=c.getImmediateChild(d)),f!=null?u=e.filter.updateChild(c,d,f,Gn(r),l,a):t.eventCache.getNode().hasChild(d)?u=e.filter.updateChild(c,d,kr.EMPTY_NODE,Gn(r),l,a):u=c,u.isEmpty()&&t.serverCache.isFullyInitialized()&&(s=sw(n,kh(t)),s.isLeafNode()&&(u=e.filter.updateFullNode(u,s,a)))}return s=t.serverCache.isFullyInitialized()||lw(n,hn())!=null,Qy(t,u,s,e.filter.filtersNodes())}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class aEe{constructor(t,r){this.query_=t,this.eventRegistrations_=[];const n=this.query_._queryParams,o=new XP(n.getIndex()),a=_3e(n);this.processor_=Z3e(a);const s=r.serverCache,l=r.eventCache,c=o.updateFullNode(kr.EMPTY_NODE,s.getNode(),null),u=a.updateFullNode(kr.EMPTY_NODE,l.getNode(),null),d=new jh(c,s.isFullyInitialized(),o.filtersNodes()),f=new jh(u,l.isFullyInitialized(),a.filtersNodes());this.viewCache_=TS(f,d),this.eventGenerator_=new I3e(this.query_)}get query(){return this.query_}}function sEe(e){return e.viewCache_.serverCache.getNode()}function lEe(e,t){const r=kh(e.viewCache_);return r&&(e.query._queryParams.loadsAllData()||!Yr(t)&&!r.getImmediateChild(Vr(t)).isEmpty())?r.getChild(t):null}function IB(e){return e.eventRegistrations_.length===0}function cEe(e,t){e.eventRegistrations_.push(t)}function NB(e,t,r){const n=[];if(r){Wt(t==null,"A cancel should cancel all event registrations.");const o=e.query._path;e.eventRegistrations_.forEach(a=>{const s=a.createCancelEvent(r,o);s&&n.push(s)})}if(t){let o=[];for(let a=0;a{n.push(Zm(a,s))}),r.isFullyInitialized()&&n.push(_K(r.getNode())),FK(e,n,r.getNode(),t)}function FK(e,t,r,n){const o=n?[n]:e.eventRegistrations_;return N3e(e.eventGenerator_,t,r,o)}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */let uw;class dEe{constructor(){this.views=new Map}}function fEe(e){Wt(!uw,"__referenceConstructor has already been defined"),uw=e}function pEe(){return Wt(uw,"Reference.ts has not been loaded"),uw}function hEe(e){return e.views.size===0}function o8(e,t,r,n){const o=t.source.queryId;if(o!==null){const a=e.views.get(o);return Wt(a!=null,"SyncTree gave us an op for an invalid query."),RB(a,t,r,n)}else{let a=[];for(const s of e.views.values())a=a.concat(RB(s,t,r,n));return a}}function gEe(e,t,r,n,o){const a=t._queryIdentifier,s=e.views.get(a);if(!s){let l=sw(r,o?n:null),c=!1;l?c=!0:n instanceof kr?(l=r8(r,n),c=!1):(l=kr.EMPTY_NODE,c=!1);const u=TS(new jh(l,c,!1),new jh(n,o,!1));return new aEe(t,u)}return s}function mEe(e,t,r,n,o,a){const s=gEe(e,t,n,o,a);return e.views.has(t._queryIdentifier)||e.views.set(t._queryIdentifier,s),cEe(s,r),uEe(s,r)}function vEe(e,t,r,n){const o=t._queryIdentifier,a=[];let s=[];const l=Bf(e);if(o==="default")for(const[c,u]of e.views.entries())s=s.concat(NB(u,r,n)),IB(u)&&(e.views.delete(c),u.query._queryParams.loadsAllData()||a.push(u.query));else{const c=e.views.get(o);c&&(s=s.concat(NB(c,r,n)),IB(c)&&(e.views.delete(o),c.query._queryParams.loadsAllData()||a.push(c.query)))}return l&&!Bf(e)&&a.push(new(pEe())(t._repo,t._path)),{removed:a,events:s}}function MK(e){const t=[];for(const r of e.views.values())r.query._queryParams.loadsAllData()||t.push(r);return t}function lm(e,t){let r=null;for(const n of e.views.values())r=r||lEe(n,t);return r}function DK(e,t){if(t._queryParams.loadsAllData())return PS(e);{const n=t._queryIdentifier;return e.views.get(n)}}function zK(e,t){return DK(e,t)!=null}function Bf(e){return PS(e)!=null}function PS(e){for(const t of e.views.values())if(t.query._queryParams.loadsAllData())return t;return null}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */let dw;function yEe(e){Wt(!dw,"__referenceConstructor has already been defined"),dw=e}function xEe(){return Wt(dw,"Reference.ts has not been loaded"),dw}let bEe=1;class LB{constructor(t){this.listenProvider_=t,this.syncPointTree_=new ri(null),this.pendingWriteTree_=G3e(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function wEe(e,t,r,n,o){return M3e(e.pendingWriteTree_,t,r,n,o),o?Ob(e,new Sh(EK(),t,r)):[]}function Kg(e,t,r=!1){const n=D3e(e.pendingWriteTree_,t);if(z3e(e.pendingWriteTree_,t)){let a=new ri(null);return n.snap!=null?a=a.set(hn(),!0):gs(n.children,s=>{a=a.set(new Wn(s),!0)}),Ob(e,new aw(n.path,a,r))}else return[]}function OS(e,t,r){return Ob(e,new Sh(JP(),t,r))}function SEe(e,t,r){const n=ri.fromObject(r);return Ob(e,new Jx(JP(),t,n))}function jEe(e,t){return Ob(e,new Zx(JP(),t))}function kEe(e,t,r){const n=a8(e,r);if(n){const o=s8(n),a=o.path,s=o.queryId,l=ds(a,t),c=new Zx(e8(s),l);return l8(e,a,c)}else return[]}function ZA(e,t,r,n,o=!1){const a=t._path,s=e.syncPointTree_.get(a);let l=[];if(s&&(t._queryIdentifier==="default"||zK(s,t))){const c=vEe(s,t,r,n);hEe(s)&&(e.syncPointTree_=e.syncPointTree_.remove(a));const u=c.removed;if(l=c.events,!o){const d=u.findIndex(h=>h._queryParams.loadsAllData())!==-1,f=e.syncPointTree_.findOnPath(a,(h,p)=>Bf(p));if(d&&!f){const h=e.syncPointTree_.subtree(a);if(!h.isEmpty()){const p=EEe(h);for(let y=0;y0&&!n&&(d?e.listenProvider_.stopListening(Zy(t),null):u.forEach(h=>{const p=e.queryToTagMap.get(IS(h));e.listenProvider_.stopListening(Zy(h),p)}))}AEe(e,u)}return l}function _Ee(e,t,r,n){const o=a8(e,n);if(o!=null){const a=s8(o),s=a.path,l=a.queryId,c=ds(s,t),u=new Sh(e8(l),c,r);return l8(e,s,u)}else return[]}function CEe(e,t,r,n){const o=a8(e,n);if(o){const a=s8(o),s=a.path,l=a.queryId,c=ds(s,t),u=ri.fromObject(r),d=new Jx(e8(l),c,u);return l8(e,s,d)}else return[]}function FB(e,t,r,n=!1){const o=t._path;let a=null,s=!1;e.syncPointTree_.foreachOnPath(o,(h,p)=>{const y=ds(h,o);a=a||lm(p,y),s=s||Bf(p)});let l=e.syncPointTree_.get(o);l?(s=s||Bf(l),a=a||lm(l,hn())):(l=new dEe,e.syncPointTree_=e.syncPointTree_.set(o,l));let c;a!=null?c=!0:(c=!1,a=kr.EMPTY_NODE,e.syncPointTree_.subtree(o).foreachChild((p,y)=>{const m=lm(y,hn());m&&(a=a.updateImmediateChild(p,m))}));const u=zK(l,t);if(!u&&!t._queryParams.loadsAllData()){const h=IS(t);Wt(!e.queryToTagMap.has(h),"View does not exist, but we have a tag");const p=TEe();e.queryToTagMap.set(h,p),e.tagToQueryMap.set(p,h)}const d=t8(e.pendingWriteTree_,o);let f=mEe(l,t,r,d,a,c);if(!u&&!s&&!n){const h=DK(l,t);f=f.concat(PEe(e,t,h))}return f}function BK(e,t,r){const o=e.pendingWriteTree_,a=e.syncPointTree_.findOnPath(t,(s,l)=>{const c=ds(s,t),u=lm(l,c);if(u)return u});return OK(o,t,a,r,!0)}function Ob(e,t){return WK(t,e.syncPointTree_,null,t8(e.pendingWriteTree_,hn()))}function WK(e,t,r,n){if(Yr(e.path))return qK(e,t,r,n);{const o=t.get(hn());r==null&&o!=null&&(r=lm(o,hn()));let a=[];const s=Vr(e.path),l=e.operationForChild(s),c=t.children.get(s);if(c&&l){const u=r?r.getImmediateChild(s):null,d=IK(n,s);a=a.concat(WK(l,c,u,d))}return o&&(a=a.concat(o8(o,e,n,r))),a}}function qK(e,t,r,n){const o=t.get(hn());r==null&&o!=null&&(r=lm(o,hn()));let a=[];return t.children.inorderTraversal((s,l)=>{const c=r?r.getImmediateChild(s):null,u=IK(n,s),d=e.operationForChild(s);d&&(a=a.concat(qK(d,l,c,u)))}),o&&(a=a.concat(o8(o,e,n,r))),a}function $K(e,t){const r=t.query,n=fw(e,r);return{hashFn:()=>(sEe(t)||kr.EMPTY_NODE).hash(),onComplete:o=>{if(o==="ok")return n?kEe(e,r._path,n):jEe(e,r._path);{const a=k4e(o,r);return ZA(e,r,null,a)}}}}function fw(e,t){const r=IS(t);return e.queryToTagMap.get(r)}function IS(e){return e._path.toString()+"$"+e._queryIdentifier}function a8(e,t){return e.tagToQueryMap.get(t)}function s8(e){const t=e.indexOf("$");return Wt(t!==-1&&t{if(r&&Bf(r))return[PS(r)];{let o=[];return r&&(o=MK(r)),gs(n,(a,s)=>{o=o.concat(s)}),o}})}function Zy(e){return e._queryParams.loadsAllData()&&!e._queryParams.isDefault()?new(xEe())(e._repo,e._path):e}function AEe(e,t){for(let r=0;r{if(!Yr(u)&&d&&Bf(d))return[PS(d).query];{let h=[];return d&&(h=h.concat(MK(d).map(p=>p.query))),gs(f,(p,y)=>{h=h.concat(y)}),h}});for(let u=0;u{const u=d8(c,t.getImmediateChild(l),r);u!==c&&(a=a.updateImmediateChild(l,u))}),a}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class f8{constructor(t="",r=null,n={children:{},childCount:0}){this.name=t,this.parent=r,this.node=n}}function p8(e,t){let r=t instanceof Wn?t:new Wn(t),n=e,o=Vr(r);for(;o!==null;){const a=Qm(n.node.children,o)||{children:{},childCount:0};n=new f8(o,n,a),r=Gn(r),o=Vr(r)}return n}function Ev(e){return e.node.value}function UK(e,t){e.node.value=t,JA(e)}function HK(e){return e.node.childCount>0}function FEe(e){return Ev(e)===void 0&&!HK(e)}function NS(e,t){gs(e.node.children,(r,n)=>{t(new f8(r,e,n))})}function VK(e,t,r,n){r&&t(e),NS(e,o=>{VK(o,t,!0)})}function MEe(e,t,r){let n=e.parent;for(;n!==null;){if(t(n))return!0;n=n.parent}return!1}function Ib(e){return new Wn(e.parent===null?e.name:Ib(e.parent)+"/"+e.name)}function JA(e){e.parent!==null&&DEe(e.parent,e.name,e)}function DEe(e,t,r){const n=FEe(r),o=Cd(e.node.children,t);n&&o?(delete e.node.children[t],e.node.childCount--,JA(e)):!n&&!o&&(e.node.children[t]=r.node,e.node.childCount++,JA(e))}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const zEe=/[\[\].#$\/\u0000-\u001F\u007F]/,BEe=/[\[\].#$\u0000-\u001F\u007F]/,G4=10*1024*1024,YK=function(e){return typeof e=="string"&&e.length!==0&&!zEe.test(e)},GK=function(e){return typeof e=="string"&&e.length!==0&&!BEe.test(e)},WEe=function(e){return e&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),GK(e)},KK=function(e,t,r){const n=r instanceof Wn?new n3e(r,e):r;if(t===void 0)throw new Error(e+"contains undefined "+qp(n));if(typeof t=="function")throw new Error(e+"contains a function "+qp(n)+" with contents = "+t.toString());if(KG(t))throw new Error(e+"contains "+t.toString()+" "+qp(n));if(typeof t=="string"&&t.length>G4/3&&CS(t)>G4)throw new Error(e+"contains a string greater than "+G4+" utf8 bytes "+qp(n)+" ('"+t.substring(0,50)+"...')");if(t&&typeof t=="object"){let o=!1,a=!1;if(gs(t,(s,l)=>{if(s===".value")o=!0;else if(s!==".priority"&&s!==".sv"&&(a=!0,!YK(s)))throw new Error(e+" contains an invalid key ("+s+") "+qp(n)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);i3e(n,s),KK(e,l,n),o3e(n)}),o&&a)throw new Error(e+' contains ".value" child '+qp(n)+" in addition to actual children.")}},QK=function(e,t,r,n){if(!GK(r))throw new Error(zG(e,t)+'was an invalid path = "'+r+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},qEe=function(e,t,r,n){r&&(r=r.replace(/^\/*\.info(\/|$)/,"/")),QK(e,t,r)},$Ee=function(e,t){const r=t.path.toString();if(typeof t.repoInfo.host!="string"||t.repoInfo.host.length===0||!YK(t.repoInfo.namespace)&&t.repoInfo.host.split(":")[0]!=="localhost"||r.length!==0&&!WEe(r))throw new Error(zG(e,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class UEe{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function XK(e,t){let r=null;for(let n=0;nGP(n,t))}function Dh(e,t,r){XK(e,r),JK(e,n=>ic(n,t)||ic(t,n))}function JK(e,t){e.recursionDepth_++;let r=!0;for(let n=0;n{DB(e,n,o,a,s)},e.authTokenProvider_,e.appCheckProvider_),setTimeout(()=>zB(e,!0),0);else{if(typeof r<"u"&&r!==null){if(typeof r!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{Mo(r)}catch(n){throw new Error("Invalid authOverride provided: "+n)}}e.persistentConnection_=new cd(e.repoInfo_,t,(n,o,a,s)=>{DB(e,n,o,a,s)},n=>{zB(e,n)},n=>{XEe(e,n)},e.authTokenProvider_,e.appCheckProvider_,r),e.server_=e.persistentConnection_}e.authTokenProvider_.addTokenChangeListener(n=>{e.server_.refreshAuthToken(n)}),e.appCheckProvider_.addTokenChangeListener(n=>{e.server_.refreshAppCheckToken(n.token)}),e.statsReporter_=N4e(e.repoInfo_,()=>new O3e(e.stats_,e.server_)),e.infoData_=new C3e,e.infoSyncTree_=new LB({startListening:(n,o,a,s)=>{let l=[];const c=e.infoData_.getNode(n._path);return c.isEmpty()||(l=OS(e.infoSyncTree_,n._path,c),setTimeout(()=>{s("ok")},0)),l},stopListening:()=>{}}),h8(e,"connected",!1),e.serverSyncTree_=new LB({startListening:(n,o,a,s)=>(e.server_.listen(n,a,o,(l,c)=>{const u=s(l,c);Dh(e.eventQueue_,n._path,u)}),[]),stopListening:(n,o)=>{e.server_.unlisten(n,o)}})}function QEe(e){const r=e.infoData_.getNode(new Wn(".info/serverTimeOffset")).val()||0;return new Date().getTime()+r}function eQ(e){return OEe({timestamp:QEe(e)})}function DB(e,t,r,n,o){e.dataUpdateCount++;const a=new Wn(t);r=e.interceptServerDataCallback_?e.interceptServerDataCallback_(t,r):r;let s=[];if(o)if(n){const c=Z2(r,u=>ma(u));s=CEe(e.serverSyncTree_,a,c,o)}else{const c=ma(r);s=_Ee(e.serverSyncTree_,a,c,o)}else if(n){const c=Z2(r,u=>ma(u));s=SEe(e.serverSyncTree_,a,c)}else{const c=ma(r);s=OS(e.serverSyncTree_,a,c)}let l=a;s.length>0&&(l=m8(e,a)),Dh(e.eventQueue_,l,s)}function zB(e,t){h8(e,"connected",t),t===!1&&JEe(e)}function XEe(e,t){gs(t,(r,n)=>{h8(e,r,n)})}function h8(e,t,r){const n=new Wn("/.info/"+t),o=ma(r);e.infoData_.updateSnapshot(n,o);const a=OS(e.infoSyncTree_,n,o);Dh(e.eventQueue_,n,a)}function ZEe(e){return e.nextWriteId_++}function JEe(e){tQ(e,"onDisconnectEvents");const t=eQ(e),r=ow();VA(e.onDisconnect_,hn(),(o,a)=>{const s=REe(o,a,e.serverSyncTree_,t);CK(r,o,s)});let n=[];VA(r,hn(),(o,a)=>{n=n.concat(OS(e.serverSyncTree_,o,a));const s=iAe(e,o);m8(e,s)}),e.onDisconnect_=ow(),Dh(e.eventQueue_,hn(),n)}function eAe(e,t,r){let n;Vr(t._path)===".info"?n=FB(e.infoSyncTree_,t,r):n=FB(e.serverSyncTree_,t,r),ZK(e.eventQueue_,t._path,n)}function BB(e,t,r){let n;Vr(t._path)===".info"?n=ZA(e.infoSyncTree_,t,r):n=ZA(e.serverSyncTree_,t,r),ZK(e.eventQueue_,t._path,n)}function tAe(e){e.persistentConnection_&&e.persistentConnection_.interrupt(VEe)}function tQ(e,...t){let r="";e.persistentConnection_&&(r=e.persistentConnection_.id+":"),ga(r,...t)}function rQ(e,t,r){return BK(e.serverSyncTree_,t,r)||kr.EMPTY_NODE}function g8(e,t=e.transactionQueueTree_){if(t||RS(e,t),Ev(t)){const r=iQ(e,t);Wt(r.length>0,"Sending zero length transaction queue"),r.every(o=>o.status===0)&&rAe(e,Ib(t),r)}else HK(t)&&NS(t,r=>{g8(e,r)})}function rAe(e,t,r){const n=r.map(u=>u.currentWriteId),o=rQ(e,t,n);let a=o;const s=o.hash();for(let u=0;u{tQ(e,"transaction put response",{path:c.toString(),status:u});let d=[];if(u==="ok"){const f=[];for(let h=0;hr[h].onComplete(null,!0,r[h].currentOutputSnapshotResolved)),r[h].unwatcher();RS(e,p8(e.transactionQueueTree_,t)),g8(e,e.transactionQueueTree_),Dh(e.eventQueue_,t,d);for(let h=0;hl.status===0).map(l=>l.currentWriteId);for(let l=0;l=YEe)d=!0,f="maxretry",o=o.concat(Kg(e.serverSyncTree_,c.currentWriteId,!0));else{const h=rQ(e,c.path,s);c.currentInputSnapshot=h;const p=t[l].update(h.val());if(p!==void 0){KK("transaction failed: Data returned ",p,c.path);let y=ma(p);typeof p=="object"&&p!=null&&Cd(p,".priority")||(y=y.updatePriority(h.getPriority()));const x=c.currentWriteId,b=eQ(e),w=LEe(y,h,b);c.currentOutputSnapshotRaw=y,c.currentOutputSnapshotResolved=w,c.currentWriteId=ZEe(e),s.splice(s.indexOf(x),1),o=o.concat(wEe(e.serverSyncTree_,c.path,w,c.currentWriteId,c.applyLocally)),o=o.concat(Kg(e.serverSyncTree_,x,!0))}else d=!0,f="nodata",o=o.concat(Kg(e.serverSyncTree_,c.currentWriteId,!0))}Dh(e.eventQueue_,r,o),o=[],d&&(t[l].status=2,(function(h){setTimeout(h,Math.floor(0))})(t[l].unwatcher),t[l].onComplete&&(f==="nodata"?n.push(()=>t[l].onComplete(null,!1,t[l].currentInputSnapshot)):n.push(()=>t[l].onComplete(new Error(f),!1,null))))}RS(e,e.transactionQueueTree_);for(let l=0;ln.order-o.order),r}function oQ(e,t,r){const n=Ev(t);if(n)for(let o=0;o{oQ(e,o,r)})}function RS(e,t){const r=Ev(t);if(r){let n=0;for(let o=0;o0?r:void 0)}NS(t,n=>{RS(e,n)})}function iAe(e,t){const r=Ib(nQ(e,t)),n=p8(e.transactionQueueTree_,t);return MEe(n,o=>{K4(e,o)}),K4(e,n),VK(n,o=>{K4(e,o)}),r}function K4(e,t){const r=Ev(t);if(r){const n=[];let o=[],a=-1;for(let s=0;s0){let o=r[n];try{o=decodeURIComponent(o.replace(/\+/g," "))}catch{}t+="/"+o}return t}function aAe(e){const t={};e.charAt(0)==="?"&&(e=e.substring(1));for(const r of e.split("&")){if(r.length===0)continue;const n=r.split("=");n.length===2?t[decodeURIComponent(n[0])]=decodeURIComponent(n[1]):Xs(`Invalid query segment '${r}' in query '${e}'`)}return t}const WB=function(e,t){const r=sAe(e),n=r.namespace;r.domain==="firebase.com"&&vd(r.host+" is no longer supported. Please use .firebaseio.com instead"),(!n||n==="undefined")&&r.domain!=="localhost"&&vd("Cannot parse Firebase url. Please use https://.firebaseio.com"),r.secure||x4e();const o=r.scheme==="ws"||r.scheme==="wss";return{repoInfo:new sK(r.host,r.secure,n,o,t,"",n!==r.subdomain),path:new Wn(r.pathString)}},sAe=function(e){let t="",r="",n="",o="",a="",s=!0,l="https",c=443;if(typeof e=="string"){let u=e.indexOf("//");u>=0&&(l=e.substring(0,u-1),e=e.substring(u+2));let d=e.indexOf("/");d===-1&&(d=e.length);let f=e.indexOf("?");f===-1&&(f=e.length),t=e.substring(0,Math.min(d,f)),d=0?(s=l==="https"||l==="wss",c=parseInt(t.substring(u+1),10)):u=t.length;const p=t.slice(0,u);if(p.toLowerCase()==="localhost")r="localhost";else if(p.split(".").length<=2)r=p;else{const y=t.indexOf(".");n=t.substring(0,y).toLowerCase(),r=t.substring(y+1),a=n}"ns"in h&&(a=h.ns)}return{host:t,port:c,domain:r,subdomain:n,secure:s,scheme:l,pathString:o,namespace:a}};/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class lAe{constructor(t,r,n,o){this.eventType=t,this.eventRegistration=r,this.snapshot=n,this.prevName=o}getPath(){const t=this.snapshot.ref;return this.eventType==="value"?t._path:t.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+Mo(this.snapshot.exportVal())}}class cAe{constructor(t,r,n){this.eventRegistration=t,this.error=r,this.path=n}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class uAe{constructor(t,r){this.snapshotCallback=t,this.cancelCallback=r}onValue(t,r){this.snapshotCallback.call(null,t,r)}onCancel(t){return Wt(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,t)}get hasCancelCallback(){return!!this.cancelCallback}matches(t){return this.snapshotCallback===t.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===t.snapshotCallback.userCallback&&this.snapshotCallback.context===t.snapshotCallback.context}}/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */class v8{constructor(t,r,n,o){this._repo=t,this._path=r,this._queryParams=n,this._orderByCalled=o}get key(){return Yr(this._path)?null:mK(this._path)}get ref(){return new Qf(this._repo,this._path)}get _queryIdentifier(){const t=kB(this._queryParams),r=UP(t);return r==="{}"?"default":r}get _queryObject(){return kB(this._queryParams)}isEqual(t){if(t=ES(t),!(t instanceof v8))return!1;const r=this._repo===t._repo,n=GP(this._path,t._path),o=this._queryIdentifier===t._queryIdentifier;return r&&n&&o}toJSON(){return this.toString()}toString(){return this._repo.toString()+r3e(this._path)}}class Qf extends v8{constructor(t,r){super(t,r,new ZP,!1)}get parent(){const t=yK(this._path);return t===null?null:new Qf(this._repo,t)}get root(){let t=this;for(;t.parent!==null;)t=t.parent;return t}}class pw{constructor(t,r,n){this._node=t,this.ref=r,this._index=n}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(t){const r=new Wn(t),n=e6(this.ref,t);return new pw(this._node.getChild(r),n,Ti)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(t){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(n,o)=>t(new pw(o,e6(this.ref,n),Ti)))}hasChild(t){const r=new Wn(t);return!this._node.getChild(r).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function dAe(e,t){return e=ES(e),e._checkNotDeleted("ref"),t!==void 0?e6(e._root,t):e._root}function e6(e,t){return e=ES(e),Vr(e._path)===null?qEe("child","path",t):QK("child","path",t),new Qf(e._repo,fo(e._path,t))}class y8{constructor(t){this.callbackContext=t}respondsTo(t){return t==="value"}createEvent(t,r){const n=r._queryParams.getIndex();return new lAe("value",this,new pw(t.snapshotNode,new Qf(r._repo,r._path),n))}getEventRunner(t){return t.getEventType()==="cancel"?()=>this.callbackContext.onCancel(t.error):()=>this.callbackContext.onValue(t.snapshot,null)}createCancelEvent(t,r){return this.callbackContext.hasCancelCallback?new cAe(this,t,r):null}matches(t){return t instanceof y8?!t.callbackContext||!this.callbackContext?!0:t.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}}function fAe(e,t,r,n,o){let a;if(typeof n=="object"&&(a=void 0,o=n),typeof n=="function"&&(a=n),o&&o.onlyOnce){const c=r,u=(d,f)=>{BB(e._repo,e,l),c(d,f)};u.userCallback=r.userCallback,u.context=r.context,r=u}const s=new uAe(r,a||void 0),l=new y8(s);return eAe(e._repo,e,l),()=>BB(e._repo,e,l)}function pAe(e,t,r,n){return fAe(e,"value",t,r,n)}fEe(Qf);yEe(Qf);/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */const hAe="FIREBASE_DATABASE_EMULATOR_HOST",t6={};let gAe=!1;function mAe(e,t,r,n){const o=t.lastIndexOf(":"),a=t.substring(0,o),s=qP(a);e.repoInfo_=new sK(t,s,e.repoInfo_.namespace,e.repoInfo_.webSocketOnly,e.repoInfo_.nodeAdmin,e.repoInfo_.persistenceKey,e.repoInfo_.includeNamespaceInQueryParams,!0,r),n&&(e.authTokenProvider_=n)}function vAe(e,t,r,n,o){let a=n||e.options.databaseURL;a===void 0&&(e.options.projectId||vd("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),ga("Using default host for project ",e.options.projectId),a=`${e.options.projectId}-default-rtdb.firebaseio.com`);let s=WB(a,o),l=s.repoInfo,c;typeof process<"u"&&aB&&(c=aB[hAe]),c?(a=`http://${c}?ns=${l.namespace}`,s=WB(a,o),l=s.repoInfo):s.repoInfo.secure;const u=new P4e(e.name,e.options,t);$Ee("Invalid Firebase Database URL",s),Yr(s.path)||vd("Database URL must point to the root of a Firebase Database (not including a child path).");const d=xAe(l,e,u,new T4e(e,r));return new bAe(d,e)}function yAe(e,t){const r=t6[t];(!r||r[e.key]!==e)&&vd(`Database ${t}(${e.repoInfo_}) has already been deleted.`),tAe(e),delete r[e.key]}function xAe(e,t,r,n){let o=t6[t.name];o||(o={},t6[t.name]=o);let a=o[e.toURLString()];return a&&vd("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),a=new GEe(e,gAe,r,n),o[e.toURLString()]=a,a}class bAe{constructor(t,r){this._repoInternal=t,this.app=r,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(KEe(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new Qf(this._repo,hn())),this._rootInternal}_delete(){return this._rootInternal!==null&&(yAe(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(t){this._rootInternal===null&&vd("Cannot call "+t+" on a deleted database.")}}function wAe(e=r4e(),t){const r=XCe(e,"database").getImmediate({identifier:t});if(!r._instanceStarted){const n=F_e("database");n&&SAe(r,...n)}return r}function SAe(e,t,r,n={}){e=ES(e),e._checkNotDeleted("useEmulator");const o=`${t}:${r}`,a=e._repoInternal;if(e._instanceStarted){if(o===e._repoInternal.repoInfo_.host&&J2(n,a.repoInfo_.emulatorOptions))return;vd("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let s;if(a.repoInfo_.nodeAdmin)n.mockUserToken&&vd('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),s=new b0(b0.OWNER);else if(n.mockUserToken){const l=typeof n.mockUserToken=="string"?n.mockUserToken:D_e(n.mockUserToken,e.app.options.projectId);s=new b0(l)}qP(t)&&(M_e(t),W_e("Database",!0)),mAe(a,o,n,s)}/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */function jAe(e){p4e(t4e),ew(new Hx("database",(t,{instanceIdentifier:r})=>{const n=t.getProvider("app").getImmediate(),o=t.getProvider("auth-internal"),a=t.getProvider("app-check-internal");return vAe(n,o,a,r)},"PUBLIC").setMultipleInstances(!0)),om(sB,lB,e),om(sB,lB,"esm2017")}cd.prototype.simpleListen=function(e,t){this.sendRequest("q",{p:e},t)};cd.prototype.echo=function(e,t){this.sendRequest("echo",{d:e},t)};jAe();var kAe="firebase",_Ae="11.10.0";/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */om(kAe,_Ae,"app");const aQ="AIzaSyBbrU8aLBBUyXPYWRSlVBNGYRRq1AcdXQ4",sQ="https://eventbuzz-live-default-rtdb.asia-southeast1.firebasedatabase.app";let t0=null;function lQ(){return!!(aQ.trim()&&sQ.trim())}function CAe(){if(!lQ())throw new Error("VITE_FIREBASE_API_KEY and VITE_FIREBASE_DATABASE_URL must be set.");return t0||(rB().length?t0=rB()[0]:t0=$G({apiKey:aQ.trim(),databaseURL:sQ.trim()})),t0}function EAe(){return wAe(CAe())}function hw(e){if(typeof e=="number"&&!Number.isNaN(e))return e;const t=Number(e);return Number.isFinite(t)?t:0}function AAe(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Object.entries(e).map(([r,n])=>{if(!n||typeof n!="object")return null;const o=n,s=(o._id!=null&&String(o._id).trim()!==""?String(o._id).trim():"")||r,l=o.status!=null?String(o.status):"pending";return{_id:s,author:String(o.authorName??"Anonymous"),text:String(o.question??""),up:hw(o.upvotes),down:hw(o.downvotes),createdAt:o.createdAt!=null?String(o.createdAt):void 0,status:l,shortlisted:!!o.shortlisted,audienceListed:o.audienceListed!==!1}}).filter(r=>r!=null).sort((r,n)=>{if(n.up!==r.up)return n.up-r.up;const o=r.createdAt?Date.parse(r.createdAt):0;return(n.createdAt?Date.parse(n.createdAt):0)-o})}function TAe(e){if(!Array.isArray(e))return[];const t=[];for(const r of e){if(!r||typeof r!="object")continue;const n=r,o=n._id!=null?String(n._id):"";if(!o)continue;const a=n.participant&&typeof n.participant=="object"&&!Array.isArray(n.participant)?n.participant:null;let s="Anonymous";if(!n.isAnonymous&&a){const u=a.displayName!=null?String(a.displayName).trim():"",d=[a.firstName,a.lastName].filter(h=>h!=null&&String(h).trim()).map(h=>String(h).trim()).join(" ").trim(),f=a.email!=null?String(a.email).trim():"";s=u||d||f&&f.split("@")[0]||"Guest"}const l=n.status!=null?String(n.status):"pending",c=n.createdAt!=null?typeof n.createdAt=="string"?n.createdAt:new Date(n.createdAt).toISOString():void 0;t.push({_id:o,author:s,text:n.question!=null?String(n.question):"",up:hw(n.upvotes),down:hw(n.downvotes),createdAt:c,status:l,shortlisted:!!n.shortlisted,audienceListed:n.audienceListed!==!1})}return t.sort((r,n)=>{if(n.up!==r.up)return n.up-r.up;const o=r.createdAt?Date.parse(r.createdAt):0;return(n.createdAt?Date.parse(n.createdAt):0)-o}),t}function PAe(e,t,r){const n=EAe(),o=dAe(n,`sessions/${e}/questions`);return pAe(o,a=>{try{t(AAe(a.val()))}catch(s){r==null||r(s instanceof Error?s:new Error(String(s)))}},a=>{r==null||r(a instanceof Error?a:new Error(String(a)))})}const cQ={listBySession(e){return Xe.get(`/sessions/${e}/questions`)},patch(e,t){return Fg(`/questions/${e}`,{method:"PATCH",body:JSON.stringify(t),skipGlobalLoading:!0})}},OAe=4e3;function IAe(e){return/permission_denied|PERMISSION_DENIED|permission denied/i.test(e)}function NAe(e){const[t,r]=j.useState([]),[n,o]=j.useState(!0),[a,s]=j.useState(null),l=(e==null?void 0:e.trim())??"";return j.useEffect(()=>{if(!l){r([]),o(!1),s(null);return}let c=!1,u=null,d=null,f=!1;const h=async()=>{var x;const y=await cQ.listBySession(l);if(c)return;if(y.error){s(y.error),r([]),o(!1);return}const m=TAe(((x=y.data)==null?void 0:x.questions)??[]);r(m),o(!1),s(null)},p=()=>{f||(f=!0,d&&(d(),d=null),h(),u=setInterval(()=>{c||document.visibilityState!=="visible"||h()},OAe))};return o(!0),s(null),lQ()?d=PAe(l,y=>{c||f||(r(y),o(!1),s(null))},y=>{if(c)return;const m=y.message||String(y);if(IAe(m)){p();return}s(m),r([]),o(!1)}):p(),()=>{c=!0,d&&d(),u&&clearInterval(u)}},[l]),{items:t,loading:n,error:a}}function x8(e){return!Number.isNaN(e.getTime())}function b8(e){if(e==null||String(e).trim()==="")return"—";const t=new Date(e);return x8(t)?t.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):String(e)}function uQ(e){if(e==null||String(e).trim()==="")return"";const t=String(e).trim(),r=t.match(/^(\d{4}-\d{2}-\d{2})/);if(r)return r[1];const n=new Date(t);return x8(n)?n.toISOString().slice(0,10):""}function RAe(e){if(!e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return"Date TBD";const t=new Date(`${e}T12:00:00`);return x8(t)?t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric"}):e}function LAe(e){return e===new Date().toISOString().slice(0,10)}function dQ(e){const t=new Map;for(const n of e){const o=n.trackId??null,a=n.name||"Unassigned";for(const s of n.sessions){const c=uQ(s.startTime)||"_nodate";t.has(c)||t.set(c,[]),t.get(c).push({trackId:o,trackName:a,sessionId:s.sessionId,title:s.title,startTime:s.startTime})}}return Array.from(t.keys()).sort((n,o)=>n==="_nodate"?1:o==="_nodate"?-1:n.localeCompare(o)).map(n=>{const o=t.get(n),a=new Map;for(const s of o){const l=s.trackId??s.trackName;a.has(l)||a.set(l,{trackId:s.trackId,trackName:s.trackName,sessions:[]}),a.get(l).sessions.push({sessionId:s.sessionId,title:s.title,startTime:s.startTime})}return a.forEach(s=>s.sessions.sort((l,c)=>l.startTime.localeCompare(c.startTime))),{dateKey:n,dateLabel:n==="_nodate"?"No date":RAe(n),tracks:Array.from(a.values())}})}function fQ(e){const t=[];for(const r of e)for(const n of r.sessions)t.push({id:n.sessionId,trackName:r.name||"Unassigned",label:n.title,startTime:n.startTime,timeLabel:b8(n.startTime),dateKey:uQ(n.startTime)||"_nodate"});return t.sort((r,n)=>r.startTime.localeCompare(n.startTime)),t}function pQ({sessions:e,sessionId:t,onOpenSessionPicker:r}){const n=e.find(a=>a.id===t)??e[0],o=e.length>1;return e.length===0?null:i.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden"},children:[i.jsxs("div",{style:{padding:"7px 14px",flex:1},children:[i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"1px",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Session"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.3"},children:[(n==null?void 0:n.label)??"—",i.jsx("span",{style:{color:"var(--muted)",fontWeight:"var(--font-weight-normal)",marginLeft:"6px"},children:(n==null?void 0:n.timeLabel)??""})]})]}),o?i.jsx("button",{type:"button",onClick:r,style:{padding:"0 14px",background:"var(--secondary)",border:"none",borderLeft:"1px solid var(--border)",cursor:"pointer",display:"flex",alignItems:"center",color:"var(--primary)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"Change"}):null]})}function hQ({dateGroups:e,onSelectSession:t,selectPrompt:r}){var f;const n=new Date().toISOString().slice(0,10),o=e.some(h=>h.dateKey===n)?n:((f=e[0])==null?void 0:f.dateKey)??"",[a,s]=j.useState(o),[l,c]=j.useState(new Set);j.useEffect(()=>{e.length&&o&&s(o)},[e.length,o]);const u=e.find(h=>h.dateKey===a)??e[0];j.useEffect(()=>{const h=e.find(y=>y.dateKey===a)??e[0];if(!(h!=null&&h.tracks.length)){c(new Set);return}const p=h.tracks.map((y,m)=>String(y.trackId??y.trackName??`t-${m}`));c(new Set(p))},[a,e]);const d=h=>{c(p=>{const y=new Set(p);return y.has(h)?y.delete(h):y.add(h),y})};return e.length===0?i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:320,padding:24,textAlign:"center"},children:[i.jsx(Jee,{size:40,style:{color:"var(--border)",marginBottom:12}}),i.jsx("p",{style:{fontSize:"var(--text-base)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"No sessions in this event. Add tracks and sessions in Agenda first."})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:380,padding:24},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:16},children:r??"Select a session"}),i.jsx("div",{style:{display:"flex",gap:4,marginBottom:20,flexWrap:"wrap",justifyContent:"center"},children:e.map(h=>i.jsx("button",{type:"button",onClick:()=>s(h.dateKey),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:a===h.dateKey?"var(--primary)":"var(--card)",color:a===h.dateKey?"var(--primary-foreground)":"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:a===h.dateKey?600:400,cursor:"pointer"},children:h.dateKey!=="_nodate"&&LAe(h.dateKey)?"Today":h.dateLabel},h.dateKey))}),i.jsx("div",{style:{width:"100%",maxWidth:920,border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden",background:"var(--card)"},children:u==null?void 0:u.tracks.map((h,p)=>{const y=String(h.trackId??h.trackName??`t-${p}`),m=l.has(y);return i.jsxs("div",{style:{borderBottom:pd(y),style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"12px 16px",background:"var(--secondary)",border:"none",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",fontWeight:600,color:"var(--foreground)",textAlign:"left"},children:[i.jsx(po,{size:14,style:{transform:m?"rotate(180deg)":"none",transition:"transform 0.2s"}}),h.trackName,i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",fontWeight:400},children:["(",h.sessions.length," session",h.sessions.length!==1?"s":"",")"]})]}),m&&i.jsx("div",{style:{padding:"4px 0"},children:h.sessions.map(x=>i.jsxs("button",{type:"button",onClick:()=>t(x.sessionId),style:{width:"100%",padding:"10px 16px 10px 44px",border:"none",background:"none",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)",textAlign:"left"},onMouseEnter:b=>{b.currentTarget.style.background="var(--secondary)"},onMouseLeave:b=>{b.currentTarget.style.background="none"},children:[x.title,i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:2},children:b8(x.startTime)})]},x.sessionId))})]},y)})})]})}function FAe(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():(t[0]||"?").slice(0,2).toUpperCase()}const qB=["#16a34a","#2563eb","#d97706","#7c3aed","#0891b2","#be185d","#0d9488","#ea580c"];function MAe(e){let t=0;for(let r=0;ri.jsxs("button",{type:"button",disabled:x||t,onClick:y,style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:x||t?"not-allowed":"pointer",opacity:x||t?.55:1,transition:"all 0.1s"},onMouseEnter:b=>{x||t||(b.currentTarget.style.borderColor=m,b.currentTarget.style.color=m,b.currentTarget.style.background=m+"10")},onMouseLeave:b=>{b.currentTarget.style.borderColor="var(--border)",b.currentTarget.style.color="var(--muted)",b.currentTarget.style.background="var(--card)"},children:[h," ",p]});return i.jsxs("div",{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{display:"flex",gap:"0",background:"var(--card)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",overflow:"hidden",boxShadow:s?"var(--elevation-sm)":"none",transition:"box-shadow 0.15s"},children:[i.jsxs("div",{style:{width:"72px",flexShrink:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"2px",padding:"16px 0",borderRight:"1px solid var(--border)",background:"var(--secondary)"},children:[i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1"},children:e.up}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"upvotes"}),i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[e.down," down"]})]}),i.jsxs("div",{style:{flex:1,padding:"14px 16px",minWidth:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"7px",flexWrap:"wrap"},children:[i.jsx("div",{style:{width:"22px",height:"22px",borderRadius:"50%",background:u,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx("span",{style:{color:"#fff",fontSize:"8px",fontFamily:"var(--font-inter)",fontWeight:"600"},children:c})}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:e.author}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"·"}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:DAe(e.createdAt)}),i.jsxs("span",{style:{marginLeft:"auto",display:"flex",gap:"4px",flexWrap:"wrap"},children:[e.shortlisted&&i.jsx("span",{style:{padding:"2px 8px",borderRadius:"999px",background:"#dcfce7",color:"#15803d",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:"Shortlisted"}),!e.audienceListed&&i.jsx("span",{style:{padding:"2px 8px",borderRadius:"999px",background:"#fee2e2",color:"#b91c1c",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:"Hidden"}),d&&i.jsx("span",{style:{padding:"2px 8px",borderRadius:"999px",background:"#f1f5f9",color:"#475569",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:"Archived"}),e.status==="answered"&&!d&&i.jsx("span",{style:{padding:"2px 8px",borderRadius:"999px",background:"#e0f2fe",color:"#0369a1",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:"Answered"})]})]}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",lineHeight:"1.6",marginBottom:"10px"},children:e.text}),i.jsxs("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[e.shortlisted?f(i.jsx(tI,{size:11}),"Remove shortlist",()=>r(!1),"#15803d",d):f(i.jsx(tI,{size:11}),"Shortlist",()=>r(!0),"#15803d",d),e.audienceListed?f(i.jsx(R6,{size:11}),"Hide from audience",()=>n(!1),"#b91c1c",d):f(i.jsx(Ah,{size:11}),"Show to audience",()=>n(!0),"#15803d",d),d?f(i.jsx(Ite,{size:11}),"Restore",a,"#2563eb",!1):f(i.jsx(QJ,{size:11}),"Archive",o,"#475569",!1)]})]})]})}function gQ({fixedSessionId:e=null,compactChrome:t=!1}={}){const n=qi()==="mobile",{selectedEventId:o}=eo(),[a,s]=j.useState(e??null),[l,c]=j.useState([]),[u,d]=j.useState(!1),[f,h]=j.useState(null),[p,y]=j.useState("All"),[m,x]=j.useState("votes"),[b,w]=j.useState(""),[k,S]=j.useState(!1),[_,P]=j.useState(null),[O,T]=j.useState(null),R=j.useMemo(()=>dQ(l),[l]),I=j.useMemo(()=>fQ(l),[l]),{items:E,loading:A,error:F}=NAe(a);j.useEffect(()=>{if(!o){h(null);return}zr.get(o).then(H=>{var B;(B=H.data)!=null&&B.name?h(H.data.name):h(null)})},[o]),j.useEffect(()=>{if(!o){c([]),s(null);return}d(!0),za.agendaTree(o).then(H=>{var B;d(!1),c(((B=H.data)==null?void 0:B.tracks)??[])})},[o]),j.useLayoutEffect(()=>{if(e){s(e);return}!o||u||a===null&&I.length===1&&s(I[0].id)},[o,u,a,I,e]);const L=j.useMemo(()=>{const H=E.length,B=E.filter(q=>q.shortlisted).length,M=E.filter(q=>!q.audienceListed).length,$=E.filter(q=>q.status==="archived").length;return{All:H,Shortlisted:B,Hidden:M,Archived:$}},[E]),z=j.useMemo(()=>{let H=E;p==="Shortlisted"?H=H.filter(M=>M.shortlisted):p==="Hidden"?H=H.filter(M=>!M.audienceListed):p==="Archived"&&(H=H.filter(M=>M.status==="archived")),H=H.filter(M=>!b||M.text.toLowerCase().includes(b.toLowerCase())||M.author.toLowerCase().includes(b.toLowerCase()));const B=[...H];return m==="votes"?B.sort((M,$)=>$.up-M.up||($.createdAt?Date.parse($.createdAt):0)-(M.createdAt?Date.parse(M.createdAt):0)):B.sort((M,$)=>($.createdAt?Date.parse($.createdAt):0)-(M.createdAt?Date.parse(M.createdAt):0)),B},[E,p,b,m]),V=async(H,B)=>{T(null),P(H);const M=await cQ.patch(H,B);P(null),M.error&&T(M.error)},Q=["All","Shortlisted","Hidden","Archived"];if(!o)return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,alignItems:"center",justifyContent:"center",minHeight:280},children:[i.jsx(Wi,{size:40,style:{color:"var(--border)"}}),i.jsx("p",{style:{fontSize:"var(--text-base)",color:"var(--muted)"},children:"Select an event to manage audience questions."})]});const U=!e&&a===null,ee=I.find(H=>H.id===a);return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[t?i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:[L.All," in session  · ",i.jsxs("span",{style:{color:"#15803d"},children:[L.Shortlisted," shortlisted"]})," · ",i.jsxs("span",{style:{color:"#b91c1c"},children:[L.Hidden," hidden"]})," · ",i.jsxs("span",{children:[L.Archived," archived"]})]}):i.jsxs("div",{style:{display:"flex",alignItems:n?"stretch":"flex-start",flexDirection:n?"column":"row",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:f??"Event"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:n?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"Questions"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[L.All," in session  · ",i.jsxs("span",{style:{color:"#15803d"},children:[L.Shortlisted," shortlisted"]})," · ",i.jsxs("span",{style:{color:"#b91c1c"},children:[L.Hidden," hidden"]})," · ",i.jsxs("span",{children:[L.Archived," archived"]})]})]}),!U&&!e?i.jsx("div",{style:{flex:n?1:"none",minWidth:0,maxWidth:n?"100%":360},children:i.jsx(pQ,{sessions:I,sessionId:a,onOpenSessionPicker:()=>s(null)})}):null]}),O&&i.jsx("div",{style:{padding:"10px 14px",borderRadius:"var(--radius-button)",background:"#fef2f2",border:"1px solid #fecaca",color:"#b91c1c",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:O}),U?u?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading sessions…"}):i.jsx(hQ,{dateGroups:R,onSelectSession:H=>s(H),selectPrompt:"Select a session to view and moderate audience questions"}):i.jsxs(i.Fragment,{children:[ee&&!t&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:["Session: ",i.jsx("strong",{style:{color:"var(--foreground)"},children:ee.label}),i.jsx("span",{style:{marginLeft:8},children:ee.trackName}),i.jsx("span",{style:{marginLeft:8,color:"var(--muted)"},children:b8(ee.startTime)})]}),F&&i.jsx("div",{style:{padding:"12px 16px",borderRadius:"var(--radius-button)",background:"#fff7ed",border:"1px solid #fed7aa",color:"#9a3412",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:F}),A&&!F?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading questions…"}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsx("div",{style:{display:"flex",background:"var(--secondary)",borderRadius:"var(--radius-button)",padding:"2px",gap:"2px"},children:Q.map(H=>i.jsxs("button",{type:"button",onClick:()=>y(H),style:{padding:"5px 12px",borderRadius:"var(--radius-button)",border:"none",background:p===H?"var(--card)":"transparent",color:p===H?"var(--foreground)":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:p===H?"var(--font-weight-medium)":"var(--font-weight-normal)",cursor:"pointer",transition:"all 0.12s",boxShadow:p===H?"var(--elevation-sm)":"none",display:"flex",alignItems:"center",gap:"5px"},children:[H==="Hidden"?"Hidden from audience":H,L[H]>0&&i.jsx("span",{style:{padding:"0 5px",borderRadius:"999px",background:p===H?"var(--accent)":"transparent",color:p===H?"var(--primary)":"var(--muted)",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:L[H]})]},H))}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px",padding:"0 10px",height:"32px",flex:"1 1 180px",background:"var(--card)",border:`1px solid ${k?"var(--ring)":"var(--border)"}`,borderRadius:"var(--radius-button)",transition:"border-color 0.12s"},children:[i.jsx(Pi,{size:12,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:b,onChange:H=>w(H.target.value),placeholder:"Search questions or authors…",onFocus:()=>S(!0),onBlur:()=>S(!1),style:{background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",width:"100%"}}),b&&i.jsx("button",{type:"button",onClick:()=>w(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0},children:i.jsx(er,{size:11})})]}),i.jsxs("button",{type:"button",onClick:()=>x(H=>H==="votes"?"recent":"votes"),style:{display:"flex",alignItems:"center",gap:"5px",height:"32px",padding:"0 12px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:H=>{H.currentTarget.style.borderColor="var(--primary)",H.currentTarget.style.color="var(--primary)"},onMouseLeave:H=>{H.currentTarget.style.borderColor="var(--border)",H.currentTarget.style.color="var(--muted)"},children:[i.jsx(eee,{size:12}),m==="votes"?"Most upvoted":"Most recent"]})]}),z.length===0?i.jsxs("div",{style:{textAlign:"center",padding:"64px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(ch,{size:32,style:{color:"var(--border)",margin:"0 auto 12px"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:b?"No questions match your search":"No questions yet"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)"},children:b?"Try different keywords.":"Audience questions will appear here when submitted for this session."})]}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:z.map(H=>i.jsx(zAe,{q:H,busy:_===H._id,onShortlist:B=>void V(H._id,{shortlisted:B}),onAudienceToggle:B=>void V(H._id,{audienceListed:B}),onArchive:()=>void V(H._id,{status:"archived"}),onRestore:()=>void V(H._id,{status:"pending"})},H._id))})]})]}),t?null:i.jsx("div",{style:{paddingTop:"8px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})})]})}const BAe=[{rank:1,name:"Ravi Gulhane",polls:18,quiz:27,total:45},{rank:2,name:"Pawankumar J.",polls:15,quiz:23,total:38},{rank:3,name:"Zeeshan",polls:12,quiz:20,total:32},{rank:4,name:"Amey Bhagwat",polls:10,quiz:18,total:28},{rank:5,name:"Abhijit Aundhkar",polls:8,quiz:16,total:24},{rank:6,name:"Shabareesh D.",polls:7,quiz:14,total:21}],WAe={Active:{bg:"#dcfce7",color:"#15803d"},Completed:{bg:"var(--secondary)",color:"var(--muted)"},Draft:{bg:"#f3f4f6",color:"#6b7280"}},qAe={1:{bg:"#fef3c7",color:"#92400e",medal:"🥇"},2:{bg:"#f1f5f9",color:"#475569",medal:"🥈"},3:{bg:"#ffedd5",color:"#c2410c",medal:"🥉"}},Q4={width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)",flexShrink:0};function $Ae({sessions:e,itemId:t,itemType:r,eventId:n,onClose:o,onDone:a}){const[s,l]=j.useState(""),[c,u]=j.useState(!1),[d,f]=j.useState(!1),[h,p]=j.useState(null);j.useEffect(()=>{t&&(l(""),u(!0),p(null),Oa.get(t).then(m=>{var x;u(!1),(x=m.data)!=null&&x.session?l(String(m.data.session)):e.length&&l(e[0].id)}))},[t,e.length]);const y=async()=>{if(!s||!n)return;f(!0),p(null);const m=await Oa.get(t);if(m.error||!m.data){p(m.error||"Failed to load item"),f(!1);return}const x=m.data,b={session:s,title:(x.title||"").trim()+" (Copy)",type:x.type,description:x.description,questions:(x.questions||[]).map(k=>({question:k.question,type:k.type,options:k.options,points:k.points,required:k.required})),settings:x.settings?{...x.settings,isLive:!1}:void 0},w=await Oa.create(n,b);if(f(!1),w.error){p(w.error);return}a(),o()};return c?i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("div",{style:{background:"var(--card)",padding:24,borderRadius:"var(--radius-card)"},children:"Loading…"})}):i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:24},onClick:o,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:420,boxShadow:"var(--elevation-sm)"},onClick:m=>m.stopPropagation(),children:[i.jsxs("div",{style:{padding:"20px 24px",borderBottom:"1px solid var(--border)"},children:[i.jsxs("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:600,color:"var(--foreground)",marginBottom:4},children:["Copy ",r==="poll"?"Poll":"Quiz"]}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:["Select the session to copy this ",r," to (with all questions)."]})]}),i.jsxs("div",{style:{padding:"20px 24px"},children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:500,marginBottom:8},children:"Session"}),i.jsxs("select",{value:s,onChange:m=>l(m.target.value),style:{width:"100%",height:40,padding:"0 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-sm)"},children:[i.jsx("option",{value:"",children:"Select session"}),e.map(m=>i.jsxs("option",{value:m.id,children:[m.label," · ",m.trackName]},m.id))]}),h&&i.jsx("p",{style:{marginTop:8,fontSize:"var(--text-sm)",color:"var(--destructive)"},children:h})]}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:8},children:[i.jsx("button",{type:"button",onClick:o,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:y,disabled:!s||d,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:s&&!d?"var(--primary)":"var(--border)",color:s&&!d?"var(--primary-foreground)":"var(--muted)",cursor:s&&!d?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontWeight:600},children:d?"Copying…":"Copy here"})]})]})})}function UAe({live:e,onChange:t}){return i.jsxs("button",{onClick:t,style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",borderRadius:"999px",background:e?"#f0fdf4":"var(--secondary)",border:`1px solid ${e?"#bbf7d0":"var(--border)"}`,cursor:"pointer",transition:"all 0.15s",whiteSpace:"nowrap"},children:[i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:e?"#16a34a":"var(--border)",display:"block",flexShrink:0}}),i.jsx("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:e?"#15803d":"var(--muted)"},children:e?"Live":"Not Live"})]})}function X4({checked:e,onChange:t}){return i.jsxs("button",{onClick:t,style:{width:"16px",height:"16px",borderRadius:"3px",border:`1.5px solid ${e?"var(--primary)":"var(--border)"}`,background:e===!0?"var(--primary)":"#fff",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",flexShrink:0,padding:0},children:[e===!0&&i.jsx(Oi,{size:10,strokeWidth:3,color:"#fff"}),e==="indeterminate"&&i.jsx(Ow,{size:10,strokeWidth:3,color:"var(--primary)"})]})}function HAe({polls:e,quizzes:t,onClose:r}){const[n,o]=j.useState(new Set),[a,s]=j.useState(new Set),[l,c]=j.useState(!0),[u,d]=j.useState(!1),f=_=>o(P=>{const O=new Set(P);return O.has(_)?O.delete(_):O.add(_),O}),h=_=>s(P=>{const O=new Set(P);return O.has(_)?O.delete(_):O.add(_),O}),p=e.map(_=>_.id),y=t.map(_=>_.id),m=n.size+a.size,x=p.length+y.length,b=n.size===p.length&&a.size===y.length,w=m>0,k=()=>m===0?!1:m===x?!0:"indeterminate",S=()=>{b?(o(new Set),s(new Set)):(o(new Set(p)),s(new Set(y)))};return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.3)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:"680px",maxHeight:"90vh",display:"flex",flexDirection:"column",boxShadow:"var(--elevation-sm)",overflow:"hidden"},children:[i.jsxs("div",{style:{background:"var(--primary)",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx(od,{size:15,color:"rgba(255,255,255,0.9)"}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"#fff"},children:"Session Leaderboard"})]}),i.jsx("button",{onClick:r,style:{background:"none",border:"none",cursor:"pointer",color:"rgba(255,255,255,0.7)",display:"flex"},children:i.jsx(er,{size:16})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{onClick:()=>c(_=>!_),style:{width:"100%",display:"flex",alignItems:"center",gap:"10px",padding:"12px 20px",background:"var(--secondary)",border:"none",cursor:"pointer",borderBottom:l?"1px solid var(--border)":"none"},children:[i.jsx(hee,{size:13,style:{color:"var(--muted)"}}),i.jsx("span",{style:{flex:1,textAlign:"left",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Filter Quizzes & Polls"}),m>0&&!u&&i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",background:"var(--accent)",color:"var(--primary)",padding:"2px 7px",borderRadius:"999px",fontWeight:"600"},children:[m," selected"]}),i.jsx(po,{size:13,style:{color:"var(--muted)",transform:l?"rotate(180deg)":"none",transition:"transform 0.15s"}})]}),l&&i.jsxs("div",{style:{padding:"16px 20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"14px",paddingBottom:"12px",borderBottom:"1px solid var(--border)"},children:[i.jsx(X4,{checked:k(),onChange:S}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"},children:"Select all"}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginLeft:"auto"},children:[m," of ",x," selected"]})]}),i.jsxs("div",{style:{marginBottom:"14px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"8px"},children:[i.jsx(nu,{size:12,style:{color:"#16a34a"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"#16a34a",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Polls"})]}),e.map(_=>i.jsxs("div",{onClick:()=>f(_.id),style:{width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"7px 0 7px 16px",borderBottom:"1px solid var(--border)",cursor:"pointer"},children:[i.jsx(X4,{checked:n.has(_.id),onChange:()=>{}}),i.jsx("span",{style:{flex:1,textAlign:"left",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:_.name})]},_.id))]}),i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"8px"},children:[i.jsx(M6,{size:12,style:{color:"var(--primary)"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--primary)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Quizzes"})]}),t.map(_=>i.jsxs("div",{onClick:()=>h(_.id),style:{width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"7px 0 7px 16px",borderBottom:"1px solid var(--border)",cursor:"pointer"},children:[i.jsx(X4,{checked:a.has(_.id),onChange:()=>{}}),i.jsx("span",{style:{flex:1,textAlign:"left",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:_.name})]},_.id))]}),i.jsxs("button",{onClick:()=>w&&d(!0),style:{width:"100%",marginTop:"16px",padding:"11px",borderRadius:"var(--radius-button)",background:w?"var(--primary)":"var(--border)",color:w?"var(--primary-foreground)":"var(--muted)",border:"none",cursor:w?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"background 0.15s"},children:[i.jsx(od,{size:13})," Generate Leaderboard"]})]})]}),u?i.jsxs("div",{style:{padding:"20px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:"14px"},children:"Results"}),i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"48px 1fr 80px 80px 80px",background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:["#","Participant","Polls","Quiz","Total"].map((_,P)=>i.jsx("div",{style:{padding:"8px 12px",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.04em",textAlign:P>1?"right":"left"},children:_},_))}),BAe.map(_=>{const P=qAe[_.rank];return i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"48px 1fr 80px 80px 80px",alignItems:"center",borderBottom:"1px solid var(--border)",background:"var(--card)"},children:[i.jsx("div",{style:{padding:"10px 12px"},children:P?i.jsx("span",{style:{fontSize:"13px"},children:P.medal}):i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["#",_.rank]})}),i.jsx("div",{style:{padding:"10px 12px"},children:i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",fontWeight:"var(--font-weight-medium)"},children:_.name})}),i.jsx("div",{style:{padding:"10px 12px",textAlign:"right"},children:i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:_.polls})}),i.jsx("div",{style:{padding:"10px 12px",textAlign:"right"},children:i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:_.quiz})}),i.jsx("div",{style:{padding:"10px 12px",textAlign:"right"},children:i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:_.total})})]},_.rank)})]})]}):l?null:i.jsxs("div",{style:{padding:"60px 20px",textAlign:"center"},children:[i.jsx(od,{size:40,style:{color:"var(--border)",margin:"0 auto 14px"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"Select quizzes and polls to generate"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Use the filter section above to pick items, then click Generate Leaderboard."})]})]})]})})}function $B({name:e,description:t,badge:r,status:n,live:o,onToggleLive:a,onDuplicate:s,onEdit:l,onDelete:c}){const[u,d]=j.useState(!1),f=WAe[n];return i.jsxs("div",{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",gap:"12px",padding:"13px 18px",borderBottom:"1px solid var(--border)",background:u?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsx(sv,{size:13,style:{color:"var(--border)",flexShrink:0}}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px",marginBottom:"3px",flexWrap:"wrap"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:e}),i.jsx("span",{style:{padding:"1px 7px",borderRadius:"3px",background:f.bg,color:f.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:n}),r&&i.jsx("span",{style:{padding:"1px 7px",borderRadius:"3px",background:"var(--accent)",color:"var(--accent-foreground)",fontSize:"10px",fontFamily:"var(--font-noto-sans)"},children:r})]}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",lineHeight:"1.45",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"480px"},children:t})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexShrink:0},children:[i.jsx(UAe,{live:o,onChange:a}),i.jsx("button",{type:"button",onClick:s,style:Q4,title:"Duplicate",onMouseEnter:h=>{h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--muted)"},children:i.jsx(iu,{size:12})}),i.jsx("button",{type:"button",onClick:l,style:Q4,title:"Edit",onMouseEnter:h=>{h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--muted)"},children:i.jsx(Ii,{size:12})}),i.jsx("button",{type:"button",onClick:c,style:{...Q4,color:"var(--muted)"},title:"Delete",onMouseEnter:h=>{h.currentTarget.style.borderColor="var(--destructive)",h.currentTarget.style.color="var(--destructive)"},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--muted)"},children:i.jsx(gn,{size:12})})]})]})}function UB(e){var a,s,l,c,u,d;const t=(a=e.settings)==null?void 0:a.status,r=!t&&(((s=e.settings)==null?void 0:s.isLive)===!1||((l=e.settings)==null?void 0:l.isLive)===void 0&&((c=e.settings)==null?void 0:c.isActive)===!1),n=t==="draft"||r,o=((u=e.settings)==null?void 0:u.isLive)??((d=e.settings)==null?void 0:d.isActive)??!1;return{id:e._id,name:e.title,description:e.description??"",status:n?"Draft":"Active",live:o,type:e.type==="quiz"?"Quiz":void 0}}function VAe(e){return e!=null&&e.length?e.map((t,r)=>{const n=(t.options||[]).map((a,s)=>({id:`o-${r}-${s}`,text:a.text||"",isCorrect:!!a.isCorrect,imageUrl:a.imageUrl})),o=n.some(a=>a.imageUrl);return{id:`q-${r}`,text:t.question||"",imageUrl:t.imageUrl,useImagesOptions:o,type:t.type==="multiple"?"Multiple Choice":(t.type==="text"||t.type==="rating","Single Choice"),order:r,options:n,status:"Active"}}):[]}function HB({icon:e,iconColor:t,title:r,count:n,addLabel:o,onAdd:a,children:s}){return i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"13px 18px",borderBottom:"1px solid var(--border)",background:"var(--secondary)"},children:[i.jsx("span",{style:{color:t},children:e}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:r}),i.jsx("span",{style:{width:"18px",height:"18px",borderRadius:"50%",background:t,color:"#fff",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center"},children:n}),i.jsx("div",{style:{flex:1}}),i.jsxs("button",{onClick:a,style:{display:"flex",alignItems:"center",gap:"5px",padding:"5px 12px",borderRadius:"var(--radius-button)",background:t,color:"#fff",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:12})," ",o]})]}),s]})}function mQ({fixedSessionId:e=null,compactChrome:t=!1,onQuizPollPersisted:r}={}){const o=qi()==="mobile",{selectedEventId:a}=eo(),[s,l]=j.useState(e??null),[c,u]=j.useState(!1),[d,f]=j.useState(null),[h,p]=j.useState(null),[y,m]=j.useState(null),[x,b]=j.useState([]),[w,k]=j.useState([]),[S,_]=j.useState(!1),[P,O]=j.useState(!1),T=j.useMemo(()=>dQ(x),[x]),R=j.useMemo(()=>fQ(x),[x]);j.useEffect(()=>{if(!a){b([]),l(null);return}_(!0),za.agendaTree(a).then(B=>{var M;_(!1),b(((M=B.data)==null?void 0:M.tracks)??[])})},[a]),j.useLayoutEffect(()=>{if(e){l(e);return}!a||S||s===null&&R.length===1&&l(R[0].id)},[a,S,s,R,e]);const I=()=>{s&&(O(!0),Oa.listBySession(s).then(B=>{var M;O(!1),k(((M=B.data)==null?void 0:M.quizPolls)??[])}))};j.useEffect(()=>{if(!s){k([]);return}I()},[s]),j.useEffect(()=>{if(!d||d.mode!=="edit"){p(null);return}p(null),Oa.get(d.id).then(B=>{if(!B.data)return;const M=B.data,$=M.type==="quiz"?"quiz":"poll",q=Aoe(M,VAe(M.questions));p({kind:$,form:q.form,questions:q.questions})})},[d]);const E=j.useMemo(()=>w.filter(B=>B.type==="poll").map(UB),[w]),A=j.useMemo(()=>w.filter(B=>B.type==="quiz").map(UB),[w]),F=async B=>{var q,Y,K;const M=w.find(G=>G._id===B);if(!M)return;const $=!(((q=M.settings)==null?void 0:q.isLive)??((Y=M.settings)==null?void 0:Y.isActive));if(await Oa[$?"publish":"close"](B),s){const G=await Oa.listBySession(s);k(((K=G.data)==null?void 0:K.quizPolls)??[])}},L=async B=>{var q,Y,K;const M=w.find(G=>G._id===B);if(!M)return;const $=!(((q=M.settings)==null?void 0:q.isLive)??((Y=M.settings)==null?void 0:Y.isActive));if(await Oa[$?"publish":"close"](B),s){const G=await Oa.listBySession(s);k(((K=G.data)==null?void 0:K.quizPolls)??[])}},z=()=>{f(null),p(null)},V=async B=>{if(!a||!s||!d)return;const M=d.mode==="create"?d.kind:(h==null?void 0:h.kind)??"poll",$=d.mode==="edit"?d.id:null,q=G=>{var re,J;return{question:G.text,imageUrl:(re=G.imageUrl)!=null&&re.trim()?G.imageUrl.trim():null,type:G.type==="Single Choice"||G.type==="True / False"?"single":G.type==="Multiple Choice"?"multiple":"text",options:(J=G.options)==null?void 0:J.map(ae=>{var le;return{text:ae.text,isCorrect:ae.isCorrect,imageUrl:(le=ae.imageUrl)!=null&&le.trim()?ae.imageUrl.trim():null}}),required:!0,...M==="quiz"?{points:1}:{}}},Y={session:s,title:B.form.title,type:M,description:B.form.description||void 0,questions:B.questions.map(q),settings:iT(B.form,M)};if($){(await Oa.update($,Y)).error||(I(),z(),await(r==null?void 0:r()));return}(await Oa.create(a,Y)).error||(I(),z(),await(r==null?void 0:r()))},Q=async B=>{if(!confirm("Delete this poll? You can restore it later if needed (soft delete)."))return;(await Oa.remove(B)).error||I()},U=async B=>{if(!confirm("Delete this quiz? You can restore it later if needed (soft delete)."))return;(await Oa.remove(B)).error||I()};if(!a)return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,alignItems:"center",justifyContent:"center",minHeight:280},children:[i.jsx(Wi,{size:40,style:{color:"var(--border)"}}),i.jsx("p",{style:{fontSize:"var(--text-base)",color:"var(--muted)"},children:"Select an event to manage quizzes and polls."})]});const ee=!e&&s===null,H=R.find(B=>B.id===s);return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[t?ee?null:i.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:i.jsxs("button",{type:"button",onClick:()=>u(!0),style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",flexShrink:0},children:[i.jsx(od,{size:13})," ",o?"Leaderboard":"Session Leaderboard"]})}):i.jsxs("div",{style:{display:"flex",alignItems:o?"stretch":"flex-start",flexDirection:o?"column":"row",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Quiz & Polls"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:o?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Quiz & Polls"})]}),!ee&&i.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:o?"wrap":"nowrap"},children:[e?null:i.jsx("div",{style:{flex:o?1:"none",minWidth:0},children:i.jsx(pQ,{sessions:R,sessionId:s,onOpenSessionPicker:()=>l(null)})}),i.jsxs("button",{type:"button",onClick:()=>u(!0),style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",flexShrink:0},children:[i.jsx(od,{size:13})," ",o?"Leaderboard":"Session Leaderboard"]})]})]}),ee?S?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading sessions…"}):i.jsx(hQ,{dateGroups:T,onSelectSession:B=>l(B),selectPrompt:"Select a session to manage quizzes and polls"}):i.jsxs(i.Fragment,{children:[H&&!t&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:["Session: ",i.jsx("strong",{style:{color:"var(--foreground)"},children:H.label}),i.jsx("span",{style:{marginLeft:8},children:H.trackName})]}),P?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading quizzes & polls…"}):i.jsxs(i.Fragment,{children:[i.jsx(HB,{icon:i.jsx(nu,{size:15}),iconColor:"#16a34a",title:"Polls",count:E.length,addLabel:"Add Poll",onAdd:()=>f({mode:"create",kind:"poll"}),children:E.map(B=>i.jsx($B,{name:B.name,description:B.description,status:B.status,live:B.live,onToggleLive:()=>F(B.id),onDuplicate:()=>m({id:B.id,type:"poll"}),onEdit:()=>f({mode:"edit",id:B.id}),onDelete:()=>Q(B.id)},B.id))}),i.jsx(HB,{icon:i.jsx(M6,{size:15}),iconColor:"var(--primary)",title:"Quizzes",count:A.length,addLabel:"Add Quiz",onAdd:()=>f({mode:"create",kind:"quiz"}),children:A.map(B=>i.jsx($B,{name:B.name,description:B.description,badge:B.type,status:B.status,live:B.live,onToggleLive:()=>L(B.id),onDuplicate:()=>m({id:B.id,type:"quiz"}),onEdit:()=>f({mode:"edit",id:B.id}),onDelete:()=>U(B.id)},B.id))})]})]}),t?null:i.jsx("div",{style:{paddingTop:"8px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})}),c&&i.jsx(HAe,{polls:E,quizzes:A,onClose:()=>u(!1)}),d&&(d.mode==="create"||h)&&i.jsx(ax,{kind:d.mode==="create"?d.kind:h.kind,initial:d.mode==="edit"?{form:h.form,questions:h.questions}:void 0,eventId:a,onClose:z,onSave:B=>void V(B)},d.mode==="edit"?d.id:`new-${d.kind}`),y&&a&&R.length>0&&i.jsx($Ae,{sessions:R,itemId:y.id,itemType:y.type,eventId:a,onClose:()=>m(null),onDone:I})]})}function r6(e){if(typeof e.enableQnA=="boolean")return e.enableQnA;const t=e.qnaEnabled;return typeof t=="boolean"?t:!0}function n6(e){return typeof e.enableQnP=="boolean"?e.enableQnP:!0}function YAe(e){const t=e.track;let r=null;t&&typeof t=="object"&&"_id"in t?r=String(t._id):typeof t=="string"&&t.trim()&&(r=t);const n=(e.speakers||[]).map(o=>typeof o=="string"?o:o._id);return{title:e.title,description:e.description??"",type:e.type,startTime:e.startTime,endTime:e.endTime,location:e.location,track:r,speakers:n,moderator:e.moderator??null,capacity:e.capacity,status:e.status,resources:e.resources,audienceFeedbackEnabled:e.audienceFeedbackEnabled,audienceRatingsEnabled:e.audienceRatingsEnabled,audienceFeedbackForm:e.audienceFeedbackForm??null,audienceRatingsForm:e.audienceRatingsForm??null,enableQnA:r6(e),enableQnP:n6(e)}}function GAe({event:e,session:t,selectedEventId:r,onSaved:n}){const[o,a]=j.useState(1),[s,l]=j.useState(()=>new Set([1,2,3,4])),[c,u]=j.useState(()=>z0(e)),[d,f]=j.useState(()=>r6(t)),[h,p]=j.useState(()=>n6(t)),[y,m]=j.useState({}),[x,b]=j.useState(!1),[w,k]=j.useState(null),S=j.useRef(null),_=j.useRef(null);j.useEffect(()=>{u(z0(e)),f(r6(t)),p(n6(t)),m({}),k(null)},[e._id,e.updatedAt,t._id,t]);const P=j.useCallback((H,B)=>{u(M=>({...M,[H]:B}))},[]),O=H=>y[H],T=H=>a(B=>B===H?0:H),R=()=>u(H=>({...H,customFields:[...H.customFields,$$()]})),I=H=>{u(B=>({...B,customFields:B.customFields.filter(M=>M.id!==H)})),m(B=>{const M={...B};return Object.keys(M).forEach($=>{($.startsWith(`cf_${H}_`)||$===`cf_${H}_label`)&&delete M[$]}),M})},E=(H,B)=>{u(M=>({...M,customFields:M.customFields.map($=>{if($.id!==H)return $;const q={...$,label:B};return $.codeAuto&&(q.code=ph(B)),q})}))},A=(H,B)=>{u(M=>({...M,customFields:M.customFields.map($=>$.id===H?{...$,code:B,codeAuto:!1}:$)}))},F=(H,B)=>{u(M=>({...M,customFields:M.customFields.map($=>{if($.id!==H)return $;const q={...$,fieldType:B};return nc(B)&&$.options.length===0&&(q.options=[{id:Math.random().toString(36).slice(2),value:"",label:""}]),nc(B)||(q.options=[]),q})}))},L=H=>{u(B=>({...B,customFields:B.customFields.map(M=>M.id===H?{...M,options:[...M.options,{id:Math.random().toString(36).slice(2),value:"",label:""}]}:M)}))},z=(H,B)=>{u(M=>({...M,customFields:M.customFields.map($=>$.id===H?{...$,options:$.options.filter(q=>q.id!==B)}:$)})),m(M=>{const $={...M};return delete $[`cf_${H}_opt_${B}`],$})},V=(H,B,M,$)=>{u(q=>({...q,customFields:q.customFields.map(Y=>Y.id===H?{...Y,options:Y.options.map(K=>K.id===B?{...K,[M]:$}:K)}:Y)}))},Q=H=>{k(null),m({}),l(B=>new Set([...B,H])),H{k(null);const H=eoe(c,e),B=H.customFields.filter(q=>!(!q.label.trim()||nc(q.fieldType)&&q.options.filter(K=>K.label.trim()&&K.value.trim()).length===0)),M={...H,customFields:B},$=toe(M);if(Object.keys($).length>0){m($),($.virtualLink||$.endDate)&&a(2),k("Fix the highlighted fields, then save again.");return}m({}),b(!0);try{const Y={...B$(M),recordKind:e.recordKind??"activity",activitySubtype:e.activitySubtype},K=await zr.update(r,Y);if(K.error){k(K.error);return}const G=await Da.update(t._id,{...YAe(t),enableQnA:d,enableQnP:h});if(G.error){k(G.error);return}k("Saved."),await n()}finally{b(!1)}},ee=Math.round(s.size/Zg*100);return i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",overflow:"hidden"},children:[i.jsxs("div",{style:{padding:"14px 20px",borderBottom:"1px solid var(--border)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px",flexWrap:"wrap",gap:"10px"},children:[i.jsxs("div",{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"Activity settings"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0"},children:"Empty fields keep existing saved values. Session Q&A and quiz toggles are under Basic."})]}),i.jsx("button",{type:"button",disabled:x,onClick:()=>void U(),style:{padding:"8px 18px",borderRadius:"var(--radius-button)",background:x?"var(--secondary)":"var(--primary)",color:x?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:x?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:x?"Saving…":"Save settings"})]}),w&&i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:w==="Saved."?"#15803d":"#b91c1c",margin:"8px 0 0"},children:w}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"10px",marginBottom:"6px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:[s.size," of ",Zg," sections complete"]}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:[ee,"%"]})]}),i.jsx("div",{style:{height:"6px",borderRadius:"99px",background:"var(--border)",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${ee}%`,background:"#22c55e",borderRadius:"99px",transition:"width 0.3s ease"}})})]}),i.jsxs("div",{style:{maxHeight:"min(70vh, 640px)",overflowY:"auto"},children:[i.jsxs(Sf,{n:1,title:"Basic",subtitle:"Name, description, and session features",open:o===1,completed:s.has(1),onToggle:()=>T(1),onNext:()=>Q(1),nextLabel:"Continue to Schedule & Location",nextDisabled:x,children:[i.jsxs(lr,{error:O("eventName"),children:[i.jsx(ur,{text:"Activity name"}),i.jsx("input",{style:{...Xr,...O("eventName")?{borderColor:"var(--destructive)"}:{}},value:c.eventName,onChange:H=>P("eventName",H.target.value)})]}),i.jsxs(lr,{error:O("description"),children:[i.jsx(ur,{text:"Description"}),i.jsx("textarea",{style:{...Xr,resize:"vertical",minHeight:"80px",...O("description")?{borderColor:"var(--destructive)"}:{}},value:c.description,onChange:H=>P("description",H.target.value)})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:d,onChange:H=>f(H.target.checked)}),"Enable Q&A (Questions tab)"]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:h,onChange:H=>p(H.target.checked)}),"Enable quiz & polls (Quiz & Polls tab)"]})]}),i.jsxs(Sf,{n:2,title:"Schedule & Location",subtitle:"When and where",open:o===2,completed:s.has(2),onToggle:()=>T(2),onNext:()=>Q(2),nextLabel:"Continue to Media & Tags",nextDisabled:x,children:[i.jsxs(No,{children:[i.jsxs(lr,{error:O("status"),children:[i.jsx(ur,{text:"Status"}),i.jsx(La,{children:i.jsxs("select",{style:{...Ra,...O("status")?{borderColor:"var(--destructive)"}:{}},value:c.status,onChange:H=>P("status",H.target.value),children:[i.jsx("option",{value:"",children:"Select Status"}),i.jsx("option",{children:"Draft"}),i.jsx("option",{children:"Upcoming"}),i.jsx("option",{children:"Live"}),i.jsx("option",{children:"Completed"})]})})]}),i.jsxs(lr,{error:O("locationType"),children:[i.jsx(ur,{text:"Location Type"}),i.jsx(La,{children:i.jsxs("select",{style:{...Ra,...O("locationType")?{borderColor:"var(--destructive)"}:{}},value:c.locationType,onChange:H=>P("locationType",H.target.value),children:[i.jsx("option",{value:"",children:"Select"}),i.jsx("option",{children:"Physical"}),i.jsx("option",{children:"Virtual"}),i.jsx("option",{children:"Hybrid"})]})})]})]}),(c.locationType==="Physical"||c.locationType==="Hybrid")&&i.jsxs(lr,{error:O("venue"),children:[i.jsx(ur,{text:"Venue / Address"}),i.jsx("input",{style:{...Xr,...O("venue")?{borderColor:"var(--destructive)"}:{}},value:c.venue,onChange:H=>P("venue",H.target.value)})]}),(c.locationType==="Virtual"||c.locationType==="Hybrid")&&i.jsxs(lr,{error:O("virtualLink"),children:[i.jsx(ur,{text:"Virtual link"}),i.jsx("input",{style:{...Xr,...O("virtualLink")?{borderColor:"var(--destructive)"}:{}},placeholder:"https://…",value:c.virtualLink,onChange:H=>P("virtualLink",H.target.value)})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:O("startDate"),children:[i.jsx(ur,{text:"Start Date"}),i.jsx("input",{type:"date",style:{...Xr,...O("startDate")?{borderColor:"var(--destructive)"}:{}},value:c.startDate,onChange:H=>P("startDate",H.target.value)})]}),i.jsxs(lr,{error:O("endDate"),children:[i.jsx(ur,{text:"End Date"}),i.jsx("input",{type:"date",style:{...Xr,...O("endDate")?{borderColor:"var(--destructive)"}:{}},value:c.endDate,onChange:H=>P("endDate",H.target.value)})]})]})]}),i.jsxs(Sf,{n:3,title:"Media & Tags",subtitle:"Logo, banner, and tags",open:o===3,completed:s.has(3),onToggle:()=>T(3),onNext:()=>Q(3),nextLabel:"Continue to Registration & Form Fields",nextDisabled:x,children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Key People (tags)"}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx(Pi,{size:13,style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}}),i.jsx("input",{style:{...Xr,paddingLeft:"30px"},placeholder:"Comma-separated",value:c.keyPeople,onChange:H=>P("keyPeople",H.target.value)})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Event Logo"}),i.jsx(D0,{label:"logo",preview:c.eventLogo,error:O("eventLogo"),inputRef:S,onFile:H=>{P("eventLogo",H),m(B=>{const M={...B};return delete M.eventLogo,M})}})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Banner Image"}),i.jsx(D0,{label:"banner",preview:c.eventBanner,error:O("eventBanner"),inputRef:_,onFile:H=>{P("eventBanner",H),m(B=>{const M={...B};return delete M.eventBanner,M})}})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Enable Feedback"}),i.jsx(wf,{name:"enableFeedback",value:c.enableFeedback,onChange:H=>P("enableFeedback",H),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Enable Ratings"}),i.jsx(wf,{name:"enableRatings",value:c.enableRatings,onChange:H=>P("enableRatings",H),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]})]})]}),i.jsxs(Sf,{n:4,title:"Registration & Form Fields",subtitle:"Registration rules and custom registration fields",open:o===4,completed:s.has(4),onToggle:()=>T(4),onNext:()=>void U(),nextLabel:"Save settings",nextDisabled:x,children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:"Registration settings"}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Registration Required"}),i.jsx(wf,{name:"regRequired",value:c.registrationRequired,onChange:H=>P("registrationRequired",H),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{error:O("registrationMode"),children:[i.jsx(ur,{text:"Registration Mode"}),i.jsx(La,{children:i.jsxs("select",{style:{...Ra,...O("registrationMode")?{borderColor:"var(--destructive)"}:{}},value:c.registrationMode,onChange:H=>P("registrationMode",H.target.value),disabled:c.registrationRequired!=="Yes",children:[i.jsx("option",{value:"",children:c.registrationRequired==="Yes"?"Select mode":"N/A"}),i.jsx("option",{children:"Open"}),i.jsx("option",{children:"Invite Only"}),i.jsx("option",{children:"Approval Required"})]})})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Verify Email"}),i.jsx(wf,{name:"verifyEmail",value:c.verifyEmail,onChange:H=>P("verifyEmail",H),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Registration Deadline"}),i.jsx("input",{type:"date",style:Xr,value:c.registrationDeadline,onChange:H=>P("registrationDeadline",H.target.value)})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:O("authenticationType"),children:[i.jsx(ur,{text:"Authentication Type"}),i.jsx(La,{children:i.jsx("select",{style:{...Ra,...O("authenticationType")?{borderColor:"var(--destructive)"}:{}},value:c.authenticationType,onChange:H=>P("authenticationType",H.target.value),disabled:c.registrationRequired!=="Yes",children:tT.map(H=>i.jsx("option",{value:H.value,children:H.label},H.value))})})]}),i.jsxs(lr,{error:O("registrationBaseFields"),children:[i.jsx(ur,{text:"Registration Base Fields"}),i.jsx(La,{children:i.jsx("select",{style:{...Ra,...O("registrationBaseFields")?{borderColor:"var(--destructive)"}:{}},value:c.registrationBaseFields,onChange:H=>P("registrationBaseFields",H.target.value),disabled:c.registrationRequired!=="Yes",children:rT.map(H=>i.jsx("option",{value:H.value,children:H.label},H.value))})})]})]}),i.jsxs("div",{style:{borderTop:"1px solid var(--border)",paddingTop:"12px",marginTop:"4px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 10px",fontFamily:"var(--font-noto-sans)"},children:"Custom registration fields (optional)"}),c.customFields.map((H,B)=>i.jsxs("div",{style:{background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"12px",marginBottom:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",fontFamily:"var(--font-noto-sans)"},children:["Field ",B+1]}),i.jsx("button",{type:"button",onClick:()=>I(H.id),style:{background:"none",border:"none",cursor:"pointer",color:"var(--destructive)"},children:i.jsx(gn,{size:14})})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:O(`cf_${H.id}_label`),children:[i.jsx(ur,{text:"Field Label"}),i.jsx("input",{style:{...Xr,...O(`cf_${H.id}_label`)?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. Dietary preference",value:H.label,onChange:M=>E(H.id,M.target.value)})]}),i.jsxs(lr,{error:O(`cf_${H.id}_code`),children:[i.jsx(ur,{text:"Field Code"}),i.jsx("input",{style:{...Xr,...O(`cf_${H.id}_code`)?{borderColor:"var(--destructive)"}:{},opacity:H.codeAuto?.92:1},placeholder:"auto from label",value:H.code||(H.codeAuto?ph(H.label):""),onChange:M=>A(H.id,M.target.value)}),i.jsx("p",{style:{fontSize:"10px",color:"var(--muted)",margin:"4px 0 0"},children:"Auto-updates from label until you edit it."})]})]}),i.jsxs(lr,{error:O(`cf_${H.id}_type`),children:[i.jsx(ur,{text:"Field Type"}),i.jsx(La,{children:i.jsx("select",{style:{...Ra,...O(`cf_${H.id}_type`)?{borderColor:"var(--destructive)"}:{}},value:H.fieldType,onChange:M=>F(H.id,M.target.value),children:eT.map(M=>i.jsx("option",{value:M.value,children:M.label},M.value))})})]}),nc(H.fieldType)&&i.jsxs("div",{style:{marginTop:"10px"},children:[i.jsx(ur,{text:"Options (Value & Label)"}),O(`cf_${H.id}_options`)&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"0 0 6px"},children:O(`cf_${H.id}_options`)}),H.options.map(M=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr auto",gap:"8px",alignItems:"start",marginBottom:"8px"},children:[i.jsx(lr,{error:O(`cf_${H.id}_opt_${M.id}`),children:i.jsx("input",{style:{...Xr,...O(`cf_${H.id}_opt_${M.id}`)?{borderColor:"var(--destructive)"}:{}},placeholder:"Value",value:M.value,onChange:$=>V(H.id,M.id,"value",$.target.value)})}),i.jsx(lr,{error:O(`cf_${H.id}_opt_${M.id}`),children:i.jsx("input",{style:{...Xr,...O(`cf_${H.id}_opt_${M.id}`)?{borderColor:"var(--destructive)"}:{}},placeholder:"Label",value:M.label,onChange:$=>V(H.id,M.id,"label",$.target.value)})}),i.jsx("button",{type:"button",onClick:()=>z(H.id,M.id),style:{padding:"8px",border:"none",background:"transparent",cursor:"pointer",color:"var(--destructive)",marginTop:"4px"},"aria-label":"Remove option",children:i.jsx(gn,{size:14})})]},M.id)),i.jsxs("button",{type:"button",onClick:()=>L(H.id),style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px dashed var(--primary)",background:"var(--card)",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(wr,{size:12})," Add option"]})]})]},H.id)),i.jsxs("button",{type:"button",onClick:R,style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"var(--secondary)",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:13})," Add custom field"]})]})]})]})]})}function KAe(e,t){var r,n;return{question:e.text,imageUrl:(r=e.imageUrl)!=null&&r.trim()?e.imageUrl.trim():null,type:e.type==="Single Choice"||e.type==="True / False"?"single":e.type==="Multiple Choice"?"multiple":"text",options:(n=e.options)==null?void 0:n.map(o=>{var a;return{text:o.text,isCorrect:o.isCorrect,imageUrl:(a=o.imageUrl)!=null&&a.trim()?o.imageUrl.trim():null}}),required:!0,...t==="quiz"?{points:1}:{}}}function QAe(e){const t=e.activityStats;if(!t)return 0;const r=Math.min(t.questionCount*12,35),n=Math.min(t.participantCount*6,35),o=Math.min(t.responseCount*3,30);return Math.min(100,Math.round(r+n+o))}function Ry(e){if(typeof e.enableQnA=="boolean")return e.enableQnA;const t=e.qnaEnabled;return typeof t=="boolean"?t:!0}function Ly(e){return typeof e.enableQnP=="boolean"?e.enableQnP:!0}function Z4(e){const t=e.track;let r=null;t&&typeof t=="object"&&"_id"in t?r=String(t._id):typeof t=="string"&&t.trim()&&(r=t);const n=(e.speakers||[]).map(o=>typeof o=="string"?o:o._id);return{title:e.title,description:e.description??"",type:e.type,startTime:e.startTime,endTime:e.endTime,location:e.location,track:r,speakers:n,moderator:e.moderator??null,capacity:e.capacity,status:e.status,resources:e.resources,audienceFeedbackEnabled:e.audienceFeedbackEnabled,audienceRatingsEnabled:e.audienceRatingsEnabled,audienceFeedbackForm:e.audienceFeedbackForm??null,audienceRatingsForm:e.audienceRatingsForm??null,enableQnA:Ry(e),enableQnP:Ly(e)}}function XAe(){var L,z,V,Q;const{selectedEventId:e,setActiveNav:t}=eo(),n=qi()==="mobile",[o,a]=j.useState(null),[s,l]=j.useState(null),[c,u]=j.useState(!0),[d,f]=j.useState(null),[h,p]=j.useState("questions"),[y,m]=j.useState(!1),[x,b]=j.useState(!1),[w,k]=j.useState(null),S=j.useCallback(async()=>{var U;if(e){u(!0),f(null);try{const[ee,H]=await Promise.all([zr.get(e),Da.list(e)]);if(ee.error||!ee.data){f(ee.error||"Could not load activity."),a(null),l(null);return}const B=ee.data;a(B);const $=(((U=H.data)==null?void 0:U.sessions)??[])[0]??null;l($)}finally{u(!1)}}},[e]);j.useEffect(()=>{S()},[S]);const _=s?Ry(s):!0,P=s?Ly(s):!0,O=j.useMemo(()=>{const U=[];return _&&U.push({id:"questions",label:"Questions"}),P&&U.push({id:"quiz-polls",label:"Quiz & Polls"}),U.push({id:"participants",label:"Participants"},{id:"settings",label:"Settings"}),U},[_,P]);j.useEffect(()=>{var U;O.some(ee=>ee.id===h)||p(((U=O[0])==null?void 0:U.id)??"participants")},[O,h]),o&&QAe(o);const T=s?Ry(s):!0,R=s?Ly(s):!0;o!=null&&o.activitySubtype;const I=async()=>{if(!(!s||x)){b(!0);try{(await Da.update(s._id,{...Z4(s),enableQnA:!0,enableQnP:Ly(s)})).error||await S()}finally{b(!1)}}},E=j.useCallback(async()=>{if(!s||Ly(s))return;(await Da.update(s._id,{...Z4(s),enableQnP:!0,enableQnA:Ry(s)})).error||await S()},[s,S]),A=j.useMemo(()=>{var ee;if(!w||!o)return;const U=nT();return U.title=(ee=o.name)!=null&&ee.trim()?o.name.trim().slice(0,200):w==="quiz"?"New quiz":"New poll",{form:U,questions:[]}},[w,o]),F=async U=>{if(!e||!s||!w)return;const ee=w,H={session:s._id,title:U.form.title,type:ee,description:U.form.description||void 0,questions:U.questions.map($=>KAe($,ee)),settings:iT(U.form,ee)};if((await Oa.create(e,H)).error)return;k(null),(await Da.update(s._id,{...Z4(s),enableQnP:!0,enableQnA:Ry(s)})).error||await S()};return e?c&&!o?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading activity…"}):d||!o||!s?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"center",padding:40},children:[i.jsx("p",{style:{color:"#b91c1c",fontFamily:"var(--font-noto-sans)"},children:d||"This activity has no session yet."}),i.jsx("button",{type:"button",onClick:()=>t("activities"),style:{padding:"8px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Back to activities"})]}):o.recordKind&&o.recordKind!=="activity"?i.jsx("div",{style:{padding:24,fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"This view is for standalone activities. Use the main event dashboard for conference-style events."}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"16px",flexWrap:"wrap"},children:[i.jsx("div",{style:{flex:1,minWidth:0},children:i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:n?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:o.name})}),i.jsxs("button",{type:"button",disabled:!((L=s.joinCode)!=null&&L.trim()),title:(z=s.joinCode)!=null&&z.trim()?"QR code":"Join code not available yet",onClick:()=>m(!0),style:{display:"flex",alignItems:"center",gap:"6px",padding:n?"8px 12px":"6px 14px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:(V=s.joinCode)!=null&&V.trim()?"pointer":"not-allowed",flexShrink:0,opacity:(Q=s.joinCode)!=null&&Q.trim()?1:.55,transition:"all 0.15s"},onMouseEnter:U=>{var H;if(!((H=s.joinCode)!=null&&H.trim()))return;const ee=U.currentTarget;ee.style.background="var(--secondary)",ee.style.borderColor="var(--primary)",ee.style.color="var(--primary)"},onMouseLeave:U=>{var H;if(!((H=s.joinCode)!=null&&H.trim()))return;const ee=U.currentTarget;ee.style.background="var(--card)",ee.style.borderColor="var(--border)",ee.style.color="var(--card-foreground)"},children:[i.jsx(lv,{size:n?18:15,"aria-hidden":!0}),"Generate QR Code"]})]}),i.jsx("div",{style:{borderBottom:"1px solid var(--border)"},children:i.jsx("div",{style:{display:"flex",gap:n?"8px":"0",flexWrap:"wrap"},children:O.map(U=>i.jsx("button",{type:"button",onClick:()=>p(U.id),style:{padding:n?"10px 16px":"12px 24px",background:"none",border:"none",borderBottom:h===U.id?"2px solid var(--primary)":"2px solid transparent",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:h===U.id?"var(--font-weight-medium)":"var(--font-weight-normal)",color:h===U.id?"var(--primary)":"var(--card-foreground)",transition:"all 0.15s"},children:U.label},U.id))})}),i.jsxs("div",{style:{minHeight:"240px"},children:[h==="questions"&&_?i.jsx(gQ,{fixedSessionId:s._id,compactChrome:!0}):null,h==="quiz-polls"&&P?i.jsx(mQ,{fixedSessionId:s._id,compactChrome:!0,onQuizPollPersisted:E}):null,h==="participants"?i.jsx(kY,{compactChrome:!0}):null,h==="settings"?i.jsx("div",{style:{padding:"20px"},children:i.jsx(GAe,{event:o,session:s,selectedEventId:e,onSaved:S})}):null]}),!T||!R?i.jsxs("div",{style:{paddingTop:"16px",borderTop:"1px solid var(--border)"},children:[i.jsx("h2",{style:{fontSize:"var(--text-lg)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 8px"},children:"Next steps"}),T?null:i.jsxs("div",{style:{marginBottom:R?0:"24px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 16px",lineHeight:1.5},children:"Turn on Q&A to collect and moderate audience questions for this session. This will show the Questions tab."}),i.jsx("button",{type:"button",disabled:x,onClick:()=>void I(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"14px 32px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:x?"wait":"pointer",fontSize:"var(--text-base)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:x?.85:1},children:x?"Enabling…":"Enable Q&A"})]}),R?null:i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 16px",lineHeight:1.5},children:"Add a quiz or add a poll to engage your audience. Saving either one will enable the Quiz & Polls tab for this session."}),i.jsxs("div",{style:{display:"flex",gap:"16px",flexWrap:"wrap"},children:[i.jsx("button",{type:"button",onClick:()=>k("quiz"),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"14px 32px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-base)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",flex:n?"1 1 100%":"0 1 auto"},children:"Add a quiz"}),i.jsx("button",{type:"button",onClick:()=>k("poll"),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"14px 32px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-base)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",flex:n?"1 1 100%":"0 1 auto"},children:"Add a poll"})]})]})]}):null,w&&A?i.jsx(ax,{kind:w,initial:A,eventId:e,onClose:()=>k(null),onSave:U=>void F(U)},w):null,i.jsx(aT,{open:y,onClose:()=>m(!1),kind:"session",joinCode:s.joinCode??"",label:s.title||o.name})]}):i.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Select an activity from the list to view details."})}const w8=["Moderator","Presenter","Co-organiser","Viewer"];function vQ(e,t,r){return e||t?[e==null?void 0:e[0],t==null?void 0:t[0]].filter(Boolean).join("").toUpperCase().slice(0,2):r?r.slice(0,2).toUpperCase():"??"}const VB=["#f97316","#16a34a","#7c3aed","#0891b2","#be185d","#0d9488"];function i6(e){let t=0;for(let r=0;rt.sessions.map(r=>r.sessionId))}function S8({tracks:e,selected:t,onToggle:r,onSelectGroup:n,onSelectAll:o}){const a=j.useMemo(()=>LS(e),[e]),s=c=>{const u=c.filter(d=>t.has(d)).length;return u===0?!1:u===c.length?!0:"indeterminate"},l=s(a);return a.length===0?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"No tracks or sessions for this event. Add them in Agenda first."}):i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Session access"}),i.jsxs("div",{style:{display:"flex",gap:6},children:[i.jsxs("button",{type:"button",onClick:()=>o(!0),style:{display:"flex",alignItems:"center",gap:4,padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"var(--primary)",color:"#fff",fontSize:"var(--text-xs)",cursor:"pointer"},children:[i.jsx(Oi,{size:11})," Select all"]}),i.jsxs("button",{type:"button",onClick:()=>o(!1),style:{display:"flex",alignItems:"center",gap:4,padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",cursor:"pointer"},children:[i.jsx(Ow,{size:11})," Clear"]})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 0",marginBottom:10,borderBottom:"1px solid var(--border)"},children:[i.jsx(J4,{checked:l,onChange:()=>o(l!==!0)}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",fontWeight:600},children:[t.size," of ",a.length," sessions"]})]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:e.map((c,u)=>{const d=c.sessions.map(h=>h.sessionId),f=s(d);return i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px",background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:[i.jsx(J4,{checked:f,onChange:()=>n(d,f!==!0)}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontWeight:600,color:"var(--foreground)"},children:c.name||"Unassigned"}),i.jsxs("span",{style:{fontSize:11,color:"var(--muted)"},children:[d.filter(h=>t.has(h)).length,"/",d.length]})]}),c.sessions.map(h=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px 8px 38px",background:"var(--card)",borderBottom:"1px solid var(--border)"},children:[i.jsx(J4,{checked:t.has(h.sessionId),onChange:()=>r(h.sessionId)}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",color:"var(--card-foreground)"},children:h.title}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:h.startTime?new Date(h.startTime).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):""})]},h.sessionId))]},c.trackId??u)})})]})}function ZAe({eventId:e,onClose:t,onSuccess:r}){const[n,o]=j.useState("users"),[a,s]=j.useState([]),[l,c]=j.useState([]),[u,d]=j.useState(!0),[f,h]=j.useState(!1),[p,y]=j.useState(null),[m,x]=j.useState(new Set),[b,w]=j.useState("Viewer"),[k,S]=j.useState(new Set),_=j.useMemo(()=>LS(l),[l]);j.useEffect(()=>{let A=!1;return d(!0),Promise.all([za.listAvailableUsers(e),za.agendaTree(e)]).then(([F,L])=>{var z,V;A||(d(!1),(z=F.data)!=null&&z.users&&s(F.data.users),(V=L.data)!=null&&V.tracks&&c(L.data.tracks))}),()=>{A=!0}},[e]);const P=A=>{x(F=>{const L=new Set(F);return L.has(A)?L.delete(A):L.add(A),L})},O=A=>{S(F=>{const L=new Set(F);return L.has(A)?L.delete(A):L.add(A),L})},T=(A,F)=>{S(L=>{const z=new Set(L);return A.forEach(V=>F?z.add(V):z.delete(V)),z})},R=A=>S(A?new Set(_):new Set),I=m.size>0&&b,E=async()=>{y(null),h(!0);const A=await za.addStaff(e,{userIds:Array.from(m),sessionIds:Array.from(k),eventRole:b});if(h(!1),A.error){y(A.error);return}r(),t()};return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:24,backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:560,maxHeight:"88vh",display:"flex",flexDirection:"column",boxShadow:"var(--elevation-sm)"},children:[i.jsxs("div",{style:{padding:"20px 24px 16px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:600,color:"var(--foreground)",marginBottom:2},children:"Add users to event"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Select organisation members and their session access."})]}),i.jsx("button",{type:"button",onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:2},children:i.jsx(er,{size:16})})]}),i.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--border)",padding:"0 24px"},children:["users","sessions"].map((A,F)=>i.jsxs("button",{type:"button",onClick:()=>o(A),style:{padding:"10px 0",marginRight:24,background:"none",border:"none",borderBottom:`2px solid ${n===A?"var(--primary)":"transparent"}`,cursor:"pointer",fontSize:"var(--text-sm)",fontWeight:n===A?600:400,color:n===A?"var(--primary)":"var(--muted)"},children:[i.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:"50%",background:n===A?"var(--primary)":"var(--border)",color:"#fff",fontSize:10,marginRight:6},children:F+1}),A==="users"?"Users & role":"Session access"]},A))}),i.jsx("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px"},children:u?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading…"}):n==="users"?i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:8},children:"Event role (applies to all selected)"}),i.jsx("div",{style:{marginBottom:16},children:i.jsx("select",{value:b,onChange:A=>w(A.target.value),style:{width:"100%",maxWidth:200,height:36,padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-sm)"},children:w8.map(A=>i.jsx("option",{value:A,children:A},A))})}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:10},children:"Select users"}),a.length===0?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"No other users available; they may already be on this event."}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:a.map(A=>i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:10,background:"var(--secondary)",borderRadius:"var(--radius-button)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:m.has(A._id),onChange:()=>P(A._id)}),i.jsx(o6,{initials:vQ(A.firstName,A.lastName,A.email),color:i6(A.email),size:28}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontWeight:500},children:[A.firstName,A.lastName].filter(Boolean).join(" ")||A.email}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:A.email})]},A._id))})]}):i.jsx(S8,{tracks:l,selected:k,onToggle:O,onSelectGroup:T,onSelectAll:R})}),p&&i.jsx("div",{style:{padding:"8px 24px",background:"#fef2f2",color:"#b91c1c",fontSize:"var(--text-sm)"},children:p}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i.jsx("div",{children:n==="sessions"&&i.jsx("button",{type:"button",onClick:()=>o("users"),style:{background:"none",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"← Back"})}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",cursor:"pointer"},children:"Cancel"}),n==="users"?i.jsx("button",{type:"button",onClick:()=>o("sessions"),disabled:!I,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:I?"var(--primary)":"var(--border)",color:I?"var(--primary-foreground)":"var(--muted)",fontSize:"var(--text-sm)",fontWeight:600,cursor:I?"pointer":"not-allowed"},children:"Next: Session access →"}):i.jsx("button",{type:"button",onClick:E,disabled:f,style:{display:"flex",alignItems:"center",gap:6,padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontWeight:600,cursor:f?"wait":"pointer"},children:f?"Adding…":"Add to event"})]})]})]})})}function JAe({eventId:e,onClose:t,onSuccess:r}){const[n,o]=j.useState([{id:"r1",email:"",role:"Viewer"}]),[a,s]=j.useState("users"),[l,c]=j.useState([]),[u,d]=j.useState(new Set),[f,h]=j.useState(!1),[p,y]=j.useState(!1),[m,x]=j.useState(null),b=j.useMemo(()=>LS(l),[l]);j.useEffect(()=>{a==="sessions"&&(h(!0),za.agendaTree(e).then(E=>{var A;h(!1),(A=E.data)!=null&&A.tracks&&c(E.data.tracks)}))},[e,a]);const w=()=>o(E=>[...E,{id:`r${Date.now()}`,email:"",role:"Viewer"}]),k=E=>o(A=>A.filter(F=>F.id!==E)),S=(E,A,F)=>o(L=>L.map(z=>z.id===E?{...z,[A]:F}:z)),_=E=>d(A=>{const F=new Set(A);return F.has(E)?F.delete(E):F.add(E),F}),P=(E,A)=>d(F=>{const L=new Set(F);return E.forEach(z=>A?L.add(z):L.delete(z)),L}),O=E=>d(E?new Set(b):new Set),T=n.filter(E=>E.email.trim()&&E.role),R=T.length>0,I=async()=>{var A;x(null),y(!0);const E=await za.sendInvites(e,{invites:T.map(F=>({email:F.email.trim(),eventRole:F.role||"Viewer"})),sessionIds:Array.from(u)});y(!1),E.data&&x(E.data),!(E.error&&!E.data)&&E.data&&(E.data.sent>0||((A=E.data.errors)==null?void 0:A.length)===0)&&(r(),t())};return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:24,backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:680,maxHeight:"88vh",display:"flex",flexDirection:"column",boxShadow:"var(--elevation-sm)"},children:[i.jsxs("div",{style:{padding:"20px 24px 16px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:600,color:"var(--foreground)",marginBottom:2},children:"Invite by email"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"They will receive an email to join this event (and organisation if new)."})]}),i.jsx("button",{type:"button",onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:2},children:i.jsx(er,{size:16})})]}),i.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--border)",padding:"0 24px"},children:["users","sessions"].map((E,A)=>i.jsxs("button",{type:"button",onClick:()=>s(E),style:{padding:"10px 0",marginRight:24,background:"none",border:"none",borderBottom:`2px solid ${a===E?"var(--primary)":"transparent"}`,cursor:"pointer",fontSize:"var(--text-sm)",fontWeight:a===E?600:400,color:a===E?"var(--primary)":"var(--muted)"},children:[i.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:"50%",background:a===E?"var(--primary)":"var(--border)",color:"#fff",fontSize:10,marginRight:6},children:A+1}),E==="users"?"Emails & roles":"Session access"]},E))}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px"},children:[a==="users"&&i.jsxs("div",{children:[i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10,marginBottom:16},children:n.map(E=>i.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-start",background:"var(--secondary)",borderRadius:"var(--radius-card)",padding:14},children:[i.jsxs("div",{style:{flex:1},children:[i.jsxs("p",{style:{fontSize:"var(--text-xs)",marginBottom:5},children:["Email ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx("input",{type:"email",placeholder:"user@example.com",value:E.email,onChange:A=>S(E.id,"email",A.target.value),style:{width:"100%",height:36,padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{style:{width:160},children:[i.jsxs("p",{style:{fontSize:"var(--text-xs)",marginBottom:5},children:["Role ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx("select",{value:E.role,onChange:A=>S(E.id,"role",A.target.value),style:{width:"100%",height:36,padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-sm)"},children:w8.map(A=>i.jsx("option",{value:A,children:A},A))})]}),n.length>1&&i.jsx("button",{type:"button",onClick:()=>k(E.id),style:{width:36,height:36,marginTop:18,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(er,{size:12})})]},E.id))}),i.jsxs("button",{type:"button",onClick:w,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"transparent",color:"var(--primary)",fontSize:"var(--text-sm)",cursor:"pointer"},children:[i.jsx(z6,{size:13})," Add another"]})]}),a==="sessions"&&(f?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading sessions…"}):i.jsx(S8,{tracks:l,selected:u,onToggle:_,onSelectGroup:P,onSelectAll:O}))]}),(m==null?void 0:m.errors)&&m.errors.length>0&&i.jsx("div",{style:{padding:"8px 24px",background:"#fef2f2",color:"#b91c1c",fontSize:"var(--text-sm)"},children:m.errors.map((E,A)=>i.jsxs("div",{children:[E.email,": ",E.message]},A))}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i.jsx("div",{children:a==="sessions"&&i.jsx("button",{type:"button",onClick:()=>s("users"),style:{background:"none",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"← Back"})}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",cursor:"pointer"},children:"Cancel"}),a==="users"?i.jsx("button",{type:"button",onClick:()=>s("sessions"),disabled:!R,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:R?"var(--primary)":"var(--border)",color:R?"var(--primary-foreground)":"var(--muted)",fontSize:"var(--text-sm)",fontWeight:600,cursor:R?"pointer":"not-allowed"},children:"Next: Session access →"}):i.jsxs("button",{type:"button",onClick:I,disabled:p,style:{display:"flex",alignItems:"center",gap:6,padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontWeight:600,cursor:p?"wait":"pointer"},children:[i.jsx(kq,{size:13})," Send invitations"]})]})]})]})})}function e6e({eventId:e,member:t,onClose:r,onSuccess:n}){const[o,a]=j.useState([]),[s,l]=j.useState(!0),[c,u]=j.useState(!1),[d,f]=j.useState(new Set(t.sessionIds)),[h,p]=j.useState(t.eventRole||"Viewer"),y=j.useMemo(()=>LS(o),[o]);j.useEffect(()=>{za.agendaTree(e).then(k=>{var S;l(!1),(S=k.data)!=null&&S.tracks&&a(k.data.tracks)})},[e]);const m=k=>f(S=>{const _=new Set(S);return _.has(k)?_.delete(k):_.add(k),_}),x=(k,S)=>f(_=>{const P=new Set(_);return k.forEach(O=>S?P.add(O):P.delete(O)),P}),b=k=>f(k?new Set(y):new Set),w=async()=>{u(!0);const k=await za.updateStaff(e,t.userId,{sessionIds:Array.from(d),eventRole:h});u(!1),k.error||(n(),r())};return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:24,backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:520,maxHeight:"88vh",display:"flex",flexDirection:"column",boxShadow:"var(--elevation-sm)"},children:[i.jsxs("div",{style:{padding:"20px 24px 16px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:600,color:"var(--foreground)",marginBottom:2},children:"Edit access"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:[t.firstName,t.lastName].filter(Boolean).join(" ")||t.email})]}),i.jsx("button",{type:"button",onClick:r,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:2},children:i.jsx(er,{size:16})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px"},children:[i.jsxs("div",{style:{marginBottom:16},children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",display:"block",marginBottom:6},children:"Event role"}),i.jsx("select",{value:h,onChange:k=>p(k.target.value),style:{width:"100%",maxWidth:200,height:36,padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-sm)"},children:w8.map(k=>i.jsx("option",{value:k,children:k},k))})]}),s?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading sessions…"}):i.jsx(S8,{tracks:o,selected:d,onToggle:m,onSelectGroup:x,onSelectAll:b})]}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:8},children:[i.jsx("button",{type:"button",onClick:r,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",cursor:"pointer"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:w,disabled:c,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontWeight:600,cursor:c?"wait":"pointer"},children:c?"Saving…":"Save"})]})]})})}function t6e(){const{selectedEventId:e}=eo(),[t,r]=j.useState(null),[n,o]=j.useState([]),[a,s]=j.useState([]),[l,c]=j.useState(!0),[u,d]=j.useState(!1),[f,h]=j.useState(""),[p,y]=j.useState(null),[m,x]=j.useState(!1),[b,w]=j.useState(!1),[k,S]=j.useState(!1),[_,P]=j.useState(null),O=async()=>{var z;if(!e){c(!1),o([]),s([]),r(null);return}c(!0),d(!1);const[F,L]=await Promise.all([zr.get(e),za.listStaff(e)]);if(c(!1),(z=F.data)!=null&&z.name&&r(F.data.name),L.error){L.status===403&&d(!0);return}L.data&&(o(L.data.members??[]),s(L.data.invites??[]))};j.useEffect(()=>{O()},[e]);const T=j.useMemo(()=>{if(!f.trim())return n;const F=f.toLowerCase();return n.filter(L=>L.email.toLowerCase().includes(F)||[L.firstName,L.lastName].filter(Boolean).join(" ").toLowerCase().includes(F))},[n,f]),R=j.useMemo(()=>f.trim()?a.filter(F=>F.email.toLowerCase().includes(f.toLowerCase())):a,[a,f]),I=async F=>{if(!e||!confirm("Remove this user from the event?"))return;(await za.removeStaff(e,F)).error||O()},E=async F=>{e&&(await za.resendInvite(e,F),O())},A=async F=>{if(!e||!confirm("Cancel this invitation?"))return;(await za.cancelInvite(e,F)).error||O()};return e?u?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,alignItems:"center",justifyContent:"center",minHeight:280},children:[i.jsx(id,{size:40,style:{color:"var(--destructive)"}}),i.jsx("p",{style:{fontSize:"var(--text-base)",color:"var(--muted)"},children:"You don’t have permission to manage this event’s team."})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:16},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:4},children:t??"Event"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:600,color:"var(--foreground)",lineHeight:1.2,marginBottom:6},children:"Users & Permissions"}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:[n.length," member",n.length!==1?"s":""," · ",a.length," pending invite",a.length!==1?"s":""]})]}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsxs("button",{type:"button",onClick:()=>w(!0),style:{display:"flex",alignItems:"center",gap:6,padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"transparent",color:"var(--primary)",fontSize:"var(--text-sm)",fontWeight:600,cursor:"pointer"},children:[i.jsx(vi,{size:14})," Add users"]}),i.jsxs("button",{type:"button",onClick:()=>S(!0),style:{display:"flex",alignItems:"center",gap:6,padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontWeight:600},children:[i.jsx(z6,{size:14})," Invite by email"]})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,height:38,padding:"0 12px",background:"var(--card)",border:`1px solid ${m?"var(--ring)":"var(--border)"}`,borderRadius:"var(--radius-button)",maxWidth:380},children:[i.jsx(Pi,{size:14,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:f,onChange:F=>h(F.target.value),placeholder:"Search by name or email…",onFocus:()=>x(!0),onBlur:()=>x(!1),style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"}}),f&&i.jsx("button",{type:"button",onClick:()=>h(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0},children:i.jsx(er,{size:12})})]}),i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"minmax(160px,1fr) minmax(200px,1.5fr) 110px 160px",padding:"9px 20px",background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:["User","Email","Access",""].map(F=>i.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-noto-sans)",fontWeight:600,color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:F},F))}),l?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading…"}):T.length===0&&R.length===0?i.jsxs("div",{style:{padding:"48px 20px",textAlign:"center"},children:[i.jsx(id,{size:28,style:{color:"var(--border)",margin:"0 auto 10px"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"No users or invites match your search."})]}):i.jsxs(i.Fragment,{children:[T.map(F=>i.jsxs("div",{onMouseEnter:()=>y(F.userId),onMouseLeave:()=>y(null),style:{display:"grid",gridTemplateColumns:"minmax(160px,1fr) minmax(200px,1.5fr) 110px 160px",alignItems:"center",padding:"13px 20px",borderBottom:"1px solid var(--border)",background:p===F.userId?"var(--secondary)":"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx(o6,{initials:vQ(F.firstName,F.lastName,F.email),color:i6(F.email)}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500,color:"var(--foreground)"},children:[F.firstName,F.lastName].filter(Boolean).join(" ")||F.email})]}),i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:F.email}),i.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:999,width:"fit-content",background:"#e0e7ff",color:"#3730a3",fontSize:11,fontWeight:600},children:F.eventRole||"Viewer"}),i.jsxs("div",{style:{display:"flex",gap:6,opacity:p===F.userId?1:0},children:[i.jsxs("button",{type:"button",onClick:()=>P(F),style:{display:"flex",alignItems:"center",gap:4,padding:"5px 11px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",cursor:"pointer"},children:[i.jsx(Ii,{size:12})," Edit"]}),i.jsx("button",{type:"button",onClick:()=>I(F.userId),style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(gn,{size:12})})]})]},F.userId)),R.map(F=>i.jsxs("div",{onMouseEnter:()=>y(`inv-${F.id}`),onMouseLeave:()=>y(null),style:{display:"grid",gridTemplateColumns:"minmax(160px,1fr) minmax(200px,1.5fr) 110px 160px",alignItems:"center",padding:"13px 20px",borderBottom:"1px solid var(--border)",background:p===`inv-${F.id}`?"var(--secondary)":"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx(o6,{initials:F.email.slice(0,2).toUpperCase(),color:i6(F.email)}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500,color:"var(--foreground)"},children:F.email})]}),i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Pending invite"}),i.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:999,width:"fit-content",background:"#fef9c3",color:"#92400e",fontSize:11,fontWeight:600},children:F.eventRole}),i.jsxs("div",{style:{display:"flex",gap:6,opacity:p===`inv-${F.id}`?1:0},children:[i.jsxs("button",{type:"button",onClick:()=>E(F.id),style:{display:"flex",alignItems:"center",gap:4,padding:"5px 11px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",cursor:"pointer"},children:[i.jsx(kq,{size:12})," Resend"]}),i.jsx("button",{type:"button",onClick:()=>A(F.id),style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(gn,{size:12})})]})]},F.id))]})]}),b&&e&&i.jsx(ZAe,{eventId:e,onClose:()=>w(!1),onSuccess:O}),k&&e&&i.jsx(JAe,{eventId:e,onClose:()=>S(!1),onSuccess:O}),_&&e&&i.jsx(e6e,{eventId:e,member:_,onClose:()=>P(null),onSuccess:O})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,alignItems:"center",justifyContent:"center",minHeight:280},children:[i.jsx(id,{size:40,style:{color:"var(--border)"}}),i.jsx("p",{style:{fontSize:"var(--text-base)",color:"var(--muted)"},children:"Select an event to manage users and permissions."})]})}const e3=[{key:"registrationComplete",label:"Registration complete",hint:"Awarded once when someone joins the event"},{key:"questionAsk",label:"Ask a question",hint:"Per question (signed-in attendee)"},{key:"questionUpvote",label:"Upvote a question",hint:"Per upvote state change"},{key:"questionDownvote",label:"Downvote a question",hint:"Per downvote state change"},{key:"quizPollSubmitted",label:"Quiz submitted",hint:"When a visitor completes a quiz"},{key:"quizCorrectPerQuestion",label:"Correct quiz answer",hint:"Loyalty per correct objective question"},{key:"pollParticipation",label:"Poll / survey participation",hint:"When a visitor submits a poll or survey"},{key:"feedbackFormSubmitted",label:"Feedback form (reserved)",hint:"Wire when visitor feedback API exists"},{key:"ratingSubmitted",label:"Rating (reserved)",hint:"Wire when visitor rating API exists"}];function oh(e){const t=[e.firstName,e.lastName].filter(Boolean).join(" ").trim();return t||(e.email?e.email:"Participant")}function r6e(e,t){return{name:e.name,type:e.type,status:e.status,startDate:e.startDate,endDate:e.endDate,subtitle:e.subtitle??null,description:e.description??null,category:e.category??null,location:e.location??null,locationType:e.locationType??void 0,virtualLink:e.virtualLink??null,tags:e.tags,image:e.image??null,bannerImage:e.bannerImage??null,settings:e.settings,metadata:e.metadata,rewardRules:t}}function n6e({top3:e}){const[t,r,n]=[e[0],e[1],e[2]],o=[r,t,n],a=[72,100,56],s=["🥈","🥇","🥉"],l=["#475569","#92400e","#c2410c"],c=["#f1f5f9","#fef3c7","#ffedd5"];return!t&&!r&&!n?i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"24px 20px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:"No leaderboard entries yet. Configure point rules and let attendees earn points."}):i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"24px 20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"24px"},children:[i.jsx(od,{size:15,style:{color:"#d97706"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Top performers"})]}),i.jsx("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"center",gap:"8px",height:"200px"},children:o.map((u,d)=>u?i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flex:1,maxWidth:"180px"},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px",flex:1,justifyContent:"flex-end"},children:[i.jsx("span",{style:{fontSize:"20px",marginBottom:"4px"},children:s[d]}),i.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:d===1?"var(--primary)":"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid var(--border)",marginBottom:"5px"},children:i.jsx("span",{style:{fontSize:"11px",fontFamily:"var(--font-inter)",fontWeight:"600",color:d===1?"#fff":"var(--foreground)"},children:oh(u).slice(0,2).toUpperCase()})}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",textAlign:"center",lineHeight:"1.3",maxWidth:"120px"},children:oh(u)}),i.jsxs("p",{style:{display:"inline-flex",marginTop:"4px",padding:"2px 8px",borderRadius:"999px",background:c[d],color:l[d],fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:[u.total," pts"]})]}),i.jsx("div",{style:{width:"100%",height:a[d],background:d===1?"var(--accent)":"var(--secondary)",borderRadius:"4px 4px 0 0",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--border)",borderBottom:"none"},children:i.jsxs("span",{style:{fontSize:"var(--text-base)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:d===1?"var(--primary)":"var(--muted)"},children:["#",d===0?2:d===1?1:3]})})]},u.participantId+d):i.jsx("div",{style:{flex:1,maxWidth:"180px"}},`empty-${d}`))}),i.jsx("div",{style:{height:"4px",background:"var(--border)",borderRadius:"0 0 4px 4px"}})]})}function i6e({initialRules:e,onClose:t,onSave:r,saving:n}){const[o,a]=j.useState(()=>{const c={};for(const{key:u}of e3){const d=e[u];c[u]=d!=null&&d!==""?String(d):""}return c}),s=(c,u)=>a(d=>({...d,[c]:u})),l=()=>{const c={};for(const{key:u}of e3){const d=String(o[u]??"").trim();if(d==="")continue;const f=Number(d);Number.isFinite(f)&&f>=0&&(c[u]=f)}r(c)};return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.25)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:"520px",boxShadow:"var(--elevation-sm)",display:"flex",flexDirection:"column",maxHeight:"90vh"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 22px",borderBottom:"1px solid var(--border)"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"2px"},children:"Reward rules"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Set to 0 or leave blank to disable. Session and quiz settings can override later."})]}),i.jsx("button",{type:"button",onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",marginLeft:"12px"},children:i.jsx(er,{size:16})})]}),i.jsx("div",{style:{padding:"20px 22px",display:"flex",flexDirection:"column",gap:"12px",overflowY:"auto"},children:e3.map(c=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[i.jsxs("div",{style:{flex:1},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",marginBottom:"1px"},children:c.label}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:c.hint})]}),i.jsxs("div",{style:{display:"flex",alignItems:"stretch",flexShrink:0},children:[i.jsx("input",{type:"number",min:0,max:1e4,value:o[c.key]??"",onChange:u=>s(c.key,u.target.value),style:{width:"68px",height:"34px",padding:"0 8px",borderRadius:"var(--radius-button) 0 0 var(--radius-button)",border:"1px solid var(--border)",borderRight:"none",background:"var(--card)",fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",color:"var(--foreground)",outline:"none",textAlign:"center"}}),i.jsx("div",{style:{padding:"0 10px",height:"34px",display:"flex",alignItems:"center",background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"0 var(--radius-button) var(--radius-button) 0"},children:i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",whiteSpace:"nowrap"},children:"pts"})})]})]},c.key))}),i.jsxs("div",{style:{padding:"14px 22px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Cancel"}),i.jsxs("button",{type:"button",disabled:n,onClick:l,style:{display:"flex",alignItems:"center",gap:"5px",padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:n?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:n?.75:1},children:[i.jsx(Nw,{size:13})," Save"]})]})]})})}function o6e({row:e,onClose:t,onSubmit:r,loading:n}){const[o,a]=j.useState(5),[s,l]=j.useState("");return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.25)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:"380px",boxShadow:"var(--elevation-sm)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Add points"}),i.jsx("button",{type:"button",onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex"},children:i.jsx(er,{size:15})})]}),i.jsxs("div",{style:{padding:"18px 20px",display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs("div",{style:{background:"var(--secondary)",borderRadius:"var(--radius-button)",padding:"10px 14px",display:"flex",alignItems:"center",gap:"10px"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("span",{style:{color:"#fff",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"600"},children:oh(e).slice(0,2).toUpperCase()})}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:oh(e)}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Net ",e.total," pts"]})]})]}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",marginBottom:"5px"},children:"Points to add"}),i.jsx("input",{type:"number",min:1,value:o,onChange:c=>a(Number(c.target.value)),style:{width:"100%",height:"36px",padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)",outline:"none",boxSizing:"border-box"}})]}),i.jsxs("div",{children:[i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",marginBottom:"5px"},children:["Reason ",i.jsx("span",{style:{color:"var(--muted)"},children:"(optional)"})]}),i.jsx("input",{type:"text",value:s,onChange:c=>l(c.target.value),placeholder:"e.g. Best question award",style:{width:"100%",height:"36px",padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)",outline:"none",boxSizing:"border-box"}})]})]}),i.jsxs("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Cancel"}),i.jsxs("button",{type:"button",disabled:n,onClick:()=>r(o,s.trim()),style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:n?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:13})," Add ",o," pts"]})]})]})})}function a6e({eventId:e}){var L;const[t,r]=j.useState(!1),[n,o]=j.useState(null),[a,s]=j.useState(null),[l,c]=j.useState([]),[u,d]=j.useState(null),[f,h]=j.useState(!1),[p,y]=j.useState(!1),[m,x]=j.useState(!1),[b,w]=j.useState(""),[k,S]=j.useState(!1),[_,P]=j.useState(null),O=j.useCallback(async()=>{var z;if(!e){s(null),c([]);return}h(!0),d(null);try{const[V,Q]=await Promise.all([zr.get(e),ZO.leaderboard(e,200)]);if(V.error){d(V.error),s(null),c([]);return}s(V.data??null);const U=((z=Q.data)==null?void 0:z.leaderboard)??[];if(Q.error){d(Q.error),c([]);return}c(U)}finally{h(!1)}},[e]);j.useEffect(()=>{O()},[O]);const T=j.useMemo(()=>{const z=b.trim().toLowerCase();return z?l.filter(V=>{const Q=oh(V).toLowerCase(),U=(V.email||"").toLowerCase();return Q.includes(z)||U.includes(z)}):l},[l,b]),R=T.slice(0,3),I=Math.max(((L=T[0])==null?void 0:L.total)??1,1),E=()=>{const z=[["rank","name","email","net_points"].join(",")];T.forEach((ee,H)=>{const B=oh(ee).replace(/"/g,'""'),M=(ee.email||"").replace(/"/g,'""');z.push(`${H+1},"${B}","${M}",${ee.total}`)});const V=new Blob([z.join(` -`)],{type:"text/csv"}),Q=URL.createObjectURL(V),U=document.createElement("a");U.href=Q,U.download=`reward-leaderboard-${e||"event"}.csv`,U.click(),URL.revokeObjectURL(Q)},A=async z=>{if(!(!e||!a)){y(!0);try{const V=r6e(a,z);(await zr.update(e,V)).error||(r(!1),await O())}finally{y(!1)}}},F=async(z,V)=>{if(!(!e||!n)){x(!0);try{await ZO.create(e,{participant:n.participantId,points:Math.max(1,Math.floor(z)),type:"earned",source:"manual",description:V||void 0}),o(null),await O()}finally{x(!1)}}};return e?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:f?"Loading…":(a==null?void 0:a.name)??"Event"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"Reward points"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:u?i.jsx("span",{style:{color:"var(--destructive)"},children:u}):`${l.length} on leaderboard · Net score (earned − redeemed)`})]}),i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[i.jsxs("button",{type:"button",onClick:E,disabled:!T.length,style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--card-foreground)",border:"1px solid var(--border)",cursor:T.length?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",opacity:T.length?1:.5},children:[i.jsx(Al,{size:13})," Export CSV"]}),i.jsx("button",{type:"button",onClick:()=>r(!0),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"34px",height:"34px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--muted)",border:"1px solid var(--border)",cursor:"pointer"},children:i.jsx(Pl,{size:14})})]})]}),i.jsx(n6e,{top3:R}),i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",borderBottom:"1px solid var(--border)",background:"var(--secondary)"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Rankings"}),i.jsx("div",{style:{flex:1}}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",height:"28px",padding:"0 10px",background:"var(--card)",border:`1px solid ${k?"var(--ring)":"var(--border)"}`,borderRadius:"var(--radius-button)",width:"200px"},children:[i.jsx(Pi,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:b,onChange:z=>w(z.target.value),placeholder:"Search…",onFocus:()=>S(!0),onBlur:()=>S(!1),style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"}}),b&&i.jsx("button",{type:"button",onClick:()=>w(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0},children:i.jsx(er,{size:10})})]})]}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"56px 1fr 1.6fr 80px 120px",padding:"8px 16px",background:"var(--card)",borderBottom:"1px solid var(--border)"},children:["Rank","Name","Email","Points",""].map(z=>i.jsx("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.04em"},children:z},z))}),!T.length&&!f?i.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--muted)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:"No participants with positive net points yet."}):T.map((z,V)=>{const Q=V+1,U=Q<=3,ee=z.total/I;return i.jsxs("div",{onMouseEnter:()=>P(V),onMouseLeave:()=>P(null),style:{display:"grid",gridTemplateColumns:"56px 1fr 1.6fr 80px 120px",alignItems:"center",padding:"10px 16px",borderBottom:"1px solid var(--border)",background:_===V?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsx("div",{children:Q===1?i.jsx("span",{style:{fontSize:"16px"},children:"🥇"}):Q===2?i.jsx("span",{style:{fontSize:"16px"},children:"🥈"}):Q===3?i.jsx("span",{style:{fontSize:"16px"},children:"🥉"}):i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["#",Q]})}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:U?"var(--font-weight-medium)":"var(--font-weight-normal)",color:"var(--foreground)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oh(z)}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:z.email??"—"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:z.total}),i.jsx("div",{style:{flex:1,height:"3px",background:"var(--border)",borderRadius:"999px",overflow:"hidden"},children:i.jsx("div",{style:{width:`${Math.round(ee*100)}%`,height:"100%",background:"var(--primary)",opacity:.5,borderRadius:"999px"}})})]}),i.jsx("div",{style:{opacity:_===V?1:0,transition:"opacity 0.15s"},children:i.jsxs("button",{type:"button",onClick:()=>o(z),style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",whiteSpace:"nowrap"},children:[i.jsx(wr,{size:11})," Add points"]})})]},z.participantId)})]}),t&&a&&i.jsx(i6e,{initialRules:a.rewardRules||{},onClose:()=>r(!1),onSave:A,saving:p}),n&&i.jsx(o6e,{row:n,onClose:()=>o(null),onSubmit:F,loading:m})]}):i.jsx("div",{style:{padding:"24px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Select an event to manage reward points and the leaderboard."})}function yQ(e){const t=e.cu??"INR",r=e.pa.trim(),n=e.pn.trim().slice(0,99),o=e.am.trim();return!r||!n||!o?"":`upi://pay?pa=${encodeURIComponent(r)}&pn=${encodeURIComponent(n)}&am=${encodeURIComponent(o)}&cu=${encodeURIComponent(t)}`}const Go={fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)",textTransform:"uppercase",letterSpacing:"0.06em"};function s6e(e,t){return`${t} ${(e/100).toFixed(2)}`}const YB="__eb_payment_cancelled__";function l6e(){var De,tt;const{user:e}=Ur(),{selectedEventId:t}=eo(),r=zn(e),[n,o]=j.useState([]),[a,s]=j.useState(!0),[l,c]=j.useState(null),[u,d]=j.useState([]),[f,h]=j.useState([]),[p,y]=j.useState(!1),[m,x]=j.useState(null),[b,w]=j.useState(!1),[k,S]=j.useState(""),[_,P]=j.useState(""),[O,T]=j.useState([""]),[R,I]=j.useState(""),[E,A]=j.useState("INR"),[F,L]=j.useState(0),[z,V]=j.useState(""),[Q,U]=j.useState(""),[ee,H]=j.useState(""),[B,M]=j.useState([]),[$,q]=j.useState(null),[Y,K]=j.useState(!1),[G,re]=j.useState(null),[J,ae]=j.useState(!1),[le,me]=j.useState(!1),[Oe,we]=j.useState(""),[ie,Me]=j.useState("upload"),[ke,se]=j.useState(""),[fe,Ie]=j.useState(""),[ce,je]=j.useState(""),[qe,Ne]=j.useState(""),[Je,vt]=j.useState(""),[Ge,Ot]=j.useState([]),[nt,Ae]=j.useState(!1),[Te,wt]=j.useState(!1),ft=(e==null?void 0:e.role)==="super_admin"||(e==null?void 0:e.role)==="admin",Pt=typeof window<"u"&&t?`${window.location.origin}/event/${t}/tickets`:"",At=j.useCallback(async()=>{var Le;if(!t||!r){o([]),s(!1);return}s(!0),c(null);try{const[Ke,Fe,Ve]=await Promise.all([m1.list(t),Fa.list({organization:r}),Ma.listForEvent(t)]);if(o(Ke),Fe.error)throw new Error(Fe.error);d((((Le=Fe.data)==null?void 0:Le.lists)??[]).filter(xt=>xt.type==="fixed")),h(Ve)}catch(Ke){c(Ke instanceof Error?Ke.message:"Failed to load"),o([])}finally{s(!1)}},[t,r]);j.useEffect(()=>{At()},[At]);const Ht=j.useCallback(async()=>{var Le,Ke;if(!t){q(null);return}K(!0),re(null);try{const[Fe,Ve]=await Promise.all([Pj.get(t),zr.get(t)]);we(((Ke=(Le=Ve.data)==null?void 0:Le.name)==null?void 0:Ke.trim())||""),q(Fe),me(Fe.enabled),Me(Fe.manualQrMode==="dynamic"?"dynamic":"upload"),Ie(Fe.upiQrImageUrl||""),je(Fe.upiId||""),Ne(Fe.payeeName||""),vt(Fe.instructions||"");const xt=await v1.list(t,"pending_review");Ot(xt)}catch(Fe){re(Fe instanceof Error?Fe.message:"Failed to load UPI settings"),q(null)}finally{K(!1)}},[t]);j.useEffect(()=>{Ht()},[Ht]),j.useEffect(()=>{var Tt,Mt;if(ie!=="dynamic"||!ce.trim()||!Oe.trim()){se("");return}const Ke=`${((Tt=n[0])==null?void 0:Tt.name)||"Sample ticket"} · ${Oe}`.slice(0,99),Ve=((((Mt=n[0])==null?void 0:Mt.basePriceMinor)??1e4)/100).toFixed(2),xt=yQ({pa:ce.trim(),pn:Ke,am:Ve});if(!xt){se("");return}let dt=!1;return Mw.toDataURL(xt,{margin:1,width:220,errorCorrectionLevel:"M"}).then(fr=>{dt||se(fr)}),()=>{dt=!0}},[ie,ce,Oe,n]);const Se=async()=>{if(t){Ae(!0);try{Ot(await v1.list(t,"pending_review"))}catch{}finally{Ae(!1)}}},ct=async()=>{if(t){ae(!0);try{const Le={enabled:le,manualQrMode:ie,upiQrImageUrl:fe.trim(),upiId:ce.trim(),payeeName:qe.trim(),instructions:Je,platformFeeInr:null},Ke=await Pj.patch(t,Le);q(Ke),me(Ke.enabled),Me(Ke.manualQrMode==="dynamic"?"dynamic":"upload"),Ie(Ke.upiQrImageUrl||""),await Se()}catch(Le){window.alert(Le instanceof Error?Le.message:"Save failed")}finally{ae(!1)}}},gt=async()=>{if(!(!t||!ft)){wt(!0);try{await P6();const Le=await Pj.checkoutEnablementOrder(t),Ke=window.Razorpay;await new Promise((Fe,Ve)=>{let xt=!1;const dt=new Ke({key:Le.keyId,amount:Le.amount,currency:Le.currency,order_id:Le.orderId,name:"EventBuzz",description:"Manual UPI ticketing — enablement fee",handler:Tt=>{xt=!0,Ku.checkoutVerify({orderId:Tt.razorpay_order_id,paymentId:Tt.razorpay_payment_id,signature:Tt.razorpay_signature}).then(()=>Fe()).catch(Mt=>Ve(Mt instanceof Error?Mt:new Error("Verification failed")))},modal:{ondismiss:()=>{xt||Ve(new Error(YB))}},theme:{color:"#0B4DD1"},prefill:e!=null&&e.email?{email:e.email}:void 0});dt.on("payment.failed",Tt=>{var Mt;Ve(new Error(((Mt=Tt.error)==null?void 0:Mt.description)||"Payment failed"))}),dt.open()}),await Ht()}catch(Le){const Ke=Le instanceof Error?Le.message:"Payment failed";Ke!==YB&&window.alert(Ke)}finally{wt(!1)}}},We=async Le=>{var Ke;if(!(!Le||!t||!r))try{const Ve=(Ke=(await Ys(Le,{eventId:t,module:"ticketing-upi-qr"})).url)==null?void 0:Ke.trim();Ve&&Ie(Ve)}catch(Fe){window.alert(Fe instanceof Error?Fe.message:"Upload failed")}},Pe=()=>{var Le;x(null),S(""),P(""),T([""]),I(""),A("INR"),L(0),V(""),U(((Le=u[0])==null?void 0:Le._id)||""),H(""),M([]),y(!0)},rt=Le=>{var Ke,Fe;x(Le),S(Le.name),P(Le.description||""),T((Ke=Le.keyPoints)!=null&&Ke.length?Le.keyPoints:[""]),I(String((Le.basePriceMinor||0)/100)),A(Le.currency||"INR"),L(Le.sortOrder??0),V(Le.maxPerOrder!=null?String(Le.maxPerOrder):""),U(Le.participantList),H(Le.registrationForm||""),M((Fe=Le.taxItems)!=null&&Fe.length?[...Le.taxItems]:[]),y(!0)},Ze=async()=>{if(!t||!Q)return;const Le=parseFloat(R);if(!Number.isFinite(Le)||Le<0){window.alert("Enter a valid price.");return}const Ke=Math.round(Le*100),Fe={name:k.trim(),description:_.trim(),keyPoints:O.map(Ve=>Ve.trim()).filter(Boolean),basePriceMinor:Ke,currency:E,sortOrder:F,maxPerOrder:z.trim()?parseInt(z,10):null,taxItems:B,participantList:Q,registrationForm:ee.trim()||null,isActive:!0};w(!0);try{m?await m1.update(t,m._id,Fe):await m1.create(t,Fe),y(!1),await At()}catch(Ve){window.alert(Ve instanceof Error?Ve.message:"Save failed")}finally{w(!1)}},pe=async Le=>{if(t&&window.confirm(`Deactivate “${Le.name}”? It will no longer appear on the public checkout page.`))try{await m1.remove(t,Le._id),await At()}catch(Ke){window.alert(Ke instanceof Error?Ke.message:"Failed")}},xe=()=>{Pt&&navigator.clipboard.writeText(Pt).then(()=>window.alert("Checkout link copied."),()=>window.alert(Pt))};return t?r?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsx("p",{style:Go,children:"Event"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Ticketing"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",marginTop:"6px",maxWidth:"560px"},children:"Sell tickets on the public checkout page. Buyers are added to the participant list you choose. Online card/UPI uses your Razorpay (or platform) gateway when configured; if not, you can enable per-event UPI QR and review payment screenshots below."})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-end"},children:[i.jsxs("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:xe,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(iu,{size:14})," Copy checkout link"]}),i.jsxs("a",{href:Pt||"#",target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",color:"var(--primary)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",textDecoration:"none"},children:[i.jsx(av,{size:14})," Open checkout"]}),i.jsxs("button",{type:"button",onClick:Pe,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:14})," Add ticket"]})]}),Pt&&i.jsx("code",{style:{fontSize:"11px",color:"var(--muted)",maxWidth:"420px",wordBreak:"break-all",textAlign:"right"},children:Pt})]})]}),l&&i.jsx("p",{style:{color:"var(--destructive)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:l}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 360px), 1fr))",gap:"24px",alignItems:"start"},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px",minWidth:0},children:[a&&i.jsx("p",{style:{color:"var(--muted)"},children:"Loading…"}),!a&&n.length===0&&!l&&i.jsx("div",{style:{padding:"40px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)",textAlign:"center",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"No tickets yet. Add a ticket to publish it on the public checkout page."}),i.jsx("div",{style:{display:"grid",gap:"12px"},children:n.map(Le=>{var Ke;return i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"16px",background:"var(--card)",display:"flex",justifyContent:"space-between",gap:"12px",flexWrap:"wrap",opacity:Le.isActive?1:.65},children:[i.jsxs("div",{children:[i.jsxs("p",{style:{fontWeight:"var(--font-weight-medium)",fontFamily:"var(--font-inter)",marginBottom:"4px"},children:[Le.name," ",!Le.isActive&&i.jsx("span",{style:{fontSize:"11px",color:"var(--muted)"},children:"(inactive)"})]}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"8px"},children:[s6e(Le.basePriceMinor,Le.currency),(Ke=Le.taxItems)!=null&&Ke.length?` · ${Le.taxItems.length} tax row(s)`:""]}),Le.description&&i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",maxWidth:"640px"},children:Le.description})]}),i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start"},children:[i.jsxs("button",{type:"button",onClick:()=>rt(Le),style:{padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"var(--text-xs)"},children:[i.jsx(Ii,{size:14})," Edit"]}),Le.isActive&&i.jsxs("button",{type:"button",onClick:()=>void pe(Le),style:{padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--destructive)",color:"var(--destructive)",background:"transparent",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"var(--text-xs)"},children:[i.jsx(gn,{size:14})," Deactivate"]})]})]},Le._id)})})]}),i.jsx("aside",{style:{minWidth:0},children:i.jsxs("section",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"16px",background:"var(--card)",position:"sticky",top:16},children:[i.jsx("h2",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",margin:"0 0 8px"},children:"UPI / manual checkout"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",margin:"0 0 12px"},children:"For events without an online payment gateway. Buyers pay you directly, then upload proof for you to approve."}),G&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)"},children:G}),Y&&i.jsx("p",{style:{color:"var(--muted)"},children:"Loading UPI settings…"}),!Y&&$&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[$.enablementPaid?i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:["Enablement fee paid",$.enablementPaidAt?` · ${new Date($.enablementPaidAt).toLocaleString()}`:"",". You can configure and enable manual checkout below."]}):i.jsxs("div",{style:{padding:"12px",borderRadius:"8px",border:"1px solid var(--border)",background:"var(--muted-background, rgba(0,0,0,0.04))"},children:[i.jsxs("p",{style:{fontSize:"var(--text-sm)",margin:"0 0 10px",color:"var(--foreground)"},children:["Pay a one-time ",i.jsxs("strong",{children:["INR ",((tt=(De=$.enablementFeeInr)==null?void 0:De.toFixed)==null?void 0:tt.call(De,0))??$.enablementFeeInr]})," ","enablement fee per event to turn on manual UPI checkout. The receipt is listed under"," ",i.jsx("strong",{children:"Settings → Billing"})," with your other invoices."]}),ft?i.jsx("button",{type:"button",disabled:Te,onClick:()=>void gt(),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:Te?"wait":"pointer",fontSize:"var(--text-sm)"},children:Te?"Processing…":"Pay enablement fee"}):i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Only organisation administrators can complete this payment."})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"checkbox",checked:le,disabled:!$.enablementPaid&&!le,onChange:Le=>me(Le.target.checked)}),"Enable UPI / manual checkout for this event"]}),!$.enablementPaid&&!le?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Complete payment above before you can enable this option."}):null,le&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{background:"#fffbeb",border:"1px solid #fcd34d",borderRadius:"8px",padding:"12px",fontSize:"var(--text-sm)",color:"#92400e",lineHeight:1.45},children:[i.jsx("strong",{children:"Manual verification required."})," EventBuzz does not confirm money movement on UPI. You must check each payment in your bank or UPI app, match it to the buyer’s screenshot, then approve or reject the ticket in the queue below. Unmatched or fraudulent payments should be rejected."]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[i.jsx("span",{style:Go,children:"QR code"}),i.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"8px",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"radio",name:"eb-manual-qr-mode",checked:ie==="upload",onChange:()=>Me("upload"),style:{marginTop:3}}),i.jsx("span",{children:"Upload a static QR image (or image URL)"})]}),i.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"8px",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"radio",name:"eb-manual-qr-mode",checked:ie==="dynamic",onChange:()=>Me("dynamic"),style:{marginTop:3}}),i.jsxs("span",{children:["Generate QR from UPI ID: payee name is ",i.jsx("em",{children:"ticket name · event name"}),"; amount is the buyer’s order total at checkout."]})]})]}),ie==="upload"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Go,children:"UPI QR image"}),i.jsx("input",{type:"file",accept:"image/*",onChange:Le=>{var Ke;return void We(((Ke=Le.target.files)==null?void 0:Ke[0])??null)}}),fe?i.jsx("img",{src:fe,alt:"QR",style:{maxWidth:200,borderRadius:8,border:"1px solid var(--border)"}}):null,i.jsx("input",{value:fe,onChange:Le=>Ie(Le.target.value),placeholder:"Or paste image URL",style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Go,children:"UPI ID (optional, shown to buyers)"}),i.jsx("input",{value:ce,onChange:Le=>je(Le.target.value),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Go,children:"Payee name (optional)"}),i.jsx("input",{value:qe,onChange:Le=>Ne(Le.target.value),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Go,children:"UPI ID (VPA) — required"}),i.jsx("input",{value:ce,onChange:Le=>je(Le.target.value),placeholder:"e.g. merchant@paytm",style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]}),i.jsx("p",{style:{fontSize:"11px",color:"var(--muted)",margin:0},children:"Preview uses your first ticket’s base price only. On the public page the QR updates with the exact total (ticket + tax, no Eventbuzz add-on)."}),ke?i.jsx("img",{src:ke,alt:"Sample UPI QR",style:{maxWidth:220,borderRadius:8,border:"1px solid var(--border)"}}):null]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Go,children:"Instructions for buyers"}),i.jsx("textarea",{value:Je,onChange:Le=>vt(Le.target.value),rows:3,style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)",fontFamily:"inherit"}})]}),i.jsx("p",{style:{fontSize:"11px",color:"var(--muted)",margin:0,lineHeight:1.45},children:"Buyers pay ticket price plus tax only on this path. Eventbuzz is covered by the one-time manual UPI enablement fee you pay per event (Billing)."}),i.jsx("button",{type:"button",disabled:J,onClick:()=>void ct(),style:{alignSelf:"flex-start",padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer"},children:J?"Saving…":"Save UPI settings"})]})]}),i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",marginTop:"24px",marginBottom:"8px"},children:"Pending UPI proofs"}),nt?i.jsx("p",{style:{color:"var(--muted)"},children:"Refreshing…"}):Ge.length===0?i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)"},children:"No pending reviews."}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:Ge.map(Le=>{var Ke;return i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:"8px",padding:"12px",display:"grid",gap:"8px",gridTemplateColumns:"1fr auto",alignItems:"start"},children:[i.jsxs("div",{children:[i.jsxs("p",{style:{fontWeight:"var(--font-weight-medium)",margin:"0 0 4px"},children:[((Ke=Le.ticket)==null?void 0:Ke.name)||"Ticket"," · ",Le.purchaserEmail]}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:[Le.quote&&typeof Le.quote.totalMinor=="number"?`${Le.quote.totalMinor/100} ${Le.currency}`:"—"," ","· ",Le.createdAt?new Date(Le.createdAt).toLocaleString():""]}),Le.buyerNote?i.jsx("p",{style:{fontSize:"var(--text-sm)",margin:"8px 0 0"},children:Le.buyerNote}):null,Le.screenshotUrl?i.jsx("a",{href:Le.screenshotUrl,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"var(--text-sm)"},children:"View screenshot"}):null]}),i.jsxs("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[i.jsx("button",{type:"button",onClick:()=>{(async()=>{if(t&&window.confirm("Approve this payment and register attendees?"))try{await v1.approve(t,Le._id),await Se(),await At()}catch(Fe){window.alert(Fe instanceof Error?Fe.message:"Approve failed")}})()},style:{padding:"6px 12px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-xs)"},children:"Approve"}),i.jsx("button",{type:"button",onClick:()=>{(async()=>{if(!t)return;const Fe=window.prompt("Reject reason (optional)")??"";try{await v1.reject(t,Le._id,Fe),await Se()}catch(Ve){window.alert(Ve instanceof Error?Ve.message:"Reject failed")}})()},style:{padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--destructive)",color:"var(--destructive)",background:"transparent",cursor:"pointer",fontSize:"var(--text-xs)"},children:"Reject"})]})]},Le._id)})})]})})]}),p&&i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",padding:"16px"},onClick:()=>!b&&y(!1),children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",maxWidth:"560px",width:"100%",maxHeight:"90vh",overflow:"auto",padding:"20px",border:"1px solid var(--border)"},onClick:Le=>Le.stopPropagation(),children:[i.jsx("h2",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",marginBottom:"16px"},children:m?"Edit ticket":"New ticket"}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Go,children:"Name"}),i.jsx("input",{value:k,onChange:Le=>S(Le.target.value),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Go,children:"Description"}),i.jsx("textarea",{value:_,onChange:Le=>P(Le.target.value),rows:3,style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)",fontFamily:"inherit"}})]}),i.jsxs("div",{children:[i.jsx("span",{style:Go,children:"Key points"}),O.map((Le,Ke)=>i.jsxs("div",{style:{display:"flex",gap:"8px",marginTop:"6px"},children:[i.jsx("input",{value:Le,onChange:Fe=>{const Ve=[...O];Ve[Ke]=Fe.target.value,T(Ve)},placeholder:"Bullet point",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}}),i.jsx("button",{type:"button",onClick:()=>T(O.filter((Fe,Ve)=>Ve!==Ke)),style:{padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"8px",background:"var(--background)"},children:"−"})]},Ke)),i.jsx("button",{type:"button",onClick:()=>T([...O,""]),style:{marginTop:"8px",padding:"6px 12px",borderRadius:"8px",border:"1px dashed var(--border)",background:"transparent",cursor:"pointer"},children:"+ Add point"})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsxs("span",{style:Go,children:["Price (",E,")"]}),i.jsx("input",{value:R,onChange:Le=>I(Le.target.value),placeholder:"0.00",style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Go,children:"Currency"}),i.jsx("input",{value:E,onChange:Le=>A(Le.target.value.toUpperCase()),maxLength:3,style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Go,children:"Sort order"}),i.jsx("input",{type:"number",value:F,onChange:Le=>L(parseInt(Le.target.value,10)||0),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Go,children:"Max per order (optional)"}),i.jsx("input",{value:z,onChange:Le=>V(Le.target.value),placeholder:"Unlimited",style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Go,children:"Participant list (fixed)"}),i.jsxs("select",{value:Q,onChange:Le=>U(Le.target.value),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"},children:[i.jsx("option",{value:"",children:"Select list…"}),u.map(Le=>i.jsx("option",{value:Le._id,children:Le.name},Le._id))]})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Go,children:"Registration form (optional)"}),i.jsxs("select",{value:ee,onChange:Le=>H(Le.target.value),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"},children:[i.jsx("option",{value:"",children:"None"}),f.map(Le=>i.jsxs("option",{value:Le._id,children:[Le.name," (",Le.type,")"]},Le._id))]})]}),i.jsxs("div",{children:[i.jsx("span",{style:Go,children:"Tax items"}),i.jsx("p",{style:{fontSize:"11px",color:"var(--muted)",margin:"4px 0 8px"},children:"Rate as percent (e.g. 18 for 18%). Leave states empty to apply everywhere; otherwise enter comma-separated codes (e.g. KA,MH)."}),B.map((Le,Ke)=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 80px 1fr auto",gap:"8px",marginBottom:"8px"},children:[i.jsx("input",{placeholder:"Label (e.g. GST)",value:Le.label,onChange:Fe=>{const Ve=[...B];Ve[Ke]={...Ve[Ke],label:Fe.target.value},M(Ve)},style:{padding:"8px",borderRadius:"8px",border:"1px solid var(--border)"}}),i.jsx("input",{type:"number",placeholder:"%",value:Le.rateBps/100,onChange:Fe=>{const Ve=parseFloat(Fe.target.value)||0,xt=[...B];xt[Ke]={...xt[Ke],rateBps:Math.round(Ve*100)},M(xt)},style:{padding:"8px",borderRadius:"8px",border:"1px solid var(--border)"}}),i.jsx("input",{placeholder:"States or empty = all",value:Le.appliesToStates.join(","),onChange:Fe=>{const Ve=[...B];Ve[Ke]={...Ve[Ke],appliesToStates:Fe.target.value.split(",").map(xt=>xt.trim().toUpperCase()).filter(Boolean)},M(Ve)},style:{padding:"8px",borderRadius:"8px",border:"1px solid var(--border)"}}),i.jsx("button",{type:"button",onClick:()=>M(B.filter((Fe,Ve)=>Ve!==Ke)),style:{padding:"8px",border:"1px solid var(--border)",borderRadius:"8px"},children:"×"})]},Ke)),i.jsx("button",{type:"button",onClick:()=>M([...B,{label:"",rateBps:0,appliesToStates:[]}]),style:{padding:"6px 12px",borderRadius:"8px",border:"1px dashed var(--border)",background:"transparent"},children:"+ Tax row"})]})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"20px"},children:[i.jsx("button",{type:"button",disabled:b,onClick:()=>y(!1),style:{padding:"8px 16px",borderRadius:"8px",border:"1px solid var(--border)",background:"var(--background)"},children:"Cancel"}),i.jsx("button",{type:"button",disabled:b||!k.trim()||!Q,onClick:()=>void Ze(),style:{padding:"8px 16px",borderRadius:"8px",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",opacity:b?.7:1},children:b?"Saving…":"Save"})]})]})})]}):i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Your account needs an organisation to use ticketing."}):i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Select an event to manage tickets."})}function c6e({...e}){return i.jsx(s$,{"data-slot":"sheet",...e})}function u6e({...e}){return i.jsx(l$,{"data-slot":"sheet-portal",...e})}const xQ=j.forwardRef(({className:e,...t},r)=>i.jsx(c$,{ref:r,"data-slot":"sheet-overlay",className:Xo("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t}));xQ.displayName="SheetOverlay";function d6e({className:e,children:t,side:r="right",...n}){return i.jsxs(u6e,{children:[i.jsx(xQ,{}),i.jsxs(u$,{"data-slot":"sheet-content",className:Xo("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",r==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",r==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",r==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",r==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...n,children:[t,i.jsxs(f$,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[i.jsx(er,{className:"size-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function f6e({className:e,...t}){return i.jsx("div",{"data-slot":"sheet-header",className:Xo("flex flex-col gap-1.5 p-4",e),...t})}function p6e({className:e,...t}){return i.jsx(d$,{"data-slot":"sheet-title",className:Xo("text-foreground font-semibold",e),...t})}function h6e(e){const t=j.useRef({value:e,previous:e});return j.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var j8="Switch",[g6e]=Rw(j8),[m6e,v6e]=g6e(j8),bQ=j.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:o,defaultChecked:a,required:s,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,p]=j.useState(null),y=Nl(t,k=>p(k)),m=j.useRef(!1),x=h?d||!!h.closest("form"):!0,[b=!1,w]=W6({prop:o,defaultProp:a,onChange:u});return i.jsxs(m6e,{scope:r,checked:b,disabled:l,children:[i.jsx(ya.button,{type:"button",role:"switch","aria-checked":b,"aria-required":s,"data-state":jQ(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:y,onClick:ps(e.onClick,k=>{w(S=>!S),x&&(m.current=k.isPropagationStopped(),m.current||k.stopPropagation())})}),x&&i.jsx(y6e,{control:h,bubbles:!m.current,name:n,value:c,checked:b,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});bQ.displayName=j8;var wQ="SwitchThumb",SQ=j.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,o=v6e(wQ,r);return i.jsx(ya.span,{"data-state":jQ(o.checked),"data-disabled":o.disabled?"":void 0,...n,ref:t})});SQ.displayName=wQ;var y6e=e=>{const{control:t,checked:r,bubbles:n=!0,...o}=e,a=j.useRef(null),s=h6e(r),l=iG(t);return j.useEffect(()=>{const c=a.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==r&&f){const h=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(h)}},[s,r,n]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...o,tabIndex:-1,ref:a,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function jQ(e){return e?"checked":"unchecked"}var x6e=bQ,b6e=SQ;function w6e({className:e,...t}){return i.jsx(x6e,{"data-slot":"switch",className:Xo("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-switch-background focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:i.jsx(b6e,{"data-slot":"switch-thumb",className:Xo("bg-card dark:data-[state=unchecked]:bg-card-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}const $t={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"},Nr={...$t,cursor:"pointer",appearance:"none",paddingRight:"32px"};({...$t});const kt=e=>{e.currentTarget.style.borderColor="var(--primary)",e.currentTarget.style.boxShadow="0 0 0 2px rgba(11,77,209,0.10)"},_t=e=>{e.currentTarget.style.borderColor="var(--border)",e.currentTarget.style.boxShadow="none"};function pt({text:e,required:t}){return i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",marginBottom:"5px"},children:[t&&i.jsx("span",{style:{color:"var(--destructive)",marginRight:"3px"},children:"*"}),e]})}function Qt({text:e}){return i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0",display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("span",{style:{fontSize:"10px"},children:"ℹ"})," ",e]})}function lt({children:e,span2:t,error:r}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gridColumn:t?"1 / -1":void 0},children:[e,r&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:"4px 0 0"},children:r})]})}function Zi({children:e,cols:t=2}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"12px"},children:e})}function an({children:e}){return i.jsxs("div",{style:{position:"relative"},children:[e,i.jsx(po,{size:13,style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}})]})}function go({name:e,value:t,onChange:r,options:n}){return i.jsx("div",{style:{display:"flex",gap:"20px",alignItems:"center",paddingTop:"2px"},children:n.map(o=>i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",fontWeight:"var(--font-weight-normal)"},children:[i.jsx("input",{type:"radio",name:e,value:o.value,checked:t===o.value,onChange:()=>r(o.value),style:{accentColor:"var(--primary)",width:"16px",height:"16px",cursor:"pointer"}}),o.label]},o.value))})}function gw({text:e,onRemove:t}){return i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"3px 8px",borderRadius:"var(--radius-button)",background:"var(--accent)",border:"1px solid var(--accent-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--accent-foreground)"},children:[e,t&&i.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0,lineHeight:1},children:i.jsx(er,{size:10})})]})}function S6e(){return i.jsx("div",{style:{height:"1px",background:"var(--border)",margin:"4px 0"}})}function ev({text:e}){return i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"8px",marginTop:"4px"},children:e})}function j6e({n:e,state:t}){return i.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:t==="todo"?"var(--muted)":"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t==="done"?i.jsx(Oi,{size:13,style:{color:"#fff"}}):i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",color:"#fff",fontWeight:"var(--font-weight-medium)"},children:e})})}function $r({n:e,title:t,subtitle:r,open:n,completed:o,onToggle:a,children:s,onSave:l,nextLabel:c,nextDisabled:u,sectionError:d}){const f=n?"active":o?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{onClick:a,style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(j6e,{n:e,state:f}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:n?"var(--primary)":"var(--card-foreground)",margin:0},children:t}),!n&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:r})]}),n?i.jsx($f,{size:18,style:{color:"var(--muted)",flexShrink:0}}):i.jsx(po,{size:18,style:{color:"var(--muted)",flexShrink:0}})]}),n&&i.jsxs("div",{style:{padding:"0 20px 16px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 16px 40px"},children:r}),d&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:"0 0 12px 40px"},children:d}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:s}),i.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"12px",marginTop:"20px",paddingTop:"14px",borderTop:"1px solid var(--border)"},children:i.jsx("button",{type:"button",disabled:u,onClick:l,style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 18px",borderRadius:"var(--radius-button)",background:u?"var(--secondary)":"var(--primary)",color:u?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:u?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:c})})]})]})}function Zo({children:e,onClose:t,title:r,breadcrumb:n,description:o,completedCount:a,totalSections:s,ctaLabel:l,ctaDisabled:c,onCtaClick:u,showProgress:d=!0,hidePrimaryCta:f=!1,panelWidth:h}){const p=s>0?Math.round(a/s*100):0,y=u?!c:!c&&a>=s;return i.jsxs(i.Fragment,{children:[i.jsx("style",{children:"@keyframes __panelIn { from { transform:translateX(100%); opacity:.6 } to { transform:translateX(0); opacity:1 } }"}),i.jsx("div",{role:"presentation",onClick:t,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.50)",zIndex:200}}),i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"__panel-shell-title",onClick:m=>m.stopPropagation(),style:{position:"fixed",top:0,right:0,height:"100%",width:h??"min(560px,100vw)",maxWidth:"100vw",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.20)",animation:"__panelIn .25s cubic-bezier(.4,0,.2,1)"},children:[i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:d?"14px":"0"},children:[i.jsxs("div",{style:{flex:1,minWidth:0},children:[n&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 3px"},children:n}),i.jsx("h3",{id:"__panel-shell-title",style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:r}),o&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"5px 0 0"},children:o})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:t,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:m=>{m.currentTarget.style.borderColor="var(--destructive)",m.currentTarget.style.color="var(--destructive)"},onMouseLeave:m=>{m.currentTarget.style.borderColor="var(--border)",m.currentTarget.style.color="var(--muted)"},children:i.jsx(er,{size:14})}),!f&&i.jsx("button",{type:"button",disabled:!y,onClick:()=>y&&(u==null?void 0:u()),style:{padding:"6px 16px",borderRadius:"var(--radius-button)",background:y?"var(--primary)":"var(--secondary)",color:y?"var(--primary-foreground)":"var(--muted)",border:"none",cursor:y?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",transition:"background .2s"},children:l})]})]}),d&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[a," of ",s," sections complete"]}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:[p,"%"]})]}),i.jsx("div",{style:{height:"6px",borderRadius:"99px",background:"var(--border)",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${p}%`,background:p===100?"#22c55e":"var(--primary)",borderRadius:"99px",transition:"width .35s ease"}})})]})]}),i.jsx("div",{style:{flex:1,overflowY:"auto"},children:e})]})]})}function mc(e){const[t,r]=j.useState(1),[n,o]=j.useState(new Set);return{open:t,done:n,advance:l=>{o(c=>new Set([...c,l])),lr(c=>c===l?0:l)}}const k6e="https://api.eventbuzz.live/api".replace(/\/api\/?$/,"")||(typeof window<"u"?window.location.origin:"");function jy(e){return e?e.startsWith("http")?e:`${k6e}${e.startsWith("/")?"":"/"}${e}`:""}const _6e=3;function C6e({eventId:e,open:t,onOpenChange:r}){const[n,o]=j.useState({}),[a,s]=j.useState(!1),[l,c]=j.useState(null),[u,d]=j.useState("idle"),[f,h]=j.useState(null),[p,y]=j.useState([]),[m,x]=j.useState(!1),b=j.useRef(null),w=mc(_6e),k=j.useCallback(async()=>{if(e){s(!0);try{const I=await Uc.get(e);o(I.data||{})}catch{o({})}finally{s(!1)}}},[e]);j.useEffect(()=>{t&&e&&(k(),x(!0),Hs.list({type:"microsite",limit:50}).then(I=>{var E;y(((E=I.data)==null?void 0:E.templates)??[])}).catch(()=>y([])).finally(()=>x(!1)))},[t,e,k]);const S=j.useCallback(async I=>{if(e){h(null),c(I);try{await Uc.update(e,n),w.advance(I)}catch(E){h(E instanceof Error?E.message:"Failed to save")}finally{c(null)}}},[e,n,w]),_=j.useCallback(async()=>{var E;const I=(n.folder||"").trim().toLowerCase().replace(/[^a-z0-9-]/g,"");if(!I){d("idle");return}if(e){d("checking");try{const A=await Uc.checkFolder(e,I);d((E=A.data)!=null&&E.available?"available":"taken")}catch{d("idle")}}},[e,n.folder]);j.useEffect(()=>{if(b.current&&clearTimeout(b.current),!(n.folder||"").trim()){d("idle");return}return b.current=setTimeout(()=>_(),500),()=>{b.current&&clearTimeout(b.current)}},[n.folder,_]);const P=async I=>{var A;const E=(A=I.target.files)==null?void 0:A[0];if(!(!E||!e)){try{const F=await Ys(E,{eventId:e,module:"website/logo"});o(L=>({...L,logo:F.url}))}catch{}I.target.value=""}},O=async I=>{var A;const E=(A=I.target.files)==null?void 0:A[0];if(!(!E||!e)){try{const F=await Ys(E,{eventId:e,module:"website/banner"});o(L=>({...L,banners:[...L.banners||[],F.url]}))}catch{}I.target.value=""}},T=I=>{o(E=>({...E,banners:(E.banners||[]).filter((A,F)=>F!==I)}))},R=async I=>{var A;const E=(A=I.target.files)==null?void 0:A[0];if(!(!E||!e)){try{const F=await Ys(E,{eventId:e,module:"website/favicon"});o(L=>({...L,favicon:F.url}))}catch{}I.target.value=""}};return i.jsx(c6e,{open:t,onOpenChange:r,children:i.jsxs(d6e,{side:"right",className:"sm:max-w-2xl flex flex-col p-0",children:[i.jsx(f6e,{className:"px-4 pt-4 pb-2 border-b border-border",children:i.jsxs(p6e,{className:"flex items-center gap-2",children:[i.jsx(Pl,{size:18})," Website Settings"]})}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:a?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(ix,{className:"size-6 animate-spin text-muted-foreground"})}):i.jsxs(i.Fragment,{children:[i.jsxs($r,{n:1,title:"Basic configuration",subtitle:"Enable website, folder, title, description and keywords",open:w.open===1,completed:w.done.has(1),onToggle:()=>w.toggle(1),onSave:()=>S(1),nextLabel:l===1?"Saving…":"Save",nextDisabled:l!==null,sectionError:f||(u==="taken"?"Another event uses this website folder.":void 0),children:[i.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[i.jsx(w6e,{checked:!!n.enabled,onCheckedChange:I=>o(E=>({...E,enabled:I}))}),i.jsx("span",{className:"text-sm text-foreground font-medium",children:"Enable website"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Website folder"}),i.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[i.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"http://web.eventbuzz.live/"}),i.jsx("input",{type:"text",value:n.folder||"",onChange:I=>o(E=>({...E,folder:I.target.value})),placeholder:"e.g. napcon-2026",style:{flex:"1 1 120px",minWidth:0,padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}})]}),u==="checking"&&i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Checking…"}),u==="available"&&i.jsx("p",{className:"text-xs text-green-600 mt-1",children:"Available"}),u==="taken"&&i.jsx("p",{className:"text-xs text-destructive mt-1",children:"Another event uses this folder"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Website title"}),i.jsx("input",{type:"text",value:n.title||"",onChange:I=>o(E=>({...E,title:I.target.value})),placeholder:"Event website title",style:{width:"100%",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Description"}),i.jsx("textarea",{value:n.description||"",onChange:I=>o(E=>({...E,description:I.target.value})),placeholder:"Meta description",rows:2,style:{width:"100%",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)",resize:"none"}})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Keywords (comma-separated)"}),i.jsx("input",{type:"text",value:Array.isArray(n.keywords)?n.keywords.join(", "):n.keywords||"",onChange:I=>o(E=>({...E,keywords:I.target.value.split(",").map(A=>A.trim()).filter(Boolean)})),placeholder:"event, conference, 2026",style:{width:"100%",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}})]})]}),i.jsxs($r,{n:2,title:"Template",subtitle:"Choose a microsite template",open:w.open===2,completed:w.done.has(2),onToggle:()=>w.toggle(2),onSave:()=>S(2),nextLabel:l===2?"Saving…":"Save",nextDisabled:l!==null,children:[m?i.jsx("div",{className:"flex items-center justify-center py-6",children:i.jsx(ix,{className:"size-5 animate-spin text-muted-foreground"})}):i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"12px"},children:p.map(I=>i.jsxs("div",{style:{background:"var(--card)",border:n.templateId===I._id?"2px solid var(--primary)":"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{height:"100px",background:"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center",borderBottom:"1px solid var(--border)"},children:I.thumbnail?i.jsx("img",{src:jy(I.thumbnail),alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):i.jsx(_q,{size:28,style:{color:"var(--muted)"}})}),i.jsxs("div",{style:{padding:"8px 10px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:I.name}),i.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"6px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:()=>o(E=>({...E,templateId:I._id})),style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 8px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:n.templateId===I._id?"var(--primary)":"var(--secondary)",color:n.templateId===I._id?"var(--primary-foreground)":"var(--foreground)",cursor:"pointer",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"500"},children:[n.templateId===I._id?i.jsx(Oi,{size:10}):null," Select"]}),i.jsxs("button",{type:"button",onClick:()=>I.thumbnail?window.open(jy(I.thumbnail),"_blank"):null,style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 8px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",color:"var(--foreground)",cursor:"pointer",fontSize:"11px",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(Ah,{size:10})," Preview"]})]})]})]},I._id))}),!m&&p.length===0&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"No microsite templates found. Create templates under Design → Microsite Templates."})]}),i.jsxs($r,{n:3,title:"Logo & Banners",subtitle:"Upload logo, favicon and banner images",open:w.open===3,completed:w.done.has(3),onToggle:()=>w.toggle(3),onSave:()=>S(3),nextLabel:l===3?"Saving…":"Save",nextDisabled:l!==null,children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Logo"}),n.logo?i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("img",{src:jy(n.logo),alt:"Logo",style:{height:40,objectFit:"contain",border:"1px solid var(--border)",borderRadius:4}}),i.jsx("button",{type:"button",onClick:()=>o(I=>({...I,logo:void 0})),style:{fontSize:"var(--text-xs)",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:"Remove"})]}):null,i.jsx("input",{type:"file",accept:"image/*",onChange:P,className:"text-sm text-muted-foreground file:mr-2 file:py-1 file:px-2 file:rounded file:border file:text-xs"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Favicon"}),n.favicon?i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("img",{src:jy(n.favicon),alt:"Favicon",style:{width:24,height:24,objectFit:"contain"}}),i.jsx("button",{type:"button",onClick:()=>o(I=>({...I,favicon:void 0})),style:{fontSize:"var(--text-xs)",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:"Remove"})]}):null,i.jsx("input",{type:"file",accept:"image/*,.ico",onChange:R,className:"text-sm text-muted-foreground file:mr-2 file:py-1 file:px-2 file:rounded file:border file:text-xs"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Banner images (multiple)"}),i.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:(n.banners||[]).map((I,E)=>i.jsxs("div",{style:{position:"relative"},children:[i.jsx("img",{src:jy(I),alt:"",style:{height:64,width:96,objectFit:"cover",borderRadius:4,border:"1px solid var(--border)"}}),i.jsx("button",{type:"button",onClick:()=>T(E),style:{position:"absolute",top:-4,right:-4,width:20,height:20,borderRadius:"50%",background:"var(--destructive)",color:"var(--destructive-foreground)",border:"none",cursor:"pointer",fontSize:12,display:"flex",alignItems:"center",justifyContent:"center"},children:"×"})]},E))}),i.jsx("input",{type:"file",accept:"image/*",onChange:O,className:"text-sm text-muted-foreground file:mr-2 file:py-1 file:px-2 file:rounded file:border file:text-xs"})]})]})]})})]})})}function E6e(e){return e.replace(/\/+$/,"")}function A6e(){return E6e("https://builder.eventbuzz.live")}function kQ(){try{return new URL(A6e()).origin}catch{return"*"}}const T6e="EB_EXPORT_HTML",P6e="EB_EXPORT_HTML_RESULT";function mw(e,t=2e4){return new Promise((r,n)=>{const o=e==null?void 0:e.contentWindow;if(!o){n(new Error("Editor is not ready."));return}const a=`${Date.now()}-${Math.random().toString(36).slice(2)}`,s=kQ(),l=u=>{var d;u.source===o&&(((d=u.data)==null?void 0:d.type)!==P6e||u.data.requestId!==a||(window.removeEventListener("message",l),window.clearTimeout(c),u.data.error?n(new Error(String(u.data.error))):r(String(u.data.html??""))))};window.addEventListener("message",l);const c=window.setTimeout(()=>{window.removeEventListener("message",l),n(new Error("Timed out waiting for editor HTML."))},t);o.postMessage({type:T6e,requestId:a},s==="*"?"*":s)})}function _Q(e){return e.replace(/\/+$/,"")}function O6e(){return _Q("https://builder.eventbuzz.live")}function I6e(){return _Q("https://api.eventbuzz.live/api")}function N6e(...e){return t=>{e.forEach(r=>{r&&(typeof r=="function"?r(t):r.current=t)})}}const R6e="EB_BUILDER_READY",CQ=j.forwardRef(function({pageId:t,eventId:r,micrositeId:n=null,variant:o="default",mountNonce:a=0},s){const l=j.useRef(null),c=kQ(),u=j.useCallback(()=>{var w;const y=(w=l.current)==null?void 0:w.contentWindow;if(!y)return;const m=MJ(),x=I6e(),b={type:"SET_AUTH_TOKEN",token:m,pageId:t,eventId:r,apiBaseUrl:x};n&&String(n).trim()&&(b.micrositeId=String(n).trim()),y.postMessage(b,c==="*"?"*":c)},[t,r,n,c]),d=j.useCallback(()=>{u(),window.setTimeout(u,0),window.setTimeout(u,50),window.setTimeout(u,200)},[u]);j.useEffect(()=>{const y=m=>{var x,b;m.source===((x=l.current)==null?void 0:x.contentWindow)&&((b=m.data)==null?void 0:b.type)===R6e&&d()};return window.addEventListener("message",y),()=>window.removeEventListener("message",y)},[d]);const f=j.useCallback(()=>{d()},[d]),h=O6e(),p=o==="fullscreen";return i.jsx("div",{style:{width:"100%",height:p?"100%":"calc(100vh - 220px)",minHeight:p?0:"min(70vh, 900px)",maxHeight:p?"none":"1200px",flex:p?1:void 0,display:"flex",flexDirection:"column",border:p?"none":"1px solid var(--border)",borderRadius:p?0:"var(--radius-card)",overflow:"hidden",background:p?"var(--background)":"var(--card)"},children:i.jsx("iframe",{ref:N6e(l,s),src:h,onLoad:f,title:"Microsite visual editor",style:{width:"100%",flex:1,minHeight:0,border:"none"}},`${t}-${a}-${n??"legacy"}`)})}),GB={header:"Header",banner:"Banner",contact_form:"Contact form",agenda:"Agenda / schedule",register_links:"Register links",speakers:"Speakers",footer:"Footer",sponsors:"Sponsors",cta:"CTA",custom_html:"Custom HTML",countdown:"Countdown strip",gallery:"Gallery",about:"About",venue:"Venue",faq:"FAQ",tickets:"Tickets / pricing"};function KB(e){switch(e){case"header":return{logoText:"",menuItems:[]};case"banner":return{headline:"",subtext:"",ctaText:"",ctaUrl:"#",secondaryCtaText:"View schedule",secondaryCtaUrl:"#schedule",backgroundClass:"bg-primary"};case"contact_form":return{title:"Contact Us",submitLabel:"Send"};case"agenda":return{title:"Schedule"};case"register_links":return{title:"Register",primaryLabel:"Register Now",primaryUrl:"#",secondaryLabel:"",secondaryUrl:"#"};case"speakers":return{title:"Speakers",limit:12};case"footer":return{copyrightText:"",links:[]};case"sponsors":return{title:"Sponsors & partners",sponsors:[],partnerCtaLabel:"",partnerCtaUrl:"#"};case"cta":return{headline:"Join us",subtext:"",buttonLabel:"Register",buttonUrl:"#"};case"custom_html":return{html:""};case"countdown":return{headingLine:""};case"gallery":return{title:"Gallery",images:[]};case"about":return{title:"About",lead:"",bulletsTitle:"Why attend",bullets:[],ctaLabel:"",ctaUrl:"#register"};case"venue":return{title:"Venue",venueName:"",intro:"",mapEmbedUrl:"",transportCards:[]};case"faq":return{title:"FAQ",items:[],contactEmail:""};case"tickets":return{title:"Tickets",intro:"",tiers:[],includedTitle:"",includedBullets:[]};default:return{}}}function L6e(){var At,Ht;const{selectedEventId:e,pendingMicrositeBuilder:t,setPendingMicrositeBuilder:r}=eo(),[n,o]=j.useState([]),[a,s]=j.useState(!1),[l,c]=j.useState(!1),[u,d]=j.useState(""),[f,h]=j.useState("home"),[p,y]=j.useState(""),[m,x]=j.useState(!1),[b,w]=j.useState(null),[k,S]=j.useState(null),[_,P]=j.useState(!1),[O,T]=j.useState(!1),[R,I]=j.useState(!1),E=j.useRef(null),[A,F]=j.useState(null),[L,z]=j.useState({}),[V,Q]=j.useState(""),[U,ee]=j.useState(!1),[H,B]=j.useState(!1),[M,$]=j.useState(null),[q,Y]=j.useState(""),[K,G]=j.useState(!1),[re,J]=j.useState("sections"),[ae,le]=j.useState(""),[me,Oe]=j.useState(null),we=j.useRef(null),[ie,Me]=j.useState(!1),[ke,se]=j.useState(null),fe=j.useCallback(async()=>{var Se;if(e){s(!0);try{const ct=await Wc.list(e);o(((Se=ct.data)==null?void 0:Se.pages)??[])}catch{o([])}finally{s(!1)}}},[e]);j.useEffect(()=>{fe()},[fe]),j.useEffect(()=>{if(!e){le(""),Oe(null);return}(async()=>{var We;const Se=await ua.list(e);if(Se.data&&Se.data.length>0){const Pe=Se.data[0];Oe(Pe._id),le(Pe.publishFolder!=null?String(Pe.publishFolder).trim():"");return}Oe(null);const ct=await Uc.get(e),gt=((We=ct.data)==null?void 0:We.folder)!=null?String(ct.data.folder).trim():"";le(gt)})().catch(()=>{Oe(null),le("")})},[e]),j.useEffect(()=>{const Se=t;!Se||!e||Se.eventId!==e||(r(null),(async()=>{var gt;let ct=Se.pageId;if(!ct)try{const Pe=((gt=(await Wc.list(e)).data)==null?void 0:gt.pages)??[],rt=Pe.find(Ze=>Ze.type==="home")??Pe[0];ct=(rt==null?void 0:rt._id)??null}catch{ct=null}ct&&(w(ct),J(Se.mode))})())},[t,e,r]);const Ie=j.useCallback(async()=>{if(se(null),!e||!ae.trim()){se("Set a microsite URL slug in Configure event microsite first.");return}Me(!0);try{const Se=await mw(we.current);if(me){const ct=await ua.update(e,me,{micrositeHtml:Se});if(ct.error)throw new Error(ct.error);const gt=await ua.publish(e,me,{targets:"draft"});if(gt.error)throw new Error(gt.error)}else{const ct=await Uc.update(e,{micrositeHtml:Se});if(ct.error)throw new Error(ct.error);const gt=await Uc.publishMicrosite(e,{targets:"draft"});if(gt.error)throw new Error(gt.error)}}catch(Se){se(Se instanceof Error?Se.message:"Save failed")}finally{Me(!1)}},[e,ae,me]),ce=j.useCallback(async()=>{if(se(null),!e||!ae.trim()){se("Set a microsite URL slug in Configure event microsite first.");return}Me(!0);try{const Se=await mw(we.current);if(me){const ct=await ua.update(e,me,{micrositeHtml:Se});if(ct.error)throw new Error(ct.error);const gt=await ua.publish(e,me,{targets:"both"});if(gt.error)throw new Error(gt.error)}else{const ct=await Uc.update(e,{micrositeHtml:Se});if(ct.error)throw new Error(ct.error);const gt=await Uc.publishMicrosite(e,{targets:"both"});if(gt.error)throw new Error(gt.error)}}catch(Se){se(Se instanceof Error?Se.message:"Publish failed")}finally{Me(!1)}},[e,ae,me]),je=j.useCallback(async Se=>{P(!0);try{const ct=await Wc.get(Se);S(ct.data??null)}catch{S(null)}finally{P(!1)}},[]);j.useEffect(()=>{b?je(b):S(null)},[b,je]),j.useEffect(()=>{const Se=ct=>{E.current&&!E.current.contains(ct.target)&&T(!1)};return document.addEventListener("mousedown",Se),()=>document.removeEventListener("mousedown",Se)},[]);const qe=async Se=>{if(!b)return;const ct=await Wc.update(b,{sections:Se});ct.data&&S(ct.data)},Ne=(Se,ct)=>{if(!(k!=null&&k.sections))return;const We=[...[...k.sections].sort((Ze,pe)=>(Ze.order??0)-(pe.order??0))],Pe=ct==="up"?Se-1:Se+1;if(Pe<0||Pe>=We.length)return;[We[Se],We[Pe]]=[We[Pe],We[Se]];const rt=We.map((Ze,pe)=>({...Ze,order:pe}));qe(rt)},Je=Se=>{if(!(k!=null&&k.sections))return;const gt=[...k.sections].sort((We,Pe)=>(We.order??0)-(Pe.order??0)).filter((We,Pe)=>Pe!==Se).map((We,Pe)=>({...We,order:Pe}));qe(gt)},vt=async Se=>{if(!b||!k)return;T(!1),I(!0);const ct=k.sections??[],gt=ct.length,We={id:crypto.randomUUID(),type:Se,order:gt,config:KB(Se)},Pe=[...ct,We];try{const rt=await Wc.update(b,{sections:Pe});rt.data&&S(rt.data)}finally{I(!1)}},Ge=Se=>{F(Se.id),Q(Se.type),z({...Se.config||KB(Se.type)})},Ot=async()=>{if(!b||!k||!A)return;ee(!0);const Se=(k.sections??[]).map(ct=>ct.id===A?{...ct,config:{...L}}:ct);try{const ct=await Wc.update(b,{sections:Se});ct.data&&(S(ct.data),F(null))}finally{ee(!1)}},nt=(Se,ct)=>{z(gt=>({...gt,[Se]:ct}))},Ae=(Se,ct,gt,We)=>{z(Pe=>{const Ze=[...Pe[Se]??[]];return Ze[ct]?(Ze[ct]={...Ze[ct],[gt]:We},{...Pe,[Se]:Ze}):Pe})},Te=(Se,ct)=>{z(gt=>{const We=gt[Se]??[];return{...gt,[Se]:[...We,ct]}})},wt=(Se,ct)=>{z(gt=>{const We=gt[Se]??[];return{...gt,[Se]:We.filter((Pe,rt)=>rt!==ct)}})},ft=async Se=>{var ct;if(b){$(null),B(!0);try{const gt=await Wc.exportHtml(b,q.trim()||void 0);if(gt.error){$(gt.error);return}const We=(ct=gt.data)==null?void 0:ct.html;if(!We){$("No HTML returned");return}if(Se){const Pe=window.open("","_blank");Pe?(Pe.document.write(We),Pe.document.close()):$("Popup blocked. Allow popups to preview.")}else{const Pe=new Blob([We],{type:"text/html"}),rt=URL.createObjectURL(Pe),Ze=document.createElement("a");Ze.href=rt,Ze.download=((k==null?void 0:k.slug)||"page")+".html",Ze.click(),URL.revokeObjectURL(rt)}}catch(gt){$(gt instanceof Error?gt.message:"Export failed")}finally{B(!1)}}},Pt=async Se=>{if(Se.preventDefault(),!(!e||!u.trim())){x(!0);try{(await Wc.create(e,{title:u.trim(),type:f,slug:p.trim()||void 0})).data&&(c(!1),d(""),h("home"),y(""),fe())}finally{x(!1)}}};return e?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Event Website"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2"},children:"Event Website"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginTop:"4px"},children:"Pages"})]}),b?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:()=>{w(null),S(null),$(null),J("sections")},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",color:"var(--foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(wq,{size:14})," Back to pages"]}),i.jsx("span",{style:{flex:1,minWidth:"120px",fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:(k==null?void 0:k.title)??((At=n.find(Se=>Se._id===b))==null?void 0:At.title)??"Page"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:()=>J("visual"),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",boxShadow:re==="visual"?"0 0 0 2px var(--ring, rgba(99,102,241,0.5))":void 0},title:"Open GrapesJS visual editor (run website_builder separately)",children:[i.jsx(Z3,{size:16})," Visual builder"]}),i.jsxs("button",{type:"button",onClick:()=>G(!0),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",color:"var(--foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(Pl,{size:14})," Settings"]})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",flexWrap:"wrap",padding:"4px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",width:"fit-content"},role:"tablist","aria-label":"Editor mode",children:[i.jsx("button",{type:"button",role:"tab","aria-selected":re==="sections",onClick:()=>J("sections"),style:{padding:"8px 14px",borderRadius:"calc(var(--radius-button) - 2px)",border:"none",background:re==="sections"?"var(--card)":"transparent",color:"var(--foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:re==="sections"?"600":"400",boxShadow:re==="sections"?"0 1px 2px rgba(0,0,0,0.06)":void 0},children:"Sections list"}),i.jsx("button",{type:"button",role:"tab","aria-selected":re==="visual",onClick:()=>J("visual"),style:{padding:"8px 14px",borderRadius:"calc(var(--radius-button) - 2px)",border:"none",background:re==="visual"?"var(--card)":"transparent",color:"var(--foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:re==="visual"?"600":"400",boxShadow:re==="visual"?"0 1px 2px rgba(0,0,0,0.06)":void 0},children:"Visual editor (iframe)"})]}),re==="visual"?i.jsxs(i.Fragment,{children:[i.jsxs("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",margin:0},children:["Visual HTML is stored on ",me?i.jsxs(i.Fragment,{children:["the selected ",i.jsx("code",{style:{fontSize:"0.85em"},children:"EventMicrosite"})," template"]}):i.jsxs(i.Fragment,{children:[i.jsx("code",{style:{fontSize:"0.85em"},children:"Event.website.micrositeHtml"})," (legacy)"]}),". ",i.jsx("strong",{children:"Save (draft site)"})," updates the DB and publishes only ",i.jsxs("code",{style:{fontSize:"0.85em"},children:[ae||"slug","_draft"]}),". ",i.jsx("strong",{children:"Publish"})," writes both draft and live folders. Set ",i.jsx("code",{style:{fontSize:"0.85em"},children:"VITE_PARENT_ORIGIN"})," on the builder in production."]}),e&&b?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginTop:"10px"},children:[i.jsxs("button",{type:"button",disabled:ie||!ae.trim(),onClick:()=>void Ie(),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",color:"var(--foreground)",cursor:ie||!ae.trim()?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(Nw,{size:16,"aria-hidden":!0})," ",ie?"Working…":"Save (draft site)"]}),i.jsxs("button",{type:"button",disabled:ie||!ae.trim(),onClick:()=>void ce(),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:ie||!ae.trim()?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(Aq,{size:16,"aria-hidden":!0})," Publish"]})]}),ke?i.jsx("p",{style:{margin:"8px 0 0",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)"},children:ke}):null,i.jsx(CQ,{ref:we,pageId:b,eventId:e,micrositeId:me??void 0})]}):i.jsx("div",{style:{padding:"24px",color:"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Select an event and page to open the visual editor."})]}):k?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"},children:[i.jsx("input",{type:"text",placeholder:"Registration URL (optional)",value:q,onChange:Se=>Y(Se.target.value),style:{maxWidth:"280px",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}}),i.jsxs("button",{type:"button",onClick:()=>ft(!0),disabled:H,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",color:"var(--foreground)",cursor:H?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(av,{size:14})," ",H?"Loading…":"Preview HTML"]}),i.jsxs("button",{type:"button",onClick:()=>ft(!1),disabled:H,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:H?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(Al,{size:14})," Download HTML"]})]}),M&&i.jsx("div",{style:{padding:"8px 12px",borderRadius:"var(--radius-button)",background:"#fef2f2",color:"#b91c1c",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:M}),i.jsxs("div",{style:{marginBottom:"12px",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"8px"},children:[i.jsx("span",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Add a section to this page"}),i.jsxs("div",{ref:E,style:{position:"relative"},children:[i.jsxs("button",{type:"button",disabled:R,onClick:()=>T(Se=>!Se),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:R?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:14})," Add section"]}),O&&i.jsx("div",{style:{position:"absolute",right:0,top:"100%",marginTop:"4px",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",boxShadow:"var(--shadow-md)",zIndex:50,minWidth:"180px",overflow:"hidden"},children:BJ.map(Se=>i.jsx("button",{type:"button",onClick:()=>vt(Se),style:{display:"block",width:"100%",padding:"10px 14px",textAlign:"left",background:"none",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"},children:GB[Se]??Se},Se))})]})]}),i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border)",fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Sections"}),_?i.jsx("div",{style:{padding:"24px",color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Loading…"}):(Ht=k.sections)!=null&&Ht.length?i.jsx("div",{style:{display:"flex",flexDirection:"column"},children:[...k.sections??[]].sort((Se,ct)=>(Se.order??0)-(ct.order??0)).map((Se,ct)=>{var gt,We,Pe;return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"10px 16px",borderBottom:"1px solid var(--border)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("span",{style:{display:"inline-flex",padding:"2px 8px",borderRadius:"4px",background:"var(--secondary)",color:"var(--foreground)",fontSize:"var(--text-xs)",fontWeight:"500",minWidth:"100px"},children:Se.type.replace(/_/g," ")}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:["Order: ",ct+1]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginLeft:"auto"},children:[i.jsx("button",{type:"button",onClick:()=>Ge(Se),title:"Edit section",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(Ii,{size:14})}),i.jsx("button",{type:"button",onClick:()=>Ne(ct,"up"),disabled:ct===0,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:ct===0?"not-allowed":"pointer",opacity:ct===0?.5:1},children:i.jsx($f,{size:14})}),i.jsx("button",{type:"button",onClick:()=>Ne(ct,"down"),disabled:ct===(((gt=k.sections)==null?void 0:gt.length)??0)-1,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:ct===(((We=k.sections)==null?void 0:We.length)??0)-1?"not-allowed":"pointer",opacity:ct===(((Pe=k.sections)==null?void 0:Pe.length)??0)-1?.5:1},children:i.jsx(po,{size:14})}),i.jsx("button",{type:"button",onClick:()=>Je(ct),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--destructive)",cursor:"pointer"},children:i.jsx(gn,{size:14})})]})]},Se.id)})}):i.jsx("div",{style:{padding:"24px",color:"var(--muted)",fontSize:"var(--text-sm)"},children:"No sections yet. Add one below."})]})]}):i.jsx("div",{style:{padding:"24px",color:"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:_?"Loading page…":"Could not load this page."})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsx("div",{style:{flex:1,minWidth:0}}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsxs("button",{type:"button",onClick:()=>G(!0),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",color:"var(--foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(Pl,{size:14})," Settings"]}),i.jsxs("button",{type:"button",onClick:()=>c(!0),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:14})," Add page"]})]})]}),l&&i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px"},children:[i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Add page"}),i.jsx("button",{type:"button",onClick:()=>{c(!1),d(""),y("")},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--muted)"},children:i.jsx(er,{size:18})})]}),i.jsxs("form",{onSubmit:Pt,style:{display:"flex",flexDirection:"column",gap:"12px",maxWidth:"400px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Title *"}),i.jsx("input",{type:"text",value:u,onChange:Se=>d(Se.target.value),required:!0,placeholder:"e.g. Home",style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Type"}),i.jsx("select",{value:f,onChange:Se=>h(Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"},children:zJ.map(Se=>i.jsx("option",{value:Se,children:Se},Se))})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Slug (optional)"}),i.jsx("input",{type:"text",value:p,onChange:Se=>y(Se.target.value),placeholder:"e.g. home",style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{style:{display:"flex",gap:"8px"},children:[i.jsx("button",{type:"submit",disabled:m||!u.trim(),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:m?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:m?"Saving…":"Create"}),i.jsx("button",{type:"button",onClick:()=>{c(!1),d(""),y("")},style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--foreground)",border:"1px solid var(--border)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"})]})]})]}),i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:a?i.jsx("div",{style:{padding:"24px",color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Loading pages…"}):n.length===0?i.jsx("div",{style:{padding:"32px"},children:i.jsx(SI,{icon:i.jsx(ud,{size:24}),title:"No pages yet",description:"Add one to get started."})}):i.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[i.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border)",background:"var(--secondary)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)"},children:["Click a page to edit sections, or use ",i.jsx("strong",{style:{color:"var(--foreground)"},children:"Visual builder"})," to open the GrapesJS editor in an iframe (run ",i.jsx("code",{style:{fontSize:"0.85em"},children:"website_builder"})," locally)."]}),n.map(Se=>{var ct;return i.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{w(Se._id),J("sections")},onKeyDown:gt=>{(gt.key==="Enter"||gt.key===" ")&&(gt.preventDefault(),w(Se._id),J("sections"))},style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px 16px",borderBottom:"1px solid var(--border)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:[i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:Se.title}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:Se.slug}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",textTransform:"capitalize"},children:Se.type}),((ct=Se.settings)==null?void 0:ct.isPublished)&&i.jsx("span",{style:{display:"inline-flex",padding:"2px 8px",borderRadius:"999px",background:"#dcfce7",color:"#15803d",fontSize:"10px",fontWeight:"600"},children:"Published"}),i.jsxs("button",{type:"button",onClick:gt=>{gt.stopPropagation(),w(Se._id),J("visual")},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",flexShrink:0},children:[i.jsx(Z3,{size:14})," Visual builder"]})]},Se._id)})]})})]}),i.jsx(C6e,{eventId:e,open:K,onOpenChange:G}),i.jsx(bie,{open:!!A,onOpenChange:Se=>{Se||F(null)},title:`Edit section: ${GB[V]??V}`,children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px",maxHeight:"70vh",overflowY:"auto"},children:[V==="header"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Logo text"}),i.jsx("input",{type:"text",value:String(L.logoText??""),onChange:Se=>nt("logoText",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Menu items (label, url)"}),(L.menuItems??[]).map((Se,ct)=>i.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"6px"},children:[i.jsx("input",{type:"text",placeholder:"Label",value:(Se==null?void 0:Se.label)??"",onChange:gt=>Ae("menuItems",ct,"label",gt.target.value),style:{flex:1,padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("input",{type:"text",placeholder:"URL",value:(Se==null?void 0:Se.url)??"",onChange:gt=>Ae("menuItems",ct,"url",gt.target.value),style:{flex:1,padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("button",{type:"button",onClick:()=>wt("menuItems",ct),style:{padding:"6px 10px",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:i.jsx(gn,{size:14})})]},ct)),i.jsx("button",{type:"button",onClick:()=>Te("menuItems",{label:"",url:"#"}),style:{padding:"6px 12px",fontSize:"var(--text-xs)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer"},children:"+ Add item"})]})]}),V==="banner"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Headline"}),i.jsx("input",{type:"text",value:String(L.headline??""),onChange:Se=>nt("headline",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Subtext"}),i.jsx("input",{type:"text",value:String(L.subtext??""),onChange:Se=>nt("subtext",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"CTA text"}),i.jsx("input",{type:"text",value:String(L.ctaText??""),onChange:Se=>nt("ctaText",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"CTA URL"}),i.jsx("input",{type:"text",value:String(L.ctaUrl??""),onChange:Se=>nt("ctaUrl",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Secondary CTA text"}),i.jsx("input",{type:"text",value:String(L.secondaryCtaText??""),onChange:Se=>nt("secondaryCtaText",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Secondary CTA URL"}),i.jsx("input",{type:"text",value:String(L.secondaryCtaUrl??""),onChange:Se=>nt("secondaryCtaUrl",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Background class (e.g. bg-primary)"}),i.jsx("input",{type:"text",value:String(L.backgroundClass??""),onChange:Se=>nt("backgroundClass",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),V==="contact_form"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(L.title??""),onChange:Se=>nt("title",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Submit button label"}),i.jsx("input",{type:"text",value:String(L.submitLabel??""),onChange:Se=>nt("submitLabel",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),V==="agenda"&&i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(L.title??""),onChange:Se=>nt("title",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),V==="register_links"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(L.title??""),onChange:Se=>nt("title",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Primary button label"}),i.jsx("input",{type:"text",value:String(L.primaryLabel??""),onChange:Se=>nt("primaryLabel",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Primary URL"}),i.jsx("input",{type:"text",value:String(L.primaryUrl??""),onChange:Se=>nt("primaryUrl",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Secondary button label"}),i.jsx("input",{type:"text",value:String(L.secondaryLabel??""),onChange:Se=>nt("secondaryLabel",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Secondary URL"}),i.jsx("input",{type:"text",value:String(L.secondaryUrl??""),onChange:Se=>nt("secondaryUrl",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),V==="speakers"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(L.title??""),onChange:Se=>nt("title",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Limit (number)"}),i.jsx("input",{type:"number",value:Number(L.limit??12),onChange:Se=>nt("limit",Se.target.value===""?12:parseInt(Se.target.value,10)||12),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),V==="footer"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Copyright text"}),i.jsx("input",{type:"text",value:String(L.copyrightText??""),onChange:Se=>nt("copyrightText",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Links (label, url)"}),(L.links??[]).map((Se,ct)=>i.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"6px"},children:[i.jsx("input",{type:"text",placeholder:"Label",value:(Se==null?void 0:Se.label)??"",onChange:gt=>Ae("links",ct,"label",gt.target.value),style:{flex:1,padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("input",{type:"text",placeholder:"URL",value:(Se==null?void 0:Se.url)??"",onChange:gt=>Ae("links",ct,"url",gt.target.value),style:{flex:1,padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("button",{type:"button",onClick:()=>wt("links",ct),style:{padding:"6px 10px",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:i.jsx(gn,{size:14})})]},ct)),i.jsx("button",{type:"button",onClick:()=>Te("links",{label:"",url:"#"}),style:{padding:"6px 12px",fontSize:"var(--text-xs)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer"},children:"+ Add link"})]})]}),V==="sponsors"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(L.title??""),onChange:Se=>nt("title",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Sponsors (name, logoUrl, url)"}),(L.sponsors??[]).map((Se,ct)=>i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"6px"},children:[i.jsx("input",{type:"text",placeholder:"Name",value:(Se==null?void 0:Se.name)??"",onChange:gt=>Ae("sponsors",ct,"name",gt.target.value),style:{flex:"1 1 120px",minWidth:"80px",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("input",{type:"text",placeholder:"Logo URL",value:(Se==null?void 0:Se.logoUrl)??"",onChange:gt=>Ae("sponsors",ct,"logoUrl",gt.target.value),style:{flex:"1 1 120px",minWidth:"80px",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("input",{type:"text",placeholder:"URL",value:(Se==null?void 0:Se.url)??"",onChange:gt=>Ae("sponsors",ct,"url",gt.target.value),style:{flex:"1 1 100px",minWidth:"80px",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("button",{type:"button",onClick:()=>wt("sponsors",ct),style:{padding:"6px 10px",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:i.jsx(gn,{size:14})})]},ct)),i.jsx("button",{type:"button",onClick:()=>Te("sponsors",{name:"",logoUrl:"",url:"#"}),style:{padding:"6px 12px",fontSize:"var(--text-xs)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer"},children:"+ Add sponsor"})]})]}),V==="cta"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Headline"}),i.jsx("input",{type:"text",value:String(L.headline??""),onChange:Se=>nt("headline",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Subtext"}),i.jsx("input",{type:"text",value:String(L.subtext??""),onChange:Se=>nt("subtext",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Button label"}),i.jsx("input",{type:"text",value:String(L.buttonLabel??""),onChange:Se=>nt("buttonLabel",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Button URL"}),i.jsx("input",{type:"text",value:String(L.buttonUrl??""),onChange:Se=>nt("buttonUrl",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),V==="custom_html"&&i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"HTML"}),i.jsx("textarea",{value:String(L.html??""),onChange:Se=>nt("html",Se.target.value),rows:8,style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"monospace"}})]}),V==="countdown"&&i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Countdown heading line"}),i.jsx("input",{type:"text",value:String(L.headingLine??""),onChange:Se=>nt("headingLine",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),V==="gallery"&&i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(L.title??""),onChange:Se=>nt("title",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),V==="about"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(L.title??""),onChange:Se=>nt("title",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Lead paragraph"}),i.jsx("textarea",{value:String(L.lead??""),onChange:Se=>nt("lead",Se.target.value),rows:3,style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Bullets title"}),i.jsx("input",{type:"text",value:String(L.bulletsTitle??""),onChange:Se=>nt("bulletsTitle",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"CTA label"}),i.jsx("input",{type:"text",value:String(L.ctaLabel??""),onChange:Se=>nt("ctaLabel",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"CTA URL"}),i.jsx("input",{type:"text",value:String(L.ctaUrl??""),onChange:Se=>nt("ctaUrl",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),V==="venue"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(L.title??""),onChange:Se=>nt("title",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Venue name"}),i.jsx("input",{type:"text",value:String(L.venueName??""),onChange:Se=>nt("venueName",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Intro"}),i.jsx("textarea",{value:String(L.intro??""),onChange:Se=>nt("intro",Se.target.value),rows:3,style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Map embed URL"}),i.jsx("input",{type:"text",value:String(L.mapEmbedUrl??""),onChange:Se=>nt("mapEmbedUrl",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),V==="faq"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(L.title??""),onChange:Se=>nt("title",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Contact email"}),i.jsx("input",{type:"text",value:String(L.contactEmail??""),onChange:Se=>nt("contactEmail",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),V==="tickets"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(L.title??""),onChange:Se=>nt("title",Se.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Intro"}),i.jsx("textarea",{value:String(L.intro??""),onChange:Se=>nt("intro",Se.target.value),rows:2,style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),i.jsxs("div",{style:{display:"flex",gap:"8px",marginTop:"8px"},children:[i.jsx("button",{type:"button",onClick:Ot,disabled:U,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:U?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:U?"Saving…":"Save"}),i.jsx("button",{type:"button",onClick:()=>F(null),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--foreground)",border:"1px solid var(--border)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"})]})]})})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Event Website"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2"},children:"Event Website"})]}),i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"32px"},children:i.jsx(SI,{icon:i.jsx(ud,{size:24}),title:"Select an event",description:"Choose an event from the sidebar to build and manage its website pages."})})]})}const Zl={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"},QB={...Zl,cursor:"pointer",appearance:"none",paddingRight:"32px"},wl=e=>{e.currentTarget.style.borderColor="var(--primary)",e.currentTarget.style.boxShadow="0 0 0 2px rgba(11,77,209,0.12)"},Sl=e=>{e.currentTarget.style.borderColor="var(--border)",e.currentTarget.style.boxShadow="none"};function Po({text:e,required:t}){return i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",marginBottom:"5px"},children:[t&&i.jsx("span",{style:{color:"var(--destructive)",marginRight:"3px"},children:"*"}),e]})}function ky({text:e}){return i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0",display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("span",{style:{fontSize:"10px"},children:"ℹ"})," ",e]})}function Ko({children:e,span2:t,error:r}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gridColumn:t?"1 / -1":void 0},children:[e,r?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:"5px 0 0",lineHeight:1.35},children:r}):null]})}function t3({children:e,cols:t=2}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"12px"},children:e})}function XB({children:e}){return i.jsxs("div",{style:{position:"relative"},children:[e,i.jsx(po,{size:13,style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}})]})}function _y({name:e,value:t,onChange:r,options:n}){return i.jsx("div",{style:{display:"flex",gap:"20px",alignItems:"center",paddingTop:"2px"},children:n.map(o=>i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",fontWeight:"var(--font-weight-normal)"},children:[i.jsx("input",{type:"radio",name:e,value:o.value,checked:t===o.value,onChange:()=>r(o.value),style:{accentColor:"var(--primary)",width:"16px",height:"16px",cursor:"pointer"}}),o.label]},o.value))})}const F6e=2*1024*1024,EQ="image/jpeg,image/png,image/webp,image/gif";function M6e(e){return e.type&&EQ.split(",").includes(e.type)?!0:/\.(jpe?g|png|webp|gif)$/i.test(e.name)}function D6e({preview:e,onChange:t,eventId:r}){const n=j.useRef(null),[o,a]=j.useState(!1),[s,l]=j.useState(null),c=async d=>{if(l(null),!M6e(d)){l("Use a JPG, PNG, WEBP, or GIF image.");return}if(d.size>F6e){l("Image must be 2 MB or smaller.");return}a(!0);try{const f=await Ys(d,{...r!=null&&r.trim()?{eventId:r.trim()}:{},module:"speakers/photo"});if(f!=null&&f.url)t(f.url);else throw new Error("Upload did not return a URL")}catch(f){l(f instanceof Error?f.message:"Upload failed")}finally{a(!1)}},u=d=>{d&&c(d)};return i.jsxs("div",{onClick:()=>{var d;o||(d=n.current)==null||d.click()},onDragOver:d=>d.preventDefault(),onDrop:d=>{if(d.preventDefault(),o)return;const f=d.dataTransfer.files[0];u(f)},style:{border:"1.5px dashed var(--primary)",borderRadius:"var(--radius-button)",background:"var(--secondary)",padding:"20px 12px",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",cursor:o?"wait":"pointer",transition:"background 0.15s",opacity:o?.85:1},onMouseEnter:d=>{o||(d.currentTarget.style.background="var(--accent)")},onMouseLeave:d=>{d.currentTarget.style.background="var(--secondary)"},children:[i.jsx("input",{ref:n,type:"file",accept:EQ,style:{display:"none"},disabled:o,onChange:d=>{var h;const f=(h=d.target.files)==null?void 0:h[0];d.target.value="",u(f)}}),e?i.jsx("img",{src:e,alt:"Speaker photo",style:{width:64,height:64,borderRadius:"50%",objectFit:"cover",border:"2px solid var(--primary)"}}):i.jsx("div",{style:{width:56,height:56,borderRadius:"50%",background:"var(--border)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(ou,{size:22,style:{color:"var(--primary)"}})}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",textAlign:"center",margin:0},children:o?"Uploading…":i.jsxs(i.Fragment,{children:["Drag and drop or"," ",i.jsx("span",{style:{color:"var(--primary)",textDecoration:"underline"},children:"choose a file"}),". Files are stored on S3 and served via CDN."]})}),e&&!o&&i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--primary)"},children:"Click to change photo"}),s?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:0,textAlign:"center"},children:s}):null]})}function r3({icon:e,placeholder:t,value:r,onChange:n}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"var(--muted)"},children:e}),i.jsx("input",{style:{...Zl,flex:1,width:"auto"},placeholder:t,value:r,onChange:o=>n(o.target.value),onFocus:wl,onBlur:Sl})]})}function z6e({n:e,state:t}){return i.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:t==="todo"?"var(--muted)":"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t==="done"?i.jsx(Oi,{size:13,style:{color:"#fff"}}):i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",color:"#fff",fontWeight:"var(--font-weight-medium)"},children:e})})}function n3({n:e,title:t,subtitle:r,open:n,completed:o,onToggle:a,children:s,onSave:l,nextLabel:c,isLast:u,nextDisabled:d}){const f=n?"active":o?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{onClick:a,style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(z6e,{n:e,state:f}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:n?"var(--primary)":"var(--card-foreground)",margin:0},children:t}),!n&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:r})]}),n?i.jsx($f,{size:18,style:{color:"var(--muted)",flexShrink:0}}):i.jsx(po,{size:18,style:{color:"var(--muted)",flexShrink:0}})]}),n&&i.jsxs("div",{style:{padding:"0 20px 16px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 12px 40px"},children:r}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:s}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"12px",marginTop:"20px",paddingTop:"14px",borderTop:"1px solid var(--border)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--primary)"},children:[i.jsx(Oi,{size:12})," Saved"]}),i.jsx("button",{type:"button",disabled:d,onClick:l,style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 18px",borderRadius:"var(--radius-button)",background:d?"var(--secondary)":"var(--primary)",color:d?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:d?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:c})]})]})]})}const B6e={fullName:"",title:"",specialisation:"",organisation:"",email:"",phone:"",photo:null,bio:"",website:"",linkedin:"",twitter:"",role:"Speaker",visibility:"Public",featured:"No",honorarium:"No",honorariumAmount:"",travelRequired:"No",accommodation:"No",dietaryRequirements:"",notes:""};function W6e(e){const t=e.trim().split(/\s+/);return t.length===0?{firstName:"",lastName:""}:t.length===1?{firstName:t[0],lastName:""}:{firstName:t[0],lastName:t.slice(1).join(" ")}}const Cy=["fullName","title","specialisation","organisation","email","role"];function ZB(e){const t={};return e.fullName.trim()||(t.fullName="Full name is required."),e.title||(t.title="Please select a title."),e.specialisation.trim()||(t.specialisation="Specialisation is required."),e.organisation.trim()||(t.organisation="Organisation / Institution is required."),e.email.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.email.trim())||(t.email="Enter a valid email address."):t.email="Email is required.",e.role||(t.role="Please select a speaker role."),t}function JB(e){const t={};return e.bio.trim()||(t.bio="Bio is required."),t}function Ey(e,t){const r={...e};return t.forEach(n=>{delete r[n]}),r}function q6e({onClose:e,speakerId:t,onSuccess:r,eventId:n}){const{user:o}=Ur(),a=o!=null&&o.organization&&typeof o.organization=="object"&&"_id"in o.organization?String(o.organization._id):o!=null&&o.organization?String(o.organization):void 0,s=!!t,[l,c]=j.useState(1),[u,d]=j.useState(new Set),[f,h]=j.useState(B6e),[p,y]=j.useState(!1),[m,x]=j.useState({}),[b,w]=j.useState(!1),[k,S]=j.useState(!1);j.useEffect(()=>{t&&Ef.get(t).then(z=>{var V,Q,U,ee,H;if(z.data){const B=z.data,M=B.logistics;h({fullName:`${B.firstName} ${B.lastName}`.trim(),title:B.title??"",specialisation:((V=B.expertise)==null?void 0:V[0])??"",organisation:B.organizationName??"",email:B.email,phone:B.phone??"",photo:B.photo??null,bio:B.bio??"",website:((Q=B.socialLinks)==null?void 0:Q.website)??"",linkedin:((U=B.socialLinks)==null?void 0:U.linkedin)??"",twitter:((ee=B.socialLinks)==null?void 0:ee.twitter)??"",role:((H=B.speakerRole)==null?void 0:H.trim())||"Speaker",visibility:B.profileVisibility==="private"?"Private":"Public",featured:B.isFeatured?"Yes":"No",honorarium:M!=null&&M.honorarium?"Yes":"No",honorariumAmount:(M==null?void 0:M.honorariumAmount)!=null?String(M.honorariumAmount):"",travelRequired:M!=null&&M.travelRequired?"Yes":"No",accommodation:M!=null&&M.accommodation?"Yes":"No",dietaryRequirements:(M==null?void 0:M.dietaryRequirements)??"",notes:(M==null?void 0:M.internalNotes)??""}),d(new Set([1,2,3]))}})},[t]),j.useEffect(()=>{if(!b)return;const z=ZB(f);Object.keys(z).length===0?x(V=>Ey(V,Cy)):x(V=>({...Ey(V,Cy),...z}))},[f.fullName,f.email,f.title,f.specialisation,f.organisation,f.role,b]),j.useEffect(()=>{if(!k)return;const z=JB(f);Object.keys(z).length===0?x(V=>{const Q={...V};return delete Q.bio,Q}):x(V=>({...V,bio:z.bio}))},[f.bio,k]);const _=3,P=u.size,O=Math.round(P/_*100),T=(z,V)=>h(Q=>({...Q,[z]:V})),R=z=>{d(V=>new Set([...V,z])),z===1&&x(V=>Ey(V,Cy)),z===2&&x(V=>{const Q={...V};return delete Q.bio,Q}),z<_&&c(z+1)},I=z=>{if(z===1){const V=ZB(f);if(Object.keys(V).length){w(!0),x(U=>({...Ey(U,Cy),...V}));return}w(!1),x(U=>Ey(U,Cy)),R(1);return}if(z===2){const V=JB(f);if(Object.keys(V).length){S(!0),x(Q=>({...Q,...V}));return}S(!1),x(Q=>{const U={...Q};return delete U.bio,U}),R(2)}},E=()=>{x(z=>{const V={...z};return delete V._submit,V}),R(3),L()},A=z=>c(V=>V===z?0:z),F=!p&&!!f.fullName.trim()&&!!f.email.trim(),L=async()=>{const{firstName:z,lastName:V}=W6e(f.fullName);if(!z.trim()||!f.email.trim())return;y(!0);const Q={firstName:z,lastName:V,email:f.email.trim(),phone:f.phone||void 0,title:f.title||void 0,organizationName:f.organisation||void 0,bio:f.bio||void 0,photo:f.photo||void 0,socialLinks:f.website||f.linkedin||f.twitter?{website:f.website||void 0,linkedin:f.linkedin||void 0,twitter:f.twitter||void 0}:void 0,expertise:f.specialisation?[f.specialisation]:void 0,isFeatured:f.featured==="Yes",speakerRole:f.role.trim()||void 0,profileVisibility:f.visibility==="Private"?"private":"public",logistics:{honorarium:f.honorarium==="Yes",honorariumAmount:f.honorariumAmount.trim()||"",travelRequired:f.travelRequired==="Yes",accommodation:f.accommodation==="Yes",dietaryRequirements:f.dietaryRequirements.trim()||"",internalNotes:f.notes.trim()||""}};(o==null?void 0:o.role)==="super_admin"&&a&&(Q.organization=a);const U=s&&t?await Ef.update(t,Q):await Ef.create(Q);y(!1),U.error?(x(ee=>({...ee,_submit:U.error||"Could not save. Please try again."})),c(3)):(r==null||r(),e())};return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:e,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.50)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(560px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.20)",animation:"spSlideIn 0.25s cubic-bezier(0.4,0,0.2,1)"},children:[i.jsx("style",{children:` - @keyframes spSlideIn { - from { transform: translateX(100%); opacity: 0.6; } - to { transform: translateX(0); opacity: 1; } - } - `}),i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0,background:"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:"14px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 3px"},children:"Faculty & Speakers"}),i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:s?"Edit Speaker":"Add Speaker"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"5px 0 0"},children:["Add a speaker's details and manage logistics. Fields marked with ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})," are required."]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{onClick:e,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:z=>{z.currentTarget.style.borderColor="var(--destructive)",z.currentTarget.style.color="var(--destructive)"},onMouseLeave:z=>{z.currentTarget.style.borderColor="var(--border)",z.currentTarget.style.color="var(--muted)"},children:i.jsx(er,{size:14})}),i.jsx("button",{type:"button",disabled:!F,onClick:L,style:{padding:"6px 16px",borderRadius:"var(--radius-button)",background:F?"var(--primary)":"var(--secondary)",color:F?"var(--primary-foreground)":"var(--muted)",border:"none",cursor:F?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",transition:"background 0.2s"},children:p?"Saving…":s?"Save changes":"Save Speaker"})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[P," of ",_," sections complete"]}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:[O,"%"]})]}),i.jsx("div",{style:{height:"6px",borderRadius:"99px",background:"var(--border)",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${O}%`,background:O===100?"#22c55e":"var(--primary)",borderRadius:"99px",transition:"width 0.35s ease"}})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[i.jsx(n3,{n:1,title:"Personal Information",subtitle:"Name, contact, role on programme, and profile visibility",open:l===1,completed:u.has(1),onToggle:()=>A(1),onSave:()=>I(1),nextLabel:"Profile & Media",children:i.jsxs(t3,{cols:2,children:[i.jsxs(Ko,{error:m.fullName,children:[i.jsx(Po,{text:"Full Name",required:!0}),i.jsx("input",{style:{...Zl,...m.fullName?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. Dr. Rajesh Sharma",value:f.fullName,onChange:z=>T("fullName",z.target.value),onFocus:wl,onBlur:Sl})]}),i.jsxs(Ko,{error:m.title,children:[i.jsx(Po,{text:"Title / Designation",required:!0}),i.jsx(XB,{children:i.jsxs("select",{style:{...QB,...m.title?{borderColor:"var(--destructive)"}:{}},value:f.title,onChange:z=>T("title",z.target.value),onFocus:wl,onBlur:Sl,children:[i.jsx("option",{value:"",children:"Select Title"}),i.jsx("option",{children:"Dr."}),i.jsx("option",{children:"Prof."}),i.jsx("option",{children:"Mr."}),i.jsx("option",{children:"Ms."}),i.jsx("option",{children:"Mrs."})]})})]}),i.jsxs(Ko,{error:m.specialisation,children:[i.jsx(Po,{text:"Specialisation",required:!0}),i.jsx("input",{style:{...Zl,...m.specialisation?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. Pulmonologist",value:f.specialisation,onChange:z=>T("specialisation",z.target.value),onFocus:wl,onBlur:Sl})]}),i.jsxs(Ko,{error:m.organisation,children:[i.jsx(Po,{text:"Organisation / Institution",required:!0}),i.jsx("input",{style:{...Zl,...m.organisation?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. AIIMS Delhi",value:f.organisation,onChange:z=>T("organisation",z.target.value),onFocus:wl,onBlur:Sl})]}),i.jsxs(Ko,{error:m.email,children:[i.jsx(Po,{text:"Email Address",required:!0}),i.jsx("input",{type:"email",style:{...Zl,...m.email?{borderColor:"var(--destructive)"}:{}},placeholder:"name@institution.org",value:f.email,onChange:z=>T("email",z.target.value),onFocus:wl,onBlur:Sl})]}),i.jsxs(Ko,{children:[i.jsx(Po,{text:"Phone Number"}),i.jsx("input",{type:"tel",style:Zl,placeholder:"+91 98765 43210",value:f.phone,onChange:z=>T("phone",z.target.value),onFocus:wl,onBlur:Sl})]}),i.jsxs(Ko,{error:m.role,children:[i.jsx(Po,{text:"Speaker Role",required:!0}),i.jsx(XB,{children:i.jsxs("select",{style:{...QB,...m.role?{borderColor:"var(--destructive)"}:{}},value:f.role,onChange:z=>T("role",z.target.value),onFocus:wl,onBlur:Sl,children:[i.jsx("option",{value:"",children:"Select Role"}),i.jsx("option",{children:"Speaker"}),i.jsx("option",{children:"Keynote Speaker"}),i.jsx("option",{children:"Moderator"}),i.jsx("option",{children:"Panelist"}),i.jsx("option",{children:"Chair"}),i.jsx("option",{children:"Co-Chair"}),i.jsx("option",{children:"Workshop Leader"})]})})]}),i.jsxs(Ko,{children:[i.jsx(Po,{text:"Profile Visibility",required:!0}),i.jsx(_y,{name:"visibility",value:f.visibility,onChange:z=>T("visibility",z),options:[{label:"Public",value:"Public"},{label:"Private",value:"Private"}]}),i.jsx(ky,{text:"Public speakers appear on the event website."})]}),i.jsxs(Ko,{span2:!0,children:[i.jsx(Po,{text:"Featured Speaker"}),i.jsx(_y,{name:"featured",value:f.featured,onChange:z=>T("featured",z),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]}),i.jsx(ky,{text:"Featured speakers appear on the event homepage."})]})]})}),i.jsxs(n3,{n:2,title:"Profile & Media",subtitle:"Upload a photo, write a bio, and add social links",open:l===2,completed:u.has(2),onToggle:()=>A(2),onSave:()=>I(2),nextLabel:"Logistics",children:[i.jsxs(t3,{cols:2,children:[i.jsxs(Ko,{children:[i.jsx(Po,{text:"Profile Photo"}),i.jsx(D6e,{preview:f.photo,onChange:z=>T("photo",z),eventId:n??void 0}),i.jsx(ky,{text:"JPG, PNG, WEBP or GIF · Max 2 MB · Square crop recommended · Uploaded via media API (S3 / CDN)"})]}),i.jsxs(Ko,{error:m.bio,children:[i.jsx(Po,{text:"Bio",required:!0}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("textarea",{style:{...Zl,resize:"vertical",minHeight:"112px",paddingBottom:"22px",...m.bio?{borderColor:"var(--destructive)"}:{}},placeholder:"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",value:f.bio,maxLength:400,onChange:z=>T("bio",z.target.value),onFocus:wl,onBlur:Sl}),i.jsxs("span",{style:{position:"absolute",bottom:"7px",right:"10px",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:f.bio.length>360?"var(--destructive)":"var(--muted)"},children:[f.bio.length,"/400"]})]}),i.jsx(ky,{text:"A short professional bio visible to attendees."})]})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[i.jsx(Po,{text:"Social & Web Links"}),i.jsx(r3,{icon:i.jsx(ud,{size:14}),placeholder:"https://personal-website.com",value:f.website,onChange:z=>T("website",z)}),i.jsx(r3,{icon:i.jsx(rte,{size:14}),placeholder:"linkedin.com/in/username",value:f.linkedin,onChange:z=>T("linkedin",z)}),i.jsx(r3,{icon:i.jsx(ere,{size:14}),placeholder:"twitter.com/handle",value:f.twitter,onChange:z=>T("twitter",z)})]})]}),i.jsx(n3,{n:3,title:"Logistics",subtitle:"Manage honorarium, travel, and special requirements",open:l===3,completed:u.has(3),onToggle:()=>A(3),onSave:E,nextLabel:"Save Speaker",nextDisabled:!F,isLast:!0,children:i.jsxs(t3,{cols:2,children:[i.jsxs(Ko,{children:[i.jsx(Po,{text:"Honorarium",required:!0}),i.jsx(_y,{name:"honorarium",value:f.honorarium,onChange:z=>T("honorarium",z),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),f.honorarium==="Yes"&&i.jsxs(Ko,{children:[i.jsx(Po,{text:"Amount (₹)"}),i.jsx("input",{type:"number",style:Zl,placeholder:"0.00",value:f.honorariumAmount,onChange:z=>T("honorariumAmount",z.target.value),onFocus:wl,onBlur:Sl})]}),i.jsxs(Ko,{children:[i.jsx(Po,{text:"Travel Required",required:!0}),i.jsx(_y,{name:"travel",value:f.travelRequired,onChange:z=>T("travelRequired",z),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(Ko,{children:[i.jsx(Po,{text:"Accommodation",required:!0}),i.jsx(_y,{name:"accommodation",value:f.accommodation,onChange:z=>T("accommodation",z),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(Ko,{span2:!0,children:[i.jsx(Po,{text:"Dietary / Special Requirements"}),i.jsx("input",{style:Zl,placeholder:"e.g. Vegetarian, Gluten-free, Wheelchair access…",value:f.dietaryRequirements,onChange:z=>T("dietaryRequirements",z.target.value),onFocus:wl,onBlur:Sl})]}),i.jsxs(Ko,{span2:!0,children:[i.jsx(Po,{text:"Internal Notes"}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("textarea",{style:{...Zl,resize:"vertical",minHeight:"72px",paddingBottom:"22px"},placeholder:"Internal notes visible only to organisers…",value:f.notes,maxLength:300,onChange:z=>T("notes",z.target.value),onFocus:wl,onBlur:Sl}),i.jsxs("span",{style:{position:"absolute",bottom:"7px",right:"10px",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[f.notes.length,"/300"]})]}),i.jsx(ky,{text:"Not visible to attendees or the speaker."})]}),m._submit&&i.jsx("div",{style:{gridColumn:"1 / -1"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:"4px 0 0",lineHeight:1.35},children:m._submit})})]})})]})]})]})}const AQ=["Status","Tag","Event"],$6e=["is","is not"],TQ=[{label:"Pending",value:"pending"},{label:"Confirmed",value:"confirmed"},{label:"Checked In",value:"checked_in"},{label:"Cancelled",value:"cancelled"}],e9=()=>({listName:"",description:"",rules:[{id:`r-${Math.random().toString(36).slice(2)}`,field:"Status",operator:"is",value:"pending"}],conjunction:"AND",visibility:"Private",autoUpdate:"Yes"});function PQ(e){return`rule-${e}-${Math.random().toString(36).slice(2,10)}`}function U6e(e,t){const r=String(e.field??"Status"),n=AQ.includes(r)?r:"Status",a=String(e.operator??"is").trim().toLowerCase()==="is not"?"is not":"is";let s=String(e.value??"");return n==="Status"&&(TQ.some(c=>c.value===s)||(s="pending")),{id:PQ(t),field:n,operator:a,value:s}}function i3(e){const t=e.rules,r=Array.isArray(t==null?void 0:t.rules)?t.rules:[],n=r.length?r.map((o,a)=>U6e(o,a)):[{id:PQ(0),field:"Status",operator:"is",value:"pending"}];return{listName:e.name,description:e.description??"",rules:n,conjunction:(t==null?void 0:t.conjunction)==="OR"?"OR":"AND",visibility:e.visibility==="shared"?"Shared":"Private",autoUpdate:e.autoUpdate!==!1?"Yes":"No"}}function OQ({onClose:e,onCreated:t,onSaved:r,editList:n=null}){const{user:o}=Ur(),a=zn(o),s=3,l=mc(s),c=(n==null?void 0:n.type)==="rule_based",[u,d]=j.useState(()=>c&&n?i3(n):e9()),f=(F,L)=>d(z=>({...z,[F]:L})),[h,p]=j.useState([]),[y,m]=j.useState([]),[x,b]=j.useState(!0),[w,k]=j.useState(!1),[S,_]=j.useState(null);j.useEffect(()=>{let F=!1;if(!a){b(!1);return}return b(!0),Promise.all([Ei.listDistinctTags({organization:a}),zr.list({limit:400,organization:a})]).then(([L,z])=>{var V,Q;F||((V=L.data)!=null&&V.tags&&p(L.data.tags),(Q=z.data)!=null&&Q.events&&m(z.data.events),b(!1))}).catch(()=>{F||b(!1)}),()=>{F=!0}},[a]),j.useEffect(()=>{if(!n||n.type!=="rule_based"){d(e9());return}d(i3(n));let F=!1;return Fa.get(n._id).then(L=>{if(F||L.error||!L.data)return;const z=L.data;z.type==="rule_based"&&d(i3(z))}),()=>{F=!0}},[n==null?void 0:n._id]),j.useEffect(()=>{h.length&&d(F=>({...F,rules:F.rules.map(L=>L.field!=="Tag"||L.value&&h.includes(L.value)?L:{...L,value:h[0]})}))},[h]),j.useEffect(()=>{y.length&&d(F=>({...F,rules:F.rules.map(L=>L.field!=="Event"||L.value&&y.some(z=>z._id===L.value)?L:{...L,value:y[0]._id})}))},[y]);const P=()=>d(F=>({...F,rules:[...F.rules,{id:Math.random().toString(36).slice(2),field:"Status",operator:"is",value:"pending"}]})),O=F=>d(L=>({...L,rules:L.rules.filter(z=>z.id!==F)})),T=(F,L,z)=>d(V=>({...V,rules:V.rules.map(Q=>Q.id===F?{...Q,[L]:z}:Q)})),R=(F,L)=>{let z="";L==="Status"?z="pending":L==="Tag"&&h[0]?z=h[0]:L==="Event"&&y[0]&&(z=y[0]._id),d(V=>({...V,rules:V.rules.map(Q=>Q.id===F?{...Q,field:L,operator:"is",value:z}:Q)}))},I=F=>{if(F.field==="Status")return i.jsx("select",{style:Nr,value:F.value||"pending",onChange:L=>T(F.id,"value",L.target.value),onFocus:kt,onBlur:_t,children:TQ.map(L=>i.jsx("option",{value:L.value,children:L.label},L.value))});if(F.field==="Tag"){if(x)return i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading tags…"});if(h.length===0)return i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"No tags yet. Add tags to participants first."});const L=F.value&&h.includes(F.value)?F.value:h[0];return i.jsx("select",{style:Nr,value:L,onChange:z=>T(F.id,"value",z.target.value),onFocus:kt,onBlur:_t,children:h.map(z=>i.jsx("option",{value:z,children:z},z))})}if(F.field==="Event"){if(x)return i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading events…"});if(y.length===0)return i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"No events available."});const L=F.value&&y.some(z=>z._id===F.value)?F.value:y[0]._id;return i.jsx("select",{style:Nr,value:L,onChange:z=>T(F.id,"value",z.target.value),onFocus:kt,onBlur:_t,children:y.map(z=>i.jsx("option",{value:z._id,children:z.name},z._id))})}return null},E=async()=>{if(_(null),!u.listName.trim()){_("List name is required.");return}if(u.rules.some(L=>L.field==="Tag"&&!h.length||L.field==="Event"&&!y.length)){_("Each rule needs a valid value. Add tags or events, or adjust rules.");return}k(!0);try{const L={rules:u.rules.map(({field:z,operator:V,value:Q})=>({field:z,operator:V,value:Q})),conjunction:u.conjunction};if(c&&n){const z=await Fa.update(n._id,{name:u.listName.trim(),description:u.description.trim(),visibility:u.visibility==="Shared"?"shared":"private",type:"rule_based",autoUpdate:u.autoUpdate==="Yes",rules:L});if(z.error){_(z.error||"Could not update list."),k(!1);return}z.data&&(r==null||r(z.data)),e()}else{const z=await Fa.create({name:u.listName.trim(),description:u.description.trim(),visibility:u.visibility==="Shared"?"shared":"private",type:"rule_based",autoUpdate:u.autoUpdate==="Yes",rules:L});if(z.error){_(z.error||"Could not create list."),k(!1);return}t==null||t(),e()}}catch{_(c?"Could not update list.":"Could not create list.")}k(!1)},A=c?"Save changes":"Create List";return i.jsxs(Zo,{onClose:e,title:c?"Edit Custom List":"Create Custom List",breadcrumb:"Participants · Custom Lists",description:c?"Update name, rules, and settings for this list. Fields marked * are required.":"Build a smart filtered list from your participant database. Fields marked * are required.",completedCount:l.done.size,totalSections:s,ctaLabel:w?"Saving…":A,ctaDisabled:w,onCtaClick:E,children:[S&&i.jsx("p",{style:{margin:"0 20px 12px",fontSize:"var(--text-sm)",color:"var(--destructive)",fontFamily:"var(--font-noto-sans)"},children:S}),i.jsxs($r,{n:1,title:"List Details",subtitle:"Name and describe your custom list",open:l.open===1,completed:l.done.has(1),onToggle:()=>l.toggle(1),onSave:()=>l.advance(1),nextLabel:"Filter Rules",children:[i.jsxs(lt,{children:[i.jsx(pt,{text:"List Name",required:!0}),i.jsx("input",{style:$t,placeholder:"e.g. VIP Delegates — NAPCON 2026",value:u.listName,onChange:F=>f("listName",F.target.value),onFocus:kt,onBlur:_t})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Description"}),i.jsx("textarea",{style:{...$t,resize:"vertical",minHeight:"72px"},placeholder:"Briefly describe who this list is for…",value:u.description,onChange:F=>f("description",F.target.value),onFocus:kt,onBlur:_t})]})]}),i.jsxs($r,{n:2,title:"Filter Rules",subtitle:"Define conditions to automatically populate this list",open:l.open===2,completed:l.done.has(2),onToggle:()=>l.toggle(2),onSave:()=>l.advance(2),nextLabel:"Settings",children:[u.rules.length>1&&i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center",marginBottom:"4px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Match"}),["AND","OR"].map(F=>i.jsx("button",{type:"button",onClick:()=>f("conjunction",F),style:{padding:"4px 12px",borderRadius:"var(--radius-button)",border:`1px solid ${u.conjunction===F?"var(--primary)":"var(--border)"}`,background:u.conjunction===F?"var(--accent)":"transparent",color:u.conjunction===F?"var(--primary)":"var(--muted)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:F},F)),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"of the following rules"})]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:u.rules.map((F,L)=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr auto",gap:"8px",alignItems:"center",padding:"10px 12px",background:"var(--secondary)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)"},children:[L>0&&i.jsx("span",{style:{gridColumn:"1/-1",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)"},children:u.conjunction}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:Nr,value:F.field,onChange:z=>R(F.id,z.target.value),onFocus:kt,onBlur:_t,children:AQ.map(z=>i.jsx("option",{value:z,children:z},z))})}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:Nr,value:F.operator,onChange:z=>T(F.id,"operator",z.target.value),onFocus:kt,onBlur:_t,children:$6e.map(z=>i.jsx("option",{value:z,children:z},z))})}),i.jsx("div",{style:{position:"relative",minWidth:0},children:I(F)}),i.jsx("button",{type:"button",onClick:()=>O(F.id),disabled:u.rules.length===1,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:u.rules.length===1?"var(--muted-foreground)":"var(--destructive)",cursor:u.rules.length===1?"not-allowed":"pointer"},children:i.jsx(gn,{size:13})})]},F.id))}),i.jsxs("button",{type:"button",onClick:P,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px dashed var(--primary)",background:"transparent",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:13})," Add Rule"]}),i.jsx(Qt,{text:"Status, Tag, and Event use lists from your organization. Tag options come from participant tags; Event from your events."})]}),i.jsx($r,{n:3,title:"Settings",subtitle:"Configure visibility and update behaviour",open:l.open===3,completed:l.done.has(3),onToggle:()=>l.toggle(3),onSave:()=>void E(),nextLabel:A,nextDisabled:w,children:i.jsxs(Zi,{cols:2,children:[i.jsxs(lt,{children:[i.jsx(pt,{text:"Visibility",required:!0}),i.jsx(go,{name:"clVisibility",value:u.visibility,onChange:F=>f("visibility",F),options:[{label:"Private",value:"Private"},{label:"Shared",value:"Shared"}]}),i.jsx(Qt,{text:"Shared lists are visible to all admins."})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Auto Update",required:!0}),i.jsx(go,{name:"clAutoUpdate",value:u.autoUpdate,onChange:F=>f("autoUpdate",F),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]}),i.jsx(Qt,{text:"Recompute rule-based members when you open the list."})]})]})})]})}function H6e({onClose:e,onSuccess:t}){var E;const{user:r}=Ur(),n=zn(r),[o,a]=j.useState(""),[s,l]=j.useState(null),[c,u]=j.useState([]),[d,f]=j.useState(new Set),[h,p]=j.useState(!1),[y,m]=j.useState(""),[x,b]=j.useState(""),[w,k]=j.useState(!1),[S,_]=j.useState(null),P=!!((E=r==null?void 0:r.organization)!=null&&E._id||r!=null&&r.organization);j.useEffect(()=>{n&&zr.list({limit:400,organization:n}).then(A=>{var F;(F=A.data)!=null&&F.events&&u(A.data.events)})},[n]);const O=A=>{f(F=>{const L=new Set(F);return L.has(A)?L.delete(A):L.add(A),L})},T=A=>{var L;const F=(L=A.target.files)==null?void 0:L[0];F&&(_(null),F.text().then(z=>{a(z),l(F.name)}).catch(()=>_("Could not read file.")),A.target.value="")},R=j.useCallback(async()=>{if(_(null),!P){_("Your account must belong to an organization.");return}if(!o.trim()){_("Choose a CSV file first.");return}if(h&&!y.trim()){_("Enter a list name for the custom list.");return}k(!0);const A=await Ei.importGlobal({csv:o,eventIds:[...d],createCustomList:h,listName:h?y.trim():void 0,listDescription:h?x.trim():void 0});if(k(!1),A.error){_(A.error);return}const F=A.data,L=[(F==null?void 0:F.participantsCreated)!=null?`${F.participantsCreated} new participant(s)`:null,F!=null&&F.membershipsAdded?`${F.membershipsAdded} event membership(s) added`:null,F!=null&&F.profilesUpdated?`${F.profilesUpdated} profile(s) updated`:null].filter(Boolean);let z=L.length?L.join(" · "):"Import finished.";F!=null&&F.skippedDuplicate&&(z+=` · Skipped duplicate membership(s): ${F.skippedDuplicate}.`),F!=null&&F.failed&&(z+=` · Failed rows: ${F.failed}.`),h&&(F!=null&&F.listId)&&(z+=` Custom list created (${F.listRows??0} rows, ${F.listLinked??0} linked).`),t(z),e()},[o,d,h,y,x,P,e,t]),I=w||!o.trim()||!P||h&&!y.trim();return i.jsx(Zo,{onClose:e,title:"Import participants",breadcrumb:"Participants · Import",description:"Upload a CSV (same columns as event import). Everyone is added under your organization. Optionally attach rows to events and/or save a fixed custom list from this file.",completedCount:o.trim()?1:0,totalSections:1,ctaLabel:w?"Importing…":"Import",ctaDisabled:I,onCtaClick:R,children:i.jsxs("div",{style:{padding:"0 20px 24px",display:"flex",flexDirection:"column",gap:"16px"},children:[S&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0,fontFamily:"var(--font-noto-sans)"},children:S}),!P&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0,fontFamily:"var(--font-noto-sans)"},children:"Your account is not linked to an organization; imports cannot be scoped."}),i.jsxs(lt,{children:[i.jsx(pt,{text:"CSV file",required:!0}),i.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"10px 14px",borderRadius:"var(--radius-button)",border:"1px dashed var(--primary)",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(ou,{size:16}),s||"Choose file…",i.jsx("input",{type:"file",accept:".csv,text/csv",style:{display:"none"},onChange:T})]}),i.jsx(Qt,{text:"Required: email, first name, last name per row."})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Attach to events (optional)"}),i.jsx("div",{style:{maxHeight:"200px",overflowY:"auto",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",padding:"8px 10px"},children:c.length===0?i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"No events loaded."}):c.map(A=>i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 4px",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("input",{type:"checkbox",checked:d.has(A._id),onChange:()=>O(A._id)}),i.jsx("span",{children:A.name})]},A._id))}),i.jsx(Qt,{text:"Selected events get a pending membership for each imported person. Leave empty to only add/update people in your org pool."})]}),i.jsx(lt,{children:i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("input",{type:"checkbox",checked:h,onChange:A=>p(A.target.checked)}),"Also create a custom list from this import"]})}),h&&i.jsxs(i.Fragment,{children:[i.jsxs(lt,{children:[i.jsx(pt,{text:"List name",required:!0}),i.jsx("input",{style:$t,value:y,onChange:A=>m(A.target.value),onFocus:kt,onBlur:_t,placeholder:"e.g. January invitees"})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Description"}),i.jsx("textarea",{style:{...$t,resize:"vertical",minHeight:"72px"},value:x,onChange:A=>b(A.target.value),onFocus:kt,onBlur:_t,placeholder:"Optional notes for admins"})]})]})]})})}function V6e(e){return e.split(/[,;\n]+/).map(t=>t.trim()).filter(Boolean)}function Y6e({participantId:e,onClose:t,onSaved:r}){const[n,o]=j.useState(""),[a,s]=j.useState(""),[l,c]=j.useState(""),[u,d]=j.useState(""),[f,h]=j.useState(""),[p,y]=j.useState(""),[m,x]=j.useState(""),[b,w]=j.useState(""),[k,S]=j.useState(!0),[_,P]=j.useState(!1),[O,T]=j.useState(null);j.useEffect(()=>{S(!0),T(null),Ei.get(e).then(I=>{if(S(!1),I.error||!I.data){T(I.error||"Could not load participant");return}const E=I.data;o(E.email??""),s(E.firstName??""),c(E.lastName??""),d(E.phone??""),h(E.organization??""),y(E.designation??""),x(E.notes??"");const A=E.tags;w(Array.isArray(A)?A.join(", "):"")}).catch(()=>{S(!1),T("Could not load participant")})},[e]);const R=j.useCallback(async()=>{if(T(null),!n.trim()){T("Email is required");return}P(!0);const I=V6e(b),E=await Ei.update(e,{email:n.trim(),firstName:a.trim(),lastName:l.trim(),phone:u.trim()||void 0,organization:f.trim()||void 0,designation:p.trim()||void 0,notes:m.trim()||void 0,tags:I});if(P(!1),E.error){T(E.error);return}r(),t()},[e,n,a,l,u,f,p,m,b,t,r]);return i.jsx(Zo,{onClose:t,title:"Edit participant",breadcrumb:"Participants · Edit",description:"Update profile and tags for this person in your organization.",completedCount:k?0:1,totalSections:1,ctaLabel:_?"Saving…":"Save",ctaDisabled:_||k,onCtaClick:R,children:i.jsxs("div",{style:{padding:"0 20px 24px",display:"flex",flexDirection:"column",gap:"14px"},children:[O&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0,fontFamily:"var(--font-noto-sans)"},children:O}),k?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading…"}):i.jsxs(i.Fragment,{children:[i.jsxs(lt,{children:[i.jsx(pt,{text:"Email",required:!0}),i.jsx("input",{style:$t,value:n,onChange:I=>o(I.target.value),onFocus:kt,onBlur:_t})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"First name",required:!0}),i.jsx("input",{style:$t,value:a,onChange:I=>s(I.target.value),onFocus:kt,onBlur:_t})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Last name",required:!0}),i.jsx("input",{style:$t,value:l,onChange:I=>c(I.target.value),onFocus:kt,onBlur:_t})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Phone"}),i.jsx("input",{style:$t,value:u,onChange:I=>d(I.target.value),onFocus:kt,onBlur:_t})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Organization"}),i.jsx("input",{style:$t,value:f,onChange:I=>h(I.target.value),onFocus:kt,onBlur:_t})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Designation"}),i.jsx("input",{style:$t,value:p,onChange:I=>y(I.target.value),onFocus:kt,onBlur:_t})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Tags"}),i.jsx("input",{style:$t,value:b,onChange:I=>w(I.target.value),onFocus:kt,onBlur:_t,placeholder:"e.g. VIP, Speaker"}),i.jsx(Qt,{text:"Comma or semicolon separated."})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Notes"}),i.jsx("textarea",{style:{...$t,resize:"vertical",minHeight:"72px"},value:m,onChange:I=>x(I.target.value),onFocus:kt,onBlur:_t})]})]})]})})}function G6e(e){return e?typeof e=="string"?e:String(e._id??""):""}const IQ=["Star Rating","NPS (0–10)","Multiple Choice","Radio","Short Text","Long Text","Checkboxes","Yes / No"],NQ=["Text","Email","Phone","Dropdown","Radio","Checkboxes","Yes / No","Date","File Upload"],K6e=[...new Set([...IQ,...NQ])],Wf=new Set(["Multiple Choice","Dropdown","Radio","Checkboxes"]),t9={Text:"text",Email:"email",Phone:"phone",Dropdown:"select",Radio:"radio",Checkboxes:"checkboxes","Yes / No":"checkbox",Date:"text","File Upload":"file"},Q6e=[{value:"",label:"Don't map (submission only)"},{value:"phone",label:"Phone"},{value:"organization",label:"Organization"},{value:"designation",label:"Designation"},{value:"notes",label:"Notes"},{value:"displayName",label:"Display name"},{value:"custom",label:"Custom field (key below)"}];function RQ(e){return(e.options??[]).map(t=>String(t).trim()).filter(Boolean)}function r9(e){return Wf.has(e.type)?RQ(e).length>=2:!0}function k8(){return["Option 1","Option 2"]}function LQ({options:e,onChange:t}){const r=e.length?e:["",""],n=(s,l)=>{const c=[...r];c[s]=l,t(c)},o=()=>t([...r,""]),a=s=>{r.length<=1||t(r.filter((l,c)=>c!==s))};return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",paddingTop:"4px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontWeight:600,fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Choices"}),r.map((s,l)=>i.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[i.jsx("input",{style:{...$t,flex:1},placeholder:`Choice ${l+1}`,value:s,onChange:c=>n(l,c.target.value),onFocus:kt,onBlur:_t}),i.jsx("button",{type:"button",onClick:()=>a(l),disabled:r.length<=1,title:"Remove choice",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--destructive)",cursor:r.length<=1?"not-allowed":"pointer",opacity:r.length<=1?.45:1,flexShrink:0},children:i.jsx(gn,{size:13})})]},l)),i.jsxs("button",{type:"button",onClick:o,style:{alignSelf:"flex-start",display:"flex",alignItems:"center",gap:"6px",padding:"5px 10px",borderRadius:"var(--radius-button)",border:"1px dashed var(--border)",background:"transparent",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(wr,{size:12})," Add choice"]}),i.jsx(Qt,{text:"At least two non-empty choices are required."})]})}function a6(){return[{id:"reg-core-fn",label:"First name",type:"Text",required:"Yes",mapsTo:"firstName",fixed:!0},{id:"reg-core-ln",label:"Last name",type:"Text",required:"Yes",mapsTo:"lastName",fixed:!0},{id:"reg-core-em",label:"Email",type:"Email",required:"Yes",mapsTo:"email",fixed:!0}]}function X6e({q:e,types:t,onPatch:r,onRemove:n,idx:o,canRemove:a}){const s=Wf.has(e.type);return i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start",padding:"10px 12px",background:"var(--secondary)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)"},children:[i.jsx("div",{style:{color:"var(--muted)",paddingTop:"6px",flexShrink:0},children:i.jsx(sv,{size:14})}),i.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"8px"},children:[i.jsxs("div",{style:{display:"grid",gridTemplateColumns:a?"1fr auto auto auto":"1fr auto auto",gap:"8px",alignItems:"center"},children:[i.jsx("input",{style:$t,placeholder:`Question ${o+1}`,value:e.label,onChange:l=>r({label:l.target.value}),onFocus:kt,onBlur:_t}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:{...Nr,width:"auto",minWidth:"130px"},value:e.type,onChange:l=>{var d;const c=l.target.value,u={type:c};Wf.has(c)?u.options=(d=e.options)!=null&&d.length?e.options:k8():u.options=[],r(u)},onFocus:kt,onBlur:_t,children:t.map(l=>i.jsx("option",{children:l},l))})}),a&&i.jsx("button",{onClick:n,type:"button",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--destructive)",cursor:"pointer",flexShrink:0},children:i.jsx(gn,{size:13})})]}),s&&i.jsx(LQ,{options:e.options??[],onChange:l=>r({options:l})}),i.jsx("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[i.jsx("input",{type:"checkbox",checked:e.required==="Yes",onChange:l=>r({required:l.target.checked?"Yes":"No"}),style:{accentColor:"var(--primary)",width:"13px",height:"13px"}}),"Required field"]})})]})]})}function Z6e({q:e,idx:t,onPatch:r}){return i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start",padding:"10px 12px",background:"var(--accent)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)"},children:[i.jsx("div",{style:{color:"var(--muted)",paddingTop:"6px",flexShrink:0},children:i.jsx(sv,{size:14})}),i.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"8px"},children:[i.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:i.jsxs("span",{style:{fontSize:"10px",fontWeight:600,fontFamily:"var(--font-noto-sans)",color:"var(--primary)",textTransform:"uppercase"},children:["Core · maps to ",e.mapsTo]})}),i.jsx("input",{style:$t,placeholder:e.mapsTo==="email"?"Email address":"Label shown to registrants",value:e.label,onChange:n=>r({label:n.target.value}),onFocus:kt,onBlur:_t})]})]})}function J6e({q:e,types:t,onPatch:r,onRemove:n,idx:o}){const a=Wf.has(e.type);return i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"10px 12px",background:"var(--secondary)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)"},children:i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start"},children:[i.jsx("div",{style:{color:"var(--muted)",paddingTop:"6px"},children:i.jsx(sv,{size:14})}),i.jsxs("div",{style:{flex:1,display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px",alignItems:"start"},children:[i.jsxs(lt,{children:[i.jsx(pt,{text:"Field label"}),i.jsx("input",{style:$t,placeholder:`Field ${o+1}`,value:e.label,onChange:s=>r({label:s.target.value}),onFocus:kt,onBlur:_t})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Field type"}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:Nr,value:e.type,onChange:s=>{var u;const l=s.target.value,c={type:l};Wf.has(l)?c.options=(u=e.options)!=null&&u.length?e.options:k8():c.options=[],r(c)},onFocus:kt,onBlur:_t,children:t.map(s=>i.jsx("option",{children:s},s))})})]}),a&&i.jsx(lt,{span2:!0,children:i.jsx(LQ,{options:e.options??[],onChange:s=>r({options:s})})}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Map to participant"}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:Nr,value:e.mapsTo??"",onChange:s=>r({mapsTo:s.target.value}),onFocus:kt,onBlur:_t,children:Q6e.map(s=>i.jsx("option",{value:s.value,children:s.label},s.value||"—"))})})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Required"}),i.jsx(go,{name:`req-${e.id}`,value:e.required,onChange:s=>r({required:s}),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),e.mapsTo==="custom"&&i.jsxs(lt,{span2:!0,children:[i.jsx(pt,{text:"Custom field key",required:!0}),i.jsx("input",{style:$t,placeholder:"e.g. dietaryPreference",value:e.customMapsKey??"",onChange:s=>r({customMapsKey:s.target.value}),onFocus:kt,onBlur:_t}),i.jsx(Qt,{text:"Stored under Participant.customFields[key]."})]})]}),i.jsx("button",{onClick:n,type:"button",title:"Remove field",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--destructive)",cursor:"pointer",flexShrink:0},children:i.jsx(gn,{size:13})})]})})}const vw=e=>{const t=e[0];return{id:Math.random().toString(36).slice(2),label:"",type:t,required:"No",options:Wf.has(t)?k8():[],mapsTo:"",customMapsKey:"",fixed:!1}},eTe=(e,t)=>({name:"",description:"",questions:[vw(e)],showThankYou:"Yes",thankYouMsg:"Thank you for your feedback!",collectEmail:"No",anonymous:t?"Yes":"No",publish:"Draft",paymentEnabled:"No",amount:"",confirmationEmail:"Yes",onSubmitTags:"",onSubmitListId:""});function FQ(e,t,r){if(e==="stars"||e==="select"&&(t==null?void 0:t.length)===5&&t.every((n,o)=>n===String(o+1)))return"Star Rating";if(e==="select"&&(t==null?void 0:t.length)===11)return"NPS (0–10)";if(e==="radio")return"Radio";if(e==="checkboxes")return"Checkboxes";if(e==="select"){const n=(r==null?void 0:r.indexOf("Multiple Choice"))??-1,o=(r==null?void 0:r.indexOf("Dropdown"))??-1;return o>=0&&(n<0||o=0,"Multiple Choice")}return e==="checkbox"?r!=null&&r.includes("Yes / No")?"Yes / No":"Checkboxes":e==="text"?r!=null&&r.includes("Short Text")?"Short Text":"Text":e==="email"?"Email":e==="phone"?"Phone":e==="file"?"File Upload":(r==null?void 0:r[0])??"Short Text"}function MQ(e){return Array.isArray(e.options)?e.options.map(t=>String(t)):[]}function DQ(e,t){var s;const r=((s=e.label)==null?void 0:s.trim())||"Untitled",n=e.required==="Yes",o=RQ(e);if(t){if(e.type==="Star Rating")return{label:r,type:"stars",required:n,options:["1","2","3","4","5"]};if(e.type==="NPS (0–10)")return{label:r,type:"select",required:n,options:Array.from({length:11},(c,u)=>String(u))};if(e.type==="Multiple Choice")return{label:r,type:"select",required:n,options:o};if(e.type==="Radio")return{label:r,type:"radio",required:n,options:o};if(e.type==="Checkboxes")return{label:r,type:"checkboxes",required:n,options:o};if(e.type==="Short Text"||e.type==="Long Text")return{label:r,type:"text",required:n};if(e.type==="Yes / No")return{label:r,type:"checkbox",required:n};const l=t9[e.type];return l?l==="select"||l==="radio"||l==="checkboxes"?{label:r,type:l,required:n,options:o}:{label:r,type:l,required:n}:{label:r,type:"text",required:n}}const a=t9[e.type]??"text";return a==="select"||a==="radio"||a==="checkboxes"?{label:r,type:a,required:n,options:o}:{label:r,type:a,required:n}}function zQ(e){return e==="firstName"||e==="lastName"||e==="email"}function tTe(e){var n;const t=DQ(e,!1),r=e.fixed===!0||zQ(e.mapsTo)?!0:t.required;return{...t,required:r,mapsTo:e.mapsTo||void 0,customMapsKey:e.mapsTo==="custom"&&((n=e.customMapsKey)!=null&&n.trim())?e.customMapsKey.trim():void 0,isFixed:e.fixed===!0}}function rTe(e){return e.isFixed===!0||zQ(e.mapsTo)||e.required?"Yes":"No"}function nTe(e,t){return e!=null&&e.length?e.map((r,n)=>{const o=FQ(r.type??"text",r.options,t);return{id:Math.random().toString(36).slice(2)+String(n),label:r.label??"",type:o,required:r.required?"Yes":"No",options:Wf.has(o)?MQ(r):[],mapsTo:r.mapsTo,customMapsKey:r.customMapsKey,fixed:r.isFixed}}):[vw(t)]}function iTe(e,t,r){const n=FQ(e.type??"text",e.options,r);return{id:`imp-${t}-${Math.random().toString(36).slice(2)}`,label:e.label??"",type:n,required:rTe(e),options:Wf.has(n)?MQ(e):[],mapsTo:e.mapsTo,customMapsKey:e.customMapsKey,fixed:e.isFixed===!0}}function oTe(e,t){const r=a6();if(!(e!=null&&e.length))return r;const n=e.map((o,a)=>iTe(o,a,t));return n.some(o=>o.mapsTo==="firstName")?n:[...r,...n]}function o3({eventId:e,formId:t,mode:r,onClose:n,onSuccess:o}){const{user:a}=Ur(),s=zn(a),l=r==="feedback",c=r==="registration",u=r==="other",d=c?5:3,f=c?NQ:u?K6e:IQ,h=l||u,p=mc(d),[y,m]=j.useState(()=>{const q=eTe(f,h);return c?{...q,questions:a6()}:q}),[x,b]=j.useState([]),[w,k]=j.useState({}),[S,_]=j.useState(!1),[P,O]=j.useState(!!t),[T,R]=j.useState([]),[I,E]=j.useState("");j.useEffect(()=>{if(!s){R([]);return}let q=!1;return zr.list({organization:s,recordKind:"event",limit:500}).then(Y=>{var G;if(q)return;const K=((G=Y.data)==null?void 0:G.events)??[];R(K.map(re=>{var J;return{_id:re._id,name:(J=re.name)!=null&&J.trim()?re.name:"Untitled"}}))}).catch(()=>{q||R([])}),()=>{q=!0}},[s]),j.useEffect(()=>{!t&&e&&E(e)},[t,e]),j.useEffect(()=>{if(c){if(!s){b([]);return}Fa.list({organization:s}).then(q=>{var Y;(Y=q.data)!=null&&Y.lists&&b(q.data.lists.filter(K=>K.type==="fixed"))}).catch(()=>b([]))}},[c,s]),j.useEffect(()=>{if(!t)return;let q=!1;return(async()=>{var Y;try{const K=await Ma.get(t);if(q)return;const G=K.type==="registration"?oTe(K.fields,f):nTe(K.fields,f),re=K.settings??{},J=Array.isArray(re.onSubmitAddTags)?re.onSubmitAddTags.join(", "):"";m({name:K.name??"",description:K.description??"",questions:G.length?G:K.type==="registration"?a6():[vw(f)],showThankYou:re.showThankYou===!1?"No":"Yes",thankYouMsg:(Y=re.thankYouMessage)!=null&&Y.trim()?re.thankYouMessage:"Thank you for your feedback!",collectEmail:re.collectEmail?"Yes":"No",anonymous:re.allowAnonymous||h?"Yes":"No",publish:re.isActive!==!1?"Published":"Draft",paymentEnabled:re.paymentEnabled?"Yes":"No",amount:re.paymentAmount!=null&&re.paymentAmount!==""?String(re.paymentAmount):"",confirmationEmail:re.sendConfirmationEmail===!1?"No":"Yes",onSubmitTags:J,onSubmitListId:re.onSubmitParticipantListId??""}),E(G6e(K.event))}catch{q||O(!1)}finally{q||O(!1)}})(),()=>{q=!0}},[t,f.join(","),h]);const A=(q,Y)=>m(K=>({...K,[q]:Y})),F=()=>m(q=>({...q,questions:[...q.questions,vw(f)]})),L=q=>m(Y=>({...Y,questions:Y.questions.filter(K=>!K.fixed&&K.id!==q)})),z=(q,Y)=>m(K=>({...K,questions:K.questions.map(G=>G.id===q?{...G,...Y}:G)})),V=j.useCallback((q,Y)=>{if(Y===1)return q.name.trim().length>0&&I.trim().length>0;if(Y===2){if(c){const re=q.questions.filter(le=>le.fixed).every(le=>le.label.trim().length>0),ae=q.questions.filter(le=>!le.fixed).every(le=>{var me;return!(!le.label.trim()||le.mapsTo==="custom"&&!((me=le.customMapsKey)!=null&&me.trim())||!r9(le))});return re&&ae}const K=q.questions.some(re=>re.label.trim().length>0),G=q.questions.every(re=>!re.label.trim()||r9(re));return K&&G}return!0},[c,I]),Q=j.useCallback(q=>{const Y=V(y,q);k(K=>({...K,[q]:Y?"":"Please complete required fields before continuing."})),Y&&p.advance(q)},[y,V,p]),U=j.useCallback(()=>{const q=c?"registration":u?"other":"feedback",Y=c?y.questions.filter(re=>re.label.trim()).map(re=>tTe(re)):y.questions.filter(re=>re.label.trim()).map(re=>DQ(re,h)),K=y.publish==="Published",G=y.onSubmitTags.split(/[,;\n]+/).map(re=>re.trim()).filter(Boolean);return{name:y.name.trim(),description:y.description.trim(),type:q,fields:Y,settings:{isActive:K,thankYouMessage:y.thankYouMsg.trim(),showThankYou:y.showThankYou==="Yes",collectEmail:y.collectEmail==="Yes",allowAnonymous:y.anonymous==="Yes",paymentEnabled:y.paymentEnabled==="Yes",paymentAmount:y.paymentEnabled==="Yes"&&y.amount.trim()?y.amount.trim():"",sendConfirmationEmail:y.confirmationEmail==="Yes",...c?{onSubmitAddTags:G,onSubmitParticipantListId:y.onSubmitListId.trim()||null}:{}}}},[y,c,u,h]),ee=j.useCallback(async()=>{if(!y.name.trim()||!I.trim()){I.trim()||k(q=>({...q,1:"Select an event for this form."}));return}_(!0),k({});try{const q=U();t?await Ma.update(t,{...q,event:I}):await Ma.create({...q,event:I}),o(),n()}catch{k(q=>({...q,1:"Failed to save. Please try again."}))}finally{_(!1)}},[y.name,t,I,U,o,n]),H=j.useCallback(()=>{const q=c?5:3;if(!V(y,q)){k(Y=>({...Y,[q]:"Please complete required fields."}));return}k(Y=>({...Y,[q]:""})),ee()},[y,c,V,ee]),B=l?"Forms & Workflow · Feedback":c?"Forms & Workflow · Registration":"Forms & Workflow · Other Forms",M=t?l?"Edit Feedback Form":c?"Edit Registration Form":"Edit Form":l?"Create Feedback Form":c?"Create Registration Form":"Create Other Form",$=l?"Design a feedback form to collect responses from your attendees.":c?"Build a registration form; each submission creates or updates a participant.":"Build custom forms (other / general-purpose) for your event.";return P?i.jsx(Zo,{onClose:n,title:M,breadcrumb:B,description:$,completedCount:0,totalSections:d,ctaLabel:"Save",ctaDisabled:!0,children:i.jsx("div",{style:{padding:"20px",color:"var(--muted)"},children:"Loading form…"})}):i.jsxs(Zo,{onClose:n,title:M,breadcrumb:B,description:$,completedCount:p.done.size,totalSections:d,ctaLabel:"Save",ctaDisabled:!y.name.trim()||!I.trim()||S||!t&&T.length===0,onCtaClick:ee,children:[i.jsxs($r,{n:1,title:"Form Details",subtitle:"Name and describe your form",open:p.open===1,completed:p.done.has(1),onToggle:()=>p.toggle(1),onSave:()=>Q(1),nextLabel:h?"Questions":"Fields",sectionError:w[1],children:[i.jsxs(lt,{children:[i.jsx(pt,{text:"Form Name",required:!0}),i.jsx("input",{style:$t,placeholder:h?"e.g. Post-Event Feedback 2026":"e.g. Conference Registration 2026",value:y.name,onChange:q=>A("name",q.target.value),onFocus:kt,onBlur:_t})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Event",required:!0}),i.jsx("div",{style:{position:"relative"},children:i.jsxs("select",{style:Nr,value:I,onChange:q=>E(q.target.value),onFocus:kt,onBlur:_t,children:[i.jsx("option",{value:"",children:"Select an event…"}),I&&!T.some(q=>q._id===I)?i.jsx("option",{value:I,children:"Current linked event"}):null,T.map(q=>i.jsx("option",{value:q._id,children:q.name},q._id))]})}),s&&T.length===0?i.jsx(Qt,{text:"No events in this organization. Create an event under Portfolio (All Events) first."}):null]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Description"}),i.jsx("textarea",{style:{...$t,resize:"vertical",minHeight:"72px"},placeholder:"Briefly describe this form…",value:y.description,onChange:q=>A("description",q.target.value),onFocus:kt,onBlur:_t})]}),h&&i.jsxs(Zi,{cols:2,children:[i.jsxs(lt,{children:[i.jsx(pt,{text:"Anonymous Responses",required:!0}),i.jsx(go,{name:"anon",value:y.anonymous,onChange:q=>A("anonymous",q),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]}),i.jsx(Qt,{text:"Anonymous forms don't record the respondent's identity."})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Collect Email"}),i.jsx(go,{name:"collectEmail",value:y.collectEmail,onChange:q=>A("collectEmail",q),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]})]})]}),i.jsxs($r,{n:2,title:h?"Questions":"Form Fields",subtitle:c?"Core fields (first name, last name, email) plus optional mapped fields":h?"Add and order your feedback questions":"Add and arrange fields",open:p.open===2,completed:p.done.has(2),onToggle:()=>p.toggle(2),onSave:()=>Q(2),nextLabel:c?"Participant actions":"Settings",sectionError:w[2],children:[i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:c?i.jsxs(i.Fragment,{children:[y.questions.filter(q=>q.fixed).map((q,Y)=>i.jsx(Z6e,{q,idx:Y,onPatch:K=>z(q.id,K)},q.id)),y.questions.filter(q=>!q.fixed).map((q,Y)=>i.jsx(J6e,{q,types:f,idx:Y,onPatch:K=>z(q.id,K),onRemove:()=>L(q.id)},q.id))]}):y.questions.map((q,Y)=>i.jsx(X6e,{q,types:f,idx:Y,onPatch:K=>z(q.id,K),onRemove:()=>L(q.id),canRemove:y.questions.length>1},q.id))}),c?i.jsxs("button",{type:"button",onClick:F,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px dashed var(--primary)",background:"transparent",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:13})," Add field"]}):i.jsxs("button",{type:"button",onClick:F,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px dashed var(--primary)",background:"transparent",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(wr,{size:13})," Add ",h?"Question":"Field"]}),i.jsx(Qt,{text:c?"Submissions must include the email field. Map extra fields to participant columns or customFields.":"Drag the grip icon to reorder questions."})]}),c&&i.jsxs($r,{n:3,title:"Participant actions",subtitle:"Tags and lists applied when someone submits",open:p.open===3,completed:p.done.has(3),onToggle:()=>p.toggle(3),onSave:()=>Q(3),nextLabel:"Payment",sectionError:w[3],children:[i.jsxs(lt,{children:[i.jsx(pt,{text:"Add tags on submit"}),i.jsx("input",{style:$t,placeholder:"e.g. VIP, Registered — comma separated",value:y.onSubmitTags,onChange:q=>A("onSubmitTags",q.target.value),onFocus:kt,onBlur:_t}),i.jsx(Qt,{text:"Merged onto the participant record (deduplicated)."})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Add to fixed participant list"}),i.jsx("div",{style:{position:"relative"},children:i.jsxs("select",{style:Nr,value:y.onSubmitListId,onChange:q=>A("onSubmitListId",q.target.value),onFocus:kt,onBlur:_t,children:[i.jsx("option",{value:"",children:"— None —"}),x.map(q=>i.jsx("option",{value:q._id,children:q.name},q._id))]})}),i.jsx(Qt,{text:"Only fixed (manual) lists in your organization are shown."})]})]}),c&&i.jsx($r,{n:4,title:"Payment",subtitle:"Configure payment settings for paid registrations",open:p.open===4,completed:p.done.has(4),onToggle:()=>p.toggle(4),onSave:()=>Q(4),nextLabel:"Publish Settings",sectionError:w[4],children:i.jsxs(Zi,{cols:2,children:[i.jsxs(lt,{children:[i.jsx(pt,{text:"Enable Payment",required:!0}),i.jsx(go,{name:"regPayment",value:y.paymentEnabled,onChange:q=>A("paymentEnabled",q),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),y.paymentEnabled==="Yes"&&i.jsxs(lt,{children:[i.jsx(pt,{text:"Registration Fee (₹)",required:!0}),i.jsx("input",{type:"number",style:$t,placeholder:"0.00",value:y.amount,onChange:q=>A("amount",q.target.value),onFocus:kt,onBlur:_t})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Confirmation Email",required:!0}),i.jsx(go,{name:"confEmail",value:y.confirmationEmail,onChange:q=>A("confirmationEmail",q),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]}),i.jsx(Qt,{text:"Send a confirmation email after registration."})]})]})}),i.jsx($r,{n:c?5:3,title:"Publish Settings",subtitle:"Set the form status and thank-you message",open:p.open===(c?5:3),completed:p.done.has(c?5:3),onToggle:()=>p.toggle(c?5:3),onSave:H,nextLabel:"Save",sectionError:w[c?5:3],children:i.jsxs(Zi,{cols:2,children:[i.jsxs(lt,{children:[i.jsx(pt,{text:"Status",required:!0}),i.jsx("div",{style:{position:"relative"},children:i.jsxs("select",{style:Nr,value:y.publish,onChange:q=>A("publish",q.target.value),onFocus:kt,onBlur:_t,children:[i.jsx("option",{children:"Draft"}),i.jsx("option",{children:"Published"})]})})]}),i.jsxs(lt,{span2:!0,children:[i.jsx(pt,{text:"Thank You Message"}),i.jsx("input",{style:$t,placeholder:"Thank you for your response!",value:y.thankYouMsg,onChange:q=>A("thankYouMsg",q.target.value),onFocus:kt,onBlur:_t}),i.jsx(Qt,{text:"Shown to respondents after they submit the form."})]})]})})]})}function aTe(e){return!e||typeof e!="object"?{}:e}function sTe(e){if(!e)return"—";try{return new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return"—"}}function lTe(e){var t;return!e||typeof e=="string"?"—":((t=e.email)==null?void 0:t.trim())||"—"}const n9=20,i9=4;function cTe({formId:e,formName:t,onClose:r}){const[n,o]=j.useState(null),[a,s]=j.useState(""),[l,c]=j.useState(""),[u,d]=j.useState(""),[f,h]=j.useState(""),[p,y]=j.useState(""),[m,x]=j.useState(""),[b,w]=j.useState(1),[k,S]=j.useState([]),[_,P]=j.useState(0),[O,T]=j.useState(!0),[R,I]=j.useState(null),[E,A]=j.useState(!1),F=((n==null?void 0:n.fields)||[]).map(B=>{var M;return(M=B.label)==null?void 0:M.trim()}).filter(Boolean),L=F.slice(0,i9),z=Math.max(0,F.length-L.length),V=j.useCallback(async()=>{try{const B=await Ma.get(e);o(B)}catch{o(null)}},[e]),Q=j.useCallback(async()=>{T(!0),I(null);try{const B=await Ma.listSubmissions(e,{q:l||void 0,dateFrom:p||void 0,dateTo:m||void 0,page:b,limit:n9});S(B.submissions),P(B.total)}catch(B){I(B instanceof Error?B.message:"Failed to load submissions."),S([]),P(0)}finally{T(!1)}},[e,l,p,m,b]);j.useEffect(()=>{V()},[V]),j.useEffect(()=>{Q()},[Q]);const U=()=>{c(a.trim()),y(u),x(f),w(1)},ee=async()=>{A(!0);try{const B=await Ma.exportSubmissionsCsv(e,{q:l||void 0,dateFrom:p||void 0,dateTo:m||void 0}),M=URL.createObjectURL(B),$=document.createElement("a");$.href=M,$.download=`form-${e}-submissions.csv`,$.click(),URL.revokeObjectURL(M)}catch(B){I(B instanceof Error?B.message:"Export failed.")}finally{A(!1)}},H=Math.max(1,Math.ceil(_/n9));return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:r,role:"presentation",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"form-submissions-title",style:{position:"fixed",top:0,right:0,height:"100%",width:"min(720px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.2)",animation:"formSubmissionsSlideIn 0.2s ease"},children:[i.jsx("style",{children:"@keyframes formSubmissionsSlideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }"}),i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,padding:"16px 18px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 4px"},children:"Submissions"}),i.jsx("h2",{id:"form-submissions-title",style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,lineHeight:1.3,wordBreak:"break-word"},children:t})]}),i.jsx("button",{type:"button",onClick:r,"aria-label":"Close",style:{flexShrink:0,width:36,height:36,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(er,{size:18})})]}),i.jsxs("div",{style:{padding:"12px 18px",borderBottom:"1px solid var(--border)",display:"flex",flexDirection:"column",gap:10,flexShrink:0},children:[i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"flex-end"},children:[i.jsxs("div",{style:{flex:"1 1 160px",minWidth:0},children:[i.jsx("label",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:600,color:"var(--muted)",textTransform:"uppercase",display:"block",marginBottom:4},children:"Search (* wildcards)"}),i.jsx("input",{value:a,onChange:B=>s(B.target.value),onKeyDown:B=>B.key==="Enter"&&U(),placeholder:"e.g. john*@*",style:{width:"100%",padding:"8px 10px",fontSize:"var(--text-sm)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",boxSizing:"border-box"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:600,color:"var(--muted)",textTransform:"uppercase",display:"block",marginBottom:4},children:"From"}),i.jsx("input",{type:"date",value:u,onChange:B=>d(B.target.value),style:{padding:"8px 10px",fontSize:"var(--text-sm)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:600,color:"var(--muted)",textTransform:"uppercase",display:"block",marginBottom:4},children:"To"}),i.jsx("input",{type:"date",value:f,onChange:B=>h(B.target.value),style:{padding:"8px 10px",fontSize:"var(--text-sm)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)"}})]}),i.jsx("button",{type:"button",onClick:U,style:{padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",color:"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:600,cursor:"pointer"},children:"Apply"}),i.jsxs("button",{type:"button",onClick:()=>void ee(),disabled:E||_===0,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:600,cursor:E||_===0?"not-allowed":"pointer",opacity:E||_===0?.6:1},children:[i.jsx(Al,{size:14}),E?"Exporting…":"Export CSV"]})]}),i.jsxs("p",{style:{margin:0,fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:["Showing ",_.toLocaleString()," match",_===1?"":"es",". List view is paged; export includes all matches and"," ",i.jsx("strong",{style:{color:"var(--foreground)"},children:"all form fields"})," as columns.",z>0?` The table only shows the first ${i9} response fields (${z} more in the file only).`:null]})]}),i.jsxs("div",{style:{flex:1,overflow:"auto",padding:"0 0 16px"},children:[R?i.jsx("p",{style:{padding:"16px 18px",margin:0,color:"var(--destructive)",fontSize:"var(--text-sm)"},children:R}):null,O?i.jsx("p",{style:{padding:"24px 18px",margin:0,color:"var(--muted)"},children:"Loading…"}):k.length===0?i.jsx("p",{style:{padding:"24px 18px",margin:0,color:"var(--muted)"},children:"No submissions for this filter."}):i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:[i.jsx("th",{style:{textAlign:"left",padding:"10px 12px",whiteSpace:"nowrap"},children:"Submitted"}),i.jsx("th",{style:{textAlign:"left",padding:"10px 12px",whiteSpace:"nowrap"},children:"Email"}),L.map(B=>i.jsx("th",{style:{textAlign:"left",padding:"10px 12px",maxWidth:180},children:B},B)),z>0?i.jsxs("th",{style:{textAlign:"left",padding:"10px 12px",color:"var(--muted)",fontWeight:600,whiteSpace:"nowrap"},children:["+",z," more…"]},"__more__"):null]})}),i.jsx("tbody",{children:k.map(B=>{const M=aTe(B.data);return i.jsxs("tr",{style:{borderBottom:"1px solid var(--border)",verticalAlign:"top"},children:[i.jsx("td",{style:{padding:"10px 12px",whiteSpace:"nowrap",color:"var(--foreground)"},children:sTe(B.submittedAt)}),i.jsx("td",{style:{padding:"10px 12px",wordBreak:"break-all"},children:lTe(B.participant)}),L.map($=>i.jsx("td",{style:{padding:"10px 12px",wordBreak:"break-word",maxWidth:220},children:uTe(M[$])},$)),z>0?i.jsx("td",{style:{padding:"10px 12px",color:"var(--muted)",fontSize:"10px",fontStyle:"italic"},children:"Export for full data"},"__more__"):null]},B._id)})})]})})]}),i.jsxs("div",{style:{padding:"12px 18px",borderTop:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexShrink:0},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:["Page ",b," of ",H]}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsxs("button",{type:"button",disabled:b<=1||O,onClick:()=>w(B=>Math.max(1,B-1)),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:b<=1||O?"not-allowed":"pointer",opacity:b<=1||O?.5:1},children:[i.jsx(Nf,{size:16})," Prev"]}),i.jsxs("button",{type:"button",disabled:b>=H||O,onClick:()=>w(B=>B+1),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:b>=H||O?"not-allowed":"pointer",opacity:b>=H||O?.5:1},children:["Next ",i.jsx(va,{size:16})]})]})]})]})]})}function uTe(e){if(e==null)return"—";if(typeof e=="boolean")return e?"Yes":"No";if(Array.isArray(e))return e.join(", ");const t=String(e);return t.length>500?`${t.slice(0,500)}…`:t}function dTe(e){return e<1024?e+" B":e<1048576?(e/1024).toFixed(1)+" KB":(e/1048576).toFixed(1)+" MB"}function fTe({onClose:e,onSuccess:t}){const{user:r}=Ur(),n=zn(r),o=3,a=mc(o),s=j.useRef(null),[l,c]=j.useState([]),[u,d]=j.useState(!1),[f,h]=j.useState({collection:"",description:"",visibility:"Private",tags:""}),[p,y]=j.useState([]),[m,x]=j.useState(""),[b,w]=j.useState({}),[k,S]=j.useState({}),[_,P]=j.useState(!1),O=(z,V)=>{h(Q=>({...Q,[z]:V})),S(Q=>({...Q,[z]:void 0}))};j.useEffect(()=>{if(!n){y([]),x("Organisation required to load collections.");return}I0.list({organization:n}).then(y).catch(()=>{y([]),x("Could not load collections.")})},[n]);const T=z=>{const V=Array.from(z).map(Q=>({id:Math.random().toString(36).slice(2),file:Q}));c(Q=>[...Q,...V]),S(Q=>({...Q,files:void 0}))},R=j.useCallback(z=>z===1?l.length===0?(S(V=>({...V,files:"Add at least one file to upload."})),!1):(S(V=>({...V,files:void 0})),!0):z===2?f.collection&&!p.some(Q=>Q._id===f.collection)?(S(Q=>({...Q,collection:"Select a valid collection or choose None."})),!1):(S(V=>({...V,collection:void 0})),!0):z===3?f.visibility!=="Private"&&f.visibility!=="Public"?(S(V=>({...V,visibility:"Select a visibility option."})),!1):(S(V=>({...V,visibility:void 0})),!0):!0,[l.length,f.collection,f.visibility,p]),I=z=>{const V=R(z);w(Q=>({...Q,[z]:V?"":"Fix the errors below before continuing."})),V&&a.advance(z)},E=j.useCallback(()=>{const z=R(1),V=R(2),Q=R(3);return w(U=>({...U,99:"",1:z?"":U[1]||"Fix the errors below before continuing.",2:V?"":U[2]||"Fix the errors below before continuing.",3:Q?"":U[3]||"Fix the errors below before continuing."})),!z||!V||!Q?(w(U=>({...U,99:"Complete and fix all sections before uploading."})),!1):!0},[R]),A=z=>{c(V=>V.filter(Q=>Q.id!==z))},F=async()=>{if(!E())return;P(!0),c(H=>H.map(B=>({...B,error:void 0,uploading:!0,done:!1})));const z=f.visibility==="Public"?"public":"private",V=f.tags.trim(),Q=f.description.trim(),U=f.collection.trim()||void 0;let ee=!1;for(let H=0;H$.map(q=>q.id===M?{...q,uploading:!1,done:!0}:q))}catch($){ee=!0;const q=$ instanceof Error?$.message:"Upload failed";c(Y=>Y.map(K=>K.id===M?{...K,uploading:!1,done:!1,error:q}:K))}}P(!1),ee||(t==null||t(),e())},L=()=>{F()};return i.jsxs(Zo,{onClose:e,title:"Upload Files",breadcrumb:"Content · Library",description:"Upload files to your content library. You can attach them to a collection after uploading.",completedCount:a.done.size,totalSections:o,ctaLabel:"Save Files",ctaDisabled:_||a.done.sizea.toggle(1),onSave:()=>I(1),nextLabel:"File Details",nextDisabled:_,sectionError:b[1],children:[i.jsx(lt,{error:k.files,children:i.jsxs("div",{onClick:()=>{var z;return(z=s.current)==null?void 0:z.click()},onDragOver:z=>{z.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:z=>{z.preventDefault(),d(!1),T(z.dataTransfer.files)},style:{border:`2px dashed ${u?"var(--primary)":k.files?"var(--destructive)":"var(--border)"}`,borderRadius:"var(--radius-card)",background:u?"var(--accent)":"var(--secondary)",padding:"32px 20px",display:"flex",flexDirection:"column",alignItems:"center",gap:"10px",cursor:"pointer",transition:"all .15s"},children:[i.jsx("input",{ref:s,type:"file",multiple:!0,style:{display:"none"},onChange:z=>z.target.files&&T(z.target.files)}),i.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:"var(--card)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(ou,{size:22,style:{color:"var(--primary)"}})}),i.jsxs("div",{style:{textAlign:"center"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",margin:"0 0 4px"},children:"Drag and drop files here"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:["or ",i.jsx("span",{style:{color:"var(--primary)",textDecoration:"underline"},children:"select files"})," to upload · Max 50 MB per file"]})]})]})}),l.length>0&&i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:l.map(z=>{const V=z.file.type.startsWith("image")?"var(--chart-1)":z.file.type==="application/pdf"?"var(--destructive)":"var(--muted)";return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",background:"var(--secondary)",borderRadius:"var(--radius-button)",border:`1px solid ${z.error?"var(--destructive)":"var(--border)"}`},children:[i.jsx(L6,{size:18,style:{color:V,flexShrink:0}}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:z.file.name}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"2px 0 0"},children:dTe(z.file.size)}),z.error&&i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"4px 0 0",display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx(nv,{size:12})," ",z.error]})]}),z.uploading&&i.jsx("span",{style:{fontSize:"10px",color:"var(--muted)"},children:"Uploading…"}),z.done&&!z.error&&i.jsx(iv,{size:14,style:{color:"#22c55e",flexShrink:0}}),i.jsx("button",{type:"button",onClick:()=>A(z.id),disabled:_,style:{background:"none",border:"none",cursor:_?"not-allowed":"pointer",color:"var(--muted)",display:"flex",flexShrink:0},children:i.jsx(er,{size:14})})]},z.id)})}),i.jsx(Qt,{text:"Supported: PDF, JPG, PNG, MP4, ZIP, PPTX, DOCX."})]}),i.jsxs($r,{n:2,title:"File Details",subtitle:"Add metadata and organise your files",open:a.open===2,completed:a.done.has(2),onToggle:()=>a.toggle(2),onSave:()=>I(2),nextLabel:"Visibility",nextDisabled:_,sectionError:b[2],children:[m&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:0},children:m}),i.jsxs(lt,{error:k.collection,children:[i.jsx(pt,{text:"Add to Collection"}),i.jsx("div",{style:{position:"relative"},children:i.jsxs("select",{style:{...Nr,...k.collection?{borderColor:"var(--destructive)"}:{}},value:f.collection,onChange:z=>O("collection",z.target.value),onFocus:kt,onBlur:_t,children:[i.jsx("option",{value:"",children:"None (Library only)"}),p.map(z=>i.jsx("option",{value:z._id,children:z.name},z._id))]})}),i.jsx(Qt,{text:"Optional. New files are appended to the collection after upload."})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Description / Notes"}),i.jsx("textarea",{style:{...$t,resize:"vertical",minHeight:"72px"},placeholder:"Optional notes about these files…",value:f.description,onChange:z=>O("description",z.target.value),onFocus:kt,onBlur:_t})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Tags"}),i.jsx("input",{style:$t,placeholder:"e.g. keynote, day1, sponsor",value:f.tags,onChange:z=>O("tags",z.target.value),onFocus:kt,onBlur:_t}),i.jsx(Qt,{text:"Separate tags with commas."})]})]}),i.jsx($r,{n:3,title:"Visibility",subtitle:"Control who can access these files",open:a.open===3,completed:a.done.has(3),onToggle:()=>a.toggle(3),onSave:L,nextLabel:"Save Files",nextDisabled:_,sectionError:b[3],children:i.jsxs(lt,{error:k.visibility,children:[i.jsx(pt,{text:"File Visibility",required:!0}),i.jsx(go,{name:"fileVis",value:f.visibility,onChange:z=>O("visibility",z),options:[{label:"Private (team only)",value:"Private"},{label:"Public (attendees can view)",value:"Public"}]}),i.jsx(Qt,{text:"Public files may be linked from the event website."})]})})]})}function o9(e){const t=e.type;return t==="image"?"Image":t==="pdf"?"PDF":t==="video"?"Video":"Other"}function pTe(e){return e==null||Number.isNaN(e)?"—":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function r0(e){return[e.firstName,e.lastName].filter(Boolean).join(" ").trim()||e.email}const a9={Image:"var(--chart-1)",PDF:"var(--destructive)",Video:"var(--chart-5)",Other:"var(--muted)"},hTe={Image:i.jsx(Ree,{size:14}),PDF:i.jsx(lh,{size:14}),Video:i.jsx(Dee,{size:14}),Other:i.jsx(L6,{size:14})},gTe=["Media Kit","Presentations","Speaker Resources","Recordings","Marketing Assets","Attendee Resources","Other"],mTe=["📁","🗂️","📸","🎥","📄","🎤","🏆","⭐","🎨","📊","🔖","💼"],vTe=["All","Image","PDF","Video","Other"];function yTe(e){return e!=null&&e.length?e.map(t=>typeof t=="string"?t:t._id):[]}function xTe(e){const t=e.visibility,r=t==="shared"?"Shared":t==="public"?"Public":"Private";let n="";if(e.expiryDate){const o=new Date(e.expiryDate);Number.isNaN(o.getTime())||(n=o.toISOString().slice(0,10))}return{name:e.name??"",description:e.description??"",collectionType:e.collectionType??"",coverIcon:e.coverIcon||"📁",tags:e.tags??[],selectedFiles:[...e.contentIds??[]],visibility:r,sharedWith:yTe(e.sharedWith),passwordProtected:!!e.passwordProtected,password:"",expiryEnabled:!!e.expiryEnabled,expiryDate:n,notifyOnAdd:e.notifyOnAdd!==!1,notifyOnShare:e.notifyOnShare!==!1}}function bTe({onClose:e,onSuccess:t,editing:r=null}){const{user:n}=Ur(),o=zn(n),a=4,s=mc(a),[l,c]=j.useState({name:"",description:"",collectionType:"",coverIcon:"📁",tags:[],selectedFiles:[],visibility:"Private",sharedWith:[],passwordProtected:!1,password:"",expiryEnabled:!1,expiryDate:"",notifyOnAdd:!0,notifyOnShare:!0}),[u,d]=j.useState([]),[f,h]=j.useState([]),[p,y]=j.useState(""),[m,x]=j.useState({}),[b,w]=j.useState({}),[k,S]=j.useState(!1),_=(J,ae)=>{c(Oe=>({...Oe,[J]:ae}));const me={name:["name"],collectionType:["collectionType"],visibility:["visibility","sharedWith","password","expiryDate"],sharedWith:["sharedWith"],passwordProtected:["password"],password:["password"],expiryEnabled:["expiryDate"],expiryDate:["expiryDate"],selectedFiles:["files"]}[J];me!=null&&me.length&&w(Oe=>{const we={...Oe};for(const ie of me)delete we[ie];return we})};j.useEffect(()=>{let J=!1;if(!o){d([]),y("Organisation required to load library.");return}return(async()=>{try{const{media:ae}=await vq({limit:400,organization:o});J||(d(ae),y(""))}catch{J||(d([]),y("Could not load library."))}})(),()=>{J=!0}},[o]),j.useEffect(()=>{let J=!1;return(async()=>{var me;const ae=await nx.list();if(J)return;if(ae.error||!((me=ae.data)!=null&&me.users)){h([]);return}const le=n==null?void 0:n._id;h(le?ae.data.users.filter(Oe=>Oe._id!==le):ae.data.users)})(),()=>{J=!0}},[n==null?void 0:n._id]),j.useEffect(()=>{r&&(c(xTe(r)),x({}),w({}))},[r==null?void 0:r._id]);const P=j.useCallback(J=>{if(J===1){const ae={};return l.name.trim()||(ae.name="Collection name is required."),l.collectionType.trim()||(ae.collectionType="Select a collection type."),Object.keys(ae).length>0?(w(le=>({...le,...ae})),!1):(w(le=>({...le,name:void 0,collectionType:void 0})),!0)}if(J===2){if(l.selectedFiles.length<1)return w(me=>({...me,files:"Select at least one file from your library."})),!1;const ae=new Set(u.map(me=>me._id));return l.selectedFiles.every(me=>ae.has(me))?(w(me=>({...me,files:void 0})),!0):(w(me=>({...me,files:"One or more selected files are no longer available."})),!1)}if(J===3){const ae={};if(["Private","Shared","Public"].includes(l.visibility)||(ae.visibility="Select a visibility option."),l.visibility==="Shared"&&l.sharedWith.length<1&&(ae.sharedWith="Add at least one team member to share with."),l.visibility==="Public"&&l.passwordProtected&&(!r||!r.passwordProtected&&l.passwordProtected)&&!l.password.trim()&&(ae.password="Enter a password or turn off password protection."),l.visibility==="Public"&&l.expiryEnabled)if(!l.expiryDate.trim())ae.expiryDate="Choose an expiry date.";else{const le=new Date(l.expiryDate);le.setHours(23,59,59,999),le.getTime()<=Date.now()&&(ae.expiryDate="Expiry date must be in the future.")}return w(le=>({...le,...ae})),Object.keys(ae).length?!1:(w(le=>({...le,visibility:void 0,sharedWith:void 0,password:void 0,expiryDate:void 0})),!0)}return!0},[l.name,l.collectionType,l.selectedFiles,l.visibility,l.sharedWith,l.passwordProtected,l.password,l.expiryEnabled,l.expiryDate,u,r]),O=J=>{const ae=P(J);x(le=>({...le,[J]:ae?"":"Fix the errors below before continuing."})),ae&&s.advance(J)},T=j.useCallback(()=>{const J=P(1),ae=P(2),le=P(3),me=P(4);return x(Oe=>({...Oe,99:"",1:J?"":Oe[1]||"Fix the errors below before continuing.",2:ae?"":Oe[2]||"Fix the errors below before continuing.",3:le?"":Oe[3]||"Fix the errors below before continuing.",4:me?"":Oe[4]||"Fix the errors below before continuing."})),!J||!ae||!le||!me?(x(Oe=>({...Oe,99:r?"Complete and fix all sections before saving.":"Complete and fix all sections before creating the collection."})),!1):!0},[P,r]),R=()=>{const J=l.visibility==="Private"?"private":l.visibility==="Shared"?"shared":"public";return{name:l.name.trim(),description:l.description.trim()||void 0,collectionType:l.collectionType,coverIcon:l.coverIcon,tags:l.tags,contentIds:l.selectedFiles,visibility:J,sharedWith:l.visibility==="Shared"?l.sharedWith:[],passwordProtected:l.visibility==="Public"?l.passwordProtected:!1,password:l.visibility==="Public"&&l.passwordProtected&&l.password.trim()?l.password.trim():void 0,expiryEnabled:l.visibility==="Public"?l.expiryEnabled:!1,expiryDate:l.visibility==="Public"&&l.expiryEnabled&&l.expiryDate.trim()?new Date(l.expiryDate).toISOString():void 0,notifyOnAdd:l.notifyOnAdd,notifyOnShare:l.notifyOnShare}},I=async()=>{if(!T())return;S(!0),x(ae=>({...ae,99:""}));const J=R();try{r!=null&&r._id?await I0.update(r._id,J):await I0.create(J),t==null||t(),e()}catch(ae){const le=ae instanceof Error?ae.message:r?"Could not update collection.":"Could not create collection.";x(me=>({...me,99:le}))}finally{S(!1)}},E=()=>{I()},[A,F]=j.useState(""),L=j.useRef(null),z=()=>{const J=A.trim();J&&!l.tags.includes(J)&&_("tags",[...l.tags,J]),F("")},V=J=>_("tags",l.tags.filter(ae=>ae!==J)),Q=J=>{(J.key==="Enter"||J.key===",")&&(J.preventDefault(),z()),J.key==="Backspace"&&!A&&l.tags.length&&V(l.tags[l.tags.length-1])},[U,ee]=j.useState(""),[H,B]=j.useState("All"),M=u.filter(J=>{const ae=o9(J);return(!U||J.name.toLowerCase().includes(U.toLowerCase()))&&(H==="All"||ae===H)}),$=J=>_("selectedFiles",l.selectedFiles.includes(J)?l.selectedFiles.filter(ae=>ae!==J):[...l.selectedFiles,J]),[q,Y]=j.useState(""),K=f.filter(J=>!l.sharedWith.includes(J._id)&&r0(J).toLowerCase().includes(q.toLowerCase())),G=J=>{_("sharedWith",[...l.sharedWith,J]),Y("")},re=J=>_("sharedWith",l.sharedWith.filter(ae=>ae!==J));return i.jsxs(Zo,{onClose:e,title:r?"Edit Collection":"New Collection",breadcrumb:"Content · Collections",description:r?"Update details, library files, and access for this collection.":"Group related files into a shareable, access-controlled collection.",completedCount:s.done.size,totalSections:a,ctaLabel:r?"Save changes":"Create Collection",ctaDisabled:k||s.done.size{I()},children:[m[99]&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",padding:"0 20px",margin:0},children:m[99]}),i.jsxs($r,{n:1,title:"Collection Details",subtitle:"Name, type, icon and tags",open:s.open===1,completed:s.done.has(1),onToggle:()=>s.toggle(1),onSave:()=>O(1),nextLabel:"Add Files",nextDisabled:k,sectionError:m[1],children:[i.jsxs(lt,{error:b.name,children:[i.jsx(pt,{text:"Collection Name",required:!0}),i.jsx("input",{style:{...$t,...b.name?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. NAPCON 2026 Media Kit",value:l.name,onChange:J=>_("name",J.target.value),onFocus:kt,onBlur:_t})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Description"}),i.jsx("textarea",{style:{...$t,resize:"vertical",minHeight:"72px"},placeholder:"What does this collection contain? Who is it for?",value:l.description,onChange:J=>_("description",J.target.value),onFocus:kt,onBlur:_t})]}),i.jsxs(Zi,{cols:2,children:[i.jsxs(lt,{error:b.collectionType,children:[i.jsx(pt,{text:"Collection Type",required:!0}),i.jsx(an,{children:i.jsxs("select",{style:{...Nr,...b.collectionType?{borderColor:"var(--destructive)"}:{}},value:l.collectionType,onChange:J=>_("collectionType",J.target.value),onFocus:kt,onBlur:_t,children:[i.jsx("option",{value:"",children:"Select type…"}),gTe.map(J=>i.jsx("option",{value:J,children:J},J))]})})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Cover Icon"}),i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",paddingTop:"2px"},children:mTe.map(J=>i.jsx("button",{onClick:()=>_("coverIcon",J),title:J,style:{width:"32px",height:"32px",borderRadius:"var(--radius-button)",border:`2px solid ${l.coverIcon===J?"var(--primary)":"var(--border)"}`,background:l.coverIcon===J?"var(--accent)":"var(--secondary)",cursor:"pointer",fontSize:"15px",display:"flex",alignItems:"center",justifyContent:"center",transition:"border-color .12s"},children:J},J))})]})]}),i.jsxs(lt,{children:[i.jsx(pt,{text:"Tags"}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"7px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",cursor:"text",minHeight:"40px",alignItems:"center"},onClick:()=>{var J;return(J=L.current)==null?void 0:J.focus()},children:[l.tags.map(J=>i.jsx(gw,{text:J,onRemove:()=>V(J)},J)),i.jsx("input",{ref:L,value:A,onChange:J=>F(J.target.value),onKeyDown:Q,onBlur:z,placeholder:l.tags.length===0?"Add tags — press Enter or comma…":"",style:{border:"none",outline:"none",background:"transparent",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",flex:1,minWidth:"120px"}})]}),i.jsx(Qt,{text:"Tags help attendees and admins find this collection quickly."})]})]}),i.jsxs($r,{n:2,title:"Add Files",subtitle:"Pick files from your library to include",open:s.open===2,completed:s.done.has(2),onToggle:()=>s.toggle(2),onSave:()=>O(2),nextLabel:"Visibility & Access",nextDisabled:k,sectionError:m[2],children:[p&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"0 0 8px"},children:p}),l.selectedFiles.length>0&&i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 10px",background:"var(--accent)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)"},children:l.selectedFiles.map(J=>{const ae=u.find(le=>le._id===J);return i.jsx(gw,{text:(ae==null?void 0:ae.name)??J,onRemove:()=>$(J)},J)})}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx(Pi,{size:13,style:{position:"absolute",left:"10px",top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}}),i.jsx("input",{style:{...$t,paddingLeft:"30px"},placeholder:"Search library…",value:U,onChange:J=>ee(J.target.value),onFocus:kt,onBlur:_t})]}),i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:vTe.map(J=>i.jsxs("button",{onClick:()=>B(J),style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"99px",border:`1px solid ${H===J?"var(--primary)":"var(--border)"}`,background:H===J?"var(--accent)":"var(--card)",color:H===J?"var(--primary)":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",transition:"all .12s"},children:[J!=="All"&&i.jsx("span",{style:{color:a9[J]??"var(--muted)"},children:hTe[J]}),J]},J))}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"3px",maxHeight:"260px",overflowY:"auto",paddingRight:"2px"},children:p?null:u.length===0?i.jsx("p",{style:{textAlign:"center",padding:"24px",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"No files in your library yet. Upload files from the Library tab first."}):M.length===0?i.jsx("p",{style:{textAlign:"center",padding:"24px",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"No files match your search."}):M.map(J=>{const ae=o9(J),le=l.selectedFiles.includes(J._id);return i.jsxs("button",{onClick:()=>$(J._id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"9px 12px",borderRadius:"var(--radius-button)",border:`1px solid ${le?"var(--primary)":"var(--border)"}`,background:le?"var(--accent)":"var(--card)",cursor:"pointer",textAlign:"left",transition:"all .12s"},children:[i.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"4px",border:`2px solid ${le?"var(--primary)":"var(--border)"}`,background:le?"var(--primary)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all .12s"},children:le&&i.jsx(Oi,{size:10,style:{color:"#fff"}})}),i.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:a9[ae]??"var(--muted)",flexShrink:0}}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:J.name}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",flexShrink:0},children:ae}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",flexShrink:0,minWidth:"52px",textAlign:"right"},children:pTe(J.size)})]},J._id)})}),i.jsx(lt,{error:b.files,children:i.jsx(Qt,{text:`${l.selectedFiles.length} file${l.selectedFiles.length!==1?"s":""} selected. You can add more files later.`})})]}),i.jsxs($r,{n:3,title:"Visibility & Access",subtitle:"Control who can view or manage this collection",open:s.open===3,completed:s.done.has(3),onToggle:()=>s.toggle(3),onSave:()=>O(3),nextLabel:"Notifications",nextDisabled:k,sectionError:m[3],children:[i.jsxs(lt,{error:b.visibility,children:[i.jsx(pt,{text:"Visibility",required:!0}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:["Private","Shared","Public"].map(J=>{const ae={Private:{icon:i.jsx(ate,{size:14}),desc:"Only you can see this collection."},Shared:{icon:i.jsx(rI,{size:14}),desc:"Specific admins or editors you invite."},Public:{icon:i.jsx(Q3,{size:14}),desc:"Anyone with the link can view."}},le=l.visibility===J;return i.jsxs("button",{type:"button",onClick:()=>_("visibility",J),style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"10px 12px",borderRadius:"var(--radius-button)",border:`1.5px solid ${le?"var(--primary)":"var(--border)"}`,background:le?"var(--accent)":"var(--card)",cursor:"pointer",textAlign:"left",transition:"all .12s"},children:[i.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"50%",flexShrink:0,marginTop:"2px",border:`2px solid ${le?"var(--primary)":"var(--border)"}`,background:le?"var(--primary)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",transition:"all .12s"},children:le&&i.jsx("div",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"#fff"}})}),i.jsx("span",{style:{color:le?"var(--primary)":"var(--muted)",marginTop:"1px",flexShrink:0},children:ae[J].icon}),i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:le?"var(--primary)":"var(--card-foreground)"},children:J}),i.jsx("p",{style:{margin:"2px 0 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:ae[J].desc})]})]},J)})})]}),l.visibility==="Shared"&&i.jsxs(lt,{error:b.sharedWith,children:[i.jsx(pt,{text:"Share With"}),l.sharedWith.length>0&&i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"8px"},children:l.sharedWith.map(J=>{const ae=f.find(me=>me._id===J),le=ae?r0(ae):J;return i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"4px 8px",borderRadius:"var(--radius-button)",background:"var(--accent)",border:"1px solid var(--border)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[i.jsx("span",{style:{width:"18px",height:"18px",borderRadius:"50%",background:"var(--primary)",color:"var(--primary-foreground)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"9px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)"},children:le.split(/\s+/).filter(Boolean).map(me=>me[0]).join("").slice(0,2).toUpperCase()}),le,i.jsx("button",{type:"button",onClick:()=>re(J),style:{background:"none",border:"none",cursor:"pointer",display:"flex",padding:0,color:"var(--muted)"},children:i.jsx(er,{size:10})})]},J)})}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("input",{style:$t,placeholder:"Search team members…",value:q,onChange:J=>Y(J.target.value),onFocus:kt,onBlur:_t}),q&&K.length>0&&i.jsx("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.10)",overflow:"hidden"},children:K.map(J=>i.jsxs("button",{type:"button",onMouseDown:()=>G(J._id),style:{width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"9px 12px",background:"none",border:"none",cursor:"pointer",textAlign:"left",borderBottom:"1px solid var(--border)"},onMouseEnter:ae=>{ae.currentTarget.style.background="var(--secondary)"},onMouseLeave:ae=>{ae.currentTarget.style.background="none"},children:[i.jsx("span",{style:{width:"24px",height:"24px",borderRadius:"50%",background:"var(--primary)",color:"var(--primary-foreground)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",flexShrink:0},children:r0(J).split(/\s+/).filter(Boolean).map(ae=>ae[0]).join("").slice(0,2).toUpperCase()}),i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:r0(J)}),i.jsx("p",{style:{margin:0,fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:J.role})]})]},J._id))})]}),i.jsx(Qt,{text:"Team members will receive an email notification when added."})]}),l.visibility==="Public"&&i.jsxs(i.Fragment,{children:[i.jsxs(lt,{error:b.password,children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:"Password Protection"}),i.jsx("p",{style:{margin:"2px 0 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Require a password to access this collection"})]}),i.jsx(s6,{value:l.passwordProtected,onChange:J=>_("passwordProtected",J)})]}),l.passwordProtected&&i.jsxs(i.Fragment,{children:[i.jsx("input",{style:{...$t,marginTop:"8px",...b.password?{borderColor:"var(--destructive)"}:{}},type:"password",placeholder:"Set access password…",value:l.password,onChange:J=>_("password",J.target.value),onFocus:kt,onBlur:_t}),(r==null?void 0:r.passwordProtected)&&i.jsx(Qt,{text:"Leave blank to keep the current password. Enter a new value to replace it."})]})]}),i.jsxs(lt,{error:b.expiryDate,children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:"Link Expiry"}),i.jsx("p",{style:{margin:"2px 0 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Automatically revoke access after a date"})]}),i.jsx(s6,{value:l.expiryEnabled,onChange:J=>_("expiryEnabled",J)})]}),l.expiryEnabled&&i.jsx("input",{style:{...$t,marginTop:"8px",...b.expiryDate?{borderColor:"var(--destructive)"}:{}},type:"date",value:l.expiryDate,onChange:J=>_("expiryDate",J.target.value),onFocus:kt,onBlur:_t})]})]})]}),i.jsxs($r,{n:4,title:"Notifications",subtitle:"Choose when to receive alerts for this collection",open:s.open===4,completed:s.done.has(4),onToggle:()=>s.toggle(4),onSave:E,nextLabel:r?"Save changes":"Create Collection",nextDisabled:k,sectionError:m[4],children:[i.jsx(ev,{text:"Notify me when…"}),i.jsx(s9,{icon:i.jsx(rI,{size:14}),label:"Files are added or removed",description:"Get notified whenever a file is uploaded or deleted.",value:l.notifyOnAdd,onChange:J=>_("notifyOnAdd",J)}),i.jsx(s9,{icon:i.jsx(Q3,{size:14}),label:"Collection is shared",description:"Alert me when someone shares or accesses this collection.",value:l.notifyOnShare,onChange:J=>_("notifyOnShare",J)}),i.jsx(Qt,{text:"Notifications are sent to your account email. You can change preferences in Settings."})]})]})}function s6({value:e,onChange:t}){return i.jsx("button",{onClick:()=>t(!e),"aria-pressed":e,style:{width:"36px",height:"20px",borderRadius:"99px",border:"none",cursor:"pointer",flexShrink:0,background:e?"var(--primary)":"var(--border)",position:"relative",transition:"background .2s"},children:i.jsx("span",{style:{position:"absolute",top:"3px",left:e?"19px":"3px",width:"14px",height:"14px",borderRadius:"50%",background:"#fff",transition:"left .2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}})})}function s9({icon:e,label:t,description:r,value:n,onChange:o}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"10px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"10px",flex:1},children:[i.jsx("span",{style:{color:n?"var(--primary)":"var(--muted)",marginTop:"2px",flexShrink:0},children:n?i.jsx(I6,{size:14}):i.jsx(iee,{size:14})}),i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:t}),i.jsx("p",{style:{margin:"2px 0 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:r})]})]}),i.jsx(s6,{value:n,onChange:o})]})}var w0={exports:{}};/*! - * Quill Editor v1.3.7 - * https://quilljs.com/ - * Copyright (c) 2014, Jason Chen - * Copyright (c) 2013, salesforce.com - */var wTe=w0.exports,l9;function STe(){return l9||(l9=1,(function(e,t){(function(n,o){e.exports=o()})(typeof self<"u"?self:wTe,function(){return(function(r){var n={};function o(a){if(n[a])return n[a].exports;var s=n[a]={i:a,l:!1,exports:{}};return r[a].call(s.exports,s,s.exports,o),s.l=!0,s.exports}return o.m=r,o.c=n,o.d=function(a,s,l){o.o(a,s)||Object.defineProperty(a,s,{configurable:!1,enumerable:!0,get:l})},o.n=function(a){var s=a&&a.__esModule?function(){return a.default}:function(){return a};return o.d(s,"a",s),s},o.o=function(a,s){return Object.prototype.hasOwnProperty.call(a,s)},o.p="",o(o.s=109)})([(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(17),s=o(18),l=o(19),c=o(45),u=o(46),d=o(47),f=o(48),h=o(49),p=o(12),y=o(32),m=o(33),x=o(31),b=o(1),w={Scope:b.Scope,create:b.create,find:b.find,query:b.query,register:b.register,Container:a.default,Format:s.default,Leaf:l.default,Embed:f.default,Scroll:c.default,Block:d.default,Inline:u.default,Text:h.default,Attributor:{Attribute:p.default,Class:y.default,Style:m.default,Store:x.default}};n.default=w}),(function(r,n,o){var a=this&&this.__extends||(function(){var x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,w){b.__proto__=w}||function(b,w){for(var k in w)w.hasOwnProperty(k)&&(b[k]=w[k])};return function(b,w){x(b,w);function k(){this.constructor=b}b.prototype=w===null?Object.create(w):(k.prototype=w.prototype,new k)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=(function(x){a(b,x);function b(w){var k=this;return w="[Parchment] "+w,k=x.call(this,w)||this,k.message=w,k.name=k.constructor.name,k}return b})(Error);n.ParchmentError=s;var l={},c={},u={},d={};n.DATA_KEY="__blot";var f;(function(x){x[x.TYPE=3]="TYPE",x[x.LEVEL=12]="LEVEL",x[x.ATTRIBUTE=13]="ATTRIBUTE",x[x.BLOT=14]="BLOT",x[x.INLINE=7]="INLINE",x[x.BLOCK=11]="BLOCK",x[x.BLOCK_BLOT=10]="BLOCK_BLOT",x[x.INLINE_BLOT=6]="INLINE_BLOT",x[x.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",x[x.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",x[x.ANY=15]="ANY"})(f=n.Scope||(n.Scope={}));function h(x,b){var w=y(x);if(w==null)throw new s("Unable to create "+x+" blot");var k=w,S=x instanceof Node||x.nodeType===Node.TEXT_NODE?x:k.create(b);return new k(S,b)}n.create=h;function p(x,b){return b===void 0&&(b=!1),x==null?null:x[n.DATA_KEY]!=null?x[n.DATA_KEY].blot:b?p(x.parentNode,b):null}n.find=p;function y(x,b){b===void 0&&(b=f.ANY);var w;if(typeof x=="string")w=d[x]||l[x];else if(x instanceof Text||x.nodeType===Node.TEXT_NODE)w=d.text;else if(typeof x=="number")x&f.LEVEL&f.BLOCK?w=d.block:x&f.LEVEL&f.INLINE&&(w=d.inline);else if(x instanceof HTMLElement){var k=(x.getAttribute("class")||"").split(/\s+/);for(var S in k)if(w=c[k[S]],w)break;w=w||u[x.tagName]}return w==null?null:b&f.LEVEL&w.scope&&b&f.TYPE&w.scope?w:null}n.query=y;function m(){for(var x=[],b=0;b1)return x.map(function(S){return m(S)});var w=x[0];if(typeof w.blotName!="string"&&typeof w.attrName!="string")throw new s("Invalid definition");if(w.blotName==="abstract")throw new s("Cannot register abstract class");if(d[w.blotName||w.attrName]=w,typeof w.keyName=="string")l[w.keyName]=w;else if(w.className!=null&&(c[w.className]=w),w.tagName!=null){Array.isArray(w.tagName)?w.tagName=w.tagName.map(function(S){return S.toUpperCase()}):w.tagName=w.tagName.toUpperCase();var k=Array.isArray(w.tagName)?w.tagName:[w.tagName];k.forEach(function(S){(u[S]==null||w.className==null)&&(u[S]=w)})}return w}n.register=m}),(function(r,n,o){var a=o(51),s=o(11),l=o(3),c=o(20),u="\0",d=function(f){Array.isArray(f)?this.ops=f:f!=null&&Array.isArray(f.ops)?this.ops=f.ops:this.ops=[]};d.prototype.insert=function(f,h){var p={};return f.length===0?this:(p.insert=f,h!=null&&typeof h=="object"&&Object.keys(h).length>0&&(p.attributes=h),this.push(p))},d.prototype.delete=function(f){return f<=0?this:this.push({delete:f})},d.prototype.retain=function(f,h){if(f<=0)return this;var p={retain:f};return h!=null&&typeof h=="object"&&Object.keys(h).length>0&&(p.attributes=h),this.push(p)},d.prototype.push=function(f){var h=this.ops.length,p=this.ops[h-1];if(f=l(!0,{},f),typeof p=="object"){if(typeof f.delete=="number"&&typeof p.delete=="number")return this.ops[h-1]={delete:p.delete+f.delete},this;if(typeof p.delete=="number"&&f.insert!=null&&(h-=1,p=this.ops[h-1],typeof p!="object"))return this.ops.unshift(f),this;if(s(f.attributes,p.attributes)){if(typeof f.insert=="string"&&typeof p.insert=="string")return this.ops[h-1]={insert:p.insert+f.insert},typeof f.attributes=="object"&&(this.ops[h-1].attributes=f.attributes),this;if(typeof f.retain=="number"&&typeof p.retain=="number")return this.ops[h-1]={retain:p.retain+f.retain},typeof f.attributes=="object"&&(this.ops[h-1].attributes=f.attributes),this}}return h===this.ops.length?this.ops.push(f):this.ops.splice(h,0,f),this},d.prototype.chop=function(){var f=this.ops[this.ops.length-1];return f&&f.retain&&!f.attributes&&this.ops.pop(),this},d.prototype.filter=function(f){return this.ops.filter(f)},d.prototype.forEach=function(f){this.ops.forEach(f)},d.prototype.map=function(f){return this.ops.map(f)},d.prototype.partition=function(f){var h=[],p=[];return this.forEach(function(y){var m=f(y)?h:p;m.push(y)}),[h,p]},d.prototype.reduce=function(f,h){return this.ops.reduce(f,h)},d.prototype.changeLength=function(){return this.reduce(function(f,h){return h.insert?f+c.length(h):h.delete?f-h.delete:f},0)},d.prototype.length=function(){return this.reduce(function(f,h){return f+c.length(h)},0)},d.prototype.slice=function(f,h){f=f||0,typeof h!="number"&&(h=1/0);for(var p=[],y=c.iterator(this.ops),m=0;m0&&p.next(m.retain-x)}for(var b=new d(y);h.hasNext()||p.hasNext();)if(p.peekType()==="insert")b.push(p.next());else if(h.peekType()==="delete")b.push(h.next());else{var w=Math.min(h.peekLength(),p.peekLength()),k=h.next(w),S=p.next(w);if(typeof S.retain=="number"){var _={};typeof k.retain=="number"?_.retain=w:_.insert=k.insert;var P=c.attributes.compose(k.attributes,S.attributes,typeof k.retain=="number");if(P&&(_.attributes=P),b.push(_),!p.hasNext()&&s(b.ops[b.ops.length-1],_)){var O=new d(h.rest());return b.concat(O).chop()}}else typeof S.delete=="number"&&typeof k.retain=="number"&&b.push(S)}return b.chop()},d.prototype.concat=function(f){var h=new d(this.ops.slice());return f.ops.length>0&&(h.push(f.ops[0]),h.ops=h.ops.concat(f.ops.slice(1))),h},d.prototype.diff=function(f,h){if(this.ops===f.ops)return new d;var p=[this,f].map(function(w){return w.map(function(k){if(k.insert!=null)return typeof k.insert=="string"?k.insert:u;var S=w===f?"on":"with";throw new Error("diff() called "+S+" non-document")}).join("")}),y=new d,m=a(p[0],p[1],h),x=c.iterator(this.ops),b=c.iterator(f.ops);return m.forEach(function(w){for(var k=w[1].length;k>0;){var S=0;switch(w[0]){case a.INSERT:S=Math.min(b.peekLength(),k),y.push(b.next(S));break;case a.DELETE:S=Math.min(k,x.peekLength()),x.next(S),y.delete(S);break;case a.EQUAL:S=Math.min(x.peekLength(),b.peekLength(),k);var _=x.next(S),P=b.next(S);s(_.insert,P.insert)?y.retain(S,c.attributes.diff(_.attributes,P.attributes)):y.push(P).delete(S);break}k-=S}}),y.chop()},d.prototype.eachLine=function(f,h){h=h||` -`;for(var p=c.iterator(this.ops),y=new d,m=0;p.hasNext();){if(p.peekType()!=="insert")return;var x=p.peek(),b=c.length(x)-p.peekLength(),w=typeof x.insert=="string"?x.insert.indexOf(h,b)-b:-1;if(w<0)y.push(p.next());else if(w>0)y.push(p.next(w));else{if(f(y,p.next(1).attributes||{},m)===!1)return;m+=1,y=new d}}y.length()>0&&f(y,{},m)},d.prototype.transform=function(f,h){if(h=!!h,typeof f=="number")return this.transformPosition(f,h);for(var p=c.iterator(this.ops),y=c.iterator(f.ops),m=new d;p.hasNext()||y.hasNext();)if(p.peekType()==="insert"&&(h||y.peekType()!=="insert"))m.retain(c.length(p.next()));else if(y.peekType()==="insert")m.push(y.next());else{var x=Math.min(p.peekLength(),y.peekLength()),b=p.next(x),w=y.next(x);if(b.delete)continue;w.delete?m.push(w):m.retain(x,c.attributes.transform(b.attributes,w.attributes,h))}return m.chop()},d.prototype.transformPosition=function(f,h){h=!!h;for(var p=c.iterator(this.ops),y=0;p.hasNext()&&y<=f;){var m=p.peekLength(),x=p.peekType();if(p.next(),x==="delete"){f-=Math.min(m,f-y);continue}else x==="insert"&&(y"u"||o.call(p,x)},d=function(p,y){s&&y.name==="__proto__"?s(p,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):p[y.name]=y.newValue},f=function(p,y){if(y==="__proto__")if(o.call(p,y)){if(l)return l(p,y).value}else return;return p[y]};r.exports=function h(){var p,y,m,x,b,w,k=arguments[0],S=1,_=arguments.length,P=!1;for(typeof k=="boolean"&&(P=k,k=arguments[1]||{},S=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});S<_;++S)if(p=arguments[S],p!=null)for(y in p)m=f(k,y),x=f(p,y),k!==x&&(P&&x&&(u(x)||(b=c(x)))?(b?(b=!1,w=m&&c(m)?m:[]):w=m&&u(m)?m:{},d(k,{name:y,newValue:h(P,w,x)})):typeof x<"u"&&d(k,{name:y,newValue:x}));return k}}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BlockEmbed=n.bubbleFormats=void 0;var a=(function(){function E(A,F){for(var L=0;L0&&(L1&&arguments[1]!==void 0?arguments[1]:!1;if(z&&(L===0||L>=this.length()-O)){var V=this.clone();return L===0?(this.parent.insertBefore(V,this),this):(this.parent.insertBefore(V,this.next),V)}else{var Q=s(A.prototype.__proto__||Object.getPrototypeOf(A.prototype),"split",this).call(this,L,z);return this.cache={},Q}}}]),A})(h.default.Block);R.blotName="block",R.tagName="P",R.defaultChild="break",R.allowedChildren=[x.default,h.default.Embed,w.default];function I(E){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return E==null||(typeof E.formats=="function"&&(A=(0,c.default)(A,E.formats())),E.parent==null||E.parent.blotName=="scroll"||E.parent.statics.scope!==E.statics.scope)?A:I(E.parent,A)}n.bubbleFormats=I,n.BlockEmbed=T,n.default=R}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.overload=n.expandConfig=void 0;var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},s=(function(){function ee(H,B){var M=[],$=!0,q=!1,Y=void 0;try{for(var K=H[Symbol.iterator](),G;!($=(G=K.next()).done)&&(M.push(G.value),!(B&&M.length===B));$=!0);}catch(re){q=!0,Y=re}finally{try{!$&&K.return&&K.return()}finally{if(q)throw Y}}return M}return function(H,B){if(Array.isArray(H))return H;if(Symbol.iterator in Object(H))return ee(H,B);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),l=(function(){function ee(H,B){for(var M=0;M2&&arguments[2]!==void 0?arguments[2]:!1;if(typeof B!="string"){var Y=B.attrName||B.blotName;typeof Y=="string"?this.register("formats/"+Y,B,M):Object.keys(B).forEach(function(K){$.register(K,B[K],M)})}else this.imports[B]!=null&&!q&&F.warn("Overwriting "+B+" with",M),this.imports[B]=M,(B.startsWith("blots/")||B.startsWith("formats/"))&&M.blotName!=="abstract"?b.default.register(M):B.startsWith("modules")&&typeof M.register=="function"&&M.register()}}]);function ee(H){var B=this,M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(A(this,ee),this.options=z(H,M),this.container=this.options.container,this.container==null)return F.error("Invalid Quill container",H);this.options.debug&&ee.debug(this.options.debug);var $=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new p.default,this.scroll=b.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new f.default(this.scroll),this.selection=new k.default(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.theme.init(),this.emitter.on(p.default.events.EDITOR_CHANGE,function(Y){Y===p.default.events.TEXT_CHANGE&&B.root.classList.toggle("ql-blank",B.editor.isBlank())}),this.emitter.on(p.default.events.SCROLL_UPDATE,function(Y,K){var G=B.selection.lastRange,re=G&&G.length===0?G.index:void 0;V.call(B,function(){return B.editor.update(null,K,re)},Y)});var q=this.clipboard.convert(`
`+$+"


");this.setContents(q),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return l(ee,[{key:"addContainer",value:function(B){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof B=="string"){var $=B;B=document.createElement("div"),B.classList.add($)}return this.container.insertBefore(B,M),B}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(B,M,$){var q=this,Y=Q(B,M,$),K=s(Y,4);return B=K[0],M=K[1],$=K[3],V.call(this,function(){return q.editor.deleteText(B,M)},$,B,-1*M)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.scroll.enable(B),this.container.classList.toggle("ql-disabled",!B)}},{key:"focus",value:function(){var B=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=B,this.scrollIntoView()}},{key:"format",value:function(B,M){var $=this,q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:p.default.sources.API;return V.call(this,function(){var Y=$.getSelection(!0),K=new u.default;if(Y==null)return K;if(b.default.query(B,b.default.Scope.BLOCK))K=$.editor.formatLine(Y.index,Y.length,E({},B,M));else{if(Y.length===0)return $.selection.format(B,M),K;K=$.editor.formatText(Y.index,Y.length,E({},B,M))}return $.setSelection(Y,p.default.sources.SILENT),K},q)}},{key:"formatLine",value:function(B,M,$,q,Y){var K=this,G=void 0,re=Q(B,M,$,q,Y),J=s(re,4);return B=J[0],M=J[1],G=J[2],Y=J[3],V.call(this,function(){return K.editor.formatLine(B,M,G)},Y,B,0)}},{key:"formatText",value:function(B,M,$,q,Y){var K=this,G=void 0,re=Q(B,M,$,q,Y),J=s(re,4);return B=J[0],M=J[1],G=J[2],Y=J[3],V.call(this,function(){return K.editor.formatText(B,M,G)},Y,B,0)}},{key:"getBounds",value:function(B){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,$=void 0;typeof B=="number"?$=this.selection.getBounds(B,M):$=this.selection.getBounds(B.index,B.length);var q=this.container.getBoundingClientRect();return{bottom:$.bottom-q.top,height:$.height,left:$.left-q.left,right:$.right-q.left,top:$.top-q.top,width:$.width}}},{key:"getContents",value:function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-B,$=Q(B,M),q=s($,2);return B=q[0],M=q[1],this.editor.getContents(B,M)}},{key:"getFormat",value:function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.getSelection(!0),M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof B=="number"?this.editor.getFormat(B,M):this.editor.getFormat(B.index,B.length)}},{key:"getIndex",value:function(B){return B.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(B){return this.scroll.leaf(B)}},{key:"getLine",value:function(B){return this.scroll.line(B)}},{key:"getLines",value:function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE;return typeof B!="number"?this.scroll.lines(B.index,B.length):this.scroll.lines(B,M)}},{key:"getModule",value:function(B){return this.theme.modules[B]}},{key:"getSelection",value:function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return B&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-B,$=Q(B,M),q=s($,2);return B=q[0],M=q[1],this.editor.getText(B,M)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(B,M,$){var q=this,Y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:ee.sources.API;return V.call(this,function(){return q.editor.insertEmbed(B,M,$)},Y,B)}},{key:"insertText",value:function(B,M,$,q,Y){var K=this,G=void 0,re=Q(B,0,$,q,Y),J=s(re,4);return B=J[0],G=J[2],Y=J[3],V.call(this,function(){return K.editor.insertText(B,M,G)},Y,B,M.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(B,M,$){this.clipboard.dangerouslyPasteHTML(B,M,$)}},{key:"removeFormat",value:function(B,M,$){var q=this,Y=Q(B,M,$),K=s(Y,4);return B=K[0],M=K[1],$=K[3],V.call(this,function(){return q.editor.removeFormat(B,M)},$,B)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(B){var M=this,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p.default.sources.API;return V.call(this,function(){B=new u.default(B);var q=M.getLength(),Y=M.editor.deleteText(0,q),K=M.editor.applyDelta(B),G=K.ops[K.ops.length-1];G!=null&&typeof G.insert=="string"&&G.insert[G.insert.length-1]===` -`&&(M.editor.deleteText(M.getLength()-1,1),K.delete(1));var re=Y.compose(K);return re},$)}},{key:"setSelection",value:function(B,M,$){if(B==null)this.selection.setRange(null,M||ee.sources.API);else{var q=Q(B,M,$),Y=s(q,4);B=Y[0],M=Y[1],$=Y[3],this.selection.setRange(new w.Range(B,M),$),$!==p.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(B){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p.default.sources.API,$=new u.default().insert(B);return this.setContents($,M)}},{key:"update",value:function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p.default.sources.USER,M=this.scroll.update(B);return this.selection.update(B),M}},{key:"updateContents",value:function(B){var M=this,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p.default.sources.API;return V.call(this,function(){return B=new u.default(B),M.editor.applyDelta(B,$)},$,!0)}}]),ee})();L.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},L.events=p.default.events,L.sources=p.default.sources,L.version="1.3.7",L.imports={delta:u.default,parchment:b.default,"core/module":m.default,"core/theme":R.default};function z(ee,H){if(H=(0,_.default)(!0,{container:ee,modules:{clipboard:!0,keyboard:!0,history:!0}},H),!H.theme||H.theme===L.DEFAULTS.theme)H.theme=R.default;else if(H.theme=L.import("themes/"+H.theme),H.theme==null)throw new Error("Invalid theme "+H.theme+". Did you register it?");var B=(0,_.default)(!0,{},H.theme.DEFAULTS);[B,H].forEach(function(q){q.modules=q.modules||{},Object.keys(q.modules).forEach(function(Y){q.modules[Y]===!0&&(q.modules[Y]={})})});var M=Object.keys(B.modules).concat(Object.keys(H.modules)),$=M.reduce(function(q,Y){var K=L.import("modules/"+Y);return K==null?F.error("Cannot load "+Y+" module. Are you sure you registered it?"):q[Y]=K.DEFAULTS||{},q},{});return H.modules!=null&&H.modules.toolbar&&H.modules.toolbar.constructor!==Object&&(H.modules.toolbar={container:H.modules.toolbar}),H=(0,_.default)(!0,{},L.DEFAULTS,{modules:$},B,H),["bounds","container","scrollingContainer"].forEach(function(q){typeof H[q]=="string"&&(H[q]=document.querySelector(H[q]))}),H.modules=Object.keys(H.modules).reduce(function(q,Y){return H.modules[Y]&&(q[Y]=H.modules[Y]),q},{}),H}function V(ee,H,B,M){if(this.options.strict&&!this.isEnabled()&&H===p.default.sources.USER)return new u.default;var $=B==null?null:this.getSelection(),q=this.editor.delta,Y=ee();if($!=null&&(B===!0&&(B=$.index),M==null?$=U($,Y,H):M!==0&&($=U($,B,M,H)),this.setSelection($,p.default.sources.SILENT)),Y.length()>0){var K,G=[p.default.events.TEXT_CHANGE,Y,q,H];if((K=this.emitter).emit.apply(K,[p.default.events.EDITOR_CHANGE].concat(G)),H!==p.default.sources.SILENT){var re;(re=this.emitter).emit.apply(re,G)}}return Y}function Q(ee,H,B,M,$){var q={};return typeof ee.index=="number"&&typeof ee.length=="number"?typeof H!="number"?($=M,M=B,B=H,H=ee.length,ee=ee.index):(H=ee.length,ee=ee.index):typeof H!="number"&&($=M,M=B,B=H,H=0),(typeof B>"u"?"undefined":a(B))==="object"?(q=B,$=M):typeof B=="string"&&(M!=null?q[B]=M:$=B),$=$||p.default.sources.API,[ee,H,q,$]}function U(ee,H,B,M){if(ee==null)return null;var $=void 0,q=void 0;if(H instanceof u.default){var Y=[ee.index,ee.index+ee.length].map(function(J){return H.transformPosition(J,M!==p.default.sources.USER)}),K=s(Y,2);$=K[0],q=K[1]}else{var G=[ee.index,ee.index+ee.length].map(function(J){return J=0?J+B:Math.max(H,J+B)}),re=s(G,2);$=re[0],q=re[1]}return new w.Range($,q-$)}n.expandConfig=z,n.overload=Q,n.default=L}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function x(b,w){for(var k=0;k0){var S=this.parent.isolate(this.offset(),this.length());this.moveChildren(S),S.wrap(this)}}}],[{key:"compare",value:function(k,S){var _=b.order.indexOf(k),P=b.order.indexOf(S);return _>=0||P>=0?_-P:k===S?0:k1?P-1:0),T=1;T1&&arguments[1]!==void 0?arguments[1]:{};a(this,l),this.quill=c,this.options=u};s.DEFAULTS={},n.default=s}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=["error","warn","log","info"],s="warn";function l(u){if(a.indexOf(u)<=a.indexOf(s)){for(var d,f=arguments.length,h=Array(f>1?f-1:0),p=1;p0&&typeof h[0]!="number")}function f(h,p,y){var m,x;if(u(h)||u(p)||h.prototype!==p.prototype)return!1;if(l(h))return l(p)?(h=a.call(h),p=a.call(p),c(h,p,y)):!1;if(d(h)){if(!d(p)||h.length!==p.length)return!1;for(m=0;m=0;m--)if(b[m]!=w[m])return!1;for(m=b.length-1;m>=0;m--)if(x=b[m],!c(h[x],p[x],y))return!1;return typeof h==typeof p}}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(1),s=(function(){function l(c,u,d){d===void 0&&(d={}),this.attrName=c,this.keyName=u;var f=a.Scope.TYPE&a.Scope.ATTRIBUTE;d.scope!=null?this.scope=d.scope&a.Scope.LEVEL|f:this.scope=a.Scope.ATTRIBUTE,d.whitelist!=null&&(this.whitelist=d.whitelist)}return l.keys=function(c){return[].map.call(c.attributes,function(u){return u.name})},l.prototype.add=function(c,u){return this.canAdd(c,u)?(c.setAttribute(this.keyName,u),!0):!1},l.prototype.canAdd=function(c,u){var d=a.query(c,a.Scope.BLOT&(this.scope|a.Scope.TYPE));return d==null?!1:this.whitelist==null?!0:typeof u=="string"?this.whitelist.indexOf(u.replace(/["']/g,""))>-1:this.whitelist.indexOf(u)>-1},l.prototype.remove=function(c){c.removeAttribute(this.keyName)},l.prototype.value=function(c){var u=c.getAttribute(this.keyName);return this.canAdd(c,u)&&u?u:""},l})();n.default=s}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Code=void 0;var a=(function(){function T(R,I){var E=[],A=!0,F=!1,L=void 0;try{for(var z=R[Symbol.iterator](),V;!(A=(V=z.next()).done)&&(E.push(V.value),!(I&&E.length===I));A=!0);}catch(Q){F=!0,L=Q}finally{try{!A&&z.return&&z.return()}finally{if(F)throw L}}return E}return function(R,I){if(Array.isArray(R))return R;if(Symbol.iterator in Object(R))return T(R,I);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function T(R,I){for(var E=0;E=E+A)){var V=this.newlineIndex(E,!0)+1,Q=z-V+1,U=this.isolate(V,Q),ee=U.next;U.format(F,L),ee instanceof R&&ee.formatAt(0,E-V+A-Q,F,L)}}}},{key:"insertAt",value:function(E,A,F){if(F==null){var L=this.descendant(b.default,E),z=a(L,2),V=z[0],Q=z[1];V.insertAt(Q,A)}}},{key:"length",value:function(){var E=this.domNode.textContent.length;return this.domNode.textContent.endsWith(` -`)?E:E+1}},{key:"newlineIndex",value:function(E){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(A)return this.domNode.textContent.slice(0,E).lastIndexOf(` -`);var F=this.domNode.textContent.slice(E).indexOf(` -`);return F>-1?E+F:-1}},{key:"optimize",value:function(E){this.domNode.textContent.endsWith(` -`)||this.appendChild(f.default.create("text",` -`)),l(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"optimize",this).call(this,E);var A=this.next;A!=null&&A.prev===this&&A.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===A.statics.formats(A.domNode)&&(A.optimize(E),A.moveChildren(this),A.remove())}},{key:"replace",value:function(E){l(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"replace",this).call(this,E),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(A){var F=f.default.find(A);F==null?A.parentNode.removeChild(A):F instanceof f.default.Embed?F.remove():F.unwrap()})}}],[{key:"create",value:function(E){var A=l(R.__proto__||Object.getPrototypeOf(R),"create",this).call(this,E);return A.setAttribute("spellcheck",!1),A}},{key:"formats",value:function(){return!0}}]),R})(p.default);O.blotName="code-block",O.tagName="PRE",O.TAB=" ",n.Code=P,n.default=O}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},s=(function(){function ee(H,B){var M=[],$=!0,q=!1,Y=void 0;try{for(var K=H[Symbol.iterator](),G;!($=(G=K.next()).done)&&(M.push(G.value),!(B&&M.length===B));$=!0);}catch(re){q=!0,Y=re}finally{try{!$&&K.return&&K.return()}finally{if(q)throw Y}}return M}return function(H,B){if(Array.isArray(H))return H;if(Symbol.iterator in Object(H))return ee(H,B);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),l=(function(){function ee(H,B){for(var M=0;M=q&&!J.endsWith(` -`)&&($=!0),M.scroll.insertAt(Y,J);var ae=M.scroll.line(Y),le=s(ae,2),me=le[0],Oe=le[1],we=(0,E.default)({},(0,w.bubbleFormats)(me));if(me instanceof k.default){var ie=me.descendant(p.default.Leaf,Oe),Me=s(ie,1),ke=Me[0];we=(0,E.default)(we,(0,w.bubbleFormats)(ke))}re=f.default.attributes.diff(we,re)||{}}else if(a(K.insert)==="object"){var se=Object.keys(K.insert)[0];if(se==null)return Y;M.scroll.insertAt(Y,se,K.insert[se])}q+=G}return Object.keys(re).forEach(function(fe){M.scroll.formatAt(Y,G,fe,re[fe])}),Y+G},0),B.reduce(function(Y,K){return typeof K.delete=="number"?(M.scroll.deleteAt(Y,K.delete),Y):Y+(K.retain||K.insert.length||1)},0),this.scroll.batchEnd(),this.update(B)}},{key:"deleteText",value:function(B,M){return this.scroll.deleteAt(B,M),this.update(new u.default().retain(B).delete(M))}},{key:"formatLine",value:function(B,M){var $=this,q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.scroll.update(),Object.keys(q).forEach(function(Y){if(!($.scroll.whitelist!=null&&!$.scroll.whitelist[Y])){var K=$.scroll.lines(B,Math.max(M,1)),G=M;K.forEach(function(re){var J=re.length();if(!(re instanceof m.default))re.format(Y,q[Y]);else{var ae=B-re.offset($.scroll),le=re.newlineIndex(ae+G)-ae+1;re.formatAt(ae,le,Y,q[Y])}G-=J})}}),this.scroll.optimize(),this.update(new u.default().retain(B).retain(M,(0,O.default)(q)))}},{key:"formatText",value:function(B,M){var $=this,q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Object.keys(q).forEach(function(Y){$.scroll.formatAt(B,M,Y,q[Y])}),this.update(new u.default().retain(B).retain(M,(0,O.default)(q)))}},{key:"getContents",value:function(B,M){return this.delta.slice(B,B+M)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(B,M){return B.concat(M.delta())},new u.default)}},{key:"getFormat",value:function(B){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,$=[],q=[];M===0?this.scroll.path(B).forEach(function(K){var G=s(K,1),re=G[0];re instanceof k.default?$.push(re):re instanceof p.default.Leaf&&q.push(re)}):($=this.scroll.lines(B,M),q=this.scroll.descendants(p.default.Leaf,B,M));var Y=[$,q].map(function(K){if(K.length===0)return{};for(var G=(0,w.bubbleFormats)(K.shift());Object.keys(G).length>0;){var re=K.shift();if(re==null)return G;G=Q((0,w.bubbleFormats)(re),G)}return G});return E.default.apply(E.default,Y)}},{key:"getText",value:function(B,M){return this.getContents(B,M).filter(function($){return typeof $.insert=="string"}).map(function($){return $.insert}).join("")}},{key:"insertEmbed",value:function(B,M,$){return this.scroll.insertAt(B,M,$),this.update(new u.default().retain(B).insert(F({},M,$)))}},{key:"insertText",value:function(B,M){var $=this,q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return M=M.replace(/\r\n/g,` -`).replace(/\r/g,` -`),this.scroll.insertAt(B,M),Object.keys(q).forEach(function(Y){$.scroll.formatAt(B,M.length,Y,q[Y])}),this.update(new u.default().retain(B).insert(M,(0,O.default)(q)))}},{key:"isBlank",value:function(){if(this.scroll.children.length==0)return!0;if(this.scroll.children.length>1)return!1;var B=this.scroll.children.head;return B.statics.blotName!==k.default.blotName||B.children.length>1?!1:B.children.head instanceof _.default}},{key:"removeFormat",value:function(B,M){var $=this.getText(B,M),q=this.scroll.line(B+M),Y=s(q,2),K=Y[0],G=Y[1],re=0,J=new u.default;K!=null&&(K instanceof m.default?re=K.newlineIndex(G)-G+1:re=K.length()-G,J=K.delta().slice(G,G+re-1).insert(` -`));var ae=this.getContents(B,M+re),le=ae.diff(new u.default().insert($).concat(J)),me=new u.default().retain(B).concat(le);return this.applyDelta(me)}},{key:"update",value:function(B){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,q=this.delta;if(M.length===1&&M[0].type==="characterData"&&M[0].target.data.match(z)&&p.default.find(M[0].target)){var Y=p.default.find(M[0].target),K=(0,w.bubbleFormats)(Y),G=Y.offset(this.scroll),re=M[0].oldValue.replace(b.default.CONTENTS,""),J=new u.default().insert(re),ae=new u.default().insert(Y.value()),le=new u.default().retain(G).concat(J.diff(ae,$));B=le.reduce(function(me,Oe){return Oe.insert?me.insert(Oe.insert,K):me.push(Oe)},new u.default),this.delta=q.compose(B)}else this.delta=this.getDelta(),(!B||!(0,R.default)(q.compose(B),this.delta))&&(B=q.diff(this.delta,$));return B}}]),ee})();function Q(ee,H){return Object.keys(H).reduce(function(B,M){return ee[M]==null||(H[M]===ee[M]?B[M]=H[M]:Array.isArray(H[M])?H[M].indexOf(ee[M])<0&&(B[M]=H[M].concat([ee[M]])):B[M]=[H[M],ee[M]]),B},{})}function U(ee){return ee.reduce(function(H,B){if(B.insert===1){var M=(0,O.default)(B.attributes);return delete M.image,H.insert({image:B.attributes.image},M)}if(B.attributes!=null&&(B.attributes.list===!0||B.attributes.bullet===!0)&&(B=(0,O.default)(B),B.attributes.list?B.attributes.list="ordered":(B.attributes.list="bullet",delete B.attributes.bullet)),typeof B.insert=="string"){var $=B.insert.replace(/\r\n/g,` -`).replace(/\r/g,` -`);return H.insert($,B.attributes)}return H.push(B)},new u.default)}n.default=V}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Range=void 0;var a=(function(){function T(R,I){var E=[],A=!0,F=!1,L=void 0;try{for(var z=R[Symbol.iterator](),V;!(A=(V=z.next()).done)&&(E.push(V.value),!(I&&E.length===I));A=!0);}catch(Q){F=!0,L=Q}finally{try{!A&&z.return&&z.return()}finally{if(F)throw L}}return E}return function(R,I){if(Array.isArray(R))return R;if(Symbol.iterator in Object(R))return T(R,I);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function T(R,I){for(var E=0;E1&&arguments[1]!==void 0?arguments[1]:0;k(this,T),this.index=R,this.length=I},P=(function(){function T(R,I){var E=this;k(this,T),this.emitter=I,this.scroll=R,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=c.default.create("cursor",this),this.lastRange=this.savedRange=new _(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,function(){E.mouseDown||setTimeout(E.update.bind(E,y.default.sources.USER),1)}),this.emitter.on(y.default.events.EDITOR_CHANGE,function(A,F){A===y.default.events.TEXT_CHANGE&&F.length()>0&&E.update(y.default.sources.SILENT)}),this.emitter.on(y.default.events.SCROLL_BEFORE_UPDATE,function(){if(E.hasFocus()){var A=E.getNativeRange();A!=null&&A.start.node!==E.cursor.textNode&&E.emitter.once(y.default.events.SCROLL_UPDATE,function(){try{E.setNativeRange(A.start.node,A.start.offset,A.end.node,A.end.offset)}catch{}})}}),this.emitter.on(y.default.events.SCROLL_OPTIMIZE,function(A,F){if(F.range){var L=F.range,z=L.startNode,V=L.startOffset,Q=L.endNode,U=L.endOffset;E.setNativeRange(z,V,Q,U)}}),this.update(y.default.sources.SILENT)}return s(T,[{key:"handleComposition",value:function(){var I=this;this.root.addEventListener("compositionstart",function(){I.composing=!0}),this.root.addEventListener("compositionend",function(){if(I.composing=!1,I.cursor.parent){var E=I.cursor.restore();if(!E)return;setTimeout(function(){I.setNativeRange(E.startNode,E.startOffset,E.endNode,E.endOffset)},1)}})}},{key:"handleDragging",value:function(){var I=this;this.emitter.listenDOM("mousedown",document.body,function(){I.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){I.mouseDown=!1,I.update(y.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(I,E){if(!(this.scroll.whitelist!=null&&!this.scroll.whitelist[I])){this.scroll.update();var A=this.getNativeRange();if(!(A==null||!A.native.collapsed||c.default.query(I,c.default.Scope.BLOCK))){if(A.start.node!==this.cursor.textNode){var F=c.default.find(A.start.node,!1);if(F==null)return;if(F instanceof c.default.Leaf){var L=F.split(A.start.offset);F.parent.insertBefore(this.cursor,L)}else F.insertBefore(this.cursor,A.start.node);this.cursor.attach()}this.cursor.format(I,E),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(I){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,A=this.scroll.length();I=Math.min(I,A-1),E=Math.min(I+E,A-1)-I;var F=void 0,L=this.scroll.leaf(I),z=a(L,2),V=z[0],Q=z[1];if(V==null)return null;var U=V.position(Q,!0),ee=a(U,2);F=ee[0],Q=ee[1];var H=document.createRange();if(E>0){H.setStart(F,Q);var B=this.scroll.leaf(I+E),M=a(B,2);if(V=M[0],Q=M[1],V==null)return null;var $=V.position(Q,!0),q=a($,2);return F=q[0],Q=q[1],H.setEnd(F,Q),H.getBoundingClientRect()}else{var Y="left",K=void 0;return F instanceof Text?(Q0&&(Y="right")),{bottom:K.top+K.height,height:K.height,left:K[Y],right:K[Y],top:K.top,width:0}}}},{key:"getNativeRange",value:function(){var I=document.getSelection();if(I==null||I.rangeCount<=0)return null;var E=I.getRangeAt(0);if(E==null)return null;var A=this.normalizeNative(E);return S.info("getNativeRange",A),A}},{key:"getRange",value:function(){var I=this.getNativeRange();if(I==null)return[null,null];var E=this.normalizedToRange(I);return[E,I]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(I){var E=this,A=[[I.start.node,I.start.offset]];I.native.collapsed||A.push([I.end.node,I.end.offset]);var F=A.map(function(V){var Q=a(V,2),U=Q[0],ee=Q[1],H=c.default.find(U,!0),B=H.offset(E.scroll);return ee===0?B:H instanceof c.default.Container?B+H.length():B+H.index(U,ee)}),L=Math.min(Math.max.apply(Math,w(F)),this.scroll.length()-1),z=Math.min.apply(Math,[L].concat(w(F)));return new _(z,L-z)}},{key:"normalizeNative",value:function(I){if(!O(this.root,I.startContainer)||!I.collapsed&&!O(this.root,I.endContainer))return null;var E={start:{node:I.startContainer,offset:I.startOffset},end:{node:I.endContainer,offset:I.endOffset},native:I};return[E.start,E.end].forEach(function(A){for(var F=A.node,L=A.offset;!(F instanceof Text)&&F.childNodes.length>0;)if(F.childNodes.length>L)F=F.childNodes[L],L=0;else if(F.childNodes.length===L)F=F.lastChild,L=F instanceof Text?F.data.length:F.childNodes.length+1;else break;A.node=F,A.offset=L}),E}},{key:"rangeToNative",value:function(I){var E=this,A=I.collapsed?[I.index]:[I.index,I.index+I.length],F=[],L=this.scroll.length();return A.forEach(function(z,V){z=Math.min(L-1,z);var Q=void 0,U=E.scroll.leaf(z),ee=a(U,2),H=ee[0],B=ee[1],M=H.position(B,V!==0),$=a(M,2);Q=$[0],B=$[1],F.push(Q,B)}),F.length<2&&(F=F.concat(F)),F}},{key:"scrollIntoView",value:function(I){var E=this.lastRange;if(E!=null){var A=this.getBounds(E.index,E.length);if(A!=null){var F=this.scroll.length()-1,L=this.scroll.line(Math.min(E.index,F)),z=a(L,1),V=z[0],Q=V;if(E.length>0){var U=this.scroll.line(Math.min(E.index+E.length,F)),ee=a(U,1);Q=ee[0]}if(!(V==null||Q==null)){var H=I.getBoundingClientRect();A.topH.bottom&&(I.scrollTop+=A.bottom-H.bottom)}}}}},{key:"setNativeRange",value:function(I,E){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:I,F=arguments.length>3&&arguments[3]!==void 0?arguments[3]:E,L=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(S.info("setNativeRange",I,E,A,F),!(I!=null&&(this.root.parentNode==null||I.parentNode==null||A.parentNode==null))){var z=document.getSelection();if(z!=null)if(I!=null){this.hasFocus()||this.root.focus();var V=(this.getNativeRange()||{}).native;if(V==null||L||I!==V.startContainer||E!==V.startOffset||A!==V.endContainer||F!==V.endOffset){I.tagName=="BR"&&(E=[].indexOf.call(I.parentNode.childNodes,I),I=I.parentNode),A.tagName=="BR"&&(F=[].indexOf.call(A.parentNode.childNodes,A),A=A.parentNode);var Q=document.createRange();Q.setStart(I,E),Q.setEnd(A,F),z.removeAllRanges(),z.addRange(Q)}}else z.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(I){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y.default.sources.API;if(typeof E=="string"&&(A=E,E=!1),S.info("setRange",I),I!=null){var F=this.rangeToNative(I);this.setNativeRange.apply(this,w(F).concat([E]))}else this.setNativeRange(null);this.update(A)}},{key:"update",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y.default.sources.USER,E=this.lastRange,A=this.getRange(),F=a(A,2),L=F[0],z=F[1];if(this.lastRange=L,this.lastRange!=null&&(this.savedRange=this.lastRange),!(0,h.default)(E,this.lastRange)){var V;!this.composing&&z!=null&&z.native.collapsed&&z.start.node!==this.cursor.textNode&&this.cursor.restore();var Q=[y.default.events.SELECTION_CHANGE,(0,d.default)(this.lastRange),(0,d.default)(E),I];if((V=this.emitter).emit.apply(V,[y.default.events.EDITOR_CHANGE].concat(Q)),I!==y.default.sources.SILENT){var U;(U=this.emitter).emit.apply(U,Q)}}}}]),T})();function O(T,R){try{R.parentNode}catch{return!1}return R instanceof Text&&(R=R.parentNode),T.contains(R)}n.Range=_,n.default=P}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function y(m,x){for(var b=0;b0&&(p+=1),[this.parent.domNode,p]},d.prototype.value=function(){var f;return f={},f[this.statics.blotName]=this.statics.value(this.domNode)||!0,f},d.scope=l.Scope.INLINE_BLOT,d})(s.default);n.default=c}),(function(r,n,o){var a=o(11),s=o(3),l={attributes:{compose:function(u,d,f){typeof u!="object"&&(u={}),typeof d!="object"&&(d={});var h=s(!0,{},d);f||(h=Object.keys(h).reduce(function(y,m){return h[m]!=null&&(y[m]=h[m]),y},{}));for(var p in u)u[p]!==void 0&&d[p]===void 0&&(h[p]=u[p]);return Object.keys(h).length>0?h:void 0},diff:function(u,d){typeof u!="object"&&(u={}),typeof d!="object"&&(d={});var f=Object.keys(u).concat(Object.keys(d)).reduce(function(h,p){return a(u[p],d[p])||(h[p]=d[p]===void 0?null:d[p]),h},{});return Object.keys(f).length>0?f:void 0},transform:function(u,d,f){if(typeof u!="object")return d;if(typeof d=="object"){if(!f)return d;var h=Object.keys(d).reduce(function(p,y){return u[y]===void 0&&(p[y]=d[y]),p},{});return Object.keys(h).length>0?h:void 0}}},iterator:function(u){return new c(u)},length:function(u){return typeof u.delete=="number"?u.delete:typeof u.retain=="number"?u.retain:typeof u.insert=="string"?u.insert.length:1}};function c(u){this.ops=u,this.index=0,this.offset=0}c.prototype.hasNext=function(){return this.peekLength()<1/0},c.prototype.next=function(u){u||(u=1/0);var d=this.ops[this.index];if(d){var f=this.offset,h=l.length(d);if(u>=h-f?(u=h-f,this.index+=1,this.offset=0):this.offset+=u,typeof d.delete=="number")return{delete:u};var p={};return d.attributes&&(p.attributes=d.attributes),typeof d.retain=="number"?p.retain=u:typeof d.insert=="string"?p.insert=d.insert.substr(f,u):p.insert=d.insert,p}else return{retain:1/0}},c.prototype.peek=function(){return this.ops[this.index]},c.prototype.peekLength=function(){return this.ops[this.index]?l.length(this.ops[this.index])-this.offset:1/0},c.prototype.peekType=function(){return this.ops[this.index]?typeof this.ops[this.index].delete=="number"?"delete":typeof this.ops[this.index].retain=="number"?"retain":"insert":"retain"},c.prototype.rest=function(){if(this.hasNext()){if(this.offset===0)return this.ops.slice(this.index);var u=this.offset,d=this.index,f=this.next(),h=this.ops.slice(this.index);return this.offset=u,this.index=d,[f].concat(h)}else return[]},r.exports=l}),(function(r,n){var o=(function(){function a(m,x){return x!=null&&m instanceof x}var s;try{s=Map}catch{s=function(){}}var l;try{l=Set}catch{l=function(){}}var c;try{c=Promise}catch{c=function(){}}function u(m,x,b,w,k){typeof x=="object"&&(b=x.depth,w=x.prototype,k=x.includeNonEnumerable,x=x.circular);var S=[],_=[],P=typeof Buffer<"u";typeof x>"u"&&(x=!0),typeof b>"u"&&(b=1/0);function O(T,R){if(T===null)return null;if(R===0)return T;var I,E;if(typeof T!="object")return T;if(a(T,s))I=new s;else if(a(T,l))I=new l;else if(a(T,c))I=new c(function(H,B){T.then(function(M){H(O(M,R-1))},function(M){B(O(M,R-1))})});else if(u.__isArray(T))I=[];else if(u.__isRegExp(T))I=new RegExp(T.source,y(T)),T.lastIndex&&(I.lastIndex=T.lastIndex);else if(u.__isDate(T))I=new Date(T.getTime());else{if(P&&Buffer.isBuffer(T))return Buffer.allocUnsafe?I=Buffer.allocUnsafe(T.length):I=new Buffer(T.length),T.copy(I),I;a(T,Error)?I=Object.create(T):typeof w>"u"?(E=Object.getPrototypeOf(T),I=Object.create(E)):(I=Object.create(w),E=w)}if(x){var A=S.indexOf(T);if(A!=-1)return _[A];S.push(T),_.push(I)}a(T,s)&&T.forEach(function(H,B){var M=O(B,R-1),$=O(H,R-1);I.set(M,$)}),a(T,l)&&T.forEach(function(H){var B=O(H,R-1);I.add(B)});for(var F in T){var L;E&&(L=Object.getOwnPropertyDescriptor(E,F)),!(L&&L.set==null)&&(I[F]=O(T[F],R-1))}if(Object.getOwnPropertySymbols)for(var z=Object.getOwnPropertySymbols(T),F=0;F0){if(Q instanceof h.BlockEmbed||B instanceof h.BlockEmbed){this.optimize();return}if(Q instanceof b.default){var M=Q.newlineIndex(Q.length(),!0);if(M>-1&&(Q=Q.split(M+1),Q===B)){this.optimize();return}}else if(B instanceof b.default){var $=B.newlineIndex(0);$>-1&&B.split($+1)}var q=B.children.head instanceof m.default?null:B.children.head;Q.moveChildren(B,q),Q.remove()}this.optimize()}},{key:"enable",value:function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.domNode.setAttribute("contenteditable",F)}},{key:"formatAt",value:function(F,L,z,V){this.whitelist!=null&&!this.whitelist[z]||(l(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"formatAt",this).call(this,F,L,z,V),this.optimize())}},{key:"insertAt",value:function(F,L,z){if(!(z!=null&&this.whitelist!=null&&!this.whitelist[L])){if(F>=this.length())if(z==null||u.default.query(L,u.default.Scope.BLOCK)==null){var V=u.default.create(this.statics.defaultChild);this.appendChild(V),z==null&&L.endsWith(` -`)&&(L=L.slice(0,-1)),V.insertAt(0,L,z)}else{var Q=u.default.create(L,z);this.appendChild(Q)}else l(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"insertAt",this).call(this,F,L,z);this.optimize()}}},{key:"insertBefore",value:function(F,L){if(F.statics.scope===u.default.Scope.INLINE_BLOT){var z=u.default.create(this.statics.defaultChild);z.appendChild(F),F=z}l(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"insertBefore",this).call(this,F,L)}},{key:"leaf",value:function(F){return this.path(F).pop()||[null,-1]}},{key:"line",value:function(F){return F===this.length()?this.line(F-1):this.descendant(T,F)}},{key:"lines",value:function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE,z=function V(Q,U,ee){var H=[],B=ee;return Q.children.forEachAt(U,ee,function(M,$,q){T(M)?H.push(M):M instanceof u.default.Container&&(H=H.concat(V(M,$,B))),B-=q}),H};return z(this,F,L)}},{key:"optimize",value:function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.batch!==!0&&(l(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"optimize",this).call(this,F,L),F.length>0&&this.emitter.emit(f.default.events.SCROLL_OPTIMIZE,F,L))}},{key:"path",value:function(F){return l(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"path",this).call(this,F).slice(1)}},{key:"update",value:function(F){if(this.batch!==!0){var L=f.default.sources.USER;typeof F=="string"&&(L=F),Array.isArray(F)||(F=this.observer.takeRecords()),F.length>0&&this.emitter.emit(f.default.events.SCROLL_BEFORE_UPDATE,L,F),l(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"update",this).call(this,F.concat([])),F.length>0&&this.emitter.emit(f.default.events.SCROLL_UPDATE,L,F)}}}]),E})(u.default.Scroll);R.blotName="scroll",R.className="ql-editor",R.tagName="DIV",R.defaultChild="block",R.allowedChildren=[p.default,h.BlockEmbed,k.default],n.default=R}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.SHORTKEY=n.default=void 0;var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(K){return typeof K}:function(K){return K&&typeof Symbol=="function"&&K.constructor===Symbol&&K!==Symbol.prototype?"symbol":typeof K},s=(function(){function K(G,re){var J=[],ae=!0,le=!1,me=void 0;try{for(var Oe=G[Symbol.iterator](),we;!(ae=(we=Oe.next()).done)&&(J.push(we.value),!(re&&J.length===re));ae=!0);}catch(ie){le=!0,me=ie}finally{try{!ae&&Oe.return&&Oe.return()}finally{if(le)throw me}}return J}return function(G,re){if(Array.isArray(G))return G;if(Symbol.iterator in Object(G))return K(G,re);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),l=(function(){function K(G,re){for(var J=0;J1&&arguments[1]!==void 0?arguments[1]:{},le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},me=Y(J);if(me==null||me.key==null)return z.warn("Attempted to add invalid keyboard binding",me);typeof ae=="function"&&(ae={handler:ae}),typeof le=="function"&&(le={handler:le}),me=(0,p.default)(me,ae,le),this.bindings[me.key]=this.bindings[me.key]||[],this.bindings[me.key].push(me)}},{key:"listen",value:function(){var J=this;this.quill.root.addEventListener("keydown",function(ae){if(!ae.defaultPrevented){var le=ae.which||ae.keyCode,me=(J.bindings[le]||[]).filter(function(Ae){return G.match(ae,Ae)});if(me.length!==0){var Oe=J.quill.getSelection();if(!(Oe==null||!J.quill.hasFocus())){var we=J.quill.getLine(Oe.index),ie=s(we,2),Me=ie[0],ke=ie[1],se=J.quill.getLeaf(Oe.index),fe=s(se,2),Ie=fe[0],ce=fe[1],je=Oe.length===0?[Ie,ce]:J.quill.getLeaf(Oe.index+Oe.length),qe=s(je,2),Ne=qe[0],Je=qe[1],vt=Ie instanceof k.default.Text?Ie.value().slice(0,ce):"",Ge=Ne instanceof k.default.Text?Ne.value().slice(Je):"",Ot={collapsed:Oe.length===0,empty:Oe.length===0&&Me.length()<=1,format:J.quill.getFormat(Oe),offset:ke,prefix:vt,suffix:Ge},nt=me.some(function(Ae){if(Ae.collapsed!=null&&Ae.collapsed!==Ot.collapsed||Ae.empty!=null&&Ae.empty!==Ot.empty||Ae.offset!=null&&Ae.offset!==Ot.offset)return!1;if(Array.isArray(Ae.format)){if(Ae.format.every(function(Te){return Ot.format[Te]==null}))return!1}else if(a(Ae.format)==="object"&&!Object.keys(Ae.format).every(function(Te){return Ae.format[Te]===!0?Ot.format[Te]!=null:Ae.format[Te]===!1?Ot.format[Te]==null:(0,f.default)(Ae.format[Te],Ot.format[Te])}))return!1;return Ae.prefix!=null&&!Ae.prefix.test(Ot.prefix)||Ae.suffix!=null&&!Ae.suffix.test(Ot.suffix)?!1:Ae.handler.call(J,Oe,Ot)!==!0});nt&&ae.preventDefault()}}}})}}]),G})(R.default);Q.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},Q.DEFAULTS={bindings:{bold:q("bold"),italic:q("italic"),underline:q("underline"),indent:{key:Q.keys.TAB,format:["blockquote","indent","list"],handler:function(G,re){if(re.collapsed&&re.offset!==0)return!0;this.quill.format("indent","+1",_.default.sources.USER)}},outdent:{key:Q.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(G,re){if(re.collapsed&&re.offset!==0)return!0;this.quill.format("indent","-1",_.default.sources.USER)}},"outdent backspace":{key:Q.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(G,re){re.format.indent!=null?this.quill.format("indent","-1",_.default.sources.USER):re.format.list!=null&&this.quill.format("list",!1,_.default.sources.USER)}},"indent code-block":$(!0),"outdent code-block":$(!1),"remove tab":{key:Q.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(G){this.quill.deleteText(G.index-1,1,_.default.sources.USER)}},tab:{key:Q.keys.TAB,handler:function(G){this.quill.history.cutoff();var re=new m.default().retain(G.index).delete(G.length).insert(" ");this.quill.updateContents(re,_.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(G.index+1,_.default.sources.SILENT)}},"list empty enter":{key:Q.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(G,re){this.quill.format("list",!1,_.default.sources.USER),re.format.indent&&this.quill.format("indent",!1,_.default.sources.USER)}},"checklist enter":{key:Q.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(G){var re=this.quill.getLine(G.index),J=s(re,2),ae=J[0],le=J[1],me=(0,p.default)({},ae.formats(),{list:"checked"}),Oe=new m.default().retain(G.index).insert(` -`,me).retain(ae.length()-le-1).retain(1,{list:"unchecked"});this.quill.updateContents(Oe,_.default.sources.USER),this.quill.setSelection(G.index+1,_.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:Q.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(G,re){var J=this.quill.getLine(G.index),ae=s(J,2),le=ae[0],me=ae[1],Oe=new m.default().retain(G.index).insert(` -`,re.format).retain(le.length()-me-1).retain(1,{header:null});this.quill.updateContents(Oe,_.default.sources.USER),this.quill.setSelection(G.index+1,_.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(G,re){var J=re.prefix.length,ae=this.quill.getLine(G.index),le=s(ae,2),me=le[0],Oe=le[1];if(Oe>J)return!0;var we=void 0;switch(re.prefix.trim()){case"[]":case"[ ]":we="unchecked";break;case"[x]":we="checked";break;case"-":case"*":we="bullet";break;default:we="ordered"}this.quill.insertText(G.index," ",_.default.sources.USER),this.quill.history.cutoff();var ie=new m.default().retain(G.index-Oe).delete(J+1).retain(me.length()-2-Oe).retain(1,{list:we});this.quill.updateContents(ie,_.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(G.index-J,_.default.sources.SILENT)}},"code exit":{key:Q.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(G){var re=this.quill.getLine(G.index),J=s(re,2),ae=J[0],le=J[1],me=new m.default().retain(G.index+ae.length()-le-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(me,_.default.sources.USER)}},"embed left":U(Q.keys.LEFT,!1),"embed left shift":U(Q.keys.LEFT,!0),"embed right":U(Q.keys.RIGHT,!1),"embed right shift":U(Q.keys.RIGHT,!0)}};function U(K,G){var re,J=K===Q.keys.LEFT?"prefix":"suffix";return re={key:K,shiftKey:G,altKey:null},E(re,J,/^$/),E(re,"handler",function(le){var me=le.index;K===Q.keys.RIGHT&&(me+=le.length+1);var Oe=this.quill.getLeaf(me),we=s(Oe,1),ie=we[0];return ie instanceof k.default.Embed?(K===Q.keys.LEFT?G?this.quill.setSelection(le.index-1,le.length+1,_.default.sources.USER):this.quill.setSelection(le.index-1,_.default.sources.USER):G?this.quill.setSelection(le.index,le.length+1,_.default.sources.USER):this.quill.setSelection(le.index+le.length+1,_.default.sources.USER),!1):!0}),re}function ee(K,G){if(!(K.index===0||this.quill.getLength()<=1)){var re=this.quill.getLine(K.index),J=s(re,1),ae=J[0],le={};if(G.offset===0){var me=this.quill.getLine(K.index-1),Oe=s(me,1),we=Oe[0];if(we!=null&&we.length()>1){var ie=ae.formats(),Me=this.quill.getFormat(K.index-1,1);le=b.default.attributes.diff(ie,Me)||{}}}var ke=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(G.prefix)?2:1;this.quill.deleteText(K.index-ke,ke,_.default.sources.USER),Object.keys(le).length>0&&this.quill.formatLine(K.index-ke,ke,le,_.default.sources.USER),this.quill.focus()}}function H(K,G){var re=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(G.suffix)?2:1;if(!(K.index>=this.quill.getLength()-re)){var J={},ae=0,le=this.quill.getLine(K.index),me=s(le,1),Oe=me[0];if(G.offset>=Oe.length()-1){var we=this.quill.getLine(K.index+1),ie=s(we,1),Me=ie[0];if(Me){var ke=Oe.formats(),se=this.quill.getFormat(K.index,1);J=b.default.attributes.diff(ke,se)||{},ae=Me.length()}}this.quill.deleteText(K.index,re,_.default.sources.USER),Object.keys(J).length>0&&this.quill.formatLine(K.index+ae-1,re,J,_.default.sources.USER)}}function B(K){var G=this.quill.getLines(K),re={};if(G.length>1){var J=G[0].formats(),ae=G[G.length-1].formats();re=b.default.attributes.diff(ae,J)||{}}this.quill.deleteText(K,_.default.sources.USER),Object.keys(re).length>0&&this.quill.formatLine(K.index,1,re,_.default.sources.USER),this.quill.setSelection(K.index,_.default.sources.SILENT),this.quill.focus()}function M(K,G){var re=this;K.length>0&&this.quill.scroll.deleteAt(K.index,K.length);var J=Object.keys(G.format).reduce(function(ae,le){return k.default.query(le,k.default.Scope.BLOCK)&&!Array.isArray(G.format[le])&&(ae[le]=G.format[le]),ae},{});this.quill.insertText(K.index,` -`,J,_.default.sources.USER),this.quill.setSelection(K.index+1,_.default.sources.SILENT),this.quill.focus(),Object.keys(G.format).forEach(function(ae){J[ae]==null&&(Array.isArray(G.format[ae])||ae!=="link"&&re.quill.format(ae,G.format[ae],_.default.sources.USER))})}function $(K){return{key:Q.keys.TAB,shiftKey:!K,format:{"code-block":!0},handler:function(re){var J=k.default.query("code-block"),ae=re.index,le=re.length,me=this.quill.scroll.descendant(J,ae),Oe=s(me,2),we=Oe[0],ie=Oe[1];if(we!=null){var Me=this.quill.getIndex(we),ke=we.newlineIndex(ie,!0)+1,se=we.newlineIndex(Me+ie+le),fe=we.domNode.textContent.slice(ke,se).split(` -`);ie=0,fe.forEach(function(Ie,ce){K?(we.insertAt(ke+ie,J.TAB),ie+=J.TAB.length,ce===0?ae+=J.TAB.length:le+=J.TAB.length):Ie.startsWith(J.TAB)&&(we.deleteAt(ke+ie,J.TAB.length),ie-=J.TAB.length,ce===0?ae-=J.TAB.length:le-=J.TAB.length),ie+=Ie.length+1}),this.quill.update(_.default.sources.USER),this.quill.setSelection(ae,le,_.default.sources.SILENT)}}}}function q(K){return{key:K[0].toUpperCase(),shortKey:!0,handler:function(re,J){this.quill.format(K,!J.format[K],_.default.sources.USER)}}}function Y(K){if(typeof K=="string"||typeof K=="number")return Y({key:K});if((typeof K>"u"?"undefined":a(K))==="object"&&(K=(0,u.default)(K,!1)),typeof K.key=="string")if(Q.keys[K.key.toUpperCase()]!=null)K.key=Q.keys[K.key.toUpperCase()];else if(K.key.length===1)K.key=K.key.toUpperCase().charCodeAt(0);else return null;return K.shortKey&&(K[V]=K.shortKey,delete K.shortKey),K}n.default=Q,n.SHORTKEY=V}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function b(w,k){var S=[],_=!0,P=!1,O=void 0;try{for(var T=w[Symbol.iterator](),R;!(_=(R=T.next()).done)&&(S.push(R.value),!(k&&S.length===k));_=!0);}catch(I){P=!0,O=I}finally{try{!_&&T.return&&T.return()}finally{if(P)throw O}}return S}return function(w,k){if(Array.isArray(w))return w;if(Symbol.iterator in Object(w))return b(w,k);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=function b(w,k,S){w===null&&(w=Function.prototype);var _=Object.getOwnPropertyDescriptor(w,k);if(_===void 0){var P=Object.getPrototypeOf(w);return P===null?void 0:b(P,k,S)}else{if("value"in _)return _.value;var O=_.get;return O===void 0?void 0:O.call(S)}},l=(function(){function b(w,k){for(var S=0;S-1}n.default=p,n.sanitize=y}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(x){return typeof x}:function(x){return x&&typeof Symbol=="function"&&x.constructor===Symbol&&x!==Symbol.prototype?"symbol":typeof x},s=(function(){function x(b,w){for(var k=0;k1&&arguments[1]!==void 0?arguments[1]:!1,S=this.container.querySelector(".ql-selected");if(w!==S&&(S!=null&&S.classList.remove("ql-selected"),w!=null&&(w.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(w.parentNode.children,w),w.hasAttribute("data-value")?this.label.setAttribute("data-value",w.getAttribute("data-value")):this.label.removeAttribute("data-value"),w.hasAttribute("data-label")?this.label.setAttribute("data-label",w.getAttribute("data-label")):this.label.removeAttribute("data-label"),k))){if(typeof Event=="function")this.select.dispatchEvent(new Event("change"));else if((typeof Event>"u"?"undefined":a(Event))==="object"){var _=document.createEvent("Event");_.initEvent("change",!0,!0),this.select.dispatchEvent(_)}this.close()}}},{key:"update",value:function(){var w=void 0;if(this.select.selectedIndex>-1){var k=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];w=this.select.options[this.select.selectedIndex],this.selectItem(k)}else this.selectItem(null);var S=w!=null&&w!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",S)}}]),x})();n.default=m}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(0),s=z(a),l=o(5),c=z(l),u=o(4),d=z(u),f=o(16),h=z(f),p=o(25),y=z(p),m=o(24),x=z(m),b=o(35),w=z(b),k=o(6),S=z(k),_=o(22),P=z(_),O=o(7),T=z(O),R=o(55),I=z(R),E=o(42),A=z(E),F=o(23),L=z(F);function z(V){return V&&V.__esModule?V:{default:V}}c.default.register({"blots/block":d.default,"blots/block/embed":u.BlockEmbed,"blots/break":h.default,"blots/container":y.default,"blots/cursor":x.default,"blots/embed":w.default,"blots/inline":S.default,"blots/scroll":P.default,"blots/text":T.default,"modules/clipboard":I.default,"modules/history":A.default,"modules/keyboard":L.default}),s.default.register(d.default,h.default,x.default,S.default,P.default,T.default),n.default=c.default}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(1),s=(function(){function l(c){this.domNode=c,this.domNode[a.DATA_KEY]={blot:this}}return Object.defineProperty(l.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),l.create=function(c){if(this.tagName==null)throw new a.ParchmentError("Blot definition missing tagName");var u;return Array.isArray(this.tagName)?(typeof c=="string"&&(c=c.toUpperCase(),parseInt(c).toString()===c&&(c=parseInt(c))),typeof c=="number"?u=document.createElement(this.tagName[c-1]):this.tagName.indexOf(c)>-1?u=document.createElement(c):u=document.createElement(this.tagName[0])):u=document.createElement(this.tagName),this.className&&u.classList.add(this.className),u},l.prototype.attach=function(){this.parent!=null&&(this.scroll=this.parent.scroll)},l.prototype.clone=function(){var c=this.domNode.cloneNode(!1);return a.create(c)},l.prototype.detach=function(){this.parent!=null&&this.parent.removeChild(this),delete this.domNode[a.DATA_KEY]},l.prototype.deleteAt=function(c,u){var d=this.isolate(c,u);d.remove()},l.prototype.formatAt=function(c,u,d,f){var h=this.isolate(c,u);if(a.query(d,a.Scope.BLOT)!=null&&f)h.wrap(d,f);else if(a.query(d,a.Scope.ATTRIBUTE)!=null){var p=a.create(this.statics.scope);h.wrap(p),p.format(d,f)}},l.prototype.insertAt=function(c,u,d){var f=d==null?a.create("text",u):a.create(u,d),h=this.split(c);this.parent.insertBefore(f,h)},l.prototype.insertInto=function(c,u){u===void 0&&(u=null),this.parent!=null&&this.parent.children.remove(this);var d=null;c.children.insertBefore(this,u),u!=null&&(d=u.domNode),(this.domNode.parentNode!=c.domNode||this.domNode.nextSibling!=d)&&c.domNode.insertBefore(this.domNode,d),this.parent=c,this.attach()},l.prototype.isolate=function(c,u){var d=this.split(c);return d.split(u),d},l.prototype.length=function(){return 1},l.prototype.offset=function(c){return c===void 0&&(c=this.parent),this.parent==null||this==c?0:this.parent.children.offset(this)+this.parent.offset(c)},l.prototype.optimize=function(c){this.domNode[a.DATA_KEY]!=null&&delete this.domNode[a.DATA_KEY].mutations},l.prototype.remove=function(){this.domNode.parentNode!=null&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},l.prototype.replace=function(c){c.parent!=null&&(c.parent.insertBefore(this,c.next),c.remove())},l.prototype.replaceWith=function(c,u){var d=typeof c=="string"?a.create(c,u):c;return d.replace(this),d},l.prototype.split=function(c,u){return c===0?this:this.next},l.prototype.update=function(c,u){},l.prototype.wrap=function(c,u){var d=typeof c=="string"?a.create(c,u):c;return this.parent!=null&&this.parent.insertBefore(d,this.next),d.appendChild(this),d},l.blotName="abstract",l})();n.default=s}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(12),s=o(32),l=o(33),c=o(1),u=(function(){function d(f){this.attributes={},this.domNode=f,this.build()}return d.prototype.attribute=function(f,h){h?f.add(this.domNode,h)&&(f.value(this.domNode)!=null?this.attributes[f.attrName]=f:delete this.attributes[f.attrName]):(f.remove(this.domNode),delete this.attributes[f.attrName])},d.prototype.build=function(){var f=this;this.attributes={};var h=a.default.keys(this.domNode),p=s.default.keys(this.domNode),y=l.default.keys(this.domNode);h.concat(p).concat(y).forEach(function(m){var x=c.query(m,c.Scope.ATTRIBUTE);x instanceof a.default&&(f.attributes[x.attrName]=x)})},d.prototype.copy=function(f){var h=this;Object.keys(this.attributes).forEach(function(p){var y=h.attributes[p].value(h.domNode);f.format(p,y)})},d.prototype.move=function(f){var h=this;this.copy(f),Object.keys(this.attributes).forEach(function(p){h.attributes[p].remove(h.domNode)}),this.attributes={}},d.prototype.values=function(){var f=this;return Object.keys(this.attributes).reduce(function(h,p){return h[p]=f.attributes[p].value(f.domNode),h},{})},d})();n.default=u}),(function(r,n,o){var a=this&&this.__extends||(function(){var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var h in f)f.hasOwnProperty(h)&&(d[h]=f[h])};return function(d,f){u(d,f);function h(){this.constructor=d}d.prototype=f===null?Object.create(f):(h.prototype=f.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(12);function l(u,d){var f=u.getAttribute("class")||"";return f.split(/\s+/).filter(function(h){return h.indexOf(d+"-")===0})}var c=(function(u){a(d,u);function d(){return u!==null&&u.apply(this,arguments)||this}return d.keys=function(f){return(f.getAttribute("class")||"").split(/\s+/).map(function(h){return h.split("-").slice(0,-1).join("-")})},d.prototype.add=function(f,h){return this.canAdd(f,h)?(this.remove(f),f.classList.add(this.keyName+"-"+h),!0):!1},d.prototype.remove=function(f){var h=l(f,this.keyName);h.forEach(function(p){f.classList.remove(p)}),f.classList.length===0&&f.removeAttribute("class")},d.prototype.value=function(f){var h=l(f,this.keyName)[0]||"",p=h.slice(this.keyName.length+1);return this.canAdd(f,p)?p:""},d})(s.default);n.default=c}),(function(r,n,o){var a=this&&this.__extends||(function(){var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var h in f)f.hasOwnProperty(h)&&(d[h]=f[h])};return function(d,f){u(d,f);function h(){this.constructor=d}d.prototype=f===null?Object.create(f):(h.prototype=f.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(12);function l(u){var d=u.split("-"),f=d.slice(1).map(function(h){return h[0].toUpperCase()+h.slice(1)}).join("");return d[0]+f}var c=(function(u){a(d,u);function d(){return u!==null&&u.apply(this,arguments)||this}return d.keys=function(f){return(f.getAttribute("style")||"").split(";").map(function(h){var p=h.split(":");return p[0].trim()})},d.prototype.add=function(f,h){return this.canAdd(f,h)?(f.style[l(this.keyName)]=h,!0):!1},d.prototype.remove=function(f){f.style[l(this.keyName)]="",f.getAttribute("style")||f.removeAttribute("style")},d.prototype.value=function(f){var h=f.style[l(this.keyName)];return this.canAdd(f,h)?h:""},d})(s.default);n.default=c}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function c(u,d){for(var f=0;fR&&this.stack.undo.length>0){var I=this.stack.undo.pop();T=T.compose(I.undo),P=I.redo.compose(P)}else this.lastRecorded=R;this.stack.undo.push({redo:P,undo:T}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(P){this.stack.undo.forEach(function(O){O.undo=P.transform(O.undo,!0),O.redo=P.transform(O.redo,!0)}),this.stack.redo.forEach(function(O){O.undo=P.transform(O.undo,!0),O.redo=P.transform(O.redo,!0)})}},{key:"undo",value:function(){this.change("undo","redo")}}]),S})(f.default);x.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1};function b(k){var S=k.ops[k.ops.length-1];return S==null?!1:S.insert!=null?typeof S.insert=="string"&&S.insert.endsWith(` -`):S.attributes!=null?Object.keys(S.attributes).some(function(_){return l.default.query(_,l.default.Scope.BLOCK)!=null}):!1}function w(k){var S=k.reduce(function(P,O){return P+=O.delete||0,P},0),_=k.length()-S;return b(k)&&(_-=1),_}n.default=x,n.getLastChangeIndex=w}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BaseTooltip=void 0;var a=(function(){function M($,q){for(var Y=0;Y0&&arguments[0]!==void 0?arguments[0]:"link",K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),K!=null?this.textbox.value=K:Y!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+Y)||""),this.root.setAttribute("data-mode",Y)}},{key:"restoreFocus",value:function(){var Y=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=Y}},{key:"save",value:function(){var Y=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":{var K=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",Y,h.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",Y,h.default.sources.USER)),this.quill.root.scrollTop=K;break}case"video":Y=H(Y);case"formula":{if(!Y)break;var G=this.quill.getSelection(!0);if(G!=null){var re=G.index+G.length;this.quill.insertEmbed(re,this.root.getAttribute("data-mode"),Y,h.default.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(re+1," ",h.default.sources.USER),this.quill.setSelection(re+2,h.default.sources.USER)}break}}this.textbox.value="",this.hide()}}]),$})(T.default);function H(M){var $=M.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||M.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return $?($[1]||"https")+"://www.youtube.com/embed/"+$[2]+"?showinfo=0":($=M.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?($[1]||"https")+"://player.vimeo.com/video/"+$[2]+"/":M}function B(M,$){var q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;$.forEach(function(Y){var K=document.createElement("option");Y===q?K.setAttribute("selected","selected"):K.setAttribute("value",Y),M.appendChild(K)})}n.BaseTooltip=ee,n.default=U}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function s(){this.head=this.tail=null,this.length=0}return s.prototype.append=function(){for(var l=[],c=0;c1&&this.append.apply(this,l.slice(1))},s.prototype.contains=function(l){for(var c,u=this.iterator();c=u();)if(c===l)return!0;return!1},s.prototype.insertBefore=function(l,c){l&&(l.next=c,c!=null?(l.prev=c.prev,c.prev!=null&&(c.prev.next=l),c.prev=l,c===this.head&&(this.head=l)):this.tail!=null?(this.tail.next=l,l.prev=this.tail,this.tail=l):(l.prev=null,this.head=this.tail=l),this.length+=1)},s.prototype.offset=function(l){for(var c=0,u=this.head;u!=null;){if(u===l)return c;c+=u.length(),u=u.next}return-1},s.prototype.remove=function(l){this.contains(l)&&(l.prev!=null&&(l.prev.next=l.next),l.next!=null&&(l.next.prev=l.prev),l===this.head&&(this.head=l.next),l===this.tail&&(this.tail=l.prev),this.length-=1)},s.prototype.iterator=function(l){return l===void 0&&(l=this.head),function(){var c=l;return l!=null&&(l=l.next),c}},s.prototype.find=function(l,c){c===void 0&&(c=!1);for(var u,d=this.iterator();u=d();){var f=u.length();if(ly?u(p,l-y,Math.min(c,y+x-l)):u(p,0,Math.min(x,l+c-y)),y+=x}},s.prototype.map=function(l){return this.reduce(function(c,u){return c.push(l(u)),c},[])},s.prototype.reduce=function(l,c){for(var u,d=this.iterator();u=d();)c=l(c,u);return c},s})();n.default=a}),(function(r,n,o){var a=this&&this.__extends||(function(){var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,p){h.__proto__=p}||function(h,p){for(var y in p)p.hasOwnProperty(y)&&(h[y]=p[y])};return function(h,p){f(h,p);function y(){this.constructor=h}h.prototype=p===null?Object.create(p):(y.prototype=p.prototype,new y)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(17),l=o(1),c={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},u=100,d=(function(f){a(h,f);function h(p){var y=f.call(this,p)||this;return y.scroll=y,y.observer=new MutationObserver(function(m){y.update(m)}),y.observer.observe(y.domNode,c),y.attach(),y}return h.prototype.detach=function(){f.prototype.detach.call(this),this.observer.disconnect()},h.prototype.deleteAt=function(p,y){this.update(),p===0&&y===this.length()?this.children.forEach(function(m){m.remove()}):f.prototype.deleteAt.call(this,p,y)},h.prototype.formatAt=function(p,y,m,x){this.update(),f.prototype.formatAt.call(this,p,y,m,x)},h.prototype.insertAt=function(p,y,m){this.update(),f.prototype.insertAt.call(this,p,y,m)},h.prototype.optimize=function(p,y){var m=this;p===void 0&&(p=[]),y===void 0&&(y={}),f.prototype.optimize.call(this,y);for(var x=[].slice.call(this.observer.takeRecords());x.length>0;)p.push(x.pop());for(var b=function(_,P){P===void 0&&(P=!0),!(_==null||_===m)&&_.domNode.parentNode!=null&&(_.domNode[l.DATA_KEY].mutations==null&&(_.domNode[l.DATA_KEY].mutations=[]),P&&b(_.parent))},w=function(_){_.domNode[l.DATA_KEY]==null||_.domNode[l.DATA_KEY].mutations==null||(_ instanceof s.default&&_.children.forEach(w),_.optimize(y))},k=p,S=0;k.length>0;S+=1){if(S>=u)throw new Error("[Parchment] Maximum optimize iterations reached");for(k.forEach(function(_){var P=l.find(_.target,!0);P!=null&&(P.domNode===_.target&&(_.type==="childList"?(b(l.find(_.previousSibling,!1)),[].forEach.call(_.addedNodes,function(O){var T=l.find(O,!1);b(T,!1),T instanceof s.default&&T.children.forEach(function(R){b(R,!1)})})):_.type==="attributes"&&b(P.prev)),b(P))}),this.children.forEach(w),k=[].slice.call(this.observer.takeRecords()),x=k.slice();x.length>0;)p.push(x.pop())}},h.prototype.update=function(p,y){var m=this;y===void 0&&(y={}),p=p||this.observer.takeRecords(),p.map(function(x){var b=l.find(x.target,!0);return b==null?null:b.domNode[l.DATA_KEY].mutations==null?(b.domNode[l.DATA_KEY].mutations=[x],b):(b.domNode[l.DATA_KEY].mutations.push(x),null)}).forEach(function(x){x==null||x===m||x.domNode[l.DATA_KEY]==null||x.update(x.domNode[l.DATA_KEY].mutations||[],y)}),this.domNode[l.DATA_KEY].mutations!=null&&f.prototype.update.call(this,this.domNode[l.DATA_KEY].mutations,y),this.optimize(p,y)},h.blotName="scroll",h.defaultChild="block",h.scope=l.Scope.BLOCK_BLOT,h.tagName="DIV",h})(s.default);n.default=d}),(function(r,n,o){var a=this&&this.__extends||(function(){var d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,h){f.__proto__=h}||function(f,h){for(var p in h)h.hasOwnProperty(p)&&(f[p]=h[p])};return function(f,h){d(f,h);function p(){this.constructor=f}f.prototype=h===null?Object.create(h):(p.prototype=h.prototype,new p)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(18),l=o(1);function c(d,f){if(Object.keys(d).length!==Object.keys(f).length)return!1;for(var h in d)if(d[h]!==f[h])return!1;return!0}var u=(function(d){a(f,d);function f(){return d!==null&&d.apply(this,arguments)||this}return f.formats=function(h){if(h.tagName!==f.tagName)return d.formats.call(this,h)},f.prototype.format=function(h,p){var y=this;h===this.statics.blotName&&!p?(this.children.forEach(function(m){m instanceof s.default||(m=m.wrap(f.blotName,!0)),y.attributes.copy(m)}),this.unwrap()):d.prototype.format.call(this,h,p)},f.prototype.formatAt=function(h,p,y,m){if(this.formats()[y]!=null||l.query(y,l.Scope.ATTRIBUTE)){var x=this.isolate(h,p);x.format(y,m)}else d.prototype.formatAt.call(this,h,p,y,m)},f.prototype.optimize=function(h){d.prototype.optimize.call(this,h);var p=this.formats();if(Object.keys(p).length===0)return this.unwrap();var y=this.next;y instanceof f&&y.prev===this&&c(p,y.formats())&&(y.moveChildren(this),y.remove())},f.blotName="inline",f.scope=l.Scope.INLINE_BLOT,f.tagName="SPAN",f})(s.default);n.default=u}),(function(r,n,o){var a=this&&this.__extends||(function(){var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var h in f)f.hasOwnProperty(h)&&(d[h]=f[h])};return function(d,f){u(d,f);function h(){this.constructor=d}d.prototype=f===null?Object.create(f):(h.prototype=f.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(18),l=o(1),c=(function(u){a(d,u);function d(){return u!==null&&u.apply(this,arguments)||this}return d.formats=function(f){var h=l.query(d.blotName).tagName;if(f.tagName!==h)return u.formats.call(this,f)},d.prototype.format=function(f,h){l.query(f,l.Scope.BLOCK)!=null&&(f===this.statics.blotName&&!h?this.replaceWith(d.blotName):u.prototype.format.call(this,f,h))},d.prototype.formatAt=function(f,h,p,y){l.query(p,l.Scope.BLOCK)!=null?this.format(p,y):u.prototype.formatAt.call(this,f,h,p,y)},d.prototype.insertAt=function(f,h,p){if(p==null||l.query(h,l.Scope.INLINE)!=null)u.prototype.insertAt.call(this,f,h,p);else{var y=this.split(f),m=l.create(h,p);y.parent.insertBefore(m,y)}},d.prototype.update=function(f,h){navigator.userAgent.match(/Trident/)?this.build():u.prototype.update.call(this,f,h)},d.blotName="block",d.scope=l.Scope.BLOCK_BLOT,d.tagName="P",d})(s.default);n.default=c}),(function(r,n,o){var a=this&&this.__extends||(function(){var c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,d){u.__proto__=d}||function(u,d){for(var f in d)d.hasOwnProperty(f)&&(u[f]=d[f])};return function(u,d){c(u,d);function f(){this.constructor=u}u.prototype=d===null?Object.create(d):(f.prototype=d.prototype,new f)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(19),l=(function(c){a(u,c);function u(){return c!==null&&c.apply(this,arguments)||this}return u.formats=function(d){},u.prototype.format=function(d,f){c.prototype.formatAt.call(this,0,this.length(),d,f)},u.prototype.formatAt=function(d,f,h,p){d===0&&f===this.length()?this.format(h,p):c.prototype.formatAt.call(this,d,f,h,p)},u.prototype.formats=function(){return this.statics.formats(this.domNode)},u})(s.default);n.default=l}),(function(r,n,o){var a=this&&this.__extends||(function(){var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var h in f)f.hasOwnProperty(h)&&(d[h]=f[h])};return function(d,f){u(d,f);function h(){this.constructor=d}d.prototype=f===null?Object.create(f):(h.prototype=f.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(19),l=o(1),c=(function(u){a(d,u);function d(f){var h=u.call(this,f)||this;return h.text=h.statics.value(h.domNode),h}return d.create=function(f){return document.createTextNode(f)},d.value=function(f){var h=f.data;return h.normalize&&(h=h.normalize()),h},d.prototype.deleteAt=function(f,h){this.domNode.data=this.text=this.text.slice(0,f)+this.text.slice(f+h)},d.prototype.index=function(f,h){return this.domNode===f?h:-1},d.prototype.insertAt=function(f,h,p){p==null?(this.text=this.text.slice(0,f)+h+this.text.slice(f),this.domNode.data=this.text):u.prototype.insertAt.call(this,f,h,p)},d.prototype.length=function(){return this.text.length},d.prototype.optimize=function(f){u.prototype.optimize.call(this,f),this.text=this.statics.value(this.domNode),this.text.length===0?this.remove():this.next instanceof d&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},d.prototype.position=function(f,h){return[this.domNode,f]},d.prototype.split=function(f,h){if(h===void 0&&(h=!1),!h){if(f===0)return this;if(f===this.length())return this.next}var p=l.create(this.domNode.splitText(f));return this.parent.insertBefore(p,this.next),this.text=this.statics.value(this.domNode),p},d.prototype.update=function(f,h){var p=this;f.some(function(y){return y.type==="characterData"&&y.target===p.domNode})&&(this.text=this.statics.value(this.domNode))},d.prototype.value=function(){return this.text},d.blotName="text",d.scope=l.Scope.INLINE_BLOT,d})(s.default);n.default=c}),(function(r,n,o){var a=document.createElement("div");if(a.classList.toggle("test-class",!1),a.classList.contains("test-class")){var s=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(l,c){return arguments.length>1&&!this.contains(l)==!c?c:s.call(this,l)}}String.prototype.startsWith||(String.prototype.startsWith=function(l,c){return c=c||0,this.substr(c,l.length)===l}),String.prototype.endsWith||(String.prototype.endsWith=function(l,c){var u=this.toString();(typeof c!="number"||!isFinite(c)||Math.floor(c)!==c||c>u.length)&&(c=u.length),c-=l.length;var d=u.indexOf(l,c);return d!==-1&&d===c}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(c){if(this===null)throw new TypeError("Array.prototype.find called on null or undefined");if(typeof c!="function")throw new TypeError("predicate must be a function");for(var u=Object(this),d=u.length>>>0,f=arguments[1],h,p=0;p_.length?S:_,T=S.length>_.length?_:S,R=O.indexOf(T);if(R!=-1)return P=[[a,O.substring(0,R)],[s,T],[a,O.substring(R+T.length)]],S.length>_.length&&(P[0][0]=P[2][0]=o),P;if(T.length==1)return[[o,S],[a,_]];var I=p(S,_);if(I){var E=I[0],A=I[1],F=I[2],L=I[3],z=I[4],V=l(E,F),Q=l(A,L);return V.concat([[s,z]],Q)}return u(S,_)}function u(S,_){for(var P=S.length,O=_.length,T=Math.ceil((P+O)/2),R=T,I=2*T,E=new Array(I),A=new Array(I),F=0;FP)Q+=2;else if(q>O)V+=2;else if(z){var Y=R+L-B;if(Y>=0&&Y=K)return d(S,_,$,q)}}}for(var G=-H+U;G<=H-ee;G+=2){var Y=R+G,K;G==-H||G!=H&&A[Y-1]P)ee+=2;else if(re>O)U+=2;else if(!z){var M=R+L-G;if(M>=0&&M=K)return d(S,_,$,q)}}}}return[[o,S],[a,_]]}function d(S,_,P,O){var T=S.substring(0,P),R=_.substring(0,O),I=S.substring(P),E=_.substring(O),A=l(T,R),F=l(I,E);return A.concat(F)}function f(S,_){if(!S||!_||S.charAt(0)!=_.charAt(0))return 0;for(var P=0,O=Math.min(S.length,_.length),T=O,R=0;P_.length?S:_,O=S.length>_.length?_:S;if(P.length<4||O.length*2=Q.length?[$,q,Y,K,M]:null}var R=T(P,O,Math.ceil(P.length/4)),I=T(P,O,Math.ceil(P.length/2)),E;if(!R&&!I)return null;I?R?E=R[4].length>I[4].length?R:I:E=I:E=R;var A,F,L,z;S.length>_.length?(A=E[0],F=E[1],L=E[2],z=E[3]):(L=E[0],z=E[1],A=E[2],F=E[3]);var V=E[4];return[A,F,L,z,V]}function y(S){S.push([s,""]);for(var _=0,P=0,O=0,T="",R="",I;_1?(P!==0&&O!==0&&(I=f(R,T),I!==0&&(_-P-O>0&&S[_-P-O-1][0]==s?S[_-P-O-1][1]+=R.substring(0,I):(S.splice(0,0,[s,R.substring(0,I)]),_++),R=R.substring(I),T=T.substring(I)),I=h(R,T),I!==0&&(S[_][1]=R.substring(R.length-I)+S[_][1],R=R.substring(0,R.length-I),T=T.substring(0,T.length-I))),P===0?S.splice(_-O,P+O,[a,R]):O===0?S.splice(_-P,P+O,[o,T]):S.splice(_-P-O,P+O,[o,T],[a,R]),_=_-P-O+(P?1:0)+(O?1:0)+1):_!==0&&S[_-1][0]==s?(S[_-1][1]+=S[_][1],S.splice(_,1)):_++,O=0,P=0,T="",R="";break}S[S.length-1][1]===""&&S.pop();var E=!1;for(_=1;_0&&O.splice(T+2,0,[I[0],E]),k(O,T,3)}else return S}function w(S){for(var _=!1,P=function(I){return I.charCodeAt(0)>=56320&&I.charCodeAt(0)<=57343},O=function(I){return I.charCodeAt(I.length-1)>=55296&&I.charCodeAt(I.length-1)<=56319},T=2;T0&&R.push(S[T]);return R}function k(S,_,P){for(var O=_+P-1;O>=0&&O>=_-1;O--)if(O+1\r?\n +\<"),this.convert();var je=this.quill.getFormat(this.quill.selection.savedRange.index);if(je[O.default.blotName]){var qe=this.container.innerText;return this.container.innerHTML="",new f.default().insert(qe,F({},O.default.blotName,je[O.default.blotName]))}var Ne=this.prepareMatching(),Je=s(Ne,2),vt=Je[0],Ge=Je[1],Ot=G(this.container,vt,Ge);return Y(Ot,` -`)&&Ot.ops[Ot.ops.length-1].attributes==null&&(Ot=Ot.compose(new f.default().retain(Ot.length()-1).delete(1))),Q.log("convert",this.container.innerHTML,Ot),this.container.innerHTML="",Ot}},{key:"dangerouslyPasteHTML",value:function(ce,je){var qe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m.default.sources.API;if(typeof ce=="string")this.quill.setContents(this.convert(ce),je),this.quill.setSelection(0,m.default.sources.SILENT);else{var Ne=this.convert(je);this.quill.updateContents(new f.default().retain(ce).concat(Ne),qe),this.quill.setSelection(ce+Ne.length(),m.default.sources.SILENT)}}},{key:"onPaste",value:function(ce){var je=this;if(!(ce.defaultPrevented||!this.quill.isEnabled())){var qe=this.quill.getSelection(),Ne=new f.default().retain(qe.index),Je=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(m.default.sources.SILENT),setTimeout(function(){Ne=Ne.concat(je.convert()).delete(qe.length),je.quill.updateContents(Ne,m.default.sources.USER),je.quill.setSelection(Ne.length()-qe.length,m.default.sources.SILENT),je.quill.scrollingContainer.scrollTop=Je,je.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var ce=this,je=[],qe=[];return this.matchers.forEach(function(Ne){var Je=s(Ne,2),vt=Je[0],Ge=Je[1];switch(vt){case Node.TEXT_NODE:qe.push(Ge);break;case Node.ELEMENT_NODE:je.push(Ge);break;default:[].forEach.call(ce.container.querySelectorAll(vt),function(Ot){Ot[U]=Ot[U]||[],Ot[U].push(Ge)});break}}),[je,qe]}}]),fe})(k.default);M.DEFAULTS={matchers:[],matchVisual:!0};function $(se,fe,Ie){return(typeof fe>"u"?"undefined":a(fe))==="object"?Object.keys(fe).reduce(function(ce,je){return $(ce,je,fe[je])},se):se.reduce(function(ce,je){return je.attributes&&je.attributes[fe]?ce.push(je):ce.insert(je.insert,(0,u.default)({},F({},fe,Ie),je.attributes))},new f.default)}function q(se){if(se.nodeType!==Node.ELEMENT_NODE)return{};var fe="__ql-computed-style";return se[fe]||(se[fe]=window.getComputedStyle(se))}function Y(se,fe){for(var Ie="",ce=se.ops.length-1;ce>=0&&Ie.length-1}function G(se,fe,Ie){return se.nodeType===se.TEXT_NODE?Ie.reduce(function(ce,je){return je(se,ce)},new f.default):se.nodeType===se.ELEMENT_NODE?[].reduce.call(se.childNodes||[],function(ce,je){var qe=G(je,fe,Ie);return je.nodeType===se.ELEMENT_NODE&&(qe=fe.reduce(function(Ne,Je){return Je(je,Ne)},qe),qe=(je[U]||[]).reduce(function(Ne,Je){return Je(je,Ne)},qe)),ce.concat(qe)},new f.default):new f.default}function re(se,fe,Ie){return $(Ie,se,!0)}function J(se,fe){var Ie=p.default.Attributor.Attribute.keys(se),ce=p.default.Attributor.Class.keys(se),je=p.default.Attributor.Style.keys(se),qe={};return Ie.concat(ce).concat(je).forEach(function(Ne){var Je=p.default.query(Ne,p.default.Scope.ATTRIBUTE);Je!=null&&(qe[Je.attrName]=Je.value(se),qe[Je.attrName])||(Je=H[Ne],Je!=null&&(Je.attrName===Ne||Je.keyName===Ne)&&(qe[Je.attrName]=Je.value(se)||void 0),Je=B[Ne],Je!=null&&(Je.attrName===Ne||Je.keyName===Ne)&&(Je=B[Ne],qe[Je.attrName]=Je.value(se)||void 0))}),Object.keys(qe).length>0&&(fe=$(fe,qe)),fe}function ae(se,fe){var Ie=p.default.query(se);if(Ie==null)return fe;if(Ie.prototype instanceof p.default.Embed){var ce={},je=Ie.value(se);je!=null&&(ce[Ie.blotName]=je,fe=new f.default().insert(ce,Ie.formats(se)))}else typeof Ie.formats=="function"&&(fe=$(fe,Ie.blotName,Ie.formats(se)));return fe}function le(se,fe){return Y(fe,` -`)||fe.insert(` -`),fe}function me(){return new f.default}function Oe(se,fe){var Ie=p.default.query(se);if(Ie==null||Ie.blotName!=="list-item"||!Y(fe,` -`))return fe;for(var ce=-1,je=se.parentNode;!je.classList.contains("ql-clipboard");)(p.default.query(je)||{}).blotName==="list"&&(ce+=1),je=je.parentNode;return ce<=0?fe:fe.compose(new f.default().retain(fe.length()-1).retain(1,{indent:ce}))}function we(se,fe){return Y(fe,` -`)||(K(se)||fe.length()>0&&se.nextSibling&&K(se.nextSibling))&&fe.insert(` -`),fe}function ie(se,fe){if(K(se)&&se.nextElementSibling!=null&&!Y(fe,` - -`)){var Ie=se.offsetHeight+parseFloat(q(se).marginTop)+parseFloat(q(se).marginBottom);se.nextElementSibling.offsetTop>se.offsetTop+Ie*1.5&&fe.insert(` -`)}return fe}function Me(se,fe){var Ie={},ce=se.style||{};return ce.fontStyle&&q(se).fontStyle==="italic"&&(Ie.italic=!0),ce.fontWeight&&(q(se).fontWeight.startsWith("bold")||parseInt(q(se).fontWeight)>=700)&&(Ie.bold=!0),Object.keys(Ie).length>0&&(fe=$(fe,Ie)),parseFloat(ce.textIndent||0)>0&&(fe=new f.default().insert(" ").concat(fe)),fe}function ke(se,fe){var Ie=se.data;if(se.parentNode.tagName==="O:P")return fe.insert(Ie.trim());if(Ie.trim().length===0&&se.parentNode.classList.contains("ql-clipboard"))return fe;if(!q(se.parentNode).whiteSpace.startsWith("pre")){var ce=function(qe,Ne){return Ne=Ne.replace(/[^\u00a0]/g,""),Ne.length<1&&qe?" ":Ne};Ie=Ie.replace(/\r\n/g," ").replace(/\n/g," "),Ie=Ie.replace(/\s\s+/g,ce.bind(ce,!0)),(se.previousSibling==null&&K(se.parentNode)||se.previousSibling!=null&&K(se.previousSibling))&&(Ie=Ie.replace(/^\s+/,ce.bind(ce,!1))),(se.nextSibling==null&&K(se.parentNode)||se.nextSibling!=null&&K(se.nextSibling))&&(Ie=Ie.replace(/\s+$/,ce.bind(ce,!1)))}return fe.insert(Ie)}n.default=M,n.matchAttributor=J,n.matchBlot=ae,n.matchNewline=we,n.matchSpacing=ie,n.matchText=ke}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function y(m,x){for(var b=0;b '}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function y(m,x){for(var b=0;bp.right&&(m=p.right-y.right,this.root.style.left=f+m+"px"),y.leftp.bottom){var x=y.bottom-y.top,b=d.bottom-d.top+x;this.root.style.top=h-b+"px",this.root.classList.add("ql-flip")}return m}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),c})();n.default=l}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function I(E,A){var F=[],L=!0,z=!1,V=void 0;try{for(var Q=E[Symbol.iterator](),U;!(L=(U=Q.next()).done)&&(F.push(U.value),!(A&&F.length===A));L=!0);}catch(ee){z=!0,V=ee}finally{try{!L&&Q.return&&Q.return()}finally{if(z)throw V}}return F}return function(E,A){if(Array.isArray(E))return E;if(Symbol.iterator in Object(E))return I(E,A);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=function I(E,A,F){E===null&&(E=Function.prototype);var L=Object.getOwnPropertyDescriptor(E,A);if(L===void 0){var z=Object.getPrototypeOf(E);return z===null?void 0:I(z,A,F)}else{if("value"in L)return L.value;var V=L.get;return V===void 0?void 0:V.call(F)}},l=(function(){function I(E,A){for(var F=0;F','','',''].join(""),n.default=T}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(29),s=je(a),l=o(36),c=o(38),u=o(64),d=o(65),f=je(d),h=o(66),p=je(h),y=o(67),m=je(y),x=o(37),b=o(26),w=o(39),k=o(40),S=o(56),_=je(S),P=o(68),O=je(P),T=o(27),R=je(T),I=o(69),E=je(I),A=o(70),F=je(A),L=o(71),z=je(L),V=o(72),Q=je(V),U=o(73),ee=je(U),H=o(13),B=je(H),M=o(74),$=je(M),q=o(75),Y=je(q),K=o(57),G=je(K),re=o(41),J=je(re),ae=o(28),le=je(ae),me=o(59),Oe=je(me),we=o(60),ie=je(we),Me=o(61),ke=je(Me),se=o(108),fe=je(se),Ie=o(62),ce=je(Ie);function je(qe){return qe&&qe.__esModule?qe:{default:qe}}s.default.register({"attributors/attribute/direction":c.DirectionAttribute,"attributors/class/align":l.AlignClass,"attributors/class/background":x.BackgroundClass,"attributors/class/color":b.ColorClass,"attributors/class/direction":c.DirectionClass,"attributors/class/font":w.FontClass,"attributors/class/size":k.SizeClass,"attributors/style/align":l.AlignStyle,"attributors/style/background":x.BackgroundStyle,"attributors/style/color":b.ColorStyle,"attributors/style/direction":c.DirectionStyle,"attributors/style/font":w.FontStyle,"attributors/style/size":k.SizeStyle},!0),s.default.register({"formats/align":l.AlignClass,"formats/direction":c.DirectionClass,"formats/indent":u.IndentClass,"formats/background":x.BackgroundStyle,"formats/color":b.ColorStyle,"formats/font":w.FontClass,"formats/size":k.SizeClass,"formats/blockquote":f.default,"formats/code-block":B.default,"formats/header":p.default,"formats/list":m.default,"formats/bold":_.default,"formats/code":H.Code,"formats/italic":O.default,"formats/link":R.default,"formats/script":E.default,"formats/strike":F.default,"formats/underline":z.default,"formats/image":Q.default,"formats/video":ee.default,"formats/list/item":y.ListItem,"modules/formula":$.default,"modules/syntax":Y.default,"modules/toolbar":G.default,"themes/bubble":fe.default,"themes/snow":ce.default,"ui/icons":J.default,"ui/picker":le.default,"ui/icon-picker":ie.default,"ui/color-picker":Oe.default,"ui/tooltip":ke.default},!0),n.default=s.default}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.IndentClass=void 0;var a=(function(){function m(x,b){for(var w=0;w0&&this.children.tail.format(O,T)}},{key:"formats",value:function(){return y({},this.statics.blotName,this.statics.formats(this.domNode))}},{key:"insertBefore",value:function(O,T){if(O instanceof w)s(_.prototype.__proto__||Object.getPrototypeOf(_.prototype),"insertBefore",this).call(this,O,T);else{var R=T==null?this.length():T.offset(this),I=this.split(R);I.parent.insertBefore(O,I)}}},{key:"optimize",value:function(O){s(_.prototype.__proto__||Object.getPrototypeOf(_.prototype),"optimize",this).call(this,O);var T=this.next;T!=null&&T.prev===this&&T.statics.blotName===this.statics.blotName&&T.domNode.tagName===this.domNode.tagName&&T.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(T.moveChildren(this),T.remove())}},{key:"replace",value:function(O){if(O.statics.blotName!==this.statics.blotName){var T=c.default.create(this.statics.defaultChild);O.moveChildren(T),this.appendChild(T)}s(_.prototype.__proto__||Object.getPrototypeOf(_.prototype),"replace",this).call(this,O)}}]),_})(h.default);k.blotName="list",k.scope=c.default.Scope.BLOCK_BLOT,k.tagName=["OL","UL"],k.defaultChild="list-item",k.allowedChildren=[w],n.ListItem=w,n.default=k}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(56),s=l(a);function l(h){return h&&h.__esModule?h:{default:h}}function c(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function u(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function d(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var f=(function(h){d(p,h);function p(){return c(this,p),u(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return p})(s.default);f.blotName="italic",f.tagName=["EM","I"],n.default=f}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function y(m,x){for(var b=0;b-1?S?this.domNode.setAttribute(k,S):this.domNode.removeAttribute(k):s(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"format",this).call(this,k,S)}}],[{key:"create",value:function(k){var S=s(b.__proto__||Object.getPrototypeOf(b),"create",this).call(this,k);return typeof k=="string"&&S.setAttribute("src",this.sanitize(k)),S}},{key:"formats",value:function(k){return y.reduce(function(S,_){return k.hasAttribute(_)&&(S[_]=k.getAttribute(_)),S},{})}},{key:"match",value:function(k){return/\.(jpe?g|gif|png)$/.test(k)||/^data:image\/.+;base64/.test(k)}},{key:"sanitize",value:function(k){return(0,u.sanitize)(k,["http","https","data"])?k:"//:0"}},{key:"value",value:function(k){return k.getAttribute("src")}}]),b})(c.default.Embed);m.blotName="image",m.tagName="IMG",n.default=m}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function x(b,w){for(var k=0;k-1?S?this.domNode.setAttribute(k,S):this.domNode.removeAttribute(k):s(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"format",this).call(this,k,S)}}],[{key:"create",value:function(k){var S=s(b.__proto__||Object.getPrototypeOf(b),"create",this).call(this,k);return S.setAttribute("frameborder","0"),S.setAttribute("allowfullscreen",!0),S.setAttribute("src",this.sanitize(k)),S}},{key:"formats",value:function(k){return y.reduce(function(S,_){return k.hasAttribute(_)&&(S[_]=k.getAttribute(_)),S},{})}},{key:"sanitize",value:function(k){return u.default.sanitize(k)}},{key:"value",value:function(k){return k.getAttribute("src")}}]),b})(l.BlockEmbed);m.blotName="video",m.className="ql-video",m.tagName="IFRAME",n.default=m}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.FormulaBlot=void 0;var a=(function(){function k(S,_){for(var P=0;P<_.length;P++){var O=_[P];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(S,O.key,O)}}return function(S,_,P){return _&&k(S.prototype,_),P&&k(S,P),S}})(),s=function k(S,_,P){S===null&&(S=Function.prototype);var O=Object.getOwnPropertyDescriptor(S,_);if(O===void 0){var T=Object.getPrototypeOf(S);return T===null?void 0:k(T,_,P)}else{if("value"in O)return O.value;var R=O.get;return R===void 0?void 0:R.call(P)}},l=o(35),c=p(l),u=o(5),d=p(u),f=o(9),h=p(f);function p(k){return k&&k.__esModule?k:{default:k}}function y(k,S){if(!(k instanceof S))throw new TypeError("Cannot call a class as a function")}function m(k,S){if(!k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:k}function x(k,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);k.prototype=Object.create(S&&S.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(k,S):k.__proto__=S)}var b=(function(k){x(S,k);function S(){return y(this,S),m(this,(S.__proto__||Object.getPrototypeOf(S)).apply(this,arguments))}return a(S,null,[{key:"create",value:function(P){var O=s(S.__proto__||Object.getPrototypeOf(S),"create",this).call(this,P);return typeof P=="string"&&(window.katex.render(P,O,{throwOnError:!1,errorColor:"#f00"}),O.setAttribute("data-value",P)),O}},{key:"value",value:function(P){return P.getAttribute("data-value")}}]),S})(c.default);b.blotName="formula",b.className="ql-formula",b.tagName="SPAN";var w=(function(k){x(S,k),a(S,null,[{key:"register",value:function(){d.default.register(b,!0)}}]);function S(){y(this,S);var _=m(this,(S.__proto__||Object.getPrototypeOf(S)).call(this));if(window.katex==null)throw new Error("Formula module requires KaTeX.");return _}return S})(h.default);n.FormulaBlot=b,n.default=w}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.CodeToken=n.CodeBlock=void 0;var a=(function(){function P(O,T){for(var R=0;R0||this.cachedText==null)&&(this.domNode.innerHTML=R(I),this.domNode.normalize(),this.attach()),this.cachedText=I)}}]),O})(y.default);k.className="ql-syntax";var S=new c.default.Attributor.Class("token","hljs",{scope:c.default.Scope.INLINE}),_=(function(P){w(O,P),a(O,null,[{key:"register",value:function(){d.default.register(S,!0),d.default.register(k,!0)}}]);function O(T,R){x(this,O);var I=b(this,(O.__proto__||Object.getPrototypeOf(O)).call(this,T,R));if(typeof I.options.highlight!="function")throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var E=null;return I.quill.on(d.default.events.SCROLL_OPTIMIZE,function(){clearTimeout(E),E=setTimeout(function(){I.highlight(),E=null},I.options.interval)}),I.highlight(),I}return a(O,[{key:"highlight",value:function(){var R=this;if(!this.quill.selection.composing){this.quill.update(d.default.sources.USER);var I=this.quill.getSelection();this.quill.scroll.descendants(k).forEach(function(E){E.highlight(R.options.highlight)}),this.quill.update(d.default.sources.SILENT),I!=null&&this.quill.setSelection(I,d.default.sources.SILENT)}}}]),O})(h.default);_.DEFAULTS={highlight:(function(){return window.hljs==null?null:function(P){var O=window.hljs.highlightAuto(P);return O.value}})(),interval:1e3},n.CodeBlock=k,n.CodeToken=S,n.default=_}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n){r.exports=' '}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BubbleTooltip=void 0;var a=function O(T,R,I){T===null&&(T=Function.prototype);var E=Object.getOwnPropertyDescriptor(T,R);if(E===void 0){var A=Object.getPrototypeOf(T);return A===null?void 0:O(A,R,I)}else{if("value"in E)return E.value;var F=E.get;return F===void 0?void 0:F.call(I)}},s=(function(){function O(T,R){for(var I=0;I0&&z===d.default.sources.USER){E.show(),E.root.style.left="0px",E.root.style.width="",E.root.style.width=E.root.offsetWidth+"px";var V=E.quill.getLines(F.index,F.length);if(V.length===1)E.position(E.quill.getBounds(F));else{var Q=V[V.length-1],U=E.quill.getIndex(Q),ee=Math.min(Q.length()-1,F.index+F.length-U),H=E.quill.getBounds(new p.Range(U,ee));E.position(H)}}else document.activeElement!==E.textbox&&E.quill.hasFocus()&&E.hide()}),E}return s(T,[{key:"listen",value:function(){var I=this;a(T.prototype.__proto__||Object.getPrototypeOf(T.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",function(){I.root.classList.remove("ql-editing")}),this.quill.on(d.default.events.SCROLL_OPTIMIZE,function(){setTimeout(function(){if(!I.root.classList.contains("ql-hidden")){var E=I.quill.getSelection();E!=null&&I.position(I.quill.getBounds(E))}},1)})}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(I){var E=a(T.prototype.__proto__||Object.getPrototypeOf(T.prototype),"position",this).call(this,I),A=this.root.querySelector(".ql-tooltip-arrow");if(A.style.marginLeft="",E===0)return E;A.style.marginLeft=-1*E-A.offsetWidth/2+"px"}}]),T})(f.BaseTooltip);P.TEMPLATE=['','
','','',"
"].join(""),n.BubbleTooltip=P,n.default=_}),(function(r,n,o){r.exports=o(63)})]).default})})(w0)),w0.exports}var Ql,c9;function jTe(){if(c9)return Ql;c9=1;var e=Ql&&Ql.__extends||(function(){var d=function(f,h){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,y){p.__proto__=y}||function(p,y){for(var m in y)y.hasOwnProperty(m)&&(p[m]=y[m])},d(f,h)};return function(f,h){d(f,h);function p(){this.constructor=f}f.prototype=h===null?Object.create(h):(p.prototype=h.prototype,new p)}})(),t=Ql&&Ql.__assign||function(){return t=Object.assign||function(d){for(var f,h=1,p=arguments.length;h1)throw new Error("The Quill editing area can only be composed of a single React element.");if(o.default.Children.count(h.children)){var y=o.default.Children.only(h.children);if(((p=y)===null||p===void 0?void 0:p.type)==="textarea")throw new Error("Quill does not support editing on a